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
This commit is contained in:
Damien Bergamini 2005-11-13 17:25:21 +00:00
parent ca5b70c4fa
commit ba1362c549

View File

@ -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 */