Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4447590rwb; Tue, 8 Aug 2023 08:38:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGXVQWwddMhHaid0uCwrDIgxoi+DAe7bBvFJ8UP7tbjITh1cbCudicQUcPcDJew0gQrkOAG X-Received: by 2002:a05:6a00:1d05:b0:657:1fe5:eb63 with SMTP id a5-20020a056a001d0500b006571fe5eb63mr10071377pfx.7.1691509130089; Tue, 08 Aug 2023 08:38:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691509130; cv=none; d=google.com; s=arc-20160816; b=ZGBhjA/LJoLfca8L7dGFBT0q2b+ymg6s5dL+FrRiyltLaI4/VgVVZScxvO9ZK+W1VE qQNoz9wbXr6apMHwWOzuym8J3W3pmWOTAwnLbK8cWsLQVSjJMpW/Qp4S3eREFrOLN9xc uoftz78Vp2JrwJEVsGYuybxEw5x373oPUpIkqega0ZEGVQNiOvYmPXbAjyvc0PfAgihr X9UpqAhUBr5P17phqUGHRaWkIXMuSaxAAbMxkhwoh+E2GRjW6jnvgYoNzkHEkYAid6f5 GMzGgw8mTCfOdp29s4AjtI4Ukl/TiJWI+zbNEUH12zA/GzHLn4rSPN6DiuinevE5+02B 2GBg== 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=uLQYdihKrZnqzA8pyJFR0KmRfev22Y9Nk5IK1CsNWSQ=; fh=d52JIWYEkePcj18BLr16Py79ZIzTYL7SzTuYhl8wvHo=; b=cDMvVDuymnNCwhGVfvtp73o5f0b2XV0rbbw2DR1lgpxge93ehnnr+lYdCUy38NqT0L l14RiQxnIIErrUbPwaq9UR4xaMC5mkscfFJ7CsaMRhAQYYcz+LoGvwlsEQIorSl5aG+Y fRy5lH+gUHFVZZMZ6aWrNxuIHGJU6eOUeoXcVPS5pbJq69XuKVFR3fkIgAD8boWLxAqA mP95sHScvC3Y5XOkKbzZxBBiC45LoeTM4b60omKk1WMFYd0cWVoMQGhGD6TjGo1+8auE 2iezCHRtzEzvFv0HyO9Xpy8DxNP9yA0WxBqlkl7T24iw9ON6IEavLM4KcHSXUw5kYTmT idFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=Kl4mmZ6w; 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 l184-20020a6388c1000000b0056418c08652si7348880pgd.811.2023.08.08.08.38.36; Tue, 08 Aug 2023 08:38:50 -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=Kl4mmZ6w; 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 S231146AbjHHDVA (ORCPT + 99 others); Mon, 7 Aug 2023 23:21:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbjHHDU4 (ORCPT ); Mon, 7 Aug 2023 23:20:56 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A405310F0 for ; Mon, 7 Aug 2023 20:20:28 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1bba54f7eefso40768345ad.1 for ; Mon, 07 Aug 2023 20:20:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1691464828; x=1692069628; 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=uLQYdihKrZnqzA8pyJFR0KmRfev22Y9Nk5IK1CsNWSQ=; b=Kl4mmZ6wC30QI0KYvWfqwsTsY4ihiWC63YfNOwTtHsCTiPRlVcI029sp+MJOROKfoo 2ZSjwgqwyuqMHwmhreAo6j9KGFeqiP4JTgT+5eIfWSoSekMcFAsja8NYdATAxJRAzZha LgHGf3BWqBvWvn5Ibdk2tZLiEfEVgU7EokhG1/IOeN7a4Al8TjQt7K1s0XC5mN196l4D ObsT7B1ydnVq2hD/R+PJ3GIdyMv70DAsQoTfRJJk0ZiyITCwrdg2BpYb2NUERKzwD37q 7WVSfkeOaG8pIqpShLoRNDtTBASpWi86pCdSd4Sb5itRrV6POLS4x2CKUFvjHQ28tKtd jk2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691464828; x=1692069628; 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=uLQYdihKrZnqzA8pyJFR0KmRfev22Y9Nk5IK1CsNWSQ=; b=fc1qJZKqx8Era/X7nlTfEb0JCHScaCLd6yjIIWiYB0C1LzCutcR+qf0O8rC62l7wSP nu9XFrUNm3Tnwn11KTRXjzh/jBo1ACkDbEJ9vbwf2vO98n75b7fQvSEDIw/YlEi4zxzA /SK3SPt0XPsng7CJ8s2LCkpKlzrnKFTeNZA1YSOycpb7Qjj90g6qlQlsalqfQb88dT2P IApRvEedZh0tEvoOA3ul1oHas9YL2h54vYmBozuuUGDwalgHmW3Wd/SgwurAvUs0vm6g TOoVQGn/Y0Bb2mJNGggtBxnQE8dBDqcKr5G97S/pkKEH5FfWhfscInQGzEHmGSCmU5oz 5hUQ== X-Gm-Message-State: AOJu0YwuUb3FsS7kih4CIfjoQrrJkzETNehPLGLiPRsrlIgEQt8wU2Zk r43tgmZU+XEtJJ45XeDveVXfKw== X-Received: by 2002:a17:902:d4c8:b0:1bc:1e17:6d70 with SMTP id o8-20020a170902d4c800b001bc1e176d70mr11761596plg.24.1691464827688; Mon, 07 Aug 2023 20:20:27 -0700 (PDT) Received: from C02FG34NMD6R.bytedance.net ([2408:8656:30f8:e020::b]) by smtp.gmail.com with ESMTPSA id 13-20020a170902c10d00b001b896686c78sm7675800pli.66.2023.08.07.20.20.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 20:20:27 -0700 (PDT) From: Albert Huang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: Albert Huang , 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 , Yunsheng Lin , Kees Cook , Richard Gobert , "open list:NETWORKING DRIVERS" , open list , "open list:XDP (eXpress Data Path)" Subject: [RFC v3 Optimizing veth xsk performance 1/9] veth: Implement ethtool's get_ringparam() callback Date: Tue, 8 Aug 2023 11:19:05 +0800 Message-Id: <20230808031913.46965-2-huangjie.albert@bytedance.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: <20230808031913.46965-1-huangjie.albert@bytedance.com> References: <20230808031913.46965-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_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 some xsk library 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: Albert Huang --- drivers/net/veth.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 614f3e3efab0..77e12d52ca2b 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