Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci avoid rbuf starvation. when grabbing a recieve ...
details: https://anonhg.NetBSD.org/src/rev/aba210b55e91
branches: trunk
changeset: 753815:aba210b55e91
user: mrg <mrg%NetBSD.org@localhost>
date: Sun Apr 11 02:02:14 2010 +0000
description:
avoid rbuf starvation. when grabbing a recieve buffer, if a local
4KB buffer isn't available, try to MEXTMALLOC() one. only if both
of these fail to we abort the recieve operation.
based on a patch from Sverre Froyen <sverre%viewmark.com@localhost>, thanks!
tested by myself, sverre and jeremy reed.
diffstat:
sys/dev/pci/if_iwn.c | 34 +++++++++++++++++++---------------
1 files changed, 19 insertions(+), 15 deletions(-)
diffs (62 lines):
diff -r 7773b0b9eff9 -r aba210b55e91 sys/dev/pci/if_iwn.c
--- a/sys/dev/pci/if_iwn.c Sun Apr 11 01:53:03 2010 +0000
+++ b/sys/dev/pci/if_iwn.c Sun Apr 11 02:02:14 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_iwn.c,v 1.38 2010/04/05 07:20:26 joerg Exp $ */
+/* $NetBSD: if_iwn.c,v 1.39 2010/04/11 02:02:14 mrg Exp $ */
/* $OpenBSD: if_iwn.c,v 1.49 2009/03/29 21:53:52 sthen Exp $ */
/*-
@@ -23,7 +23,7 @@
* 802.11 network adapters.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.38 2010/04/05 07:20:26 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.39 2010/04/11 02:02:14 mrg Exp $");
#include <sys/param.h>
@@ -1930,8 +1930,8 @@
}
/*
- * See comment in if_wpi.c:wpi_rx_intr() about locking
- * nb_free_entries here. In short: it's not required.
+ * Try to grab a local 4KB buffer. If it fails, try to
+ * MEXTMALLOC() next, and if that fails, give up.
*/
MGETHDR(m1, M_DONTWAIT, MT_DATA);
if (m1 == NULL) {
@@ -1939,17 +1939,21 @@
ifp->if_ierrors++;
return;
}
- if (sc->rxq.nb_free_entries <= 0) {
- ic->ic_stats.is_rx_nobuf++;
- ifp->if_ierrors++;
- m_freem(m1);
- return;
- }
- rbuf = iwn_alloc_rbuf(sc);
- /* Attach RX buffer to mbuf header. */
- MEXTADD(m1, rbuf->vaddr, IWN_RBUF_SIZE, 0, iwn_free_rbuf,
- rbuf);
- m1->m_flags |= M_EXT_RW;
+ if ((rbuf = iwn_alloc_rbuf(sc)) == NULL) {
+ MEXTMALLOC(m1, IWN_RBUF_SIZE, M_DONTWAIT);
+ if (!(m1->m_flags & M_EXT)) {
+ ic->ic_stats.is_rx_nobuf++;
+ ifp->if_ierrors++;
+ m_freem(m1);
+ return;
+ }
+ } else {
+ /* Attach RX buffer to mbuf header. */
+ MEXTADD(m1, rbuf->vaddr, IWN_RBUF_SIZE, 0, iwn_free_rbuf,
+ rbuf);
+ m1->m_flags |= M_EXT_RW;
+ }
+
bus_dmamap_unload(sc->sc_dmat, data->map);
error = bus_dmamap_load(sc->sc_dmat, data->map, m1->m_ext.ext_buf,
Home |
Main Index |
Thread Index |
Old Index