From: Selvamani Rajagopal Adds selftest support for onsemi S2500 MAC-PHY. Added as a separate patch for the ease of review. Signed-off-by: Selvamani Rajagopal --- changes in v10 - Added a check for CONFIG_NET_SELFTESTS before returning the count value changes in v9 - Added net_selftest entry to the ethtool_ops in the correct patch changes in v8 - No change changes in v7 - No change changes in v6 - Moved the signed off information to the correct place. changes in v5 - No change changes in v4: - Added a selftest as a separate patch - First patch --- drivers/net/ethernet/onsemi/s2500/s2500_ethtool.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/ethernet/onsemi/s2500/s2500_ethtool.c b/drivers/net/ethernet/onsemi/s2500/s2500_ethtool.c index 062cab9460dc..4e42b4748c46 100644 --- a/drivers/net/ethernet/onsemi/s2500/s2500_ethtool.c +++ b/drivers/net/ethernet/onsemi/s2500/s2500_ethtool.c @@ -5,6 +5,7 @@ */ #include +#include #include #include "s2500_hw_def.h" @@ -201,6 +202,10 @@ static int s2500_get_sset_count(struct net_device *ndev, int sset) switch (sset) { case ETH_SS_STATS: return S2500_MAC_STATS_LEN; + case ETH_SS_TEST: + if (!IS_ENABLED(CONFIG_NET_SELFTESTS)) + return -EOPNOTSUPP; + return net_selftest_get_count(); default: return -EOPNOTSUPP; } @@ -214,6 +219,9 @@ static void s2500_get_strings(struct net_device *ndev, u32 stringset, memcpy(buf, s2500_mac_stat_strings, S2500_MAC_STATS_LEN * ETH_GSTRING_LEN); break; + case ETH_SS_TEST: + net_selftest_get_strings(buf); + break; } } @@ -372,5 +380,6 @@ const struct ethtool_ops s2500_ethtool_ops = { .get_ts_info = s2500_get_ts_info, .get_regs_len = s2500_get_regs_len, .get_regs = s2500_get_regs, + .self_test = net_selftest, }; -- 2.43.0