diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2016-01-12 00:05:22 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2016-01-12 00:05:22 +0000 |
commit | 5310217ce81b145a2ec00bc0cd3c3d479ea30286 (patch) | |
tree | 9e6b6e2170a9aa35cff42943e7440103a1abf725 /sys | |
parent | 333b662f804e761d601fae9b09c9eb60d3727e7a (diff) |
post the packet on em_82547 chips after bpf
now that start and txeof can run on different cpus, txeof could
have freed the mbuf before bpf got to it.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/if_em.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c index db1e1bb31b5..ece1e5bc919 100644 --- a/sys/dev/pci/if_em.c +++ b/sys/dev/pci/if_em.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_em.c,v 1.328 2016/01/11 01:31:53 dlg Exp $ */ +/* $OpenBSD: if_em.c,v 1.329 2016/01/12 00:05:21 dlg Exp $ */ /* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */ #include <dev/pci/if_em.h> @@ -630,6 +630,18 @@ em_start(struct ifnet *ifp) /* Set timeout in case hardware has problems transmitting */ ifp->if_timer = EM_TX_TIMEOUT; + if (sc->hw.mac_type == em_82547) { + int len = m->m_pkthdr.len; + + if (sc->link_duplex == HALF_DUPLEX) + em_82547_move_tail_locked(sc); + else { + E1000_WRITE_REG(&sc->hw, TDT, + sc->sc_tx_desc_head); + em_82547_update_fifo_head(sc, len); + } + } + post = 1; } @@ -1216,12 +1228,6 @@ em_encap(struct em_softc *sc, struct mbuf *m) bus_dmamap_sync(sc->sc_dmat, sc->sc_tx_dma.dma_map, 0, sc->sc_tx_dma.dma_map->dm_mapsize, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - if (sc->link_duplex == HALF_DUPLEX) - em_82547_move_tail_locked(sc); - else { - E1000_WRITE_REG(&sc->hw, TDT, head); - em_82547_update_fifo_head(sc, m->m_pkthdr.len); - } } return (used); |