From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dvora Fuxbrumer Date: Thu, 20 May 2021 10:00:12 +0300 Subject: [Intel-wired-lan] [PATCH v6 8/9] igc: Enable RX via AF_XDP zero-copy In-Reply-To: <20210423062555.14972-9-jithu.joseph@intel.com> References: <20210423062555.14972-1-jithu.joseph@intel.com> <20210423062555.14972-9-jithu.joseph@intel.com> Message-ID: <76b942e7-6be1-ee72-245f-355526df4821@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: intel-wired-lan@osuosl.org List-ID: On 23/04/2021 09:25, Jithu Joseph wrote: > From: Andre Guedes > > Add support for receiving packets via AF_XDP zero-copy mechanism. > > Add a new flag to 'enum igc_ring_flags_t' to indicate the ring has > AF_XDP zero-copy enabled so proper ring setup is carried out during ring > configuration in igc_configure_rx_ring(). > > RX buffers can now be allocated via the shared pages mechanism (default > behavior of the driver) or via xsk pool (when AF_XDP zero-copy is > enabled) so a union is added to the 'struct igc_rx_buffer' to cover both > cases. > > When AF_XDP zero-copy is enabled, rx buffers are allocated from the xsk > pool using the new helper igc_alloc_rx_buffers_zc() which is the > counterpart of igc_alloc_rx_buffers(). > > Likewise other Intel drivers that support AF_XDP zero-copy, in igc we > have a dedicated path for cleaning up rx irqs when zero-copy is enabled. > This avoids adding too many checks within igc_clean_rx_irq(), resulting > in a more readable and efficient code since this function is called from > the hot-path of the driver. > > Signed-off-by: Andre Guedes > Signed-off-by: Vedang Patel > Signed-off-by: Jithu Joseph > Reviewed-by: Maciej Fijalkowski > --- > drivers/net/ethernet/intel/igc/igc.h | 22 +- > drivers/net/ethernet/intel/igc/igc_base.h | 1 + > drivers/net/ethernet/intel/igc/igc_main.c | 344 +++++++++++++++++++++- > drivers/net/ethernet/intel/igc/igc_xdp.c | 100 +++++++ > drivers/net/ethernet/intel/igc/igc_xdp.h | 2 + > 5 files changed, 450 insertions(+), 19 deletions(-) > Tested-by: Dvora Fuxbrumer