be2net: Add link test to list of ethtool self tests.
authorSarveshwar Bandi <sarveshwarb@serverengines.com>
Tue, 19 Jan 2010 05:15:36 +0000 (05:15 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 22 Jan 2010 06:49:51 +0000 (22:49 -0800)
Signed-off-by: Sarveshwar Bandi <sarveshwarb@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/benet/be_ethtool.c

index 2f2ebbd678f20b693a9687359fe4b6dc694a2c4c..09d8899b2de93c3382daf374e74742bc42fabf3c 100644 (file)
@@ -112,6 +112,7 @@ static const char et_self_tests[][ETH_GSTRING_LEN] = {
        "PHY Loopback test",
        "External Loopback test",
        "DDR DMA test"
+       "Link test"
 };
 
 #define ETHTOOL_TESTS_NUM ARRAY_SIZE(et_self_tests)
@@ -529,6 +530,9 @@ static void
 be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data)
 {
        struct be_adapter *adapter = netdev_priv(netdev);
+       bool link_up;
+       u8 mac_speed = 0;
+       u16 qos_link_speed = 0;
 
        memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM);
 
@@ -552,6 +556,13 @@ be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data)
                test->flags |= ETH_TEST_FL_FAILED;
        }
 
+       if (be_cmd_link_status_query(adapter, &link_up, &mac_speed,
+                               &qos_link_speed) != 0) {
+               test->flags |= ETH_TEST_FL_FAILED;
+               data[4] = -1;
+       } else if (mac_speed) {
+               data[4] = 1;
+       }
 }
 
 static int