diff options
author | damien <damien@FreeBSD.org> | 2005-11-13 17:25:21 +0000 |
---|---|---|
committer | damien <damien@FreeBSD.org> | 2005-11-13 17:25:21 +0000 |
commit | 2009d4db39d49dfd0fe90459ee8e097af941a31d (patch) | |
tree | 557bfdbc978ae1a9e69ece8a33cdb1e1623c8078 | |
parent | c63501ff97eba1036680173fc222dc6ade13e507 (diff) | |
download | FreeBSD-src-2009d4db39d49dfd0fe90459ee8e097af941a31d.zip FreeBSD-src-2009d4db39d49dfd0fe90459ee8e097af941a31d.tar.gz |
Be more robust when handling Rx interrupts. If we can't allocate a new mbuf,
just discard the received frame and reuse the old mbuf.
This should prevent the connection from stalling after high network traffic.
MFC after: 2 weeks
-rw-r--r-- | sys/dev/usb/if_ural.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/sys/dev/usb/if_ural.c b/sys/dev/usb/if_ural.c index 6ec1596..92d103a 100644 --- a/sys/dev/usb/if_ural.c +++ b/sys/dev/usb/if_ural.c @@ -846,7 +846,7 @@ ural_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) struct ural_rx_desc *desc; struct ieee80211_frame *wh; struct ieee80211_node *ni; - struct mbuf *m; + struct mbuf *mnew, *m; int len; if (status != USBD_NORMAL_COMPLETION) { @@ -880,8 +880,17 @@ ural_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) goto skip; } - /* finalize mbuf */ + mnew = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (mnew == NULL) { + ifp->if_ierrors++; + goto skip; + } + m = data->m; + data->m = mnew; + data->buf = mtod(data->m, uint8_t *); + + /* finalize mbuf */ m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = m->m_len = (le32toh(desc->flags) >> 16) & 0xfff; m->m_flags |= M_HASFCS; /* hardware appends FCS */ @@ -895,15 +904,6 @@ ural_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) /* node is no longer needed */ ieee80211_free_node(ni); - data->m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); - if (data->m == NULL) { - printf("%s: could not allocate rx mbuf\n", - USBDEVNAME(sc->sc_dev)); - return; - } - - data->buf = mtod(data->m, uint8_t *); - DPRINTFN(15, ("rx done\n")); skip: /* setup a new transfer */ |