Module Name: src Committed By: ozaki-r Date: Thu Dec 15 09:33:25 UTC 2016
Modified Files: src/sys/dev/ic: sgec.c src/sys/dev/pci: if_de.c Log Message: Move bpf_mtap in Tx hardware intrrupt to if_start The intention of the change is to prevent bpf_mtap from running in hardware interrupt context. if_start is a usual place to do bpf_mtap on Tx. Proposed on tech-kern and tech-net To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/sys/dev/ic/sgec.c cvs rdiff -u -r1.149 -r1.150 src/sys/dev/pci/if_de.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/ic/sgec.c diff -u src/sys/dev/ic/sgec.c:1.44 src/sys/dev/ic/sgec.c:1.45 --- src/sys/dev/ic/sgec.c:1.44 Thu Dec 15 09:28:05 2016 +++ src/sys/dev/ic/sgec.c Thu Dec 15 09:33:25 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sgec.c,v 1.44 2016/12/15 09:28:05 ozaki-r Exp $ */ +/* $NetBSD: sgec.c,v 1.45 2016/12/15 09:33:25 ozaki-r Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved. * @@ -45,7 +45,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sgec.c,v 1.44 2016/12/15 09:28:05 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sgec.c,v 1.45 2016/12/15 09:33:25 ozaki-r Exp $"); #include "opt_inet.h" @@ -421,6 +421,8 @@ zestart(struct ifnet *ifp) if ((ZE_RCSR(ZE_CSR5) & ZE_NICSR5_TS) != ZE_NICSR5_TS_RUN) ZE_WCSR(ZE_CSR1, -1); sc->sc_nexttx = nexttx; + + bpf_mtap(ifp, m); } if (sc->sc_inq == (TXDESCS - 1)) ifp->if_flags |= IFF_OACTIVE; @@ -504,7 +506,6 @@ sgec_intr(struct ze_softc *sc) ifp->if_opackets++; bus_dmamap_unload(sc->sc_dmat, map); KASSERT(sc->sc_txmbuf[lastack]); - bpf_mtap(ifp, sc->sc_txmbuf[lastack]); m_freem(sc->sc_txmbuf[lastack]); sc->sc_txmbuf[lastack] = 0; if (++lastack == TXDESCS) Index: src/sys/dev/pci/if_de.c diff -u src/sys/dev/pci/if_de.c:1.149 src/sys/dev/pci/if_de.c:1.150 --- src/sys/dev/pci/if_de.c:1.149 Thu Dec 15 09:28:05 2016 +++ src/sys/dev/pci/if_de.c Thu Dec 15 09:33:25 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_de.c,v 1.149 2016/12/15 09:28:05 ozaki-r Exp $ */ +/* $NetBSD: if_de.c,v 1.150 2016/12/15 09:33:25 ozaki-r Exp $ */ /*- * Copyright (c) 1994-1997 Matt Thomas (m...@3am-software.com) @@ -37,7 +37,7 @@ * board which support 21040, 21041, or 21140 (mostly). */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.149 2016/12/15 09:28:05 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.150 2016/12/15 09:33:25 ozaki-r Exp $"); #define TULIP_HDR_DATA @@ -3894,8 +3894,6 @@ tulip_tx_intr( TULIP_TXMAP_POSTSYNC(sc, map); tulip_free_txmap(sc, map); #endif /* TULIP_BUS_DMA */ - if (sc->tulip_bpf != NULL) - bpf_mtap(&sc->tulip_if, m); m_freem(m); #if defined(TULIP_DEBUG) } else { @@ -4548,6 +4546,8 @@ tulip_txput( } while ((m0 = m0->m_next) != NULL); #endif /* TULIP_BUS_DMA */ + if (sc->tulip_bpf != NULL) + bpf_mtap(&sc->tulip_if, m); /* * The descriptors have been filled in. Now get ready * to transmit.