[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZM1mtcIBUzL5kwll@vergenet.net>
Date: Fri, 4 Aug 2023 22:59:33 +0200
From: Simon Horman <horms@...nel.org>
To: "huangjie.albert" <huangjie.albert@...edance.com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
Björn Töpel <bjorn@...nel.org>,
Magnus Karlsson <magnus.karlsson@...el.com>,
Maciej Fijalkowski <maciej.fijalkowski@...el.com>,
Jonathan Lemon <jonathan.lemon@...il.com>,
Pavel Begunkov <asml.silence@...il.com>,
Kees Cook <keescook@...omium.org>,
Menglong Dong <imagedong@...cent.com>,
Richard Gobert <richardbgobert@...il.com>,
Yunsheng Lin <linyunsheng@...wei.com>,
"open list:NETWORKING DRIVERS" <netdev@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>,
"open list:XDP (eXpress Data Path)" <bpf@...r.kernel.org>
Subject: Re: [RFC Optimizing veth xsk performance 05/10] veth: use send queue
tx napi to xmit xsk tx desc
On Thu, Aug 03, 2023 at 10:04:31PM +0800, huangjie.albert wrote:
Please include a patch description.
> Signed-off-by: huangjie.albert <huangjie.albert@...edance.com>
Please consider formatting this as:
... Albert Huang <huangjie.albert@...edance.com>
> ---
> drivers/net/veth.c | 265 ++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 264 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
> index 63c3ebe4c5d0..944761807ca4 100644
> --- a/drivers/net/veth.c
> +++ b/drivers/net/veth.c
> @@ -27,6 +27,8 @@
> #include <linux/bpf_trace.h>
> #include <linux/net_tstamp.h>
> #include <net/page_pool.h>
> +#include <net/xdp_sock_drv.h>
> +#include <net/xdp.h>
>
> #define DRV_NAME "veth"
> #define DRV_VERSION "1.0"
> @@ -1061,6 +1063,176 @@ static int veth_poll(struct napi_struct *napi, int budget)
> return done;
> }
>
> +static int veth_xsk_tx_xmit(struct veth_sq *sq, struct xsk_buff_pool *xsk_pool, int budget)
> +{
> + struct veth_priv *priv, *peer_priv;
> + struct net_device *dev, *peer_dev;
> + struct veth_rq *peer_rq;
> + struct veth_stats peer_stats = {};
> + struct veth_stats stats = {};
> + struct veth_xdp_tx_bq bq;
> + struct xdp_desc desc;
> + void *xdpf;
> + int done = 0;
Please try to use reverse xmas tree ordering - longest line to shortest -
for local variable declarations in new Networking code.
https://github.com/ecree-solarflare/xmastree is your friend here.
> +
> + bq.count = 0;
> + dev = sq->dev;
> + priv = netdev_priv(dev);
> + peer_dev = priv->peer;
Sparse seems a bit unhappy about this.
.../veth.c:1081:18: warning: incorrect type in assignment (different address spaces)
.../veth.c:1081:18: expected struct net_device *peer_dev
.../veth.c:1081:18: got struct net_device [noderef] __rcu *peer
Looking over existing code in this file, perhaps this is appropriate:
peer_dev = rtnl_dereference(priv->peer);
Likewise in a few other places in this patch.
...
Powered by blists - more mailing lists