i think bpf_tap is broken, so id like to get rid of it.

the only thing(s) using it is ie, but they dont require bpf_tap.

the typical idiom with doing bpf on outgoing packets is to pass the
mbuf in between dequeueing the packet from the send queue, and
before it's given to the hardware.

this diff moves the bpf from reading a buffer out of a ring up into
the start routine as just described.

ie on isa busses was already doing that, but also doing it again
out of the ring. this simply removes the extra one. this means you
wont get to see the packet twice, but once is enough for everyone
else.

ok?

Index: arch/sparc/dev/if_ie.c
===================================================================
RCS file: /cvs/src/sys/arch/sparc/dev/if_ie.c,v
retrieving revision 1.62
diff -u -p -r1.62 if_ie.c
--- arch/sparc/dev/if_ie.c      16 Mar 2016 15:41:10 -0000      1.62
+++ arch/sparc/dev/if_ie.c      29 Mar 2016 10:54:38 -0000
@@ -998,19 +998,6 @@ static __inline void
 iexmit(sc)
        struct ie_softc *sc;
 {
-
-#if NBPFILTER > 0
-       /*
-        * If BPF is listening on this interface, let it see the packet before
-        * we push it on the wire.
-        */
-       if (sc->sc_arpcom.ac_if.if_bpf)
-               bpf_tap(sc->sc_arpcom.ac_if.if_bpf,
-                   sc->xmit_cbuffs[sc->xctail],
-                   SWAP(sc->xmit_buffs[sc->xctail]->ie_xmit_flags),
-                   BPF_DIRECTION_OUT);
-#endif
-
        sc->xmit_buffs[sc->xctail]->ie_xmit_flags |= IE_XMIT_LAST;
        sc->xmit_buffs[sc->xctail]->ie_xmit_next = SWAP(0xffff);
        ST_24(sc->xmit_buffs[sc->xctail]->ie_xmit_buf,
@@ -1314,6 +1301,11 @@ iestart(ifp)
                IFQ_DEQUEUE(&sc->sc_arpcom.ac_if.if_snd, m);
                if (!m)
                        break;
+
+#if NBPFILTER > 0
+               if (ifp->if_bpf)
+                       bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT);
+#endif
 
                len = 0;
                buffer = sc->xmit_cbuffs[sc->xchead];
Index: dev/isa/if_ie.c
===================================================================
RCS file: /cvs/src/sys/dev/isa/if_ie.c,v
retrieving revision 1.50
diff -u -p -r1.50 if_ie.c
--- dev/isa/if_ie.c     14 Mar 2016 23:08:06 -0000      1.50
+++ dev/isa/if_ie.c     29 Mar 2016 10:54:38 -0000
@@ -1120,18 +1120,6 @@ iexmit(sc)
                    sc->xctail);
 #endif
 
-#if NBPFILTER > 0
-       /*
-        * If BPF is listening on this interface, let it see the packet before
-        * we push it on the wire.
-        */
-       if (sc->sc_arpcom.ac_if.if_bpf)
-               bpf_tap(sc->sc_arpcom.ac_if.if_bpf,
-                   sc->xmit_cbuffs[sc->xctail],
-                   sc->xmit_buffs[sc->xctail]->ie_xmit_flags,
-                   BPF_DIRECTION_OUT);
-#endif
-
        sc->xmit_buffs[sc->xctail]->ie_xmit_flags |= IE_XMIT_LAST;
        sc->xmit_buffs[sc->xctail]->ie_xmit_next = 0xffff;
        sc->xmit_buffs[sc->xctail]->ie_xmit_buf =

Reply via email to