• Przemyslaw Patynowski's avatar
    ice: Fix DMA mappings leak · 7e753eb6
    Przemyslaw Patynowski authored
    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: 617f3e1b ("ice: xsk: allocate separate memory for XDP SW ring")
    Signed-off-by: default avatarPrzemyslaw Patynowski <przemyslawx.patynowski@intel.com>
    Signed-off-by: default avatarMateusz Palczewski <mateusz.palczewski@intel.com>
    Tested-by: Chandan <chandanx.rout@intel.com> (A Contingent Worker at Intel)
    Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
    7e753eb6
ice_xsk.h 2.18 KB