bpf: cpumap xdp_buff to skb conversion and allocation
This patch makes cpumap functional, by adding SKB allocation and invoking the network stack on the dequeuing CPU. For constructing the SKB on the remote CPU, the xdp_buff in converted into a struct xdp_pkt, and it mapped into the top headroom of the packet, to avoid allocating separate mem. For now, struct xdp_pkt is just a cpumap internal data structure, with info carried between enqueue to dequeue. If a driver doesn't have enough headroom it is simply dropped, with return code -EOVERFLOW. This will be picked up the xdp tracepoint infrastructure, to allow users to catch this. V2: take into account xdp->data_meta V4: - Drop busypoll tricks, keeping it more simple. - Skip RPS and Generic-XDP-recursive-reinjection, suggested by Alexei V5: correct RCU read protection around __netif_receive_skb_core. V6: Setting TASK_RUNNING vs TASK_INTERRUPTIBLE based on talk with Rik van Riel Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
9c270af37b
commit
1c601d829a
@@ -4492,6 +4492,33 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* netif_receive_skb_core - special purpose version of netif_receive_skb
|
||||
* @skb: buffer to process
|
||||
*
|
||||
* More direct receive version of netif_receive_skb(). It should
|
||||
* only be used by callers that have a need to skip RPS and Generic XDP.
|
||||
* Caller must also take care of handling if (page_is_)pfmemalloc.
|
||||
*
|
||||
* This function may only be called from softirq context and interrupts
|
||||
* should be enabled.
|
||||
*
|
||||
* Return values (usually ignored):
|
||||
* NET_RX_SUCCESS: no congestion
|
||||
* NET_RX_DROP: packet was dropped
|
||||
*/
|
||||
int netif_receive_skb_core(struct sk_buff *skb)
|
||||
{
|
||||
int ret;
|
||||
|
||||
rcu_read_lock();
|
||||
ret = __netif_receive_skb_core(skb, false);
|
||||
rcu_read_unlock();
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(netif_receive_skb_core);
|
||||
|
||||
static int __netif_receive_skb(struct sk_buff *skb)
|
||||
{
|
||||
int ret;
|
||||
|
Reference in New Issue
Block a user