Date: Sat, 25 Sep 2010 04:39:12 +0000 (UTC) From: Juli Mallett <jmallett@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r213156 - head/sys/mips/cavium/octe Message-ID: <201009250439.o8P4dCts049668@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jmallett Date: Sat Sep 25 04:39:12 2010 New Revision: 213156 URL: http://svn.freebsd.org/changeset/base/213156 Log: 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. Modified: head/sys/mips/cavium/octe/ethernet-rx.c head/sys/mips/cavium/octe/ethernet-tx.c head/sys/mips/cavium/octe/octe.c Modified: head/sys/mips/cavium/octe/ethernet-rx.c ============================================================================== --- head/sys/mips/cavium/octe/ethernet-rx.c Sat Sep 25 04:26:40 2010 (r213155) +++ head/sys/mips/cavium/octe/ethernet-rx.c Sat Sep 25 04:39:12 2010 (r213156) @@ -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_erro */ 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, i 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, i } } } + sched_unpin(); } Modified: head/sys/mips/cavium/octe/ethernet-tx.c ============================================================================== --- head/sys/mips/cavium/octe/ethernet-tx.c Sat Sep 25 04:26:40 2010 (r213155) +++ head/sys/mips/cavium/octe/ethernet-tx.c Sat Sep 25 04:39:12 2010 (r213156) @@ -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 } 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)); Modified: head/sys/mips/cavium/octe/octe.c ============================================================================== --- head/sys/mips/cavium/octe/octe.c Sat Sep 25 04:26:40 2010 (r213155) +++ head/sys/mips/cavium/octe/octe.c Sat Sep 25 04:39:12 2010 (r213156) @@ -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 {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009250439.o8P4dCts049668>