summaryrefslogtreecommitdiffstats
path: root/sys/netgraph
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2015-01-06 12:59:37 +0000
committerrwatson <rwatson@FreeBSD.org>2015-01-06 12:59:37 +0000
commit60909669f00c3675bab15d82d9d63aaff61dfafa (patch)
tree8da641e0473d723ab1cc2e5a5772cb1eed6e4d6f /sys/netgraph
parentff9d81bf5b98e98550d75c454cbd7b6d5002e628 (diff)
downloadFreeBSD-src-60909669f00c3675bab15d82d9d63aaff61dfafa.zip
FreeBSD-src-60909669f00c3675bab15d82d9d63aaff61dfafa.tar.gz
In order to reduce use of M_EXT outside of the mbuf allocator and
socket-buffer implementations, introduce a return value for MCLGET() (and m_cljget() that underlies it) to allow the caller to avoid testing M_EXT itself. Update all callers to use the return value. With this change, very few network device drivers remain aware of M_EXT; the primary exceptions lie in mbuf-chain pretty printers for debugging, and in a few cases, custom mbuf and cluster allocation implementations. NB: This is a difficult-to-test change as it touches many drivers for which I don't have physical devices. Instead we've gone for intensive review, but further post-commit review would definitely be appreciated to spot errors where changes could not easily be made mechanically, but were largely mechanical in nature. Differential Revision: https://reviews.freebsd.org/D1440 Reviewed by: adrian, bz, gnn Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'sys/netgraph')
-rw-r--r--sys/netgraph/atm/ngatmbase.c6
-rw-r--r--sys/netgraph/atm/sscop/ng_sscop_cust.h3
-rw-r--r--sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c3
-rw-r--r--sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c9
-rw-r--r--sys/netgraph/ng_vjc.c3
5 files changed, 8 insertions, 16 deletions
diff --git a/sys/netgraph/atm/ngatmbase.c b/sys/netgraph/atm/ngatmbase.c
index c5b0ced..a5f1027 100644
--- a/sys/netgraph/atm/ngatmbase.c
+++ b/sys/netgraph/atm/ngatmbase.c
@@ -151,8 +151,7 @@ uni_msg_pack_mbuf(struct uni_msg *msg, void *hdr, size_t hdrlen)
} else {
if ((n = uni_msg_len(msg)) > MHLEN) {
- MCLGET(m0, M_NOWAIT);
- if (!(m0->m_flags & M_EXT))
+ if (!(MCLGET(m0, M_NOWAIT)))
goto drop;
if (n > MCLBYTES)
n = MCLBYTES;
@@ -173,8 +172,7 @@ uni_msg_pack_mbuf(struct uni_msg *msg, void *hdr, size_t hdrlen)
last = m;
if (n > MLEN) {
- MCLGET(m, M_NOWAIT);
- if (!(m->m_flags & M_EXT))
+ if (!(MCLGET(m, M_NOWAIT)))
goto drop;
if (n > MCLBYTES)
n = MCLBYTES;
diff --git a/sys/netgraph/atm/sscop/ng_sscop_cust.h b/sys/netgraph/atm/sscop/ng_sscop_cust.h
index a1d839a..2c4e0de 100644
--- a/sys/netgraph/atm/sscop/ng_sscop_cust.h
+++ b/sys/netgraph/atm/sscop/ng_sscop_cust.h
@@ -327,8 +327,7 @@ ng_sscop_mbuf_alloc(size_t n) \
m->m_len = 0; \
m->m_pkthdr.len = 0; \
if (n > MHLEN) { \
- MCLGET(m, M_NOWAIT); \
- if (!(m->m_flags & M_EXT)){ \
+ if (!(MCLGET(m, M_NOWAIT))){ \
m_free(m); \
m = NULL; \
} \
diff --git a/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c b/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c
index 9b174bb..d7cff74 100644
--- a/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c
+++ b/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c
@@ -814,8 +814,7 @@ bt3c_receive(bt3c_softc_p sc)
break; /* XXX lost of sync */
}
- MCLGET(sc->m, M_NOWAIT);
- if (!(sc->m->m_flags & M_EXT)) {
+ if (!(MCLGET(sc->m, M_NOWAIT))) {
NG_FREE_M(sc->m);
NG_BT3C_ERR(sc->dev, "Could not get cluster\n");
diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
index 2488d06..f34c708 100644
--- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
+++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
@@ -816,8 +816,7 @@ ubt_intr_read_callback(struct usb_xfer *xfer, usb_error_t error)
goto submit_next;
}
- MCLGET(m, M_NOWAIT);
- if (!(m->m_flags & M_EXT)) {
+ if (!(MCLGET(m, M_NOWAIT))) {
UBT_STAT_IERROR(sc);
goto submit_next;
}
@@ -916,8 +915,7 @@ ubt_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
goto submit_next;
}
- MCLGET(m, M_NOWAIT);
- if (!(m->m_flags & M_EXT)) {
+ if (!(MCLGET(m, M_NOWAIT))) {
UBT_STAT_IERROR(sc);
goto submit_next;
}
@@ -1126,8 +1124,7 @@ ubt_isoc_read_one_frame(struct usb_xfer *xfer, int frame_no)
return (-1); /* XXX out of sync! */
}
- MCLGET(m, M_NOWAIT);
- if (!(m->m_flags & M_EXT)) {
+ if (!(MCLGET(m, M_NOWAIT))) {
UBT_STAT_IERROR(sc);
NG_FREE_M(m);
return (-1); /* XXX out of sync! */
diff --git a/sys/netgraph/ng_vjc.c b/sys/netgraph/ng_vjc.c
index e1b76b5..e689a10 100644
--- a/sys/netgraph/ng_vjc.c
+++ b/sys/netgraph/ng_vjc.c
@@ -484,8 +484,7 @@ ng_vjc_rcvdata(hook_p hook, item_p item)
hm->m_len = 0;
hm->m_pkthdr.rcvif = NULL;
if (hlen > MHLEN) { /* unlikely, but can happen */
- MCLGET(hm, M_NOWAIT);
- if ((hm->m_flags & M_EXT) == 0) {
+ if (!(MCLGET(hm, M_NOWAIT))) {
m_freem(hm);
priv->slc.sls_errorin++;
NG_FREE_M(m);
OpenPOWER on IntegriCloud