]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
dsa: Pass the port to get_sset_count()
authorAndrew Lunn <andrew@lunn.ch>
Thu, 1 Mar 2018 01:02:27 +0000 (02:02 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 4 Mar 2018 18:34:18 +0000 (13:34 -0500)
By passing the port, we allow different ports to have different
statistics. This is useful since some ports have SERDES interfaces
with their own statistic counters.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/b53/b53_common.c
drivers/net/dsa/b53/b53_priv.h
drivers/net/dsa/dsa_loop.c
drivers/net/dsa/lan9303-core.c
drivers/net/dsa/microchip/ksz_common.c
drivers/net/dsa/mt7530.c
drivers/net/dsa/mv88e6xxx/chip.c
drivers/net/dsa/qca8k.c
include/net/dsa.h
net/dsa/master.c
net/dsa/slave.c

index db830a1141d99774f6e21037a63840518dfdab25..cd16067265dda336e9de9e886a4d969f324fc38b 100644 (file)
@@ -852,7 +852,7 @@ void b53_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data)
 }
 EXPORT_SYMBOL(b53_get_ethtool_stats);
 
-int b53_get_sset_count(struct dsa_switch *ds)
+int b53_get_sset_count(struct dsa_switch *ds, int port)
 {
        struct b53_device *dev = ds->priv;
 
index d954cf36ecd805b8c2a83371d3c9e443b04506fe..1187ebd79287bec832f78a04e47805e45fc22aeb 100644 (file)
@@ -288,7 +288,7 @@ void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port);
 int b53_configure_vlan(struct dsa_switch *ds);
 void b53_get_strings(struct dsa_switch *ds, int port, uint8_t *data);
 void b53_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data);
-int b53_get_sset_count(struct dsa_switch *ds);
+int b53_get_sset_count(struct dsa_switch *ds, int port);
 int b53_br_join(struct dsa_switch *ds, int port, struct net_device *bridge);
 void b53_br_leave(struct dsa_switch *ds, int port, struct net_device *bridge);
 void b53_br_set_stp_state(struct dsa_switch *ds, int port, u8 state);
index 7aa84ee4e771d97b031e1e1e66910f81c1958828..f77be9f85cb36f3d229bcf1aa9dac0e86e6187c6 100644 (file)
@@ -86,7 +86,7 @@ static int dsa_loop_setup(struct dsa_switch *ds)
        return 0;
 }
 
-static int dsa_loop_get_sset_count(struct dsa_switch *ds)
+static int dsa_loop_get_sset_count(struct dsa_switch *ds, int port)
 {
        return __DSA_LOOP_CNT_MAX;
 }
index 6171c0853ff112984a21f940891e253eb57ceb3b..fefa454f3e564fcdfef5e56602975f3e31a6a13e 100644 (file)
@@ -1007,7 +1007,7 @@ static void lan9303_get_ethtool_stats(struct dsa_switch *ds, int port,
        }
 }
 
-static int lan9303_get_sset_count(struct dsa_switch *ds)
+static int lan9303_get_sset_count(struct dsa_switch *ds, int port)
 {
        return ARRAY_SIZE(lan9303_mib);
 }
index 663b0d5b982b127f934a8c87e64f5aa8209a6b0b..bcb3e6c734f25e099ac9356738edb87a22a1eb43 100644 (file)
@@ -439,7 +439,7 @@ static void ksz_disable_port(struct dsa_switch *ds, int port,
        ksz_port_cfg(dev, port, REG_PORT_CTRL_0, PORT_MAC_LOOPBACK, true);
 }
 
-static int ksz_sset_count(struct dsa_switch *ds)
+static int ksz_sset_count(struct dsa_switch *ds, int port)
 {
        return TOTAL_SWITCH_COUNTER_NUM;
 }
index 8a0bb000d05699f28e42d3a5547fffabfcc13341..511ca134f13f092ef07e461951cb4097ac5cebd4 100644 (file)
@@ -604,7 +604,7 @@ mt7530_get_ethtool_stats(struct dsa_switch *ds, int port,
 }
 
 static int
-mt7530_get_sset_count(struct dsa_switch *ds)
+mt7530_get_sset_count(struct dsa_switch *ds, int port)
 {
        return ARRAY_SIZE(mt7530_mib);
 }
index 24486f96dd395d6abd853a1814609df09704fe79..8c9a30d1b06fa291e9d9b177988189ef9cac2299 100644 (file)
@@ -754,7 +754,7 @@ static int mv88e6320_stats_get_sset_count(struct mv88e6xxx_chip *chip)
                                              STATS_TYPE_BANK1);
 }
 
-static int mv88e6xxx_get_sset_count(struct dsa_switch *ds)
+static int mv88e6xxx_get_sset_count(struct dsa_switch *ds, int port)
 {
        struct mv88e6xxx_chip *chip = ds->priv;
 
index 9df22ebee8223822d8bbfebe299b3f6ccfefc84e..600d5ad1fbde265afbf7dc030d694cadbaa8fcef 100644 (file)
@@ -631,7 +631,7 @@ qca8k_get_ethtool_stats(struct dsa_switch *ds, int port,
 }
 
 static int
-qca8k_get_sset_count(struct dsa_switch *ds)
+qca8k_get_sset_count(struct dsa_switch *ds, int port)
 {
        return ARRAY_SIZE(ar8327_mib);
 }
index 0ad17b63684d1b93583209b431065f20b5f9bb60..60fb4ec8ba616060f17963caa7cb2ac23847917b 100644 (file)
@@ -359,7 +359,7 @@ struct dsa_switch_ops {
        void    (*get_strings)(struct dsa_switch *ds, int port, uint8_t *data);
        void    (*get_ethtool_stats)(struct dsa_switch *ds,
                                     int port, uint64_t *data);
-       int     (*get_sset_count)(struct dsa_switch *ds);
+       int     (*get_sset_count)(struct dsa_switch *ds, int port);
 
        /*
         * ethtool Wake-on-LAN
index 00589147f0422341803fd1ba02f66997beaa59c8..90e6df0351eb218a6621151960ca2109c3698580 100644 (file)
@@ -42,7 +42,7 @@ static int dsa_master_get_sset_count(struct net_device *dev, int sset)
                count += ops->get_sset_count(dev, sset);
 
        if (sset == ETH_SS_STATS && ds->ops->get_sset_count)
-               count += ds->ops->get_sset_count(ds);
+               count += ds->ops->get_sset_count(ds, cpu_dp->index);
 
        return count;
 }
@@ -76,7 +76,7 @@ static void dsa_master_get_strings(struct net_device *dev, uint32_t stringset,
                 * constructed earlier
                 */
                ds->ops->get_strings(ds, port, ndata);
-               count = ds->ops->get_sset_count(ds);
+               count = ds->ops->get_sset_count(ds, port);
                for (i = 0; i < count; i++) {
                        memmove(ndata + (i * len + sizeof(pfx)),
                                ndata + i * len, len - sizeof(pfx));
index 3376dad6dcfddb48088271ab8bc422f6631ba80d..18561af7a8f1da0ec92773376ecac9a72a64751c 100644 (file)
@@ -605,7 +605,7 @@ static int dsa_slave_get_sset_count(struct net_device *dev, int sset)
 
                count = 4;
                if (ds->ops->get_sset_count)
-                       count += ds->ops->get_sset_count(ds);
+                       count += ds->ops->get_sset_count(ds, dp->index);
 
                return count;
        }