Commit ab3f97a9 authored by Vladimir Oltean's avatar Vladimir Oltean Committed by David S. Miller

net: mscc: ocelot: export ethtool MAC Merge stats for Felix VSC9959

The Felix VSC9959 switch supports frame preemption and has a MAC Merge
layer. In addition to the structured stats that exist for the eMAC,
export the counters associated with its pMAC (pause, RMON, MAC, PHY,
control) plus the high-level MAC Merge layer stats. The unstructured
ethtool counters, as well as the rtnl_link_stats64 were left to report
only the eMAC counters.

Because statistics processing is quite self-contained in ocelot_stats.c
now, I've opted for introducing an ocelot->mm_supported bool, based on
which the common switch lib does everything, rather than pushing the
TSN-specific code in felix_vsc9959.c, as happens for other TSN stuff.
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 497eea9f
...@@ -2024,6 +2024,14 @@ static int felix_port_del_dscp_prio(struct dsa_switch *ds, int port, u8 dscp, ...@@ -2024,6 +2024,14 @@ static int felix_port_del_dscp_prio(struct dsa_switch *ds, int port, u8 dscp,
return ocelot_port_del_dscp_prio(ocelot, port, dscp, prio); return ocelot_port_del_dscp_prio(ocelot, port, dscp, prio);
} }
static void felix_get_mm_stats(struct dsa_switch *ds, int port,
struct ethtool_mm_stats *stats)
{
struct ocelot *ocelot = ds->priv;
ocelot_port_get_mm_stats(ocelot, port, stats);
}
const struct dsa_switch_ops felix_switch_ops = { const struct dsa_switch_ops felix_switch_ops = {
.get_tag_protocol = felix_get_tag_protocol, .get_tag_protocol = felix_get_tag_protocol,
.change_tag_protocol = felix_change_tag_protocol, .change_tag_protocol = felix_change_tag_protocol,
...@@ -2031,6 +2039,7 @@ const struct dsa_switch_ops felix_switch_ops = { ...@@ -2031,6 +2039,7 @@ const struct dsa_switch_ops felix_switch_ops = {
.setup = felix_setup, .setup = felix_setup,
.teardown = felix_teardown, .teardown = felix_teardown,
.set_ageing_time = felix_set_ageing_time, .set_ageing_time = felix_set_ageing_time,
.get_mm_stats = felix_get_mm_stats,
.get_stats64 = felix_get_stats64, .get_stats64 = felix_get_stats64,
.get_pause_stats = felix_get_pause_stats, .get_pause_stats = felix_get_pause_stats,
.get_rmon_stats = felix_get_rmon_stats, .get_rmon_stats = felix_get_rmon_stats,
......
...@@ -318,6 +318,29 @@ static const u32 vsc9959_sys_regmap[] = { ...@@ -318,6 +318,29 @@ static const u32 vsc9959_sys_regmap[] = {
REG(SYS_COUNT_RX_GREEN_PRIO_5, 0x0000a4), REG(SYS_COUNT_RX_GREEN_PRIO_5, 0x0000a4),
REG(SYS_COUNT_RX_GREEN_PRIO_6, 0x0000a8), REG(SYS_COUNT_RX_GREEN_PRIO_6, 0x0000a8),
REG(SYS_COUNT_RX_GREEN_PRIO_7, 0x0000ac), REG(SYS_COUNT_RX_GREEN_PRIO_7, 0x0000ac),
REG(SYS_COUNT_RX_ASSEMBLY_ERRS, 0x0000b0),
REG(SYS_COUNT_RX_SMD_ERRS, 0x0000b4),
REG(SYS_COUNT_RX_ASSEMBLY_OK, 0x0000b8),
REG(SYS_COUNT_RX_MERGE_FRAGMENTS, 0x0000bc),
REG(SYS_COUNT_RX_PMAC_OCTETS, 0x0000c0),
REG(SYS_COUNT_RX_PMAC_UNICAST, 0x0000c4),
REG(SYS_COUNT_RX_PMAC_MULTICAST, 0x0000c8),
REG(SYS_COUNT_RX_PMAC_BROADCAST, 0x0000cc),
REG(SYS_COUNT_RX_PMAC_SHORTS, 0x0000d0),
REG(SYS_COUNT_RX_PMAC_FRAGMENTS, 0x0000d4),
REG(SYS_COUNT_RX_PMAC_JABBERS, 0x0000d8),
REG(SYS_COUNT_RX_PMAC_CRC_ALIGN_ERRS, 0x0000dc),
REG(SYS_COUNT_RX_PMAC_SYM_ERRS, 0x0000e0),
REG(SYS_COUNT_RX_PMAC_64, 0x0000e4),
REG(SYS_COUNT_RX_PMAC_65_127, 0x0000e8),
REG(SYS_COUNT_RX_PMAC_128_255, 0x0000ec),
REG(SYS_COUNT_RX_PMAC_256_511, 0x0000f0),
REG(SYS_COUNT_RX_PMAC_512_1023, 0x0000f4),
REG(SYS_COUNT_RX_PMAC_1024_1526, 0x0000f8),
REG(SYS_COUNT_RX_PMAC_1527_MAX, 0x0000fc),
REG(SYS_COUNT_RX_PMAC_PAUSE, 0x000100),
REG(SYS_COUNT_RX_PMAC_CONTROL, 0x000104),
REG(SYS_COUNT_RX_PMAC_LONGS, 0x000108),
REG(SYS_COUNT_TX_OCTETS, 0x000200), REG(SYS_COUNT_TX_OCTETS, 0x000200),
REG(SYS_COUNT_TX_UNICAST, 0x000204), REG(SYS_COUNT_TX_UNICAST, 0x000204),
REG(SYS_COUNT_TX_MULTICAST, 0x000208), REG(SYS_COUNT_TX_MULTICAST, 0x000208),
...@@ -349,6 +372,20 @@ static const u32 vsc9959_sys_regmap[] = { ...@@ -349,6 +372,20 @@ static const u32 vsc9959_sys_regmap[] = {
REG(SYS_COUNT_TX_GREEN_PRIO_6, 0x000270), REG(SYS_COUNT_TX_GREEN_PRIO_6, 0x000270),
REG(SYS_COUNT_TX_GREEN_PRIO_7, 0x000274), REG(SYS_COUNT_TX_GREEN_PRIO_7, 0x000274),
REG(SYS_COUNT_TX_AGED, 0x000278), REG(SYS_COUNT_TX_AGED, 0x000278),
REG(SYS_COUNT_TX_MM_HOLD, 0x00027c),
REG(SYS_COUNT_TX_MERGE_FRAGMENTS, 0x000280),
REG(SYS_COUNT_TX_PMAC_OCTETS, 0x000284),
REG(SYS_COUNT_TX_PMAC_UNICAST, 0x000288),
REG(SYS_COUNT_TX_PMAC_MULTICAST, 0x00028c),
REG(SYS_COUNT_TX_PMAC_BROADCAST, 0x000290),
REG(SYS_COUNT_TX_PMAC_PAUSE, 0x000294),
REG(SYS_COUNT_TX_PMAC_64, 0x000298),
REG(SYS_COUNT_TX_PMAC_65_127, 0x00029c),
REG(SYS_COUNT_TX_PMAC_128_255, 0x0002a0),
REG(SYS_COUNT_TX_PMAC_256_511, 0x0002a4),
REG(SYS_COUNT_TX_PMAC_512_1023, 0x0002a8),
REG(SYS_COUNT_TX_PMAC_1024_1526, 0x0002ac),
REG(SYS_COUNT_TX_PMAC_1527_MAX, 0x0002b0),
REG(SYS_COUNT_DROP_LOCAL, 0x000400), REG(SYS_COUNT_DROP_LOCAL, 0x000400),
REG(SYS_COUNT_DROP_TAIL, 0x000404), REG(SYS_COUNT_DROP_TAIL, 0x000404),
REG(SYS_COUNT_DROP_YELLOW_PRIO_0, 0x000408), REG(SYS_COUNT_DROP_YELLOW_PRIO_0, 0x000408),
...@@ -2623,6 +2660,7 @@ static int felix_pci_probe(struct pci_dev *pdev, ...@@ -2623,6 +2660,7 @@ static int felix_pci_probe(struct pci_dev *pdev,
} }
ocelot->ptp = 1; ocelot->ptp = 1;
ocelot->mm_supported = true;
ds = kzalloc(sizeof(struct dsa_switch), GFP_KERNEL); ds = kzalloc(sizeof(struct dsa_switch), GFP_KERNEL);
if (!ds) { if (!ds) {
......
This diff is collapsed.
...@@ -362,6 +362,29 @@ enum ocelot_reg { ...@@ -362,6 +362,29 @@ enum ocelot_reg {
SYS_COUNT_RX_GREEN_PRIO_5, SYS_COUNT_RX_GREEN_PRIO_5,
SYS_COUNT_RX_GREEN_PRIO_6, SYS_COUNT_RX_GREEN_PRIO_6,
SYS_COUNT_RX_GREEN_PRIO_7, SYS_COUNT_RX_GREEN_PRIO_7,
SYS_COUNT_RX_ASSEMBLY_ERRS,
SYS_COUNT_RX_SMD_ERRS,
SYS_COUNT_RX_ASSEMBLY_OK,
SYS_COUNT_RX_MERGE_FRAGMENTS,
SYS_COUNT_RX_PMAC_OCTETS,
SYS_COUNT_RX_PMAC_UNICAST,
SYS_COUNT_RX_PMAC_MULTICAST,
SYS_COUNT_RX_PMAC_BROADCAST,
SYS_COUNT_RX_PMAC_SHORTS,
SYS_COUNT_RX_PMAC_FRAGMENTS,
SYS_COUNT_RX_PMAC_JABBERS,
SYS_COUNT_RX_PMAC_CRC_ALIGN_ERRS,
SYS_COUNT_RX_PMAC_SYM_ERRS,
SYS_COUNT_RX_PMAC_64,
SYS_COUNT_RX_PMAC_65_127,
SYS_COUNT_RX_PMAC_128_255,
SYS_COUNT_RX_PMAC_256_511,
SYS_COUNT_RX_PMAC_512_1023,
SYS_COUNT_RX_PMAC_1024_1526,
SYS_COUNT_RX_PMAC_1527_MAX,
SYS_COUNT_RX_PMAC_PAUSE,
SYS_COUNT_RX_PMAC_CONTROL,
SYS_COUNT_RX_PMAC_LONGS,
SYS_COUNT_TX_OCTETS, SYS_COUNT_TX_OCTETS,
SYS_COUNT_TX_UNICAST, SYS_COUNT_TX_UNICAST,
SYS_COUNT_TX_MULTICAST, SYS_COUNT_TX_MULTICAST,
...@@ -393,6 +416,20 @@ enum ocelot_reg { ...@@ -393,6 +416,20 @@ enum ocelot_reg {
SYS_COUNT_TX_GREEN_PRIO_6, SYS_COUNT_TX_GREEN_PRIO_6,
SYS_COUNT_TX_GREEN_PRIO_7, SYS_COUNT_TX_GREEN_PRIO_7,
SYS_COUNT_TX_AGED, SYS_COUNT_TX_AGED,
SYS_COUNT_TX_MM_HOLD,
SYS_COUNT_TX_MERGE_FRAGMENTS,
SYS_COUNT_TX_PMAC_OCTETS,
SYS_COUNT_TX_PMAC_UNICAST,
SYS_COUNT_TX_PMAC_MULTICAST,
SYS_COUNT_TX_PMAC_BROADCAST,
SYS_COUNT_TX_PMAC_PAUSE,
SYS_COUNT_TX_PMAC_64,
SYS_COUNT_TX_PMAC_65_127,
SYS_COUNT_TX_PMAC_128_255,
SYS_COUNT_TX_PMAC_256_511,
SYS_COUNT_TX_PMAC_512_1023,
SYS_COUNT_TX_PMAC_1024_1526,
SYS_COUNT_TX_PMAC_1527_MAX,
SYS_COUNT_DROP_LOCAL, SYS_COUNT_DROP_LOCAL,
SYS_COUNT_DROP_TAIL, SYS_COUNT_DROP_TAIL,
SYS_COUNT_DROP_YELLOW_PRIO_0, SYS_COUNT_DROP_YELLOW_PRIO_0,
...@@ -814,6 +851,7 @@ struct ocelot { ...@@ -814,6 +851,7 @@ struct ocelot {
struct workqueue_struct *owq; struct workqueue_struct *owq;
u8 ptp:1; u8 ptp:1;
u8 mm_supported:1;
struct ptp_clock *ptp_clock; struct ptp_clock *ptp_clock;
struct ptp_clock_info ptp_info; struct ptp_clock_info ptp_info;
struct hwtstamp_config hwtstamp_config; struct hwtstamp_config hwtstamp_config;
...@@ -937,6 +975,8 @@ void ocelot_port_get_stats64(struct ocelot *ocelot, int port, ...@@ -937,6 +975,8 @@ void ocelot_port_get_stats64(struct ocelot *ocelot, int port,
struct rtnl_link_stats64 *stats); struct rtnl_link_stats64 *stats);
void ocelot_port_get_pause_stats(struct ocelot *ocelot, int port, void ocelot_port_get_pause_stats(struct ocelot *ocelot, int port,
struct ethtool_pause_stats *pause_stats); struct ethtool_pause_stats *pause_stats);
void ocelot_port_get_mm_stats(struct ocelot *ocelot, int port,
struct ethtool_mm_stats *stats);
void ocelot_port_get_rmon_stats(struct ocelot *ocelot, int port, void ocelot_port_get_rmon_stats(struct ocelot *ocelot, int port,
struct ethtool_rmon_stats *rmon_stats, struct ethtool_rmon_stats *rmon_stats,
const struct ethtool_rmon_hist_range **ranges); const struct ethtool_rmon_hist_range **ranges);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment