diff options
Diffstat (limited to 'drivers/net/benet/be_ethtool.c')
-rw-r--r-- | drivers/net/benet/be_ethtool.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c index 298b92cbd689..da66d15e2223 100644 --- a/drivers/net/benet/be_ethtool.c +++ b/drivers/net/benet/be_ethtool.c | |||
@@ -118,6 +118,7 @@ static const char et_self_tests[][ETH_GSTRING_LEN] = { | |||
118 | #define BE_MAC_LOOPBACK 0x0 | 118 | #define BE_MAC_LOOPBACK 0x0 |
119 | #define BE_PHY_LOOPBACK 0x1 | 119 | #define BE_PHY_LOOPBACK 0x1 |
120 | #define BE_ONE_PORT_EXT_LOOPBACK 0x2 | 120 | #define BE_ONE_PORT_EXT_LOOPBACK 0x2 |
121 | #define BE_NO_LOOPBACK 0xff | ||
121 | 122 | ||
122 | static void | 123 | static void |
123 | be_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) | 124 | be_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) |
@@ -489,6 +490,19 @@ err: | |||
489 | return ret; | 490 | return ret; |
490 | } | 491 | } |
491 | 492 | ||
493 | static u64 be_loopback_test(struct be_adapter *adapter, u8 loopback_type, | ||
494 | u64 *status) | ||
495 | { | ||
496 | be_cmd_set_loopback(adapter, adapter->port_num, | ||
497 | loopback_type, 1); | ||
498 | *status = be_cmd_loopback_test(adapter, adapter->port_num, | ||
499 | loopback_type, 1500, | ||
500 | 2, 0xabc); | ||
501 | be_cmd_set_loopback(adapter, adapter->port_num, | ||
502 | BE_NO_LOOPBACK, 1); | ||
503 | return *status; | ||
504 | } | ||
505 | |||
492 | static void | 506 | static void |
493 | be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) | 507 | be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) |
494 | { | 508 | { |
@@ -497,23 +511,18 @@ be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) | |||
497 | memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM); | 511 | memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM); |
498 | 512 | ||
499 | if (test->flags & ETH_TEST_FL_OFFLINE) { | 513 | if (test->flags & ETH_TEST_FL_OFFLINE) { |
500 | data[0] = be_cmd_loopback_test(adapter, adapter->port_num, | 514 | if (be_loopback_test(adapter, BE_MAC_LOOPBACK, |
501 | BE_MAC_LOOPBACK, 1500, | 515 | &data[0]) != 0) { |
502 | 2, 0xabc); | ||
503 | if (data[0] != 0) | ||
504 | test->flags |= ETH_TEST_FL_FAILED; | 516 | test->flags |= ETH_TEST_FL_FAILED; |
505 | 517 | } | |
506 | data[1] = be_cmd_loopback_test(adapter, adapter->port_num, | 518 | if (be_loopback_test(adapter, BE_PHY_LOOPBACK, |
507 | BE_PHY_LOOPBACK, 1500, | 519 | &data[1]) != 0) { |
508 | 2, 0xabc); | ||
509 | if (data[1] != 0) | ||
510 | test->flags |= ETH_TEST_FL_FAILED; | 520 | test->flags |= ETH_TEST_FL_FAILED; |
511 | 521 | } | |
512 | data[2] = be_cmd_loopback_test(adapter, adapter->port_num, | 522 | if (be_loopback_test(adapter, BE_ONE_PORT_EXT_LOOPBACK, |
513 | BE_ONE_PORT_EXT_LOOPBACK, | 523 | &data[2]) != 0) { |
514 | 1500, 2, 0xabc); | ||
515 | if (data[2] != 0) | ||
516 | test->flags |= ETH_TEST_FL_FAILED; | 524 | test->flags |= ETH_TEST_FL_FAILED; |
525 | } | ||
517 | 526 | ||
518 | data[3] = be_test_ddr_dma(adapter); | 527 | data[3] = be_test_ddr_dma(adapter); |
519 | if (data[3] != 0) | 528 | if (data[3] != 0) |