From 238ecfedf5eb81ff8e786e9cec23c9f422951a3a Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sun, 9 Aug 2009 11:40:59 +0000 Subject: MCLGETI() will now allocate a mbuf header if it is not provided, thus reducing the amount of splnet/splx dancing required.. especially in the worst case (of m_cldrop) ok dlg kettenis damien --- sys/dev/pci/if_bge.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'sys/dev/pci/if_bge.c') 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); -- cgit v1.2.3