>-----Original Message----- >From: Nguyen, Anthony L <anthony.l.nguyen@xxxxxxxxx> >Sent: Tuesday, September 27, 2022 2:02 AM >To: davem@xxxxxxxxxxxxx; kuba@xxxxxxxxxx; pabeni@xxxxxxxxxx; >edumazet@xxxxxxxxxx >Cc: Sokolowski, Jan <jan.sokolowski@xxxxxxxxx>; netdev@xxxxxxxxxxxxxxx; >Nguyen, Anthony L <anthony.l.nguyen@xxxxxxxxx>; bjorn@xxxxxxxxxx; >Fijalkowski, Maciej <maciej.fijalkowski@xxxxxxxxx>; Karlsson, Magnus ><magnus.karlsson@xxxxxxxxx>; ast@xxxxxxxxxx; daniel@xxxxxxxxxxxxx; >hawk@xxxxxxxxxx; john.fastabend@xxxxxxxxx; bpf@xxxxxxxxxxxxxxx; Rout, >ChandanX <chandanx.rout@xxxxxxxxx> >Subject: [PATCH net 3/3] i40e: Fix DMA mappings leak > >From: Jan Sokolowski <jan.sokolowski@xxxxxxxxx> > >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 i40e_configure_rx_ring and reallocated >again with i40e_alloc_rx_bi, thus kfree on rx_bi caused leak of already >mapped DMA. > >In case of non XDP ring, do not free rx_bi and reuse already existing buffer, >move kfree to XDP rings only, remove unused i40e_alloc_rx_bi function. > >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: be1222b585fd ("i40e: Separate kernel allocated rx_bi rings from AF_XDP >rings") >Signed-off-by: Jan Sokolowski <jan.sokolowski@xxxxxxxxx> >Tested-by: Chandan <chandanx.rout@xxxxxxxxx> (A Contingent Worker at >Intel) >Signed-off-by: Tony Nguyen <anthony.l.nguyen@xxxxxxxxx> >--- > .../net/ethernet/intel/i40e/i40e_ethtool.c | 3 - > drivers/net/ethernet/intel/i40e/i40e_main.c | 13 ++-- > drivers/net/ethernet/intel/i40e/i40e_txrx.c | 13 ++-- > drivers/net/ethernet/intel/i40e/i40e_txrx.h | 1 - > drivers/net/ethernet/intel/i40e/i40e_xsk.c | 67 ++++++++++++++++--- > drivers/net/ethernet/intel/i40e/i40e_xsk.h | 2 +- > 6 files changed, 71 insertions(+), 28 deletions(-) Tested-by: Chandan <chandanx.rout@xxxxxxxxx> (A Contingent Worker at Intel)