[Intel-wired-lan] [PATCH net v1] ice: Fix DMA mappings leak

Rout, ChandanX chandanx.rout at intel.com
Tue Aug 23 13:49:39 UTC 2022



>-----Original Message-----
>From: Intel-wired-lan <intel-wired-lan-bounces at osuosl.org> On Behalf Of
>Mateusz Palczewski
>Sent: Thursday, August 11, 2022 3:39 PM
>To: intel-wired-lan at lists.osuosl.org
>Cc: Patynowski, PrzemyslawX <przemyslawx.patynowski at intel.com>
>Subject: [Intel-wired-lan] [PATCH net v1] ice: Fix DMA mappings leak
>
>From: Przemyslaw Patynowski <przemyslawx.patynowski at intel.com>
>
>Fix leak, when user changes ring parameters.
>During reallocation of RX buffers, new DMA mappings are created for those
>buffers. New buffers with different RX ring count should substitute older
>ones, but those buffers were freed in ice_vsi_cfg_rxq and reallocated again
>with ice_alloc_rx_buf. kfree on rx_buf caused leak of already mapped DMA.
>Reallocate ZC with xdp_buf struct, when BPF program loads. Reallocate back
>to rx_buf, when BPF program unloads.
>If BPF program is loaded/unloaded and XSK pools are created, reallocate RX
>queues accordingly in XDP_SETUP_XSK_POOL handler.
>
>Steps for reproduction:
>while :
>do
>	for ((i=0; i<=8160; i=i+32))
>	do
>		ethtool -G enp130s0f0 rx $i tx $i
>		sleep 0.5
>		ethtool -g enp130s0f0
>	done
>done
>
>Fixes: 617f3e1b588c ("ice: xsk: allocate separate memory for XDP SW ring")
>Signed-off-by: Przemyslaw Patynowski
><przemyslawx.patynowski at intel.com>
>Signed-off-by: Mateusz Palczewski <mateusz.palczewski at intel.com>
>---
> drivers/net/ethernet/intel/ice/ice_base.c | 17 ------
>drivers/net/ethernet/intel/ice/ice_main.c |  8 +++
>drivers/net/ethernet/intel/ice/ice_xsk.c  | 63 +++++++++++++++++++++++
>drivers/net/ethernet/intel/ice/ice_xsk.h  |  7 +++
> 4 files changed, 78 insertions(+), 17 deletions(-)

Tested-by: Chandan <chandanx.rout at intel.com> (A Contingent Worker at Intel)


More information about the Intel-wired-lan mailing list