On Sun, 28 Feb 2021 23:27:25 +0100
Lorenzo Bianconi <lorenzo.bianc...@redhat.com> wrote:

> > >   drops = bq->count - sent;
> > > -out:
> > > - bq->count = 0;
> > > + if (unlikely(drops > 0)) {
> > > +         /* If not all frames have been transmitted, it is our
> > > +          * responsibility to free them
> > > +          */
> > > +         for (i = sent; i < bq->count; i++)
> > > +                 xdp_return_frame_rx_napi(bq->q[i]);
> > > + }  
> > 
> > Wouldn't the logic above be the same even w/o the 'if' condition ?  
> 
> it is just an optimization to avoid the for loop instruction if sent = 
> bq->count

True, and I like this optimization.
It will affect how the code layout is (and thereby I-cache usage).

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

Reply via email to