mlxsw: spectrum: Add priority counters
authorNogah Frankel <nogahf@mellanox.com>
Wed, 28 Feb 2018 09:44:59 +0000 (10:44 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 28 Feb 2018 17:06:00 +0000 (12:06 -0500)
Add TX packets and bytes counters per switch priority per port.

Signed-off-by: Nogah Frankel <nogahf@mellanox.com>
Reviewed-by: Yuval Mintz <yuvalm@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
drivers/net/ethernet/mellanox/mlxsw/spectrum.h

index 8d2d140d79107f44383fe3f823349ca22cacaf37..7c6204f701ae2d1e9bb5b6f0cf565e3c4f9d43c7 100644 (file)
@@ -1040,6 +1040,16 @@ mlxsw_sp_port_get_hw_xstats(struct net_device *dev,
                xstats->tail_drop[i] =
                        mlxsw_reg_ppcnt_tc_no_buffer_discard_uc_get(ppcnt_pl);
        }
+
+       for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
+               err = mlxsw_sp_port_get_stats_raw(dev, MLXSW_REG_PPCNT_PRIO_CNT,
+                                                 i, ppcnt_pl);
+               if (err)
+                       continue;
+
+               xstats->tx_packets[i] = mlxsw_reg_ppcnt_tx_frames_get(ppcnt_pl);
+               xstats->tx_bytes[i] = mlxsw_reg_ppcnt_tx_octets_get(ppcnt_pl);
+       }
 }
 
 static void update_stats_cache(struct work_struct *work)
index cc9786ff3b0505a805d43fecbdba28abf9521685..d5e711d8ad7125a2bb83f2703b7e3aa11023026d 100644 (file)
@@ -210,6 +210,8 @@ struct mlxsw_sp_port_xstats {
        u64 wred_drop[TC_MAX_QUEUE];
        u64 tail_drop[TC_MAX_QUEUE];
        u64 backlog[TC_MAX_QUEUE];
+       u64 tx_bytes[IEEE_8021QAZ_MAX_TCS];
+       u64 tx_packets[IEEE_8021QAZ_MAX_TCS];
 };
 
 struct mlxsw_sp_port {