@@ -1331,6 +1331,44 @@ static void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, int port,
1331
1331
mv88e6xxx_get_stats (chip , port , data );
1332
1332
}
1333
1333
1334
+ static void mv88e6xxx_get_eth_mac_stats (struct dsa_switch * ds , int port ,
1335
+ struct ethtool_eth_mac_stats * mac_stats )
1336
+ {
1337
+ struct mv88e6xxx_chip * chip = ds -> priv ;
1338
+ int ret ;
1339
+
1340
+ ret = mv88e6xxx_stats_snapshot (chip , port );
1341
+ if (ret < 0 )
1342
+ return ;
1343
+
1344
+ #define MV88E6XXX_ETH_MAC_STAT_MAP (_id , _member ) \
1345
+ mv88e6xxx_stats_get_stat(chip, port, \
1346
+ &mv88e6xxx_hw_stats[MV88E6XXX_HW_STAT_ID_ ## _id], \
1347
+ &mac_stats->stats._member)
1348
+
1349
+ MV88E6XXX_ETH_MAC_STAT_MAP (out_unicast , FramesTransmittedOK );
1350
+ MV88E6XXX_ETH_MAC_STAT_MAP (single , SingleCollisionFrames );
1351
+ MV88E6XXX_ETH_MAC_STAT_MAP (multiple , MultipleCollisionFrames );
1352
+ MV88E6XXX_ETH_MAC_STAT_MAP (in_unicast , FramesReceivedOK );
1353
+ MV88E6XXX_ETH_MAC_STAT_MAP (in_fcs_error , FrameCheckSequenceErrors );
1354
+ MV88E6XXX_ETH_MAC_STAT_MAP (out_octets , OctetsTransmittedOK );
1355
+ MV88E6XXX_ETH_MAC_STAT_MAP (deferred , FramesWithDeferredXmissions );
1356
+ MV88E6XXX_ETH_MAC_STAT_MAP (late , LateCollisions );
1357
+ MV88E6XXX_ETH_MAC_STAT_MAP (in_good_octets , OctetsReceivedOK );
1358
+ MV88E6XXX_ETH_MAC_STAT_MAP (out_multicasts , MulticastFramesXmittedOK );
1359
+ MV88E6XXX_ETH_MAC_STAT_MAP (out_broadcasts , BroadcastFramesXmittedOK );
1360
+ MV88E6XXX_ETH_MAC_STAT_MAP (excessive , FramesWithExcessiveDeferral );
1361
+ MV88E6XXX_ETH_MAC_STAT_MAP (in_multicasts , MulticastFramesReceivedOK );
1362
+ MV88E6XXX_ETH_MAC_STAT_MAP (in_broadcasts , BroadcastFramesReceivedOK );
1363
+
1364
+ #undef MV88E6XXX_ETH_MAC_STAT_MAP
1365
+
1366
+ mac_stats -> stats .FramesTransmittedOK += mac_stats -> stats .MulticastFramesXmittedOK ;
1367
+ mac_stats -> stats .FramesTransmittedOK += mac_stats -> stats .BroadcastFramesXmittedOK ;
1368
+ mac_stats -> stats .FramesReceivedOK += mac_stats -> stats .MulticastFramesReceivedOK ;
1369
+ mac_stats -> stats .FramesReceivedOK += mac_stats -> stats .BroadcastFramesReceivedOK ;
1370
+ }
1371
+
1334
1372
static int mv88e6xxx_get_regs_len (struct dsa_switch * ds , int port )
1335
1373
{
1336
1374
struct mv88e6xxx_chip * chip = ds -> priv ;
@@ -6852,6 +6890,7 @@ static const struct dsa_switch_ops mv88e6xxx_switch_ops = {
6852
6890
.phylink_mac_link_up = mv88e6xxx_mac_link_up ,
6853
6891
.get_strings = mv88e6xxx_get_strings ,
6854
6892
.get_ethtool_stats = mv88e6xxx_get_ethtool_stats ,
6893
+ .get_eth_mac_stats = mv88e6xxx_get_eth_mac_stats ,
6855
6894
.get_sset_count = mv88e6xxx_get_sset_count ,
6856
6895
.port_max_mtu = mv88e6xxx_get_max_mtu ,
6857
6896
.port_change_mtu = mv88e6xxx_change_mtu ,
0 commit comments