Date: Mon, 3 Feb 2020 23:25:12 +0000 (UTC) From: Navdeep Parhar <np@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r357475 - head/sys/dev/cxgbe Message-ID: <202002032325.013NPCfO017211@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: np Date: Mon Feb 3 23:25:12 2020 New Revision: 357475 URL: https://svnweb.freebsd.org/changeset/base/357475 Log: cxgbe(4): Initialize the rx buffer's metadata on first-use and not on allocation. refill_fl doesn't touch any part of a freshly allocated cluster after this change. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Mon Feb 3 23:06:42 2020 (r357474) +++ head/sys/dev/cxgbe/adapter.h Mon Feb 3 23:25:12 2020 (r357475) @@ -327,7 +327,6 @@ struct cluster_layout { struct cluster_metadata { u_int refcount; - struct fl_sdesc *sd; /* For debug only. Could easily be stale */ }; struct fl_sdesc { Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Mon Feb 3 23:06:42 2020 (r357474) +++ head/sys/dev/cxgbe/t4_sge.c Mon Feb 3 23:25:12 2020 (r357475) @@ -1872,11 +1872,12 @@ get_scatter_segment(struct adapter *sc, struct sge_fl fr_offset == 0 ? M_PKTHDR | M_NOFREE : M_NOFREE)) return (NULL); fl->mbuf_inlined++; + if (sd->nmbuf++ == 0) { + clm->refcount = 1; + counter_u64_add(extfree_refs, 1); + } m_extaddref(m, payload, blen, &clm->refcount, rxb_free, swz->zone, sd->cl); - if (sd->nmbuf++ == 0) - counter_u64_add(extfree_refs, 1); - } else { /* @@ -1890,10 +1891,12 @@ get_scatter_segment(struct adapter *sc, struct sge_fl return (NULL); fl->mbuf_allocated++; if (clm != NULL) { + if (sd->nmbuf++ == 0) { + clm->refcount = 1; + counter_u64_add(extfree_refs, 1); + } m_extaddref(m, payload, blen, &clm->refcount, rxb_free, swz->zone, sd->cl); - if (sd->nmbuf++ == 0) - counter_u64_add(extfree_refs, 1); } else { m_cljset(m, sd->cl, swz->type); sd->cl = NULL; /* consumed, not a recycle candidate */ @@ -4401,7 +4404,7 @@ refill_fl(struct adapter *sc, struct sge_fl *fl, int n if (clm != NULL) MPASS(clm->refcount == 1); #endif - goto recycled_fast; + goto recycled; } /* @@ -4440,16 +4443,8 @@ alloc: sd->cl = cl; sd->cll = *cll; *d = htobe64(pa | cll->hwidx); - clm = cl_metadata(sc, fl, cll, cl); - if (clm != NULL) { recycled: -#ifdef INVARIANTS - clm->sd = sd; -#endif - clm->refcount = 1; - } sd->nmbuf = 0; -recycled_fast: d++; sd++; if (__predict_false(++fl->pidx % 8 == 0)) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002032325.013NPCfO017211>