diff options
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/gem.c | 12 | ||||
-rw-r--r-- | sys/dev/ic/hme.c | 12 | ||||
-rw-r--r-- | sys/dev/ic/re.c | 12 | ||||
-rw-r--r-- | sys/dev/pci/if_bge.c | 22 | ||||
-rw-r--r-- | sys/dev/pci/if_bnx.c | 13 | ||||
-rw-r--r-- | sys/dev/pci/if_em.c | 12 | ||||
-rw-r--r-- | sys/dev/pci/if_iwn.c | 24 | ||||
-rw-r--r-- | sys/dev/pci/if_ix.c | 12 | ||||
-rw-r--r-- | sys/dev/pci/if_msk.c | 12 | ||||
-rw-r--r-- | sys/dev/pci/if_sis.c | 12 | ||||
-rw-r--r-- | sys/dev/pci/if_vic.c | 12 | ||||
-rw-r--r-- | sys/dev/pci/if_vr.c | 12 | ||||
-rw-r--r-- | sys/dev/pci/if_wpi.c | 24 |
13 files changed, 45 insertions, 146 deletions
diff --git a/sys/dev/ic/gem.c b/sys/dev/ic/gem.c index 851010ab767..9a02283a960 100644 --- a/sys/dev/ic/gem.c +++ b/sys/dev/ic/gem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gem.c,v 1.93 2009/08/03 11:09:10 sthen Exp $ */ +/* $OpenBSD: gem.c,v 1.94 2009/08/09 11:40:58 deraadt Exp $ */ /* $NetBSD: gem.c,v 1.1 2001/09/16 00:11:43 eeh Exp $ */ /* @@ -1006,15 +1006,9 @@ gem_add_rxbuf(struct gem_softc *sc, int idx) struct mbuf *m; int error; - MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == NULL) + m = MCLGETI(NULL, M_DONTWAIT, &sc->sc_arpcom.ac_if, MCLBYTES); + if (!m) return (ENOBUFS); - - MCLGETI(m, M_DONTWAIT, &sc->sc_arpcom.ac_if, MCLBYTES); - if ((m->m_flags & M_EXT) == 0) { - m_freem(m); - return (ENOBUFS); - } m->m_len = m->m_pkthdr.len = MCLBYTES; #ifdef GEM_DEBUG diff --git a/sys/dev/ic/hme.c b/sys/dev/ic/hme.c index e5fa4e266ad..3c5a9413a59 100644 --- a/sys/dev/ic/hme.c +++ b/sys/dev/ic/hme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hme.c,v 1.58 2009/06/22 14:31:04 sthen Exp $ */ +/* $OpenBSD: hme.c,v 1.59 2009/08/09 11:40:58 deraadt Exp $ */ /* $NetBSD: hme.c,v 1.21 2001/07/07 15:59:37 thorpej Exp $ */ /*- @@ -1415,17 +1415,11 @@ hme_newbuf(sc, d) * until we're sure everything is a success. */ - MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == NULL) + m = MCLGETI(NULL, M_DONTWAIT, &sc->sc_arpcom.ac_if, MCLBYTES); + if (!m) return (ENOBUFS); m->m_pkthdr.rcvif = &sc->sc_arpcom.ac_if; - MCLGETI(m, M_DONTWAIT, &sc->sc_arpcom.ac_if, MCLBYTES); - if ((m->m_flags & M_EXT) == 0) { - m_freem(m); - return (ENOBUFS); - } - if (bus_dmamap_load(sc->sc_dmatag, sc->sc_rxmap_spare, mtod(m, caddr_t), MCLBYTES - HME_RX_OFFSET, NULL, BUS_DMA_NOWAIT) != 0) { diff --git a/sys/dev/ic/re.c b/sys/dev/ic/re.c index e3caa4bae14..e6cbd4bf963 100644 --- a/sys/dev/ic/re.c +++ b/sys/dev/ic/re.c @@ -1,4 +1,4 @@ -/* $OpenBSD: re.c,v 1.113 2009/07/23 20:15:32 kettenis Exp $ */ +/* $OpenBSD: re.c,v 1.114 2009/08/09 11:40:58 deraadt Exp $ */ /* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */ /* * Copyright (c) 1997, 1998-2003 @@ -1213,16 +1213,10 @@ re_newbuf(struct rl_softc *sc) u_int32_t cmdstat; int error, idx; - MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == NULL) + m = MCLGETI(NULL, M_DONTWAIT, &sc->sc_arpcom.ac_if, MCLBYTES); + if (!m) return (ENOBUFS); - MCLGETI(m, M_DONTWAIT, &sc->sc_arpcom.ac_if, MCLBYTES); - if ((m->m_flags & M_EXT) == 0) { - m_freem(m); - return (ENOBUFS); - } - /* * Initialize mbuf length fields and fixup * alignment so that the frame payload is diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c index f03f1415002..8f8986974f1 100644 --- a/sys/dev/pci/if_bge.c +++ b/sys/dev/pci/if_bge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bge.c,v 1.279 2009/08/08 15:58:14 naddy Exp $ */ +/* $OpenBSD: if_bge.c,v 1.280 2009/08/09 11:40:56 deraadt Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -719,15 +719,9 @@ bge_newbuf(struct bge_softc *sc, int i) struct mbuf *m; int error; - MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == NULL) + m = MCLGETI(NULL, M_DONTWAIT, &sc->arpcom.ac_if, MCLBYTES); + if (!m) return (ENOBUFS); - - MCLGETI(m, M_DONTWAIT, &sc->arpcom.ac_if, MCLBYTES); - if (!(m->m_flags & M_EXT)) { - m_freem(m); - return (ENOBUFS); - } m->m_len = m->m_pkthdr.len = MCLBYTES; if (!(sc->bge_flags & BGE_RX_ALIGNBUG)) m_adj(m, ETHER_ALIGN); @@ -776,15 +770,9 @@ bge_newbuf_jumbo(struct bge_softc *sc, int i) struct mbuf *m; int error; - MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == NULL) + m = MCLGETI(NULL, M_DONTWAIT, &sc->arpcom.ac_if, BGE_JLEN); + if (!m) return (ENOBUFS); - - MCLGETI(m, M_DONTWAIT, &sc->arpcom.ac_if, BGE_JLEN); - if (!(m->m_flags & M_EXT)) { - m_freem(m); - return (ENOBUFS); - } m->m_len = m->m_pkthdr.len = BGE_JUMBO_FRAMELEN; if (!(sc->bge_flags & BGE_RX_ALIGNBUG)) m_adj(m, ETHER_ALIGN); diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c index e0f0de5c17a..3bf0151bdf1 100644 --- a/sys/dev/pci/if_bnx.c +++ b/sys/dev/pci/if_bnx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bnx.c,v 1.82 2009/08/06 19:53:13 sthen Exp $ */ +/* $OpenBSD: if_bnx.c,v 1.83 2009/08/09 11:40:56 deraadt Exp $ */ /*- * Copyright (c) 2006 Broadcom Corporation @@ -3591,16 +3591,9 @@ bnx_get_buf(struct bnx_softc *sc, u_int16_t *prod, *prod_bseq); /* This is a new mbuf allocation. */ - MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == NULL) + m = MCLGETI(NULL, M_DONTWAIT, &sc->arpcom.ac_if, MCLBYTES); + if (!m) return (ENOBUFS); - - /* Attach a cluster to the mbuf. */ - MCLGETI(m, M_DONTWAIT, &sc->arpcom.ac_if, MCLBYTES); - if (!(m->m_flags & M_EXT)) { - m_freem(m); - return (ENOBUFS); - } m->m_len = m->m_pkthdr.len = MCLBYTES; /* the chip aligns the ip header for us, no need to m_adj */ diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c index 7dbec34a729..9a7155f2ab6 100644 --- a/sys/dev/pci/if_em.c +++ b/sys/dev/pci/if_em.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_em.c,v 1.215 2009/07/27 16:37:52 claudio Exp $ */ +/* $OpenBSD: if_em.c,v 1.216 2009/08/09 11:40:56 deraadt Exp $ */ /* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */ #include <dev/pci/if_em.h> @@ -2307,14 +2307,8 @@ em_get_buf(struct em_softc *sc, int i) return (ENOBUFS); } - MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == NULL) { - sc->mbuf_alloc_failed++; - return (ENOBUFS); - } - MCLGETI(m, M_DONTWAIT, &sc->interface_data.ac_if, MCLBYTES); - if ((m->m_flags & M_EXT) == 0) { - m_freem(m); + m = MCLGETI(NULL, M_DONTWAIT, &sc->interface_data.ac_if, MCLBYTES); + if (!m) { sc->mbuf_cluster_failed++; return (ENOBUFS); } diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c index bc6c2d431ee..76883231278 100644 --- a/sys/dev/pci/if_iwn.c +++ b/sys/dev/pci/if_iwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwn.c,v 1.60 2009/07/10 07:44:04 blambert Exp $ */ +/* $OpenBSD: if_iwn.c,v 1.61 2009/08/09 11:40:56 deraadt Exp $ */ /*- * Copyright (c) 2007-2009 Damien Bergamini <damien.bergamini@free.fr> @@ -1010,15 +1010,8 @@ iwn_alloc_rx_ring(struct iwn_softc *sc, struct iwn_rx_ring *ring) goto fail; } - MGETHDR(data->m, M_DONTWAIT, MT_DATA); - if (data->m == NULL) { - printf("%s: could not allocate RX mbuf\n", - sc->sc_dev.dv_xname); - error = ENOMEM; - goto fail; - } - MCLGETI(data->m, M_DONTWAIT, NULL, IWN_RBUF_SIZE); - if (!(data->m->m_flags & M_EXT)) { + data->m = MCLGETI(NULL, M_DONTWAIT, NULL, IWN_RBUF_SIZE); + if (!data->m) { printf("%s: could not allocate RX mbuf cluster\n", sc->sc_dev.dv_xname); error = ENOBUFS; @@ -1704,15 +1697,8 @@ iwn_rx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc, return; } - MGETHDR(m1, M_DONTWAIT, MT_DATA); - if (m1 == NULL) { - ic->ic_stats.is_rx_nombuf++; - ifp->if_ierrors++; - return; - } - MCLGETI(m1, M_DONTWAIT, NULL, IWN_RBUF_SIZE); - if (!(m1->m_flags & M_EXT)) { - m_freem(m1); + m1 = MCLGETI(NULL, M_DONTWAIT, NULL, IWN_RBUF_SIZE); + if (!m1) { ic->ic_stats.is_rx_nombuf++; ifp->if_ierrors++; return; diff --git a/sys/dev/pci/if_ix.c b/sys/dev/pci/if_ix.c index e4a03ef8e93..067efcc2b69 100644 --- a/sys/dev/pci/if_ix.c +++ b/sys/dev/pci/if_ix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ix.c,v 1.24 2009/07/10 12:00:52 dlg Exp $ */ +/* $OpenBSD: if_ix.c,v 1.25 2009/08/09 11:40:56 deraadt Exp $ */ /****************************************************************************** @@ -2217,14 +2217,8 @@ ixgbe_get_buf(struct rx_ring *rxr, int i) return (ENOBUFS); } - MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == NULL) { - sc->mbuf_alloc_failed++; - return (ENOBUFS); - } - MCLGETI(m, M_DONTWAIT, &sc->arpcom.ac_if, size); - if ((m->m_flags & M_EXT) == 0) { - m_freem(m); + m = MCLGETI(NULL, M_DONTWAIT, &sc->arpcom.ac_if, size); + if (!m) { sc->mbuf_cluster_failed++; return (ENOBUFS); } diff --git a/sys/dev/pci/if_msk.c b/sys/dev/pci/if_msk.c index 9cc0ef3dad6..387837302e0 100644 --- a/sys/dev/pci/if_msk.c +++ b/sys/dev/pci/if_msk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_msk.c,v 1.75 2009/03/29 14:36:34 jsg Exp $ */ +/* $OpenBSD: if_msk.c,v 1.76 2009/08/09 11:40:56 deraadt Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -503,15 +503,9 @@ msk_newbuf(struct sk_if_softc *sc_if) int error; int opcode, i; - MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == NULL) + m = MCLGETI(NULL, M_DONTWAIT, &sc_if->arpcom.ac_if, sc_if->sk_pktlen); + if (!m) return (ENOBUFS); - - MCLGETI(m, M_DONTWAIT, &sc_if->arpcom.ac_if, sc_if->sk_pktlen); - if ((m->m_flags & M_EXT) == 0) { - m_freem(m); - return (ENOBUFS); - } m->m_len = m->m_pkthdr.len = sc_if->sk_pktlen; m_adj(m, ETHER_ALIGN); diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c index bc8a6d9cfa6..3fb8be5af3b 100644 --- a/sys/dev/pci/if_sis.c +++ b/sys/dev/pci/if_sis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sis.c,v 1.94 2009/07/22 21:32:50 miod Exp $ */ +/* $OpenBSD: if_sis.c,v 1.95 2009/08/09 11:40:56 deraadt Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -1232,16 +1232,10 @@ sis_newbuf(struct sis_softc *sc, struct sis_desc *c) if (c == NULL) return (EINVAL); - MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) + m_new = MCLGETI(NULL, M_DONTWAIT, &sc->arpcom.ac_if, MCLBYTES); + if (!m_new) return (ENOBUFS); - MCLGETI(m_new, M_DONTWAIT, &sc->arpcom.ac_if, MCLBYTES); - if (!(m_new->m_flags & M_EXT)) { - m_free(m_new); - return (ENOBUFS); - } - m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; if (bus_dmamap_load_mbuf(sc->sc_dmat, c->map, m_new, diff --git a/sys/dev/pci/if_vic.c b/sys/dev/pci/if_vic.c index cbe5345796f..3a5e9c1f0de 100644 --- a/sys/dev/pci/if_vic.c +++ b/sys/dev/pci/if_vic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vic.c,v 1.71 2009/06/02 12:32:06 deraadt Exp $ */ +/* $OpenBSD: if_vic.c,v 1.72 2009/08/09 11:40:56 deraadt Exp $ */ /* * Copyright (c) 2006 Reyk Floeter <reyk@openbsd.org> @@ -1340,15 +1340,9 @@ vic_alloc_mbuf(struct vic_softc *sc, bus_dmamap_t map, u_int pktlen) { struct mbuf *m = NULL; - MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == NULL) + m = MCLGETI(NULL, M_DONTWAIT, &sc->sc_ac.ac_if, pktlen); + if (!m) return (NULL); - - MCLGETI(m, M_DONTWAIT, &sc->sc_ac.ac_if, pktlen); - if ((m->m_flags & M_EXT) == 0) { - m_freem(m); - return (NULL); - } m->m_data += ETHER_ALIGN; m->m_len = m->m_pkthdr.len = pktlen - ETHER_ALIGN; diff --git a/sys/dev/pci/if_vr.c b/sys/dev/pci/if_vr.c index 1dbe51a569e..4c961ebe1c2 100644 --- a/sys/dev/pci/if_vr.c +++ b/sys/dev/pci/if_vr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vr.c,v 1.97 2009/06/18 18:53:02 claudio Exp $ */ +/* $OpenBSD: if_vr.c,v 1.98 2009/08/09 11:40:56 deraadt Exp $ */ /* * Copyright (c) 1997, 1998 @@ -1568,16 +1568,10 @@ vr_alloc_mbuf(struct vr_softc *sc, struct vr_chain_onefrag *r) if (r == NULL) return (EINVAL); - MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == NULL) + m = MCLGETI(NULL, M_DONTWAIT, &sc->arpcom.ac_if, MCLBYTES); + if (!m) return (ENOBUFS); - MCLGETI(m, M_DONTWAIT, &sc->arpcom.ac_if, MCLBYTES); - if (!(m->m_flags & M_EXT)) { - m_free(m); - return (ENOBUFS); - } - m->m_len = m->m_pkthdr.len = MCLBYTES; m_adj(m, sizeof(u_int64_t)); diff --git a/sys/dev/pci/if_wpi.c b/sys/dev/pci/if_wpi.c index d52562647fe..ccd1cd72728 100644 --- a/sys/dev/pci/if_wpi.c +++ b/sys/dev/pci/if_wpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wpi.c,v 1.89 2009/07/11 13:28:36 blambert Exp $ */ +/* $OpenBSD: if_wpi.c,v 1.90 2009/08/09 11:40:56 deraadt Exp $ */ /*- * Copyright (c) 2006-2008 @@ -641,15 +641,8 @@ wpi_alloc_rx_ring(struct wpi_softc *sc, struct wpi_rx_ring *ring) goto fail; } - MGETHDR(data->m, M_DONTWAIT, MT_DATA); - if (data->m == NULL) { - printf("%s: could not allocate RX mbuf\n", - sc->sc_dev.dv_xname); - error = ENOBUFS; - goto fail; - } - MCLGETI(data->m, M_DONTWAIT, NULL, WPI_RBUF_SIZE); - if (!(data->m->m_flags & M_EXT)) { + data->m = MCLGETI(NULL, M_DONTWAIT, NULL, WPI_RBUF_SIZE); + if (!data->m) { printf("%s: could not allocate RX mbuf cluster\n", sc->sc_dev.dv_xname); error = ENOBUFS; @@ -1192,15 +1185,8 @@ wpi_rx_done(struct wpi_softc *sc, struct wpi_rx_desc *desc, return; } - MGETHDR(m1, M_DONTWAIT, MT_DATA); - if (m1 == NULL) { - ic->ic_stats.is_rx_nombuf++; - ifp->if_ierrors++; - return; - } - MCLGETI(m1, M_DONTWAIT, NULL, WPI_RBUF_SIZE); - if (!(m1->m_flags & M_EXT)) { - m_freem(m1); + m1 = MCLGETI(NULL, M_DONTWAIT, NULL, WPI_RBUF_SIZE); + if (!m1) { ic->ic_stats.is_rx_nombuf++; ifp->if_ierrors++; return; |