Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp1275597iol; Fri, 10 Jun 2022 04:16:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJCrOWczWDShA36uTUVqc1lv0RogeFgjBoDtHt/ZEbhxOio/XUQmLhFGUVdzRZuO1e9OrY X-Received: by 2002:a17:906:2558:b0:706:ce01:ffd8 with SMTP id j24-20020a170906255800b00706ce01ffd8mr39815661ejb.682.1654859759881; Fri, 10 Jun 2022 04:15:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654859759; cv=none; d=google.com; s=arc-20160816; b=kNWhCY2wXwAmh34fyQ0lKr+tlrd9sGoWS+X4c3SZtLaWcqLKh98hJwtG25QKpUqklX tdWiEFkdROZn5x42xDkOvkg/mu0AzWZRKcLz0aN4ynrY04/2+g9W84qtXD1rorY4Lvmb U0vIwAjVvA95hc1t11bOGrUQsfwuzju4L6jmlydUmXaZ1+ABOOizrfXGotzBSvP+nG89 BXOdIokEIbbrkAvwdWZtxk/xfzq0nIcy6wssnXVB+NvPA4p2yvGKp1JQYr0qLcgXz0z+ 1ps5RgJRgz+F3aPUqyDmGq8OQUN87MAV/9K7FojMCGIn0e1GLS4N3+SjPk3FiJ/GtN2g AXLQ== 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=l7M6YYYjryQ7JCfpfmE+2pUdIi7j1rh5qvxd5Huh4wQ=; b=nUFLA2q3BE9wgqXSrKMEICX8nGU5FRr0R4frgFeLOlQFtEi/RTZzSmUattS+YtL9PG sP7jwcJSBN4E1iMYa6ccLojeW72H/CvrDJPb6KRF9RExsLlbDM3mD5raINe9BqfgrL5n 49nBZb21gfX9ccUpLtCE7t4hGLV/0XnqERlbGABUKP2i/dldsOaFG5GBBuLmgmN5ZEdU x3md7u2dUhMlHr55xL1b6KWQgEf//idCBONvlLubKsfbrRJ6UR/l20nRHdjjmVhZsoVd LBaDoLgbrJL1EC9fLvw5T9CXK3TpafXjFQDRV/v5A9tJ1+sii76zxb5kk20khaKNp3aI MGQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="hu/igHA3"; 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 f15-20020a056402354f00b0042b42c7f655si8047961edd.33.2022.06.10.04.15.34; Fri, 10 Jun 2022 04:15:59 -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="hu/igHA3"; 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 S1347510AbiFJKn5 (ORCPT + 99 others); Fri, 10 Jun 2022 06:43:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347046AbiFJKnT (ORCPT ); Fri, 10 Jun 2022 06:43:19 -0400 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::221]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDEEA229B70; Fri, 10 Jun 2022 03:39:01 -0700 (PDT) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 0AD5B240005; Fri, 10 Jun 2022 10:38:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1654857540; 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=l7M6YYYjryQ7JCfpfmE+2pUdIi7j1rh5qvxd5Huh4wQ=; b=hu/igHA3PX8+Nh2Ct2FPqMXZ034Hs0J2UJ20I+MIBp9FElnKVIzPrvAgrhA9csDeLusN4k SJPqYP4lF9YhSp3w0dthgjHfCBBZKEzgjtcxPw8gZ6YoyLv91FksK0xqQNO95e01zGmIBD aQWExPx4Czjmq91TnqZzYVT98fCKnyOblLgj77Mth066SGIrGF6f2tI6zPAHYPD/s+lJda zFIjNzW1TuWpeRqrs80inBqKmLQa8TPJBaDKzjK5an39WHaJp+4O2+7UwuQIA6T95heVTo JhKNM7ABZL9DsUcw4An4torXx5ZIFs5OCXNimtbk0q8DUapfUHMmLrRJP4mrSQ== 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 RESEND net-next v7 02/16] net: dsa: add support for ethtool get_rmon_stats() Date: Fri, 10 Jun 2022 12:36:58 +0200 Message-Id: <20220610103712.550644-3-clement.leger@bootlin.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220610103712.550644-1-clement.leger@bootlin.com> References: <20220610103712.550644-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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,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 Add support to allow dsa drivers to specify the .get_rmon_stats() operation. Reviewed-by: Vladimir Oltean Reviewed-by: Florian Fainelli Signed-off-by: Clément Léger --- 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