@@ -662,6 +662,31 @@ static void am65_cpsw_get_ethtool_stats(struct net_device *ndev,
662
662
hw_stats [i ].offset );
663
663
}
664
664
665
+ static void am65_cpsw_get_eth_mac_stats (struct net_device * ndev ,
666
+ struct ethtool_eth_mac_stats * s )
667
+ {
668
+ struct am65_cpsw_port * port = am65_ndev_to_port (ndev );
669
+ struct am65_cpsw_stats_regs __iomem * stats ;
670
+
671
+ stats = port -> stat_base ;
672
+
673
+ s -> FramesTransmittedOK = readl_relaxed (& stats -> tx_good_frames );
674
+ s -> SingleCollisionFrames = readl_relaxed (& stats -> tx_single_coll_frames );
675
+ s -> MultipleCollisionFrames = readl_relaxed (& stats -> tx_mult_coll_frames );
676
+ s -> FramesReceivedOK = readl_relaxed (& stats -> rx_good_frames );
677
+ s -> FrameCheckSequenceErrors = readl_relaxed (& stats -> rx_crc_errors );
678
+ s -> AlignmentErrors = readl_relaxed (& stats -> rx_align_code_errors );
679
+ s -> OctetsTransmittedOK = readl_relaxed (& stats -> tx_octets );
680
+ s -> FramesWithDeferredXmissions = readl_relaxed (& stats -> tx_deferred_frames );
681
+ s -> LateCollisions = readl_relaxed (& stats -> tx_late_collisions );
682
+ s -> CarrierSenseErrors = readl_relaxed (& stats -> tx_carrier_sense_errors );
683
+ s -> OctetsReceivedOK = readl_relaxed (& stats -> rx_octets );
684
+ s -> MulticastFramesXmittedOK = readl_relaxed (& stats -> tx_multicast_frames );
685
+ s -> BroadcastFramesXmittedOK = readl_relaxed (& stats -> tx_broadcast_frames );
686
+ s -> MulticastFramesReceivedOK = readl_relaxed (& stats -> rx_multicast_frames );
687
+ s -> BroadcastFramesReceivedOK = readl_relaxed (& stats -> rx_broadcast_frames );
688
+ };
689
+
665
690
static int am65_cpsw_get_ethtool_ts_info (struct net_device * ndev ,
666
691
struct ethtool_ts_info * info )
667
692
{
@@ -729,6 +754,7 @@ const struct ethtool_ops am65_cpsw_ethtool_ops_slave = {
729
754
.get_sset_count = am65_cpsw_get_sset_count ,
730
755
.get_strings = am65_cpsw_get_strings ,
731
756
.get_ethtool_stats = am65_cpsw_get_ethtool_stats ,
757
+ .get_eth_mac_stats = am65_cpsw_get_eth_mac_stats ,
732
758
.get_ts_info = am65_cpsw_get_ethtool_ts_info ,
733
759
.get_priv_flags = am65_cpsw_get_ethtool_priv_flags ,
734
760
.set_priv_flags = am65_cpsw_set_ethtool_priv_flags ,
0 commit comments