-----Original Message-----
From: Intel-wired-lan <redacted> On Behalf Of
Maciej Fijalkowski
Sent: Monday, December 13, 2021 9:01 PM
To: intel-wired-lan@lists.osuosl.org
Cc: Mathew, Elza <redacted>; netdev@vger.kernel.org;
kuba@kernel.org; bpf@vger.kernel.org; davem@davemloft.net; Karlsson,
Magnus [off-list ref]
Subject: [Intel-wired-lan] [PATCH v2 intel-net 2/6] ice: xsk: allocate separate
memory for XDP SW ring
Currently, the zero-copy data path is reusing the memory region that was
initially allocated for an array of struct ice_rx_buf for its own purposes. This
is error prone as it is based on the ice_rx_buf struct always being the same
size or bigger than what the zero-copy path needs.
There can also be old values present in that array giving rise to errors when
the zero-copy path uses it.
Fix this by freeing the ice_rx_buf region and allocating a new array for the
zero-copy path that has the right length and is initialized to zero.
Fixes: 57f7f8b6bc0b ("ice: Use xdp_buf instead of rx_buf for xsk zero-copy")
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
---
drivers/net/ethernet/intel/ice/ice_base.c | 17 ++++++++++++
drivers/net/ethernet/intel/ice/ice_txrx.c | 19 ++++++++-----
drivers/net/ethernet/intel/ice/ice_xsk.c | 33 ++++++++++++-----------
3 files changed, 47 insertions(+), 22 deletions(-)
Tested-by: Kiran Bhandare <redacted> A Contingent Worker at Intel