diff options
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r-- | drivers/net/tg3.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index ab2fa213b301..30349c5fd73c 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -7281,6 +7281,32 @@ out: | |||
7281 | return err; | 7281 | return err; |
7282 | } | 7282 | } |
7283 | 7283 | ||
7284 | #define TG3_SERDES_TIMEOUT_SEC 2 | ||
7285 | #define TG3_COPPER_TIMEOUT_SEC 6 | ||
7286 | |||
7287 | static int tg3_test_link(struct tg3 *tp) | ||
7288 | { | ||
7289 | int i, max; | ||
7290 | |||
7291 | if (!netif_running(tp->dev)) | ||
7292 | return -ENODEV; | ||
7293 | |||
7294 | if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) | ||
7295 | max = TG3_SERDES_TIMEOUT_SEC; | ||
7296 | else | ||
7297 | max = TG3_COPPER_TIMEOUT_SEC; | ||
7298 | |||
7299 | for (i = 0; i < max; i++) { | ||
7300 | if (netif_carrier_ok(tp->dev)) | ||
7301 | return 0; | ||
7302 | |||
7303 | if (msleep_interruptible(1000)) | ||
7304 | break; | ||
7305 | } | ||
7306 | |||
7307 | return -EIO; | ||
7308 | } | ||
7309 | |||
7284 | static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest, | 7310 | static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest, |
7285 | u64 *data) | 7311 | u64 *data) |
7286 | { | 7312 | { |
@@ -7292,6 +7318,10 @@ static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest, | |||
7292 | etest->flags |= ETH_TEST_FL_FAILED; | 7318 | etest->flags |= ETH_TEST_FL_FAILED; |
7293 | data[0] = 1; | 7319 | data[0] = 1; |
7294 | } | 7320 | } |
7321 | if (tg3_test_link(tp) != 0) { | ||
7322 | etest->flags |= ETH_TEST_FL_FAILED; | ||
7323 | data[1] = 1; | ||
7324 | } | ||
7295 | } | 7325 | } |
7296 | 7326 | ||
7297 | static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 7327 | static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |