]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: dsa: add get_pause_stats support
authorOleksij Rempel <o.rempel@pengutronix.de>
Tue, 28 Jun 2022 08:51:52 +0000 (10:51 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 30 Jun 2022 03:17:11 +0000 (20:17 -0700)
Add support for pause stats

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/dsa.h
net/dsa/slave.c

index 33283eeda697cc1883ff3b24ebfd288d54c33df4..ea7bf007f34f30be83fdfe19336d391f3e552c81 100644 (file)
@@ -895,6 +895,8 @@ struct dsa_switch_ops {
                                  const struct ethtool_rmon_hist_range **ranges);
        void    (*get_stats64)(struct dsa_switch *ds, int port,
                                   struct rtnl_link_stats64 *s);
+       void    (*get_pause_stats)(struct dsa_switch *ds, int port,
+                                  struct ethtool_pause_stats *pause_stats);
        void    (*self_test)(struct dsa_switch *ds, int port,
                             struct ethtool_test *etest, u64 *data);
 
index 760ca58307a34c356b09d90462c1c3f09b386f81..ad6a6663feeb5ecce4559dcb783608edb82030c2 100644 (file)
@@ -1109,6 +1109,16 @@ static int dsa_slave_set_link_ksettings(struct net_device *dev,
        return phylink_ethtool_ksettings_set(dp->pl, cmd);
 }
 
+static void dsa_slave_get_pause_stats(struct net_device *dev,
+                                 struct ethtool_pause_stats *pause_stats)
+{
+       struct dsa_port *dp = dsa_slave_to_port(dev);
+       struct dsa_switch *ds = dp->ds;
+
+       if (ds->ops->get_pause_stats)
+               ds->ops->get_pause_stats(ds, dp->index, pause_stats);
+}
+
 static void dsa_slave_get_pauseparam(struct net_device *dev,
                                     struct ethtool_pauseparam *pause)
 {
@@ -2100,6 +2110,7 @@ static const struct ethtool_ops dsa_slave_ethtool_ops = {
        .get_eee                = dsa_slave_get_eee,
        .get_link_ksettings     = dsa_slave_get_link_ksettings,
        .set_link_ksettings     = dsa_slave_set_link_ksettings,
+       .get_pause_stats        = dsa_slave_get_pause_stats,
        .get_pauseparam         = dsa_slave_get_pauseparam,
        .set_pauseparam         = dsa_slave_set_pauseparam,
        .get_rxnfc              = dsa_slave_get_rxnfc,