Skip to content

Commit ab3f97a

Browse files
vladimirolteandavem330
authored andcommitted
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: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 497eea9 commit ab3f97a

File tree

4 files changed

+366
-10
lines changed

4 files changed

+366
-10
lines changed

drivers/net/dsa/ocelot/felix.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,13 +2024,22 @@ static int felix_port_del_dscp_prio(struct dsa_switch *ds, int port, u8 dscp,
20242024
return ocelot_port_del_dscp_prio(ocelot, port, dscp, prio);
20252025
}
20262026

2027+
static void felix_get_mm_stats(struct dsa_switch *ds, int port,
2028+
struct ethtool_mm_stats *stats)
2029+
{
2030+
struct ocelot *ocelot = ds->priv;
2031+
2032+
ocelot_port_get_mm_stats(ocelot, port, stats);
2033+
}
2034+
20272035
const struct dsa_switch_ops felix_switch_ops = {
20282036
.get_tag_protocol = felix_get_tag_protocol,
20292037
.change_tag_protocol = felix_change_tag_protocol,
20302038
.connect_tag_protocol = felix_connect_tag_protocol,
20312039
.setup = felix_setup,
20322040
.teardown = felix_teardown,
20332041
.set_ageing_time = felix_set_ageing_time,
2042+
.get_mm_stats = felix_get_mm_stats,
20342043
.get_stats64 = felix_get_stats64,
20352044
.get_pause_stats = felix_get_pause_stats,
20362045
.get_rmon_stats = felix_get_rmon_stats,

drivers/net/dsa/ocelot/felix_vsc9959.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,29 @@ static const u32 vsc9959_sys_regmap[] = {
318318
REG(SYS_COUNT_RX_GREEN_PRIO_5, 0x0000a4),
319319
REG(SYS_COUNT_RX_GREEN_PRIO_6, 0x0000a8),
320320
REG(SYS_COUNT_RX_GREEN_PRIO_7, 0x0000ac),
321+
REG(SYS_COUNT_RX_ASSEMBLY_ERRS, 0x0000b0),
322+
REG(SYS_COUNT_RX_SMD_ERRS, 0x0000b4),
323+
REG(SYS_COUNT_RX_ASSEMBLY_OK, 0x0000b8),
324+
REG(SYS_COUNT_RX_MERGE_FRAGMENTS, 0x0000bc),
325+
REG(SYS_COUNT_RX_PMAC_OCTETS, 0x0000c0),
326+
REG(SYS_COUNT_RX_PMAC_UNICAST, 0x0000c4),
327+
REG(SYS_COUNT_RX_PMAC_MULTICAST, 0x0000c8),
328+
REG(SYS_COUNT_RX_PMAC_BROADCAST, 0x0000cc),
329+
REG(SYS_COUNT_RX_PMAC_SHORTS, 0x0000d0),
330+
REG(SYS_COUNT_RX_PMAC_FRAGMENTS, 0x0000d4),
331+
REG(SYS_COUNT_RX_PMAC_JABBERS, 0x0000d8),
332+
REG(SYS_COUNT_RX_PMAC_CRC_ALIGN_ERRS, 0x0000dc),
333+
REG(SYS_COUNT_RX_PMAC_SYM_ERRS, 0x0000e0),
334+
REG(SYS_COUNT_RX_PMAC_64, 0x0000e4),
335+
REG(SYS_COUNT_RX_PMAC_65_127, 0x0000e8),
336+
REG(SYS_COUNT_RX_PMAC_128_255, 0x0000ec),
337+
REG(SYS_COUNT_RX_PMAC_256_511, 0x0000f0),
338+
REG(SYS_COUNT_RX_PMAC_512_1023, 0x0000f4),
339+
REG(SYS_COUNT_RX_PMAC_1024_1526, 0x0000f8),
340+
REG(SYS_COUNT_RX_PMAC_1527_MAX, 0x0000fc),
341+
REG(SYS_COUNT_RX_PMAC_PAUSE, 0x000100),
342+
REG(SYS_COUNT_RX_PMAC_CONTROL, 0x000104),
343+
REG(SYS_COUNT_RX_PMAC_LONGS, 0x000108),
321344
REG(SYS_COUNT_TX_OCTETS, 0x000200),
322345
REG(SYS_COUNT_TX_UNICAST, 0x000204),
323346
REG(SYS_COUNT_TX_MULTICAST, 0x000208),
@@ -349,6 +372,20 @@ static const u32 vsc9959_sys_regmap[] = {
349372
REG(SYS_COUNT_TX_GREEN_PRIO_6, 0x000270),
350373
REG(SYS_COUNT_TX_GREEN_PRIO_7, 0x000274),
351374
REG(SYS_COUNT_TX_AGED, 0x000278),
375+
REG(SYS_COUNT_TX_MM_HOLD, 0x00027c),
376+
REG(SYS_COUNT_TX_MERGE_FRAGMENTS, 0x000280),
377+
REG(SYS_COUNT_TX_PMAC_OCTETS, 0x000284),
378+
REG(SYS_COUNT_TX_PMAC_UNICAST, 0x000288),
379+
REG(SYS_COUNT_TX_PMAC_MULTICAST, 0x00028c),
380+
REG(SYS_COUNT_TX_PMAC_BROADCAST, 0x000290),
381+
REG(SYS_COUNT_TX_PMAC_PAUSE, 0x000294),
382+
REG(SYS_COUNT_TX_PMAC_64, 0x000298),
383+
REG(SYS_COUNT_TX_PMAC_65_127, 0x00029c),
384+
REG(SYS_COUNT_TX_PMAC_128_255, 0x0002a0),
385+
REG(SYS_COUNT_TX_PMAC_256_511, 0x0002a4),
386+
REG(SYS_COUNT_TX_PMAC_512_1023, 0x0002a8),
387+
REG(SYS_COUNT_TX_PMAC_1024_1526, 0x0002ac),
388+
REG(SYS_COUNT_TX_PMAC_1527_MAX, 0x0002b0),
352389
REG(SYS_COUNT_DROP_LOCAL, 0x000400),
353390
REG(SYS_COUNT_DROP_TAIL, 0x000404),
354391
REG(SYS_COUNT_DROP_YELLOW_PRIO_0, 0x000408),
@@ -2623,6 +2660,7 @@ static int felix_pci_probe(struct pci_dev *pdev,
26232660
}
26242661

26252662
ocelot->ptp = 1;
2663+
ocelot->mm_supported = true;
26262664

26272665
ds = kzalloc(sizeof(struct dsa_switch), GFP_KERNEL);
26282666
if (!ds) {

0 commit comments

Comments
 (0)