Subject: Re: [PATCH v5 bpf 08/11] ice: update xdp_rxq_info::frag_size for ZC enabled Rx queue

From: Maciej Fijalkowski <[email-masked]>
Date: Wed, 24 Jan 2024 14:58:11 +0100

On Wed, Jan 24, 2024 at 09:51:47AM +0100, Magnus Karlsson wrote:
> On Mon, 22 Jan 2024 at 23:17, Maciej Fijalkowski
> <[email-masked]> wrote:
> >
> > Now that ice driver correctly sets up frag_size in xdp_rxq_info, let us
> > make it work for ZC multi-buffer as well. ice_rx_ring::rx_buf_len for ZC
> > is being set via xsk_pool_get_rx_frame_size() and this needs to be
> > propagated up to xdp_rxq_info.
> >
> > Use a bigger hammer and instead of unregistering only xdp_rxq_info's
> > memory model, unregister it altogether and register it again and have
> > xdp_rxq_info with correct frag_size value.
> >
> > Fixes: 1bbc04de607b ("ice: xsk: add RX multi-buffer support")
> > Signed-off-by: Maciej Fijalkowski <[email-masked]>
> > ---
> >  drivers/net/ethernet/intel/ice/ice_base.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/ethernet/intel/ice/ice_base.c
> > index b25b7f415965..df174c1c3817 100644
> > --- a/drivers/net/ethernet/intel/ice/ice_base.c
> > +++ b/drivers/net/ethernet/intel/ice/ice_base.c
> > @@ -564,10 +564,15 @@ int ice_vsi_cfg_rxq(struct ice_rx_ring *ring)
> >
> >                 ring->xsk_pool = ice_xsk_pool(ring);
> >                 if (ring->xsk_pool) {
> > -                       xdp_rxq_info_unreg_mem_model(&ring->xdp_rxq);
> > +                       xdp_rxq_info_unreg(&ring->xdp_rxq);
> >
> >                         ring->rx_buf_len =
> >                                 xsk_pool_get_rx_frame_size(ring->xsk_pool);
> > +                       /* coverity[check_return] */
> 
> Why not check the return value here? I can see that the non xsk_pool
> path ignores the return value too, but do not understand why.

I can't remember now, so maybe let us check retval for both paths. That
won't hurt us.

> 
> > +                       __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,
> > +                                          ring->q_index,
> > +                                          ring->q_vector->napi.napi_id,
> > +                                          ring->rx_buf_len);
> >                         err = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq,
> >                                                          MEM_TYPE_XSK_BUFF_POOL,
> >                                                          NULL);
> > --
> > 2.34.1
> >
> >