Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp2308363rwo; Thu, 3 Aug 2023 07:41:17 -0700 (PDT) X-Google-Smtp-Source: APBJJlGEnMZVnqJO2qyldzdo0HXzYIVKXYZppJVAzqv7iCfkrAa0XD82YWuooC/v59dEciZ6RzCm X-Received: by 2002:a17:906:30d5:b0:99b:c689:3f3d with SMTP id b21-20020a17090630d500b0099bc6893f3dmr7511109ejb.25.1691073676618; Thu, 03 Aug 2023 07:41:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691073676; cv=none; d=google.com; s=arc-20160816; b=rNoUXjqpUr1Xz+S2CAUkKfvC9PrQtwMG7wMGuElySajYhlCa1tzWE5j1tDPxbKtAjJ WP1wDao7s6NbYmBRaOdaehIAsP++NNw/4OClnDKQmxVIPkxtGFNF8QwfIOuK08Oy6O9v 1NbxA+NHPAiDHphTheiykj8hV4NPbq2NJNGJjGH7jgWlOjdNiOPUL4sivCt0HlvR72ho mwYgENVyRwUTEbnkRU5egViYina0tBVPkEnoIQXG5JuDPh1VCrgAVmdhhaws5nFU87CG 2mSfZ8/8n8HuchzrwwIuXdwSqd19iJO15QH5oOE+iY36gf+NMlkxWLWNVWqnpaKK6AMz ZBrg== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b12-20020a170906038c00b00991dfb5dfb7si9598948eja.573.2023.08.03.07.40.52; Thu, 03 Aug 2023 07:41:16 -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 S235888AbjHCOHG (ORCPT + 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 ); 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 ; Thu, 3 Aug 2023 07:05:31 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1bb775625e2so7268545ad.1 for ; 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" To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: "huangjie.albert" , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , Pavel Begunkov , Menglong Dong , Yunsheng Lin , Richard Gobert , 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: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/net/veth.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 */ -- 2.20.1