OSDN Git Service

net: stmmac: Add support for XDP_REDIRECT action
authorOng Boon Leong <boon.leong.ong@intel.com>
Thu, 1 Apr 2021 02:11:17 +0000 (10:11 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 3 Apr 2021 21:13:39 +0000 (14:13 -0700)
commit8b278a5b69a2298055b99895ddc5b5f4ab430df5
treee65bd88031e6a498a4bffad78330a12f069e74bb
parentbe8b38a722e68ffa069b7dfa887369c33d6ea886
net: stmmac: Add support for XDP_REDIRECT action

This patch adds the support of XDP_REDIRECT to another remote cpu for
further action. It also implements ndo_xdp_xmit ops, enabling the driver
to transmit packets forwarded to it by XDP program running on another
interface.

This patch has been tested using "xdp_redirect_cpu" for XDP_REDIRECT
+ drop testing. It also been tested with "xdp_redirect" sample app
which can be used to exercise ndo_xdp_xmit ops. The burst traffics are
generated using pktgen_sample03_burst_single_flow.sh in samples/pktgen
directory.

v4: Move xdp_do_flush() processing into stmmac_finalize_xdp_rx() and
    combined the XDP verdict of XDP TX and REDIRECT together.

v3: Added 'nq->trans_start = jiffies' to avoid TX time-out as we are
    sharing TX queue between slow path and XDP. Thanks to Jakub Kicinski
    for point out.

Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac.h
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c