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]
Message-ID: <20240227173017.GG277116@kernel.org>
Date: Tue, 27 Feb 2024 17:30:17 +0000
From: Simon Horman <horms@...nel.org>
To: Julien Panis <jpanis@...libre.com>
Cc: "David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Russell King <linux@...linux.org.uk>,
	Alexei Starovoitov <ast@...nel.org>,
	Daniel Borkmann <daniel@...earbox.net>,
	Jesper Dangaard Brouer <hawk@...nel.org>,
	John Fastabend <john.fastabend@...il.com>,
	Sumit Semwal <sumit.semwal@...aro.org>,
	Christian König <christian.koenig@....com>,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
	bpf@...r.kernel.org, linux-media@...r.kernel.org,
	dri-devel@...ts.freedesktop.org, linaro-mm-sig@...ts.linaro.org
Subject: Re: [PATCH] net: ethernet: ti: am65-cpsw: Add minimal XDP support

On Mon, Feb 26, 2024 at 06:48:25PM +0100, Julien Panis wrote:
> Hello Simon,
> 
> Thank you for the review.
> 
> On 2/26/24 18:25, Simon Horman wrote:
> > On Fri, Feb 23, 2024 at 12:01:37PM +0100, Julien Panis wrote:
> > > This patch adds XDP (eXpress Data Path) support to TI AM65 CPSW
> > > Ethernet driver. The following features are implemented:
> > > - NETDEV_XDP_ACT_BASIC (XDP_PASS, XDP_TX, XDP_DROP, XDP_ABORTED)
> > > - NETDEV_XDP_ACT_REDIRECT (XDP_REDIRECT)
> > > - NETDEV_XDP_ACT_NDO_XMIT (ndo_xdp_xmit callback)
> > > 
> > > Signed-off-by: Julien Panis <jpanis@...libre.com>
> > ...
> > 
> > > @@ -440,6 +476,27 @@ static void am65_cpsw_nuss_tx_cleanup(void *data, dma_addr_t desc_dma)
> > >   	dev_kfree_skb_any(skb);
> > >   }
> > > +static struct sk_buff *am65_cpsw_alloc_skb(struct net_device *ndev, unsigned int len)
> > > +{
> > > +	struct page *page;
> > > +	struct sk_buff *skb;
> > nit: please arrange local variables in reverse xmas tree order,
> >       from longest line to shortest in new code.
> > 
> >       This tool can be useful: https://github.com/ecree-solarflare/xmastree
> 
> You mean, for the new functions introduced in this patch only ?

It's a bit loose. But generally the idea would be to move towards this
practice. So for new functions: yes. And when modifying old ones old ones:
if possible.

> > > +
> > > +	page = dev_alloc_pages(0);
> > nit: Maybe dev_alloc_page() is appropriate here?
> 
> Absolutely.
> 
> > 
> > > +	if (unlikely(!page))
> > > +		return NULL;
> > > +
> > > +	len += AM65_CPSW_HEADROOM;
> > > +
> > > +	skb = build_skb(page_address(page), len);
> > > +	if (unlikely(!skb))
> > Does page need to be freed here?
> 
> Of course it does ! This will be fixed in the next version.

Thanks!

> 
> > 
> > > +		return NULL;
> > > +
> > > +	skb_reserve(skb, AM65_CPSW_HEADROOM + NET_IP_ALIGN);
> > > +	skb->dev = ndev;
> > > +
> > > +	return skb;
> > > +}
> > ...
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ