Fix style bug: rename the refcount field of m_ext to ext_cnt, to match
other members. Sponsored by: Nginx, Inc.
This commit is contained in:
parent
0236597739
commit
75acbf068a
@ -457,7 +457,7 @@ hatm_rx_buffer(struct hatm_softc *sc, u_int group, u_int handle)
|
||||
c0->hdr.flags &= ~MBUF_CARD;
|
||||
|
||||
if (m != NULL) {
|
||||
m->m_ext.ref_cnt = &c0->hdr.ref_cnt;
|
||||
m->m_ext.ext_cnt = &c0->hdr.ref_cnt;
|
||||
MEXTADD(m, (void *)c0, MBUF0_SIZE,
|
||||
hatm_mbuf0_free, c0, sc, M_PKTHDR, EXT_EXTREF);
|
||||
m->m_data += MBUF0_OFFSET;
|
||||
@ -481,7 +481,7 @@ hatm_rx_buffer(struct hatm_softc *sc, u_int group, u_int handle)
|
||||
c1->hdr.flags &= ~MBUF_CARD;
|
||||
|
||||
if (m != NULL) {
|
||||
m->m_ext.ref_cnt = &c1->hdr.ref_cnt;
|
||||
m->m_ext.ext_cnt = &c1->hdr.ref_cnt;
|
||||
MEXTADD(m, (void *)c1, MBUF1_SIZE,
|
||||
hatm_mbuf1_free, c1, sc, M_PKTHDR, EXT_EXTREF);
|
||||
m->m_data += MBUF1_OFFSET;
|
||||
|
@ -133,7 +133,7 @@ isc_sendPDU(isc_session_t *sp, pduq_t *pq)
|
||||
int l;
|
||||
|
||||
MGET(md, M_WAITOK, MT_DATA);
|
||||
md->m_ext.ref_cnt = &ou_refcnt;
|
||||
md->m_ext.ext_cnt = &ou_refcnt;
|
||||
l = min(MCLBYTES, len);
|
||||
debug(4, "setting ext_free(arg=%p len/l=%d/%d)", pq->buf, len, l);
|
||||
MEXTADD(md, pp->ds_addr + off, l, ext_free,
|
||||
|
@ -221,9 +221,9 @@ generic_xmit_frame(struct ifnet *ifp, struct mbuf *m,
|
||||
* (and eventually, just reference the netmap buffer)
|
||||
*/
|
||||
|
||||
if (*m->m_ext.ref_cnt != 1) {
|
||||
if (*m->m_ext.ext_cnt != 1) {
|
||||
D("invalid refcnt %d for %p",
|
||||
*m->m_ext.ref_cnt, m);
|
||||
*m->m_ext.ext_cnt, m);
|
||||
panic("in generic_xmit_frame");
|
||||
}
|
||||
// XXX the ext_size check is unnecessary if we link the netmap buf
|
||||
@ -238,7 +238,7 @@ generic_xmit_frame(struct ifnet *ifp, struct mbuf *m,
|
||||
}
|
||||
m->m_len = m->m_pkthdr.len = len;
|
||||
// inc refcount. All ours, we could skip the atomic
|
||||
atomic_fetchadd_int(m->m_ext.ref_cnt, 1);
|
||||
atomic_fetchadd_int(m->m_ext.ext_cnt, 1);
|
||||
m->m_flags |= M_FLOWID;
|
||||
m->m_pkthdr.flowid = ring_nr;
|
||||
m->m_pkthdr.rcvif = ifp; /* used for tx notification */
|
||||
|
@ -126,8 +126,8 @@ netmap_default_mbuf_destructor(struct mbuf *m)
|
||||
m->m_ext.ext_type = EXT_PACKET;
|
||||
m->m_ext.ext_free = NULL;
|
||||
m->m_ext.ext_arg1 = m->m_ext.ext_arg2 = NULL;
|
||||
if (*(m->m_ext.ref_cnt) == 0)
|
||||
*(m->m_ext.ref_cnt) = 1;
|
||||
if (*(m->m_ext.ext_cnt) == 0)
|
||||
*(m->m_ext.ext_cnt) = 1;
|
||||
uma_zfree(zone_pack, m);
|
||||
}
|
||||
|
||||
@ -141,12 +141,12 @@ netmap_get_mbuf(int len)
|
||||
m->m_ext.ext_arg2 = m->m_ext.ext_buf; /* save original */
|
||||
m->m_ext.ext_free = (void *)netmap_default_mbuf_destructor;
|
||||
m->m_ext.ext_type = EXT_EXTREF;
|
||||
ND(5, "create m %p refcnt %d", m, *m->m_ext.ref_cnt);
|
||||
ND(5, "create m %p refcnt %d", m, *m->m_ext.ext_cnt);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
#define GET_MBUF_REFCNT(m) ((m)->m_ext.ref_cnt ? *(m)->m_ext.ref_cnt : -1)
|
||||
#define GET_MBUF_REFCNT(m) ((m)->m_ext.ext_cnt ? *(m)->m_ext.ext_cnt : -1)
|
||||
|
||||
|
||||
|
||||
|
@ -476,7 +476,7 @@ mb_dtor_pack(void *mem, int size, void *arg)
|
||||
KASSERT(m->m_ext.ext_arg2 == NULL, ("%s: ext_arg2 != NULL", __func__));
|
||||
KASSERT(m->m_ext.ext_size == MCLBYTES, ("%s: ext_size != MCLBYTES", __func__));
|
||||
KASSERT(m->m_ext.ext_type == EXT_PACKET, ("%s: ext_type != EXT_PACKET", __func__));
|
||||
KASSERT(*m->m_ext.ref_cnt == 1, ("%s: ref_cnt != 1", __func__));
|
||||
KASSERT(*m->m_ext.ext_cnt == 1, ("%s: ext_cnt != 1", __func__));
|
||||
#ifdef INVARIANTS
|
||||
trash_dtor(m->m_ext.ext_buf, MCLBYTES, arg);
|
||||
#endif
|
||||
@ -548,7 +548,7 @@ mb_ctor_clust(void *mem, int size, void *arg, int how)
|
||||
m->m_ext.ext_size = size;
|
||||
m->m_ext.ext_type = type;
|
||||
m->m_ext.ext_flags = 0;
|
||||
m->m_ext.ref_cnt = refcnt;
|
||||
m->m_ext.ext_cnt = refcnt;
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
@ -261,12 +261,12 @@ m_extadd(struct mbuf *mb, caddr_t buf, u_int size,
|
||||
KASSERT(type != EXT_CLUSTER, ("%s: EXT_CLUSTER not allowed", __func__));
|
||||
|
||||
if (type != EXT_EXTREF)
|
||||
mb->m_ext.ref_cnt = uma_zalloc(zone_ext_refcnt, wait);
|
||||
mb->m_ext.ext_cnt = uma_zalloc(zone_ext_refcnt, wait);
|
||||
|
||||
if (mb->m_ext.ref_cnt == NULL)
|
||||
if (mb->m_ext.ext_cnt == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
*(mb->m_ext.ref_cnt) = 1;
|
||||
*(mb->m_ext.ext_cnt) = 1;
|
||||
mb->m_flags |= (M_EXT | flags);
|
||||
mb->m_ext.ext_buf = buf;
|
||||
mb->m_data = mb->m_ext.ext_buf;
|
||||
@ -290,7 +290,7 @@ mb_free_ext(struct mbuf *m)
|
||||
int skipmbuf;
|
||||
|
||||
KASSERT((m->m_flags & M_EXT) == M_EXT, ("%s: M_EXT not set", __func__));
|
||||
KASSERT(m->m_ext.ref_cnt != NULL, ("%s: ref_cnt not set", __func__));
|
||||
KASSERT(m->m_ext.ext_cnt != NULL, ("%s: ext_cnt not set", __func__));
|
||||
|
||||
/*
|
||||
* check if the header is embedded in the cluster
|
||||
@ -298,12 +298,12 @@ mb_free_ext(struct mbuf *m)
|
||||
skipmbuf = (m->m_flags & M_NOFREE);
|
||||
|
||||
/* Free attached storage if this mbuf is the only reference to it. */
|
||||
if (*(m->m_ext.ref_cnt) == 1 ||
|
||||
atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 1) {
|
||||
if (*(m->m_ext.ext_cnt) == 1 ||
|
||||
atomic_fetchadd_int(m->m_ext.ext_cnt, -1) == 1) {
|
||||
switch (m->m_ext.ext_type) {
|
||||
case EXT_PACKET: /* The packet zone is special. */
|
||||
if (*(m->m_ext.ref_cnt) == 0)
|
||||
*(m->m_ext.ref_cnt) = 1;
|
||||
if (*(m->m_ext.ext_cnt) == 0)
|
||||
*(m->m_ext.ext_cnt) = 1;
|
||||
uma_zfree(zone_pack, m);
|
||||
return; /* Job done. */
|
||||
case EXT_CLUSTER:
|
||||
@ -322,9 +322,9 @@ mb_free_ext(struct mbuf *m)
|
||||
case EXT_NET_DRV:
|
||||
case EXT_MOD_TYPE:
|
||||
case EXT_DISPOSABLE:
|
||||
*(m->m_ext.ref_cnt) = 0;
|
||||
*(m->m_ext.ext_cnt) = 0;
|
||||
uma_zfree(zone_ext_refcnt, __DEVOLATILE(u_int *,
|
||||
m->m_ext.ref_cnt));
|
||||
m->m_ext.ext_cnt));
|
||||
/* FALLTHROUGH */
|
||||
case EXT_EXTREF:
|
||||
KASSERT(m->m_ext.ext_free != NULL,
|
||||
@ -348,7 +348,7 @@ mb_free_ext(struct mbuf *m)
|
||||
m->m_ext.ext_free = NULL;
|
||||
m->m_ext.ext_arg1 = NULL;
|
||||
m->m_ext.ext_arg2 = NULL;
|
||||
m->m_ext.ref_cnt = NULL;
|
||||
m->m_ext.ext_cnt = NULL;
|
||||
m->m_ext.ext_size = 0;
|
||||
m->m_ext.ext_type = 0;
|
||||
m->m_ext.ext_flags = 0;
|
||||
@ -364,19 +364,19 @@ static void
|
||||
mb_dupcl(struct mbuf *n, struct mbuf *m)
|
||||
{
|
||||
KASSERT((m->m_flags & M_EXT) == M_EXT, ("%s: M_EXT not set", __func__));
|
||||
KASSERT(m->m_ext.ref_cnt != NULL, ("%s: ref_cnt not set", __func__));
|
||||
KASSERT(m->m_ext.ext_cnt != NULL, ("%s: ext_cnt not set", __func__));
|
||||
KASSERT((n->m_flags & M_EXT) == 0, ("%s: M_EXT set", __func__));
|
||||
|
||||
if (*(m->m_ext.ref_cnt) == 1)
|
||||
*(m->m_ext.ref_cnt) += 1;
|
||||
if (*(m->m_ext.ext_cnt) == 1)
|
||||
*(m->m_ext.ext_cnt) += 1;
|
||||
else
|
||||
atomic_add_int(m->m_ext.ref_cnt, 1);
|
||||
atomic_add_int(m->m_ext.ext_cnt, 1);
|
||||
n->m_ext.ext_buf = m->m_ext.ext_buf;
|
||||
n->m_ext.ext_free = m->m_ext.ext_free;
|
||||
n->m_ext.ext_arg1 = m->m_ext.ext_arg1;
|
||||
n->m_ext.ext_arg2 = m->m_ext.ext_arg2;
|
||||
n->m_ext.ext_size = m->m_ext.ext_size;
|
||||
n->m_ext.ref_cnt = m->m_ext.ref_cnt;
|
||||
n->m_ext.ext_cnt = m->m_ext.ext_cnt;
|
||||
n->m_ext.ext_type = m->m_ext.ext_type;
|
||||
n->m_ext.ext_flags = m->m_ext.ext_flags;
|
||||
n->m_flags |= M_EXT;
|
||||
|
@ -346,7 +346,7 @@ typedef struct callout sctp_os_timer_t;
|
||||
/* return the base ext data pointer */
|
||||
#define SCTP_BUF_EXTEND_BASE(m) (m->m_ext.ext_buf)
|
||||
/* return the refcnt of the data pointer */
|
||||
#define SCTP_BUF_EXTEND_REFCNT(m) (*m->m_ext.ref_cnt)
|
||||
#define SCTP_BUF_EXTEND_REFCNT(m) (*m->m_ext.ext_cnt)
|
||||
/* return any buffer related flags, this is
|
||||
* used beyond logging for apple only.
|
||||
*/
|
||||
|
@ -663,9 +663,9 @@ kdebug_mbufhdr(m)
|
||||
|
||||
if (m->m_flags & M_EXT) {
|
||||
printf(" m_ext{ ext_buf:%p ext_free:%p "
|
||||
"ext_size:%u ref_cnt:%p }\n",
|
||||
"ext_size:%u ext_cnt:%p }\n",
|
||||
m->m_ext.ext_buf, m->m_ext.ext_free,
|
||||
m->m_ext.ext_size, m->m_ext.ref_cnt);
|
||||
m->m_ext.ext_size, m->m_ext.ext_cnt);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -168,7 +168,7 @@ struct pkthdr {
|
||||
* LP64: 48
|
||||
*/
|
||||
struct m_ext {
|
||||
volatile u_int *ref_cnt; /* pointer to ref count info */
|
||||
volatile u_int *ext_cnt; /* pointer to ref count info */
|
||||
caddr_t ext_buf; /* start of buffer */
|
||||
uint32_t ext_size; /* size of buffer, for ext_free */
|
||||
uint32_t ext_type:8, /* type of external storage */
|
||||
@ -344,14 +344,14 @@ struct mbuf {
|
||||
#define EXT_NET_DRV 252 /* custom ext_buf provided by net driver(s) */
|
||||
#define EXT_MOD_TYPE 253 /* custom module's ext_buf type */
|
||||
#define EXT_DISPOSABLE 254 /* can throw this buffer away w/page flipping */
|
||||
#define EXT_EXTREF 255 /* has externally maintained ref_cnt ptr */
|
||||
#define EXT_EXTREF 255 /* has externally maintained ext_cnt ptr */
|
||||
|
||||
/*
|
||||
* Flags for external mbuf buffer types.
|
||||
* NB: limited to the lower 24 bits.
|
||||
*/
|
||||
#define EXT_FLAG_EMBREF 0x000001 /* embedded ref_cnt, notyet */
|
||||
#define EXT_FLAG_EXTREF 0x000002 /* external ref_cnt, notyet */
|
||||
#define EXT_FLAG_EMBREF 0x000001 /* embedded ext_cnt, notyet */
|
||||
#define EXT_FLAG_EXTREF 0x000002 /* external ext_cnt, notyet */
|
||||
#define EXT_FLAG_NOFREE 0x000010 /* don't free mbuf to pool, notyet */
|
||||
|
||||
#define EXT_FLAG_VENDOR1 0x010000 /* for vendor-internal use */
|
||||
@ -546,7 +546,7 @@ m_extaddref(struct mbuf *m, caddr_t buf, u_int size, u_int *ref_cnt,
|
||||
atomic_add_int(ref_cnt, 1);
|
||||
m->m_flags |= M_EXT;
|
||||
m->m_ext.ext_buf = buf;
|
||||
m->m_ext.ref_cnt = ref_cnt;
|
||||
m->m_ext.ext_cnt = ref_cnt;
|
||||
m->m_data = m->m_ext.ext_buf;
|
||||
m->m_ext.ext_size = size;
|
||||
m->m_ext.ext_free = freef;
|
||||
@ -730,7 +730,7 @@ m_cljset(struct mbuf *m, void *cl, int type)
|
||||
m->m_ext.ext_size = size;
|
||||
m->m_ext.ext_type = type;
|
||||
m->m_ext.ext_flags = 0;
|
||||
m->m_ext.ref_cnt = uma_find_refcnt(zone, cl);
|
||||
m->m_ext.ext_cnt = uma_find_refcnt(zone, cl);
|
||||
m->m_flags |= M_EXT;
|
||||
|
||||
}
|
||||
@ -779,7 +779,7 @@ m_last(struct mbuf *m)
|
||||
*/
|
||||
#define M_WRITABLE(m) (!((m)->m_flags & M_RDONLY) && \
|
||||
(!(((m)->m_flags & M_EXT)) || \
|
||||
(*((m)->m_ext.ref_cnt) == 1)) ) \
|
||||
(*((m)->m_ext.ext_cnt) == 1)) ) \
|
||||
|
||||
/* Check if the supplied mbuf has a packet header, or else panic. */
|
||||
#define M_ASSERTPKTHDR(m) \
|
||||
|
Loading…
x
Reference in New Issue
Block a user