OSDN Git Service

ice: xsk: allocate separate memory for XDP SW ring
authorMaciej Fijalkowski <maciej.fijalkowski@intel.com>
Mon, 13 Dec 2021 15:31:07 +0000 (16:31 +0100)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Fri, 17 Dec 2021 19:09:04 +0000 (11:09 -0800)
commit617f3e1b588c802517c236087561c6bcb0b4afd6
treee9cb7dea13429a81c020f62bf670afb83ed1b468
parentafe8a3ba85ec2a6b6849367e25c06a2f8e0ddd05
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>
Tested-by: Kiran Bhandare <kiranx.bhandare@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_base.c
drivers/net/ethernet/intel/ice/ice_txrx.c
drivers/net/ethernet/intel/ice/ice_xsk.c