Subject: Re: [PATCH net 0/2][pull request] Intel Wired LAN Driver Updates 2022-11-14 (i40e)

From: Maciej Fijalkowski <[email-masked]>
Date: Thu, 17 Nov 2022 01:03:04 +0100

On Thu, Nov 17, 2022 at 01:21:21AM +0200, Vladimir Oltean wrote:
> Hi,
> 
> On Mon, Nov 14, 2022 at 04:03:22PM -0800, Tony Nguyen wrote:
> > This series contains updates to i40e driver only.
> > 
> > Sylwester removes attempted allocation of Rx buffers when AF_XDP is in Tx
> > only mode.
> > 
> > Bartosz adds helper to calculate Rx buffer length so that it can be
> > used when interface is down; before value has been set in struct.
> > 
> > The following are changes since commit ed1fe1bebe18884b11e5536b5ac42e3a48960835:
> >   net: dsa: make dsa_master_ioctl() see through port_hwtstamp_get() shims
> > and are available in the git repository at:
> >   git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 40GbE
> > 
> > Bartosz Staszewski (1):
> >   i40e: fix xdp_redirect logs error message when testing with MTU=1500
> > 
> > Sylwester Dziedziuch (1):
> >   i40e: Fix failure message when XDP is configured in TX only mode
> > 
> >  drivers/net/ethernet/intel/i40e/i40e_main.c | 48 +++++++++++++++------
> >  1 file changed, 34 insertions(+), 14 deletions(-)
> > 
> > -- 
> > 2.35.1
> > 
> 
> Sorry to interject, but there might be a potential bug I noticed a while
> ago in the i40e driver, and I didn't find the occasion to bring it up,
> but remembered just now.
> 
> Is it correct for i40e_run_xdp_zc() to call i40e_xmit_xdp_tx_ring() on
> the XDP_TX action? If I'm reading the code correctly, this will map the
> buffer to DMA before sending it. But since this is a zero-copy RX buffer,
> it has already been mapped to DMA in i40e_xsk_pool_enable().

Hey Vladimir,

have a look at xdp_convert_zc_to_xdp_frame() in net/core/xdp.c. For XDP_TX
on ZC Rx side we basically create new xdp_frame backed by new page and
copy the contents we had in ZC buffer. Then we give back the ZC buffer to
XSK buff pool and new xdp_frame has to be DMA mapped to HW.

> 
> Since I don't have the hardware, I can't be 100% sure if I'm following
> the code correctly. However if I compare with i40e_xmit_zc(), the latter
> does not map buffers to DMA, so I think neither should the former.