Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp368565rwb; Fri, 4 Aug 2023 14:13:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF+FN+sKxtq5Y3okYiTSTJ/MPfgKIRJ/s+t/nNngv8DOt3opPWDXsr5m2j3uMee+I4Ybq1Z X-Received: by 2002:a05:6a20:502:b0:137:3803:33c with SMTP id 2-20020a056a20050200b001373803033cmr2320210pzp.54.1691183600976; Fri, 04 Aug 2023 14:13:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691183600; cv=none; d=google.com; s=arc-20160816; b=PgzFsDIhrwLLamnMj2uRr9FbCZMTYTNJ78lCv9b9pmtzhD9pzMpbPhkkoX4v9TZ8mc lCiqMFb4ZrygAro675qd7XBIm+3bAxmi1ih8YklKQSiSYzhrBSJCV5djHlYyIL4/dJHd bFIIWXYJnasDAkbaLraWLTRFJBuL5cUtDVimwWI5tMvVKEd4JhSie7HeYv0e0Rwh/zUs PTx+1HWThc8dtdWFUj93JkVH277RxIykn6U5Y4HncKvUMg8jxLre7gZ0qK8fc7In2/6X ItivdatN31mEW/5xXeTs44Knm9JohLXMW0w8DBA9UeR637Ep9H3YxJtRMRzBvJeKF+SC hKTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3/OMFvIZ/g8wjoxE/SQenV7Y67mWCs1lRv/mhsDPMDc=; fh=hWRWN/JB17zMCeqwWMLhUEDVTI/6/Ztdb1G/I3dzpCo=; b=HMsfTu6bsoHjRAOYgTyHAihKoRpkEjeJTxgN6O+RHmZMjD14asRrOsbEnY4zQ/C78w M7S5TGT1UL0is6yf3q6lV89/aDatAluDE3pV7Rq0j5/zahzVM2EM3NEkQPJYAzAO8WPg YmJ/6PZ6whLhgwHcXH+log8/I26+5z/HltnOrQvPMz/q+2FluxvZn/1W0oQIj4d3AggN Rwj4vVYw6Oek6Zp4VMTfchk/4uUA4eWY4eA9QJ4ulf8nuCfYHxMs5x09dV73vuBJXvWJ hcRVft34bHtbFmaaY5t5ob0xRMqCEI1VvcQOxMumB444yxTtk0LWb2uDL0TzjzoK3zsT aXSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TLfT6PIF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g185-20020a636bc2000000b00547a1922957si2195107pgc.407.2023.08.04.14.13.08; Fri, 04 Aug 2023 14:13:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TLfT6PIF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229906AbjHDU7n (ORCPT + 99 others); Fri, 4 Aug 2023 16:59:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229644AbjHDU7l (ORCPT ); Fri, 4 Aug 2023 16:59:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CC55E46 for ; Fri, 4 Aug 2023 13:59:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0EF2D620A7 for ; Fri, 4 Aug 2023 20:59:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC36AC433C7; Fri, 4 Aug 2023 20:59:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691182779; bh=xl9ztlWBE79b1gyAU0i58q8O4xnhwyApAJm9B8ORFps=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TLfT6PIF0sqgoaK3n/922Fa8/0gbGRWzzj/dTE1NEb80e9p+UDpiPw2Etmo+/399F gj9QhBEPBBkXT5rVG+n+aVfTO5n5cQEgDp7vKsiCOQTWE2G5mVWENI7oF+HvuRKhei n63JWg+aVkNjc7zs5ZpdAdJQ+twt7S4EIrIeLo9FxqBCcy0LQOCJGF4vI5ht4ChVQ3 EoPnAjDeuBIREbrezDZJYMGXa0DGk2DyGSOqh6Q7/MA5Te6zGXxa3yLrPxTPK1O0j8 HKREwC78Jxros3kkvSp3NchfTEtcKZI2/aVErOMd8Ta0xAk/6R1ljGKOrvZV5cWP9/ wcuhxNsK5XIow== Date: Fri, 4 Aug 2023 22:59:33 +0200 From: Simon Horman To: "huangjie.albert" Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , Pavel Begunkov , Kees Cook , Menglong Dong , Richard Gobert , Yunsheng Lin , "open list:NETWORKING DRIVERS" , open list , "open list:XDP (eXpress Data Path)" Subject: Re: [RFC Optimizing veth xsk performance 05/10] veth: use send queue tx napi to xmit xsk tx desc Message-ID: References: <20230803140441.53596-1-huangjie.albert@bytedance.com> <20230803140441.53596-6-huangjie.albert@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230803140441.53596-6-huangjie.albert@bytedance.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 03, 2023 at 10:04:31PM +0800, huangjie.albert wrote: Please include a patch description. > Signed-off-by: huangjie.albert Please consider formatting this as: ... Albert Huang > --- > 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 > #include > #include > +#include > +#include > > #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. ...