aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/benet/be_ethtool.c
diff options
context:
space:
mode:
authorSarveshwar Bandi <sarveshwarb@serverengines.com>2009-12-22 23:41:44 -0500
committerDavid S. Miller <davem@davemloft.net>2009-12-23 23:58:14 -0500
commitfced9999ed7f6975fbb2350a73048918ba60a773 (patch)
treeec62516793df52ef31d7a0f1ddeeddec5aa1b3df /drivers/net/benet/be_ethtool.c
parentd7b901418250f00eaaa18f9135d09ba61b72a5bc (diff)
be2net: Bug fix to config NIC appropriately before loopback test
NIC controller has to be set to an appropriate mode before doing a loopback test. Test will fail otherwise. Signed-off-by: Sarveshwar Bandi <sarveshwarb@serverengines.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet/be_ethtool.c')
-rw-r--r--drivers/net/benet/be_ethtool.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
index 298b92cbd68..da66d15e222 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
122static void 123static void
123be_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) 124be_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
493static 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
492static void 506static void
493be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) 507be_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)