diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2015-12-03 08:29:36 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2015-12-03 08:29:36 +0000 |
commit | 7339cd0627869c999974dd42aa5431d9377084f9 (patch) | |
tree | 85620ac1a9ebb1e7b3c55ad400e23cc904891e0c /sys | |
parent | 5c5eb4e6d20fbf9883bc7426842902f175f28cfa (diff) |
Rewrite the tx handler to just use ifq_dequeue and drop packets that
could not be sent either because the dma mapping failed or because
m_defrag failed. Those errors are accounted as oerrors. dlg@ agrees.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/fxp.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/sys/dev/ic/fxp.c b/sys/dev/ic/fxp.c index 320bcb18ed1..4821af2bae5 100644 --- a/sys/dev/ic/fxp.c +++ b/sys/dev/ic/fxp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fxp.c,v 1.128 2015/12/02 08:28:02 claudio Exp $ */ +/* $OpenBSD: fxp.c,v 1.129 2015/12/03 08:29:35 claudio Exp $ */ /* $NetBSD: if_fxp.c,v 1.2 1997/06/05 02:01:55 thorpej Exp $ */ /* @@ -687,26 +687,28 @@ fxp_start(struct ifnet *ifp) txs = txs->tx_next; - m0 = ifq_deq_begin(&ifp->if_snd); + m0 = ifq_dequeue(&ifp->if_snd); if (m0 == NULL) break; error = bus_dmamap_load_mbuf(sc->sc_dmat, txs->tx_map, m0, BUS_DMA_NOWAIT); - if (error == EFBIG) { - if (m_defrag(m0, M_DONTWAIT)) { - ifq_deq_rollback(&ifp->if_snd, m0); - break; - } - error = bus_dmamap_load_mbuf(sc->sc_dmat, txs->tx_map, - m0, BUS_DMA_NOWAIT); - } - if (error != 0) { - ifq_deq_rollback(&ifp->if_snd, m0); + switch (error) { + case 0: break; + case EFBIG: + if (m_defrag(m0, M_DONTWAIT) == 0 && + bus_dmamap_load_mbuf(sc->sc_dmat, txs->tx_map, + m0, BUS_DMA_NOWAIT) == 0) + break; + /* FALLTHROUGH */ + default: + ifp->if_oerrors++; + m_freem(m0); + /* try next packet */ + continue; } - ifq_deq_commit(&ifp->if_snd, m0); txs->tx_mbuf = m0; #if NBPFILTER > 0 |