igc: Add support for XDP_TX action
authorAndre Guedes <andre.guedes@intel.com>
Wed, 10 Mar 2021 07:13:21 +0000 (23:13 -0800)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Mon, 29 Mar 2021 16:12:19 +0000 (09:12 -0700)
commit73f1071c1d2952b8c93cd6cd99744768c59ec840
tree4d80d792b9fe4562bb701d8db9be9fbbda0d3f86
parent26575105d6ed8e2a8e43bd008fc7d98b75b90d5c
igc: Add support for XDP_TX action

Add support for XDP_TX action which enables XDP programs to transmit
back receiving frames.

I225 controller has only 4 Tx hardware queues. Since XDP programs may
not even issue an XDP_TX action, this patch doesn't reserve dedicated
queues just for XDP like other Intel drivers do. Instead, the queues
are shared between the network stack and XDP. The netdev queue lock is
used to ensure mutual exclusion.

Since frames can now be transmitted via XDP_TX, the igc_tx_buffer
structure is modified so we are able to save a reference to the xdp
frame for later clean up once the packet is transmitted. The tx_buffer
is mapped to either a skb or a xdpf so we use a union to save the skb
or xdpf pointer and have a bit in tx_flags to indicate which field to
use.

This patch has been tested with the sample app "xdp2" located in
samples/bpf/ dir.

Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Signed-off-by: Vedang Patel <vedang.patel@intel.com>
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Tested-by: Dvora Fuxbrumer <dvorax.fuxbrumer@linux.intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/igc/igc.h
drivers/net/ethernet/intel/igc/igc_main.c
drivers/net/ethernet/intel/igc/igc_xdp.c
drivers/net/ethernet/intel/igc/igc_xdp.h