summaryrefslogtreecommitdiff
path: root/drivers/net/dsa/bcm_sf2.c
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2019-02-06 23:45:59 +0300
committerDavid S. Miller <davem@davemloft.net>2019-02-09 09:11:07 +0300
commitf4ae9c0840b7e1f9bd2177189a45a21e6f11aa8d (patch)
treeca4a264569dca3d846e6e203bf37666d2baf994a /drivers/net/dsa/bcm_sf2.c
parentbadd62c249f3ef2d5af315ac2666256492e0af49 (diff)
downloadlinux-f4ae9c0840b7e1f9bd2177189a45a21e6f11aa8d.tar.xz
net: dsa: bcm_sf2: Add support for CFP statistics
Return CFP policer statistics (Green, Yellow or Red) as part of the standard ethtool statistics. This helps debug when CFP rules may not be hit (0 counter). Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/bcm_sf2.c')
-rw-r--r--drivers/net/dsa/bcm_sf2.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index ce5f4260ea1a..5193da67dcdc 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -897,19 +897,33 @@ static const struct b53_io_ops bcm_sf2_io_ops = {
static void bcm_sf2_sw_get_strings(struct dsa_switch *ds, int port,
u32 stringset, uint8_t *data)
{
+ int cnt = b53_get_sset_count(ds, port, stringset);
+
b53_get_strings(ds, port, stringset, data);
+ bcm_sf2_cfp_get_strings(ds, port, stringset,
+ data + cnt * ETH_GSTRING_LEN);
}
static void bcm_sf2_sw_get_ethtool_stats(struct dsa_switch *ds, int port,
uint64_t *data)
{
+ int cnt = b53_get_sset_count(ds, port, ETH_SS_STATS);
+
b53_get_ethtool_stats(ds, port, data);
+ bcm_sf2_cfp_get_ethtool_stats(ds, port, data + cnt);
}
static int bcm_sf2_sw_get_sset_count(struct dsa_switch *ds, int port,
int sset)
{
- return b53_get_sset_count(ds, port, sset);
+ int cnt = b53_get_sset_count(ds, port, sset);
+
+ if (cnt < 0)
+ return cnt;
+
+ cnt += bcm_sf2_cfp_get_sset_count(ds, port, sset);
+
+ return cnt;
}
static const struct dsa_switch_ops bcm_sf2_ops = {