[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210301084847.5117a404@carbon>
Date: Mon, 1 Mar 2021 08:48:47 +0100
From: Jesper Dangaard Brouer <brouer@...hat.com>
To: Lorenzo Bianconi <lorenzo.bianconi@...hat.com>
Cc: Shay Agroskin <shayagr@...zon.com>,
Lorenzo Bianconi <lorenzo@...nel.org>, bpf@...r.kernel.org,
netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
ast@...nel.org, daniel@...earbox.net, toke@...hat.com,
freysteinn.alfredsson@....se, john.fastabend@...il.com,
jasowang@...hat.com, mst@...hat.com, thomas.petazzoni@...tlin.com,
mw@...ihalf.com, linux@...linux.org.uk,
ilias.apalodimas@...aro.org, netanel@...zon.com,
akiyano@...zon.com, michael.chan@...adcom.com,
madalin.bucur@....com, ioana.ciornei@....com,
jesse.brandeburg@...el.com, anthony.l.nguyen@...el.com,
saeedm@...dia.com, grygorii.strashko@...com,
ecree.xilinx@...il.com, brouer@...hat.com
Subject: Re: [PATCH v2 bpf-next] bpf: devmap: move drop error path to devmap
for XDP_REDIRECT
On Sun, 28 Feb 2021 23:27:25 +0100
Lorenzo Bianconi <lorenzo.bianconi@...hat.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
Powered by blists - more mailing lists