summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorChristian Weisgerber <naddy@cvs.openbsd.org>2008-11-09 15:08:27 +0000
committerChristian Weisgerber <naddy@cvs.openbsd.org>2008-11-09 15:08:27 +0000
commit19e72e3b9f3138440f80b79260f2adaee85eae40 (patch)
tree291a75bc288930e303d106f2c4b3e8fb865415a0 /sys/dev/pci
parentbe7cd0fdfd40b4f306a204fdbb31aa7cdd7efec5 (diff)
Introduce bpf_mtap_ether(), which for the benefit of bpf listeners
creates the VLAN encapsulation from the tag stored in the mbuf header. Idea from FreeBSD, input from claudio@ and canacar@. Switch all hardware VLAN enabled drivers to the new function. ok claudio@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_bge.c6
-rw-r--r--sys/dev/pci/if_bnx.c7
-rw-r--r--sys/dev/pci/if_em.c7
-rw-r--r--sys/dev/pci/if_ix.c7
-rw-r--r--sys/dev/pci/if_ixgb.c6
-rw-r--r--sys/dev/pci/if_jme.c7
-rw-r--r--sys/dev/pci/if_nfe.c6
-rw-r--r--sys/dev/pci/if_nge.c6
-rw-r--r--sys/dev/pci/if_stge.c6
-rw-r--r--sys/dev/pci/if_ti.c6
-rw-r--r--sys/dev/pci/if_txp.c6
-rw-r--r--sys/dev/pci/if_vge.c6
-rw-r--r--sys/dev/pci/if_xge.c6
13 files changed, 43 insertions, 39 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c
index 98bef6d6799..dd768e6507d 100644
--- a/sys/dev/pci/if_bge.c
+++ b/sys/dev/pci/if_bge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bge.c,v 1.254 2008/11/08 07:37:07 deraadt Exp $ */
+/* $OpenBSD: if_bge.c,v 1.255 2008/11/09 15:08:26 naddy Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -2535,7 +2535,7 @@ bge_rxeof(struct bge_softc *sc)
* Handle BPF listeners. Let the BPF user see the packet.
*/
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
+ bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_IN);
#endif
#ifdef BGE_CHECKSUM
@@ -3028,7 +3028,7 @@ bge_start(struct ifnet *ifp)
* to him.
*/
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT);
+ bpf_mtap_ether(ifp->if_bpf, m_head, BPF_DIRECTION_OUT);
#endif
}
if (pkts == 0)
diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c
index e3237974cfa..22008bcb765 100644
--- a/sys/dev/pci/if_bnx.c
+++ b/sys/dev/pci/if_bnx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bnx.c,v 1.69 2008/10/19 23:16:38 brad Exp $ */
+/* $OpenBSD: if_bnx.c,v 1.70 2008/11/09 15:08:26 naddy Exp $ */
/*-
* Copyright (c) 2006 Broadcom Corporation
@@ -4047,7 +4047,8 @@ bnx_rx_int_next_rx:
* user see the packet.
*/
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
+ bpf_mtap_ether(ifp->if_bpf, m,
+ BPF_DIRECTION_IN);
#endif
DBPRINT(sc, BNX_VERBOSE_RECV,
@@ -4546,7 +4547,7 @@ bnx_start(struct ifnet *ifp)
#if NBPFILTER > 0
/* Send a copy of the frame to any BPF listeners. */
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT);
+ bpf_mtap_ether(ifp->if_bpf, m_head, BPF_DIRECTION_OUT);
#endif
}
diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c
index 51f6daf789c..c6fb6d456c1 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.194 2008/10/28 05:43:11 brad Exp $ */
+/* $OpenBSD: if_em.c,v 1.195 2008/11/09 15:08:26 naddy Exp $ */
/* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */
#include <dev/pci/if_em.h>
@@ -493,7 +493,7 @@ em_start(struct ifnet *ifp)
#if NBPFILTER > 0
/* Send a copy of the frame to the BPF listener */
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT);
+ bpf_mtap_ether(ifp->if_bpf, m_head, BPF_DIRECTION_OUT);
#endif
/* Set timeout in case hardware has problems transmitting */
@@ -2769,7 +2769,8 @@ discard:
* user see the packet.
*/
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
+ bpf_mtap_ether(ifp->if_bpf, m,
+ BPF_DIRECTION_IN);
#endif
ether_input_mbuf(ifp, m);
diff --git a/sys/dev/pci/if_ix.c b/sys/dev/pci/if_ix.c
index d33859e00e9..c5626db5f80 100644
--- a/sys/dev/pci/if_ix.c
+++ b/sys/dev/pci/if_ix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ix.c,v 1.13 2008/10/28 05:39:18 brad Exp $ */
+/* $OpenBSD: if_ix.c,v 1.14 2008/11/09 15:08:26 naddy Exp $ */
/******************************************************************************
@@ -362,7 +362,7 @@ ixgbe_start_locked(struct tx_ring *txr, struct ifnet * ifp)
#if NBPFILTER > 0
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT);
+ bpf_mtap_ether(ifp->if_bpf, m_head, BPF_DIRECTION_OUT);
#endif
/* Set timeout in case hardware has problems transmitting */
@@ -2813,7 +2813,8 @@ discard:
rxr->next_to_check = i;
#if NBPFILTER > 0
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
+ bpf_mtap_ether(ifp->if_bpf, m,
+ BPF_DIRECTION_IN);
#endif
ether_input_mbuf(ifp, m);
i = rxr->next_to_check;
diff --git a/sys/dev/pci/if_ixgb.c b/sys/dev/pci/if_ixgb.c
index 7fb01a52399..baac695eca5 100644
--- a/sys/dev/pci/if_ixgb.c
+++ b/sys/dev/pci/if_ixgb.c
@@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
-/* $OpenBSD: if_ixgb.c,v 1.50 2008/10/28 05:43:11 brad Exp $ */
+/* $OpenBSD: if_ixgb.c,v 1.51 2008/11/09 15:08:26 naddy Exp $ */
#include <dev/pci/if_ixgb.h>
@@ -331,7 +331,7 @@ ixgb_start(struct ifnet *ifp)
#if NBPFILTER > 0
/* Send a copy of the frame to the BPF listener */
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT);
+ bpf_mtap_ether(ifp->if_bpf, m_head, BPF_DIRECTION_OUT);
#endif
/* Set timeout in case hardware has problems transmitting */
@@ -1830,7 +1830,7 @@ ixgb_rxeof(struct ixgb_softc *sc, int count)
* user see the packet.
*/
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, sc->fmp,
+ bpf_mtap_ether(ifp->if_bpf, sc->fmp,
BPF_DIRECTION_IN);
#endif
diff --git a/sys/dev/pci/if_jme.c b/sys/dev/pci/if_jme.c
index bd27aa36131..b2c0707d444 100644
--- a/sys/dev/pci/if_jme.c
+++ b/sys/dev/pci/if_jme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_jme.c,v 1.12 2008/10/29 01:55:53 brad Exp $ */
+/* $OpenBSD: if_jme.c,v 1.13 2008/11/09 15:08:26 naddy Exp $ */
/*-
* Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org>
* All rights reserved.
@@ -1242,7 +1242,7 @@ jme_start(struct ifnet *ifp)
* to him.
*/
if (ifp->if_bpf != NULL)
- bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT);
+ bpf_mtap_ether(ifp->if_bpf, m_head, BPF_DIRECTION_OUT);
#endif
}
@@ -1715,7 +1715,8 @@ jme_rxpkt(struct jme_softc *sc)
#if NBPFILTER > 0
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
+ bpf_mtap_ether(ifp->if_bpf, m,
+ BPF_DIRECTION_IN);
#endif
ifp->if_ipackets++;
diff --git a/sys/dev/pci/if_nfe.c b/sys/dev/pci/if_nfe.c
index 6a3234b0797..133f0b7ed9d 100644
--- a/sys/dev/pci/if_nfe.c
+++ b/sys/dev/pci/if_nfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nfe.c,v 1.85 2008/10/28 05:53:20 brad Exp $ */
+/* $OpenBSD: if_nfe.c,v 1.86 2008/11/09 15:08:26 naddy Exp $ */
/*-
* Copyright (c) 2006, 2007 Damien Bergamini <damien.bergamini@free.fr>
@@ -813,7 +813,7 @@ nfe_rxeof(struct nfe_softc *sc)
#if NBPFILTER > 0
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
+ bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_IN);
#endif
ifp->if_ipackets++;
ether_input_mbuf(ifp, m);
@@ -1048,7 +1048,7 @@ nfe_start(struct ifnet *ifp)
#if NBPFILTER > 0
if (ifp->if_bpf != NULL)
- bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT);
+ bpf_mtap_ether(ifp->if_bpf, m0, BPF_DIRECTION_OUT);
#endif
}
if (sc->txq.cur == old) /* nothing sent */
diff --git a/sys/dev/pci/if_nge.c b/sys/dev/pci/if_nge.c
index fe5baf17164..7da2a2d5ea5 100644
--- a/sys/dev/pci/if_nge.c
+++ b/sys/dev/pci/if_nge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nge.c,v 1.65 2008/10/28 22:45:20 brad Exp $ */
+/* $OpenBSD: if_nge.c,v 1.66 2008/11/09 15:08:26 naddy Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
* Copyright (c) 1997, 1998, 1999, 2000, 2001
@@ -1357,7 +1357,7 @@ nge_rxeof(sc)
* Handle BPF listeners. Let the BPF user see the packet.
*/
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
+ bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_IN);
#endif
/* Do IP checksum checking. */
@@ -1709,7 +1709,7 @@ nge_start(ifp)
* to him.
*/
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT);
+ bpf_mtap_ether(ifp->if_bpf, m_head, BPF_DIRECTION_OUT);
#endif
}
if (pkts == 0)
diff --git a/sys/dev/pci/if_stge.c b/sys/dev/pci/if_stge.c
index 8d6a7154c21..91d27001ef2 100644
--- a/sys/dev/pci/if_stge.c
+++ b/sys/dev/pci/if_stge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_stge.c,v 1.43 2008/10/22 22:57:12 brad Exp $ */
+/* $OpenBSD: if_stge.c,v 1.44 2008/11/09 15:08:26 naddy Exp $ */
/* $NetBSD: if_stge.c,v 1.27 2005/05/16 21:35:32 bouyer Exp $ */
/*-
@@ -644,7 +644,7 @@ stge_start(struct ifnet *ifp)
* Pass the packet to any BPF listeners.
*/
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m0, BPF_DIRECTION_OUT);
+ bpf_mtap_ether(ifp->if_bpf, m0, BPF_DIRECTION_OUT);
#endif /* NBPFILTER > 0 */
}
@@ -1068,7 +1068,7 @@ stge_rxintr(struct stge_softc *sc)
* pass if up the stack if it's for us.
*/
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
+ bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_IN);
#endif /* NBPFILTER > 0 */
/* Pass it on. */
diff --git a/sys/dev/pci/if_ti.c b/sys/dev/pci/if_ti.c
index 499a8bfc1c8..c73367510cf 100644
--- a/sys/dev/pci/if_ti.c
+++ b/sys/dev/pci/if_ti.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ti.c,v 1.92 2008/10/20 01:02:52 brad Exp $ */
+/* $OpenBSD: if_ti.c,v 1.93 2008/11/09 15:08:26 naddy Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -1862,7 +1862,7 @@ ti_rxeof(struct ti_softc *sc)
* Handle BPF listeners. Let the BPF user see the packet.
*/
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
+ bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_IN);
#endif
if ((cur_rx->ti_ip_cksum ^ 0xffff) == 0)
@@ -2247,7 +2247,7 @@ ti_start(struct ifnet *ifp)
*/
#if NBPFILTER > 0
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT);
+ bpf_mtap_ether(ifp->if_bpf, m_head, BPF_DIRECTION_OUT);
#endif
}
if (pkts == 0)
diff --git a/sys/dev/pci/if_txp.c b/sys/dev/pci/if_txp.c
index 343bb2c6dc1..326324b426a 100644
--- a/sys/dev/pci/if_txp.c
+++ b/sys/dev/pci/if_txp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_txp.c,v 1.97 2008/10/16 19:18:03 naddy Exp $ */
+/* $OpenBSD: if_txp.c,v 1.98 2008/11/09 15:08:26 naddy Exp $ */
/*
* Copyright (c) 2001
@@ -690,7 +690,7 @@ txp_rx_reclaim(struct txp_softc *sc, struct txp_rx_ring *r,
* Handle BPF listeners. Let the BPF user see the packet.
*/
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
+ bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_IN);
#endif
if (rxd->rx_stat & htole32(RX_STAT_IPCKSUMBAD))
@@ -1454,7 +1454,7 @@ txp_start(struct ifnet *ifp)
#if NBPFILTER > 0
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT);
+ bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_OUT);
#endif
txd->tx_flags |= TX_FLAGS_VALID;
diff --git a/sys/dev/pci/if_vge.c b/sys/dev/pci/if_vge.c
index 0e845244a0e..ed280d7b627 100644
--- a/sys/dev/pci/if_vge.c
+++ b/sys/dev/pci/if_vge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vge.c,v 1.41 2008/10/22 05:31:29 brad Exp $ */
+/* $OpenBSD: if_vge.c,v 1.42 2008/11/09 15:08:26 naddy Exp $ */
/* $FreeBSD: if_vge.c,v 1.3 2004/09/11 22:13:25 wpaul Exp $ */
/*
* Copyright (c) 2004
@@ -1109,7 +1109,7 @@ vge_rxeof(struct vge_softc *sc)
#if NBPFILTER > 0
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
+ bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_IN);
#endif
ether_input_mbuf(ifp, m);
@@ -1438,7 +1438,7 @@ vge_start(struct ifnet *ifp)
*/
#if NBPFILTER > 0
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m_head, BPF_DIRECTION_OUT);
+ bpf_mtap_ether(ifp->if_bpf, m_head, BPF_DIRECTION_OUT);
#endif
if (vge_encap(sc, m_head, idx)) {
diff --git a/sys/dev/pci/if_xge.c b/sys/dev/pci/if_xge.c
index e074a7eaa4d..7bef2d3296b 100644
--- a/sys/dev/pci/if_xge.c
+++ b/sys/dev/pci/if_xge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_xge.c,v 1.47 2008/10/21 00:26:40 brad Exp $ */
+/* $OpenBSD: if_xge.c,v 1.48 2008/11/09 15:08:26 naddy Exp $ */
/* $NetBSD: if_xge.c,v 1.1 2005/09/09 10:30:27 ragge Exp $ */
/*
@@ -952,7 +952,7 @@ xge_intr(void *pv)
#if NBPFILTER > 0
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
+ bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_IN);
#endif /* NBPFILTER > 0 */
ether_input_mbuf(ifp, m);
@@ -1178,7 +1178,7 @@ xge_start(struct ifnet *ifp)
#if NBPFILTER > 0
if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT);
+ bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_OUT);
#endif /* NBPFILTER > 0 */
sc->sc_nexttx = NEXTTX(nexttx);