summaryrefslogtreecommitdiffstats
path: root/sys/mips
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2010-09-25 04:39:12 +0000
committerjmallett <jmallett@FreeBSD.org>2010-09-25 04:39:12 +0000
commitde49e8f29df0967ae7a1019bac7bdcb7d7f97d02 (patch)
treeb24acd387812d32804c7cddd3ac6866c46dcd8ae /sys/mips
parentb9b7f896c0989ace786c4764b1af88925c7291ec (diff)
downloadFreeBSD-src-de49e8f29df0967ae7a1019bac7bdcb7d7f97d02.zip
FreeBSD-src-de49e8f29df0967ae7a1019bac7bdcb7d7f97d02.tar.gz
o) Send mbufs to BPF listeners from within cvm_oct_xmit().
o) Pin receive threads when they're running since we do access some core-local resources.
Diffstat (limited to 'sys/mips')
-rw-r--r--sys/mips/cavium/octe/ethernet-rx.c8
-rw-r--r--sys/mips/cavium/octe/ethernet-tx.c4
-rw-r--r--sys/mips/cavium/octe/octe.c18
3 files changed, 11 insertions, 19 deletions
diff --git a/sys/mips/cavium/octe/ethernet-rx.c b/sys/mips/cavium/octe/ethernet-rx.c
index c6cc14c..2f8f0a8 100644
--- a/sys/mips/cavium/octe/ethernet-rx.c
+++ b/sys/mips/cavium/octe/ethernet-rx.c
@@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
+#include <sys/proc.h>
+#include <sys/sched.h>
#include <sys/smp.h>
#include <sys/taskqueue.h>
@@ -167,7 +169,7 @@ static inline int cvm_oct_check_rcv_error(cvmx_wqe_t *work)
*/
void cvm_oct_tasklet_rx(void *context, int pending)
{
- const int coreid = cvmx_get_core_num();
+ int coreid;
uint64_t old_group_mask;
uint64_t old_scratch;
int rx_count = 0;
@@ -175,6 +177,9 @@ void cvm_oct_tasklet_rx(void *context, int pending)
int num_freed;
int packet_not_copied;
+ sched_pin();
+ coreid = cvmx_get_core_num();
+
/* Prefetch cvm_oct_device since we know we need it soon */
CVMX_PREFETCH(cvm_oct_device, 0);
@@ -388,6 +393,7 @@ void cvm_oct_tasklet_rx(void *context, int pending)
}
}
}
+ sched_unpin();
}
diff --git a/sys/mips/cavium/octe/ethernet-tx.c b/sys/mips/cavium/octe/ethernet-tx.c
index fc4e273..8866f12 100644
--- a/sys/mips/cavium/octe/ethernet-tx.c
+++ b/sys/mips/cavium/octe/ethernet-tx.c
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include <sys/mbuf.h>
#include <sys/socket.h>
+#include <net/bpf.h>
#include <net/ethernet.h>
#include <net/if.h>
@@ -239,6 +240,9 @@ int cvm_oct_xmit(struct mbuf *m, struct ifnet *ifp)
} else {
/* Put this packet on the queue to be freed later */
_IF_ENQUEUE(&priv->tx_free_queue[qos], m);
+
+ /* Pass it to any BPF listeners. */
+ ETHER_BPF_MTAP(ifp, m);
}
if (work != NULL)
cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, DONT_WRITEBACK(1));
diff --git a/sys/mips/cavium/octe/octe.c b/sys/mips/cavium/octe/octe.c
index 312598d..d693314 100644
--- a/sys/mips/cavium/octe/octe.c
+++ b/sys/mips/cavium/octe/octe.c
@@ -310,24 +310,6 @@ octe_start(struct ifnet *ifp)
OCTE_TX_UNLOCK(priv);
- /*
- * XXX
- *
- * We may not be able to pass the mbuf up to BPF for one of
- * two very good reasons:
- * (1) immediately after our inserting it another CPU may be
- * kind enough to free it for us.
- * (2) m_collapse gets called on m and we don't get back the
- * modified pointer.
- *
- * We have some options other than an m_dup route:
- * (1) use a mutex or spinlock to prevent another CPU from
- * freeing it. We could lock the tx_free_list's lock,
- * that would make sense.
- * (2) get back the new mbuf pointer.
- * (3) do the collapse here.
- */
-
if (priv->queue != -1) {
error = cvm_oct_xmit(m, ifp);
} else {
OpenPOWER on IntegriCloud