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.
This commit is contained in:
parent
b9b7f896c0
commit
de49e8f29d
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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));
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user