Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp508923iog; Fri, 24 Jun 2022 08:16:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s6Ac9Xs+h0RsXCNSQdSIa7SEAEm/otxf6z/JlfsNFUZ3H8jjAWV12+7XJ+SsvTN1sJ48ml X-Received: by 2002:a05:6402:43c5:b0:435:89ee:578f with SMTP id p5-20020a05640243c500b0043589ee578fmr18040809edc.225.1656083784980; Fri, 24 Jun 2022 08:16:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656083784; cv=none; d=google.com; s=arc-20160816; b=jXAEnfFY/Vf0V9F2RR3EWk1ohd1Nz52HI1ks4A1fXmeYU+2Gzd4MnUUTw3heKtaml+ SOP74gWf1RRpcW5/HMV7SjWJKtvyG3ljUhp9pTuRgxVx7wnx+yNlE4iLIdEWi0m5tEyt QSWYexktcp0BO4zfIOFsXhPSPZp3nQdufer1nkoO7Eg3qh6tdJWcpRyqbyZnlln4YUZz 8sdC2pk+6hjv6XMsfrL6gnDmgSGDFy0zuNvnA6Gp2NCb/f8zTiV9BBKYe6fy0nAzEM8w yBb8NxBEfrFbOpFiO01bs42hu02misVDvkQ/t+MDIgIOelP8XAYxuMY5mMualxCtVDqU nQmQ== 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=VmwCQ1JvvyQyPc8uS6VvyDQhWe60wu5gxmRmnY3hew8=; b=rjqhReIschcWAfUs8eTQPEF32XCJ8yeKenInhbJTYpvYupKcfMxAU+eUjGcAU01vxM aUr4rYKASGBEkoVcCGOznGq1Nf9178WiKHKgwMEIdEDCfOWn9/119ASqgTf73wFiwwdm YpVP7c5tcEyrrBRtdEyUdCukxP1oec4nclQ3MXjWdJBcn21hb4HUP8r/XY/vYj4Ut1za 08UOOFL6HxLyk9aLG3yiRrWpgERGUBvCY+VlpR26h63fc9ktcVPBoJ/ugLY+rMOBrHND ZvpaMPAm3Wq8Tzt+pVUDIEw1pboKfglvR5SB7WUoP4aYgHQF9sLVOHOXYheX19ZDv+b7 x+KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=G4vBlLsB; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h19-20020a05640250d300b0042e0cfdab0fsi4359969edb.6.2022.06.24.08.15.58; Fri, 24 Jun 2022 08:16:24 -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=@bootlin.com header.s=gm1 header.b=G4vBlLsB; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233167AbiFXOlo (ORCPT + 99 others); Fri, 24 Jun 2022 10:41:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231916AbiFXOlf (ORCPT ); Fri, 24 Jun 2022 10:41:35 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 132DE67E42; Fri, 24 Jun 2022 07:41:32 -0700 (PDT) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 0B28AE0005; Fri, 24 Jun 2022 14:41:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1656081691; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VmwCQ1JvvyQyPc8uS6VvyDQhWe60wu5gxmRmnY3hew8=; b=G4vBlLsB8PxLCnUQ4EnLV0uLy0Fv1CeI6z39cKNfCMj2D0+8/qL9Zr5PJ2r1l0JQvUhPTB GlzR6J7xGzyw8BhNUh1GVYn62PS7B33mgioAzbCjrB8rXTPPjgCYJWfoYRFU4d25EYmHY/ 78WfCopaqMeYIBLbXsHbxX8JgPS7C5z9EulAWHlUMhOzlCA1GHrhxJ5FsHE3V8PNZcXe8X pXoz7f7FkJcFPPHD9EMtv8W3kM73fTGuFlOR+hAzJA2RNIAOvBFOF7M/BthyNuOpxCIF/6 NbYq+BvNnQLsF486cp9xfl1kNq0tahWPSrUZMHjLoweR0lAw+ae6uSOIHKGb3A== From: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Geert Uytterhoeven , Magnus Damm , Heiner Kallweit , Russell King , Alexandre Torgue , Giuseppe Cavallaro , Jose Abreu Cc: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Thomas Petazzoni , Herve Codina , =?UTF-8?q?Miqu=C3=A8l=20Raynal?= , Milan Stevanovic , Jimmy Lalande , Pascal Eberhard , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH net-next v9 02/16] net: dsa: add support for ethtool get_rmon_stats() Date: Fri, 24 Jun 2022 16:39:47 +0200 Message-Id: <20220624144001.95518-3-clement.leger@bootlin.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220624144001.95518-1-clement.leger@bootlin.com> References: <20220624144001.95518-1-clement.leger@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Add support to allow dsa drivers to specify the .get_rmon_stats() operation. Signed-off-by: Clément Léger Reviewed-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- include/net/dsa.h | 3 +++ net/dsa/slave.c | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/net/dsa.h b/include/net/dsa.h index 14f07275852b..64da5ed27fdc 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -888,6 +888,9 @@ struct dsa_switch_ops { struct ethtool_eth_mac_stats *mac_stats); void (*get_eth_ctrl_stats)(struct dsa_switch *ds, int port, struct ethtool_eth_ctrl_stats *ctrl_stats); + void (*get_rmon_stats)(struct dsa_switch *ds, int port, + struct ethtool_rmon_stats *rmon_stats, + const struct ethtool_rmon_hist_range **ranges); void (*get_stats64)(struct dsa_switch *ds, int port, struct rtnl_link_stats64 *s); void (*self_test)(struct dsa_switch *ds, int port, diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 509b98dd9954..760ca58307a3 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1002,6 +1002,18 @@ dsa_slave_get_eth_ctrl_stats(struct net_device *dev, ds->ops->get_eth_ctrl_stats(ds, dp->index, ctrl_stats); } +static void +dsa_slave_get_rmon_stats(struct net_device *dev, + struct ethtool_rmon_stats *rmon_stats, + const struct ethtool_rmon_hist_range **ranges) +{ + struct dsa_port *dp = dsa_slave_to_port(dev); + struct dsa_switch *ds = dp->ds; + + if (ds->ops->get_rmon_stats) + ds->ops->get_rmon_stats(ds, dp->index, rmon_stats, ranges); +} + static void dsa_slave_net_selftest(struct net_device *ndev, struct ethtool_test *etest, u64 *buf) { @@ -2081,6 +2093,7 @@ static const struct ethtool_ops dsa_slave_ethtool_ops = { .get_eth_phy_stats = dsa_slave_get_eth_phy_stats, .get_eth_mac_stats = dsa_slave_get_eth_mac_stats, .get_eth_ctrl_stats = dsa_slave_get_eth_ctrl_stats, + .get_rmon_stats = dsa_slave_get_rmon_stats, .set_wol = dsa_slave_set_wol, .get_wol = dsa_slave_get_wol, .set_eee = dsa_slave_set_eee, -- 2.36.1