Subject: Re: [PATCH RFC v2 19/33] nfp: add XDP frame size to netronome driver

From: Jesper Dangaard Brouer <[email-masked]>
Date: Tue, 14 Apr 2020 16:02:20 +0200

On Wed, 8 Apr 2020 10:53:44 -0700
Jakub Kicinski <[email-masked]> wrote:

> On Wed, 08 Apr 2020 13:52:10 +0200 Jesper Dangaard Brouer wrote:
> > The netronome nfp driver already had a true_bufsz variable
> > that contains what was needed for xdp.frame_sz.
> > 
> > Cc: Jakub Kicinski <[email-masked]>
> > Signed-off-by: Jesper Dangaard Brouer <[email-masked]>
> > ---
> >  .../net/ethernet/netronome/nfp/nfp_net_common.c    |    1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
> > index 9bfb3b077bc1..b9b8c30eab33 100644
> > --- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
> > +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
> > @@ -1817,6 +1817,7 @@ static int nfp_net_rx(struct nfp_net_rx_ring *rx_ring, int budget)
> >  	rcu_read_lock();
> >  	xdp_prog = READ_ONCE(dp->xdp_prog);
> >  	true_bufsz = xdp_prog ? PAGE_SIZE : dp->fl_bufsz;
> > +	xdp.frame_sz = true_bufsz;  
> 
> Since this matters only with XDP on - we can set to PAGE_SIZE directly?

Well the value was already calculate for us in true_bufsz, but I can
change that.

> But more importantly the correct value is:
> 
> 	PAGE_SIZE - NFP_NET_RX_BUF_HEADROOM

Thanks for catching that. I will fix.

> as we set hard_start at an offset. 
> 
> 	xdp.data_hard_start = rxbuf->frag + NFP_NET_RX_BUF_HEADROOM;
> 
> Cause NFP_NET_RX_BUF_HEADROOM is not DMA mapped.
> 
> >  	xdp.rxq = &rx_ring->xdp_rxq;
> >  	tx_ring = r_vec->xdp_ring;  
> 

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer