OSDN Git Service

nfp: xsk: add AF_XDP zero-copy Rx and Tx support
authorNiklas Söderlund <niklas.soderlund@corigine.com>
Fri, 4 Mar 2022 10:22:14 +0000 (11:22 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 4 Mar 2022 13:06:12 +0000 (13:06 +0000)
commit6402528b7a0bf9869aca1f7eed43b809d57f0ae5
tree36a01b632048ea8eef4adb040c3561f0bdda5bce
parent9c91a3653fbb69d07f328edb11380552042f9114
nfp: xsk: add AF_XDP zero-copy Rx and Tx support

This patch adds zero-copy Rx and Tx support for AF_XDP sockets. It do so
by adding a separate NAPI poll function that is attached to a each
channel when the XSK socket is attached with XDP_SETUP_XSK_POOL, and
restored when the XSK socket is terminated, this is done per channel.

Support for XDP_TX is implemented and the XDP buffer can safely be moved
from the Rx to the Tx queue and correctly freed and returned to the XSK
pool once it's transmitted.

Note that when AF_XDP zero-copy is enabled, the XDP action XDP_PASS
will allocate a new buffer and copy the zero-copy frame prior
passing it to the kernel stack.

This patch is based on previous work by Jakub Kicinski.

Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/Makefile
drivers/net/ethernet/netronome/nfp/nfp_net.h
drivers/net/ethernet/netronome/nfp/nfp_net_common.c
drivers/net/ethernet/netronome/nfp/nfp_net_debugfs.c
drivers/net/ethernet/netronome/nfp/nfp_net_xsk.c [new file with mode: 0644]
drivers/net/ethernet/netronome/nfp/nfp_net_xsk.h [new file with mode: 0644]