diff options
author | Ryan Thomas McBride <mcbride@cvs.openbsd.org> | 2004-09-16 00:55:10 +0000 |
---|---|---|
committer | Ryan Thomas McBride <mcbride@cvs.openbsd.org> | 2004-09-16 00:55:10 +0000 |
commit | 52fe07878e4b37cae6d9ec07f548a31ffe6152b6 (patch) | |
tree | 08c9e6b4e215b8ab62068592406d9a56ea1a0412 /sys/dev/pci | |
parent | 6494f05de83b84e20b911112563a4b97416c309c (diff) |
If we can't allocate new jumbo storage, try to copy the packet into a
new mbuf chain with m_devget() before recycling the jumbo storage.
Frome if_sk.c
ok deraadt@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/if_bge.c | 18 | ||||
-rw-r--r-- | sys/dev/pci/if_ti.c | 16 |
2 files changed, 25 insertions, 9 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c index e0bacd50f15..e5eb65336a1 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.30 2004/08/19 17:00:03 mcbride Exp $ */ +/* $OpenBSD: if_bge.c,v 1.31 2004/09/16 00:55:09 mcbride Exp $ */ /* * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2001 @@ -1952,11 +1952,19 @@ bge_rxeof(sc) bge_newbuf_jumbo(sc, sc->bge_jumbo, m); continue; } - if (bge_newbuf_jumbo(sc, sc->bge_jumbo, - NULL)== ENOBUFS) { - ifp->if_ierrors++; + if (bge_newbuf_jumbo(sc, sc->bge_jumbo, NULL) + == ENOBUFS) { + struct mbuf *m0; + m0 = m_devget(mtod(m, char *) - ETHER_ALIGN, + cur_rx->bge_len - ETHER_CRC_LEN + + ETHER_ALIGN, 0, ifp, NULL); bge_newbuf_jumbo(sc, sc->bge_jumbo, m); - continue; + if (m0 == NULL) { + ifp->if_ierrors++; + continue; + } + m_adj(m0, ETHER_ALIGN); + m = m0; } } else { BGE_INC(sc->bge_std, BGE_STD_RX_RING_CNT); diff --git a/sys/dev/pci/if_ti.c b/sys/dev/pci/if_ti.c index beee2005d7a..8e6bc404010 100644 --- a/sys/dev/pci/if_ti.c +++ b/sys/dev/pci/if_ti.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ti.c,v 1.53 2004/08/19 18:26:29 mcbride Exp $ */ +/* $OpenBSD: if_ti.c,v 1.54 2004/09/16 00:55:08 mcbride Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -1844,10 +1844,18 @@ void ti_rxeof(sc) ti_newbuf_jumbo(sc, sc->ti_jumbo, m); continue; } - if (ti_newbuf_jumbo(sc, sc->ti_jumbo, NULL) == ENOBUFS) { - ifp->if_ierrors++; + if (ti_newbuf_jumbo(sc, sc->ti_jumbo, NULL) + == ENOBUFS) { + struct mbuf *m0; + m0 = m_devget(mtod(m, char *) - ETHER_ALIGN, + cur_rx->ti_len + ETHER_ALIGN, 0, ifp, NULL); ti_newbuf_jumbo(sc, sc->ti_jumbo, m); - continue; + if (m0 == NULL) { + ifp->if_ierrors++; + continue; + } + m_adj(m0, ETHER_ALIGN); + m = m0; } } else if (cur_rx->ti_flags & TI_BDFLAG_MINI_RING) { TI_INC(sc->ti_mini, TI_MINI_RX_RING_CNT); |