[RFC,Optimizing,veth,xsk,performance,01/10] veth: Implement ethtool's get_ringparam() callback
Message ID | 20230803140441.53596-2-huangjie.albert@bytedance.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp1243801vqx; Thu, 3 Aug 2023 08:59:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlEYjwBaH7CYjOxB2Wo4MTA3/dfq49NPMUQFdyAGp7HO1qL1D7/HLLmMPsvo3uJGau4ALo2r X-Received: by 2002:a17:90b:1e43:b0:268:e30e:e92f with SMTP id pi3-20020a17090b1e4300b00268e30ee92fmr12437631pjb.18.1691078370836; Thu, 03 Aug 2023 08:59:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691078370; cv=none; d=google.com; s=arc-20160816; b=i5pAn1psWAgVpOefKiOB2B2t+dWnw0+Cln+Ow21KC8WZPUHg4fJE9K7MtH558VsXMw DubrYBS8arDOS+H6w0S29DFJXvajRhs5rg/Xora6AZC5Te6EmMY+7+t7l5FX7snI6Unt cKF1c+/LExd3Z9ezFnzW3fON37vJRPQRoCeWiBfGNP6DY5IlgKx8JtYIGRefqQ8YGTuf ri9cp+TbgSRtb5yTwsb94xnyprBcs9VbIcYC3+/uts3a2/SQwWC6dKGL9wM8za+8WmsW 7zoyyncxUZNiHT0NXzUKMX2vVxcBAlqHTbW10ONQf7+Mk8wuZw1k1+eXGJeqcAYFEzE4 mA6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7lti4noGvWp81QMD78qgE1vMb8ru0CmeNy8GFo0ds5M=; fh=AUa4WPgyk+2UDLoa4XXEC4v1iQCfVrxHGKq4C2BjbIc=; b=0hEYUjhjzqOS8kFlakFfRRem9Qys1WcOsufpuBVEJFHvfiiZp/d3tAPzFDXJot3+jl BQG/ijDgKxrr7gtUF6t6ItwbCtd6aH521INc41AjNHgqR/kcCWhTOoLNvWZt2QZuBVB4 y1IK36zc/CrZRaiBl5hq5mK6h7TjyLJu6jVHviNw5NAm+j61HMHyvGF8+ofmxM3aesxi R8KfCboVO1GpXvIUvbIq3/+Skv3W1Oqcupcfk2TLYyO5b+3znYED5iq8n7XT6k+6AG8A c/zE/a2GxsD83Y5S/GvDWa10hsmoNq8hyQ9RWl+7+yh3mJ76yo2aY4u08DFGCcxFT+Gm oTwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b="ARPb/1sW"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lj7-20020a17090b344700b0026826148914si183763pjb.32.2023.08.03.08.59.16; Thu, 03 Aug 2023 08:59:30 -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=@bytedance.com header.s=google header.b="ARPb/1sW"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236324AbjHCOHG (ORCPT <rfc822;guoshuai5156@gmail.com> + 99 others); Thu, 3 Aug 2023 10:07:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235799AbjHCOGs (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 3 Aug 2023 10:06:48 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E0963C25 for <linux-kernel@vger.kernel.org>; Thu, 3 Aug 2023 07:05:31 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1bb775625e2so7268545ad.1 for <linux-kernel@vger.kernel.org>; Thu, 03 Aug 2023 07:05:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1691071521; x=1691676321; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7lti4noGvWp81QMD78qgE1vMb8ru0CmeNy8GFo0ds5M=; b=ARPb/1sWh5T9p5GWjB03DuP/6QZsEazyqs/OXDGx5lkxhGk5XSHzLq7ODIElIYrFOb w6NmJppncUr5m/HHnhC+ubn3OXKSO93n7CunQ91Kqvw7Tf48agwl/sfkzVFunkSBsUwL JDSPtcxynczQTY4LUWfzEj8vza7wxX8VrrPUBZDCl9dsKp1h0oShS+rTDk01lxfzOOiw y6/9vPodJQo4JciEVHY9A/tNsegQ1GZOZrbkayOHoEORYyBxV7vd9Endd5Bcsumt2EBl c0qPe6AsKe7fZ1nTpg/XssSjVOlfsWqyaGzoMubvQPNbG7/icyQChTqyeTV/5C8talsZ Co2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691071521; x=1691676321; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7lti4noGvWp81QMD78qgE1vMb8ru0CmeNy8GFo0ds5M=; b=LVUvMh/N1OyEo325jm2XgPtHi+obj91DFiPu8vN5zzxHQ1IBSkTXRd7CiHOuq/k0OX fs2E900aZ4qx7YaC4SmHhlmIRQn2VWGQSMnZWadvPJxI2Qin7mlhRT+ix9RaaYdqo4A5 IKwq+ZizWZc+tro9nC+OW0PnVCwKXg2ZKT11EU5r5bshSWVXS4a0uhiLRh85AfW00Whi Qkw7uatliGRfs/aXP29bxJMt13G5IP8mtzVveePgXm4j5kdZWGeKecG9IGArv5xFSWkQ vnmhIXtMTKzHnq0vyMmEvYt2iBd+oM3ipc1MCOoEvwTG//1Pd+RoZwgGNOi2/0JW5+6k 4cvw== X-Gm-Message-State: ABy/qLagPxku/X5JVCHhfo2/Ls0ePYcDrBuzXxjyjelE29NBxwzdY3gr RWE5rp4txnATuaLmQTQx9nZx1A== X-Received: by 2002:a17:902:6943:b0:1b8:6984:f5e5 with SMTP id k3-20020a170902694300b001b86984f5e5mr18474453plt.12.1691071521455; Thu, 03 Aug 2023 07:05:21 -0700 (PDT) Received: from C02FG34NMD6R.bytedance.net ([2001:c10:ff04:0:1000::8]) by smtp.gmail.com with ESMTPSA id ji11-20020a170903324b00b001b8a897cd26sm14367485plb.195.2023.08.03.07.05.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 07:05:20 -0700 (PDT) From: "huangjie.albert" <huangjie.albert@bytedance.com> To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: "huangjie.albert" <huangjie.albert@bytedance.com>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Jesper Dangaard Brouer <hawk@kernel.org>, John Fastabend <john.fastabend@gmail.com>, =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= <bjorn@kernel.org>, Magnus Karlsson <magnus.karlsson@intel.com>, Maciej Fijalkowski <maciej.fijalkowski@intel.com>, Jonathan Lemon <jonathan.lemon@gmail.com>, Pavel Begunkov <asml.silence@gmail.com>, Menglong Dong <imagedong@tencent.com>, Yunsheng Lin <linyunsheng@huawei.com>, Richard Gobert <richardbgobert@gmail.com>, netdev@vger.kernel.org (open list:NETWORKING DRIVERS), linux-kernel@vger.kernel.org (open list), bpf@vger.kernel.org (open list:XDP (eXpress Data Path)) Subject: [RFC Optimizing veth xsk performance 01/10] veth: Implement ethtool's get_ringparam() callback Date: Thu, 3 Aug 2023 22:04:27 +0800 Message-Id: <20230803140441.53596-2-huangjie.albert@bytedance.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: <20230803140441.53596-1-huangjie.albert@bytedance.com> References: <20230803140441.53596-1-huangjie.albert@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773224194149712539 X-GMAIL-MSGID: 1773224194149712539 |
Series |
|
|
Commit Message
黄杰
Aug. 3, 2023, 2:04 p.m. UTC
some xsk libary calls get_ringparam() API to get the queue length
to init the xsk umem.
Implement that in veth so those scenarios can work properly.
Signed-off-by: huangjie.albert <huangjie.albert@bytedance.com>
---
drivers/net/veth.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
Comments
On Thu, Aug 03, 2023 at 10:04:27PM +0800, huangjie.albert wrote:
> some xsk libary calls get_ringparam() API to get the queue length
nit: libary -> library
Please consider using checkpatch.pl --codespell
diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 614f3e3efab0..c2b431a7a017 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -255,6 +255,17 @@ static void veth_get_channels(struct net_device *dev, static int veth_set_channels(struct net_device *dev, struct ethtool_channels *ch); +static void veth_get_ringparam(struct net_device *dev, + struct ethtool_ringparam *ring, + struct kernel_ethtool_ringparam *kernel_ring, + struct netlink_ext_ack *extack) +{ + ring->rx_max_pending = VETH_RING_SIZE; + ring->tx_max_pending = VETH_RING_SIZE; + ring->rx_pending = VETH_RING_SIZE; + ring->tx_pending = VETH_RING_SIZE; +} + static const struct ethtool_ops veth_ethtool_ops = { .get_drvinfo = veth_get_drvinfo, .get_link = ethtool_op_get_link, @@ -265,6 +276,7 @@ static const struct ethtool_ops veth_ethtool_ops = { .get_ts_info = ethtool_op_get_ts_info, .get_channels = veth_get_channels, .set_channels = veth_set_channels, + .get_ringparam = veth_get_ringparam, }; /* general routines */