diff options
author | Charles McLachlan <cmclachlan@solarflare.com> | 2019-10-31 10:24:12 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-10-31 14:14:53 -0700 |
commit | dfe44c1f52eed6020df74e83d21d617308164a68 (patch) | |
tree | 04fdf1c0534b08b71fa3ae5d9396a2a599a776a0 /drivers/net/ethernet/sfc/rx.c | |
parent | 3990a8fffbdad5765f47ea593f9de66c91762059 (diff) | |
download | linux-dfe44c1f52eed6020df74e83d21d617308164a68.tar.bz2 |
sfc: handle XDP_TX outcomes of XDP eBPF programs
Provide an ndo_xdp_xmit function that uses the XDP tx queue for this
CPU to send the packet.
Signed-off-by: Charles McLachlan <cmclachlan@solarflare.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sfc/rx.c')
-rw-r--r-- | drivers/net/ethernet/sfc/rx.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c index 644d157843c6..91f6d5b9ceac 100644 --- a/drivers/net/ethernet/sfc/rx.c +++ b/drivers/net/ethernet/sfc/rx.c @@ -653,6 +653,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel, u8 rx_prefix[EFX_MAX_RX_PREFIX_SIZE]; struct efx_rx_queue *rx_queue; struct bpf_prog *xdp_prog; + struct xdp_frame *xdpf; struct xdp_buff xdp; u32 xdp_act; s16 offset; @@ -713,7 +714,16 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel, break; case XDP_TX: - return -EOPNOTSUPP; + /* Buffer ownership passes to tx on success. */ + xdpf = convert_to_xdp_frame(&xdp); + err = efx_xdp_tx_buffers(efx, 1, &xdpf, true); + if (unlikely(err != 1)) { + efx_free_rx_buffers(rx_queue, rx_buf, 1); + if (net_ratelimit()) + netif_err(efx, rx_err, efx->net_dev, + "XDP TX failed (%d)\n", err); + } + break; case XDP_REDIRECT: err = xdp_do_redirect(efx->net_dev, &xdp, xdp_prog); |