summaryrefslogtreecommitdiffstats
path: root/sys/dev/ath
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2006-02-09 22:29:23 +0000
committersam <sam@FreeBSD.org>2006-02-09 22:29:23 +0000
commita3586317ec11509e393cfb010ca1c3a6e9de4833 (patch)
tree574d5de90e2a02f3204b94d33b1de8218b8e0508 /sys/dev/ath
parent9bdd11bfc81d07156e4060e96c28dd7f42ab0d1d (diff)
downloadFreeBSD-src-a3586317ec11509e393cfb010ca1c3a6e9de4833.zip
FreeBSD-src-a3586317ec11509e393cfb010ca1c3a6e9de4833.tar.gz
correct handling of mbuf allocation failure when replenishing the rx list
(leave a printf for the moment, need to make a debug msg) Obtained from: atheros MFC after: 2 weeks
Diffstat (limited to 'sys/dev/ath')
-rw-r--r--sys/dev/ath/if_ath.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index fc948cb..1940044 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -2562,7 +2562,6 @@ ath_rxbuf_init(struct ath_softc *sc, struct ath_buf *bf)
sc->sc_stats.ast_rx_nombuf++;
return ENOMEM;
}
- bf->bf_m = m;
m->m_pkthdr.len = m->m_len = m->m_ext.ext_size;
error = bus_dmamap_load_mbuf_sg(sc->sc_dmat,
@@ -2574,10 +2573,12 @@ ath_rxbuf_init(struct ath_softc *sc, struct ath_buf *bf)
"%s: bus_dmamap_load_mbuf_sg failed; error %d\n",
__func__, error);
sc->sc_stats.ast_rx_busdma++;
+ m_freem(m);
return error;
}
KASSERT(bf->bf_nseg == 1,
("multi-segment packet; nseg %u", bf->bf_nseg));
+ bf->bf_m = m;
}
bus_dmamap_sync(sc->sc_dmat, bf->bf_dmamap, BUS_DMASYNC_PREREAD);
@@ -2761,16 +2762,22 @@ ath_rx_proc(void *arg, int npending)
if_printf(ifp, "%s: no buffer!\n", __func__);
break;
}
+ m = bf->bf_m;
+ if (m == NULL) { /* NB: shouldn't happen */
+ /*
+ * If mbuf allocation failed previously there
+ * will be no mbuf; try again to re-populate it.
+ */
+ /* XXX make debug msg */
+ if_printf(ifp, "%s: no mbuf!\n", __func__);
+ STAILQ_REMOVE_HEAD(&sc->sc_rxbuf, bf_list);
+ goto rx_next;
+ }
ds = bf->bf_desc;
if (ds->ds_link == bf->bf_daddr) {
/* NB: never process the self-linked entry at the end */
break;
}
- m = bf->bf_m;
- if (m == NULL) { /* NB: shouldn't happen */
- if_printf(ifp, "%s: no mbuf!\n", __func__);
- continue;
- }
/* XXX sync descriptor memory */
/*
* Must provide the virtual address of the current
OpenPOWER on IntegriCloud