Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4995167iob; Mon, 9 May 2022 06:32:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOTHv9xhHv3p3/tPur2+8d5xBFP/HWWVhUMvRsAWkGmAdYh7rTcV/ug6Z52WChcvRjxzEG X-Received: by 2002:aa7:888c:0:b0:505:7832:98fc with SMTP id z12-20020aa7888c000000b00505783298fcmr15687444pfe.0.1652103174793; Mon, 09 May 2022 06:32:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652103174; cv=none; d=google.com; s=arc-20160816; b=bUG6cChg8lRtPgpiWurdj1dh1F0EC64vlpYK57TxUnKqo3hFgN/LX5s3RnkupFI/dO Vg81G8DIYmyuDrF4vYidXTdzF0TXSmWyQM2eNIWVbfd5usecvsEmk6ykrGweHAebYT3d q7PAKRnH6344mXOfsoi6El3SE/LF4SoZNwtZXfSrH3RpQbMI3sEdPS+GSVeY7G0mYFR0 8BMPIX5m5i/fWI7EzEd4hJFOCWDNBdEsdR1tEIai1/xlun9TMFz6TM3/OG4ejm9bfp6s WLRIRKFwb3A9vB32b5ysRVimf/CROgtHAxxsHbGmXja/cdaJB4SACUHODNJK0JmdH23I 9IUw== 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=RrjjbfswMcRGhPL51giZHhSaKlAAFTHbR8pSOyaaywI=; b=eNQesGVYWzo73600ZY51tlkdeSrjPDEVJkXDSvP3vOkrM7vB8tKSLU85SasQB6ZeQy WNzW8Amqj8qUJ1vFLfYCJY8dfQJVswKHFyObOlgnbhFSMRFIRXm6TLWH2jOs2qDWp4vp W14yQ61zhGvdzwx2FMAzDJIB8Uo4rYVIueqL7ZA3qvMyKvxvzxaU2QiC2bO3jEUJVv9M UzIIr8EEed5TydZzi/V98+5VQ0BqmADn0R2yCFwKh//u/qi8SurHoFD3p7I77bdLlzKa UAsYkmTnakRArKe5QE3tAmJrvMCjxEmtp9Z+WsVtg6dhF1K5wFoFTHYThsfabXE2ZlO2 9jaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=WPV9QV+6; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id x9-20020a170902a38900b001589d3ae40dsi10541204pla.505.2022.05.09.06.32.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 06:32:54 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=WPV9QV+6; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1996327FD4; Mon, 9 May 2022 06:20:51 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235606AbiEINY3 (ORCPT + 99 others); Mon, 9 May 2022 09:24:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235526AbiEINYW (ORCPT ); Mon, 9 May 2022 09:24:22 -0400 Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [IPv6:2001:4b98:dc4:8::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A7372B1651; Mon, 9 May 2022 06:20:27 -0700 (PDT) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id F0CB8240007; Mon, 9 May 2022 13:20:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1652102426; 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=RrjjbfswMcRGhPL51giZHhSaKlAAFTHbR8pSOyaaywI=; b=WPV9QV+6aBDtHfEpOoLvJ45aFDZKLB4fntsUTF5ftqnP0mcN1QMuUg8oPGBlVJZihOAP3S jjketnPyc4oDzbkKaW9mPeNJMj8cTuwlEKeva3QdLIv6qEa2wnkbFPP8Fn6vM6JzDcdcYP ZJH9MdUje144PRFiXvN+RN7Ghy6XDrJKtDKHW0TZI4zpNlqvucwjkC+n6VY6BYpacT9xw7 jat1lqXyDRyW9MBWgS73n+xVC4Pc/I7n7sK/yKWYXAA435QQBj4Q0hU5d+bvJv5jcLjjCV aMtqGwPDRc0ns9/m6R0bdnA94XVUmth+yRbWT+oYDevYPoX78PEvGA1DSbb/pw== 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 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 v4 01/12] net: dsa: add support for ethtool get_rmon_stats() Date: Mon, 9 May 2022 15:18:49 +0200 Message-Id: <20220509131900.7840-2-clement.leger@bootlin.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220509131900.7840-1-clement.leger@bootlin.com> References: <20220509131900.7840-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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 934958fda962..d9da32aacbf1 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -873,6 +873,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 5ee0aced9410..27c8d28fd9d8 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1026,6 +1026,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) { @@ -2105,6 +2117,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.0