mirror_ubuntu-kernels/drivers/net/ethernet/amazon/ena
Shay Agroskin 504fd6a539 net: ena: fix DMA mapping function issues in XDP
This patch fixes several bugs found when (DMA/LLQ) mapping a packet for
transmission. The mapping procedure makes the transmitted packet
accessible by the device.
When using LLQ, this requires copying the packet's header to push header
(which would be passed to LLQ) and creating DMA mapping for the payload
(if the packet doesn't fit the maximum push length).
When not using LLQ, we map the whole packet with DMA.

The following bugs are fixed in the code:
    1. Add support for non-LLQ machines:
       The ena_xdp_tx_map_frame() function assumed that LLQ is
       supported, and never mapped the whole packet using DMA. On some
       instances, which don't support LLQ, this causes loss of traffic.

    2. Wrong DMA buffer length passed to device:
       When using LLQ, the first 'tx_max_header_size' bytes of the
       packet would be copied to push header. The rest of the packet
       would be copied to a DMA'd buffer.

    3. Freeing the XDP buffer twice in case of a mapping error:
       In case a buffer DMA mapping fails, the function uses
       xdp_return_frame_rx_napi() to free the RX buffer and returns from
       the function with an error. XDP frames that fail to xmit get
       freed by the kernel and so there is no need for this call.

Fixes: 548c4940b9 ("net: ena: Implement XDP_TX action")
Signed-off-by: Shay Agroskin <shayagr@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-06-08 16:41:02 -07:00
..
ena_admin_defs.h net: ena: Change RSS related macros and variables names 2020-09-21 13:54:23 -07:00
ena_com.c net: ena: fix inaccurate print type 2021-03-31 14:34:08 -07:00
ena_com.h ethernet: amazon: ena: A typo fix in the file ena_com.h 2021-03-15 12:48:20 -07:00
ena_common_defs.h net: ena: Change license into format to SPDX in all files 2020-09-21 13:54:22 -07:00
ena_eth_com.c net: ena: fix coding style nits 2020-12-09 15:26:40 -08:00
ena_eth_com.h net: ena: add device distinct log prefix to files 2020-12-09 15:26:40 -08:00
ena_eth_io_defs.h net: ena: Change license into format to SPDX in all files 2020-09-21 13:54:22 -07:00
ena_ethtool.c ena: Update driver to use ethtool_sprintf 2021-03-17 11:42:31 -07:00
ena_netdev.c net: ena: fix DMA mapping function issues in XDP 2021-06-08 16:41:02 -07:00
ena_netdev.h net: ena: introduce ndo_xdp_xmit() function for XDP_REDIRECT 2020-12-09 15:26:40 -08:00
ena_pci_id_tbl.h net: ena: Change license into format to SPDX in all files 2020-09-21 13:54:22 -07:00
ena_regs_defs.h net: ena: Change license into format to SPDX in all files 2020-09-21 13:54:22 -07:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00