Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Move bpf_mtap in Tx hardware intrrupt to if_start



details:   https://anonhg.NetBSD.org/src/rev/0b409617c729
branches:  trunk
changeset: 349584:0b409617c729
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Thu Dec 15 09:33:25 2016 +0000

description:
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

diffstat:

 sys/dev/ic/sgec.c   |  7 ++++---
 sys/dev/pci/if_de.c |  8 ++++----
 2 files changed, 8 insertions(+), 7 deletions(-)

diffs (71 lines):

diff -r 49f9eae6f838 -r 0b409617c729 sys/dev/ic/sgec.c
--- a/sys/dev/ic/sgec.c Thu Dec 15 09:28:02 2016 +0000
+++ b/sys/dev/ic/sgec.c Thu Dec 15 09:33:25 2016 +0000
@@ -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 @@
                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 @@
                        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)
diff -r 49f9eae6f838 -r 0b409617c729 sys/dev/pci/if_de.c
--- a/sys/dev/pci/if_de.c       Thu Dec 15 09:28:02 2016 +0000
+++ b/sys/dev/pci/if_de.c       Thu Dec 15 09:33:25 2016 +0000
@@ -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 (matt%3am-software.com@localhost)
@@ -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_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 @@
     } 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.



Home | Main Index | Thread Index | Old Index