lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ