Commit 1710b52d authored by Oleksij Rempel's avatar Oleksij Rempel Committed by David S. Miller

net: usb: smsc95xx: add generic selftest support

Provide generic selftest support. Tested with LAN9500 and LAN9512.
Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 038fcdaf
...@@ -358,6 +358,7 @@ config USB_NET_SMSC95XX ...@@ -358,6 +358,7 @@ config USB_NET_SMSC95XX
select BITREVERSE select BITREVERSE
select CRC16 select CRC16
select CRC32 select CRC32
imply NET_SELFTESTS
help help
This option adds support for SMSC LAN95XX based USB 2.0 This option adds support for SMSC LAN95XX based USB 2.0
10/100 Ethernet adapters. 10/100 Ethernet adapters.
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include <linux/of_net.h> #include <linux/of_net.h>
#include <linux/mdio.h> #include <linux/mdio.h>
#include <linux/phy.h> #include <linux/phy.h>
#include <net/selftests.h>
#include "smsc95xx.h" #include "smsc95xx.h"
#define SMSC_CHIPNAME "smsc95xx" #define SMSC_CHIPNAME "smsc95xx"
...@@ -727,6 +729,26 @@ static u32 smsc95xx_get_link(struct net_device *net) ...@@ -727,6 +729,26 @@ static u32 smsc95xx_get_link(struct net_device *net)
return net->phydev->link; return net->phydev->link;
} }
static void smsc95xx_ethtool_get_strings(struct net_device *netdev, u32 sset,
u8 *data)
{
switch (sset) {
case ETH_SS_TEST:
net_selftest_get_strings(data);
break;
}
}
static int smsc95xx_ethtool_get_sset_count(struct net_device *ndev, int sset)
{
switch (sset) {
case ETH_SS_TEST:
return net_selftest_get_count();
default:
return -EOPNOTSUPP;
}
}
static const struct ethtool_ops smsc95xx_ethtool_ops = { static const struct ethtool_ops smsc95xx_ethtool_ops = {
.get_link = smsc95xx_get_link, .get_link = smsc95xx_get_link,
.nway_reset = phy_ethtool_nway_reset, .nway_reset = phy_ethtool_nway_reset,
...@@ -743,6 +765,9 @@ static const struct ethtool_ops smsc95xx_ethtool_ops = { ...@@ -743,6 +765,9 @@ static const struct ethtool_ops smsc95xx_ethtool_ops = {
.get_link_ksettings = phy_ethtool_get_link_ksettings, .get_link_ksettings = phy_ethtool_get_link_ksettings,
.set_link_ksettings = phy_ethtool_set_link_ksettings, .set_link_ksettings = phy_ethtool_set_link_ksettings,
.get_ts_info = ethtool_op_get_ts_info, .get_ts_info = ethtool_op_get_ts_info,
.self_test = net_selftest,
.get_strings = smsc95xx_ethtool_get_strings,
.get_sset_count = smsc95xx_ethtool_get_sset_count,
}; };
static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
......
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