aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/broadcom/bnx2x
diff options
context:
space:
mode:
authorMerav Sicron <meravs@broadcom.com>2012-06-19 03:48:23 -0400
committerDavid S. Miller <davem@davemloft.net>2012-06-19 17:34:34 -0400
commitcf2c1df62e065bfc15e38daf2d3479a56b320f29 (patch)
tree1fa246ecbcd525ba8181369ce379f85ef49ed2ba /drivers/net/ethernet/broadcom/bnx2x
parent8970b2e4393a34ddf5832f9c1568a88087b0d948 (diff)
bnx2x: Return only online tests for MF
1. In multi-function device, show only the online tests in self-test results as only these test are performed (offline tests cannot be performed as they may corrupt the traffic of other functions on the same physical port). Note that multi-function mode cannot change while the driver is up. 2. Check result code in NIC load and act accordingly. Signed-off-by: Merav Sicron <meravs@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnx2x')
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x.h6
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c85
2 files changed, 62 insertions, 29 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index 4335f9f51e6f..8ee4bfc1b0bb 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -1900,8 +1900,10 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
1900#define PCICFG_LINK_SPEED 0xf0000 1900#define PCICFG_LINK_SPEED 0xf0000
1901#define PCICFG_LINK_SPEED_SHIFT 16 1901#define PCICFG_LINK_SPEED_SHIFT 16
1902 1902
1903 1903#define BNX2X_NUM_TESTS_SF 7
1904#define BNX2X_NUM_TESTS 8 1904#define BNX2X_NUM_TESTS_MF 3
1905#define BNX2X_NUM_TESTS(bp) (IS_MF(bp) ? BNX2X_NUM_TESTS_MF : \
1906 BNX2X_NUM_TESTS_SF)
1905 1907
1906#define BNX2X_PHY_LOOPBACK 0 1908#define BNX2X_PHY_LOOPBACK 0
1907#define BNX2X_MAC_LOOPBACK 1 1909#define BNX2X_MAC_LOOPBACK 1
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index 68fa902511dc..ed2b49a0c5a5 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -826,7 +826,7 @@ static void bnx2x_get_drvinfo(struct net_device *dev,
826 ((phy_fw_ver[0] != '\0') ? " phy " : ""), phy_fw_ver); 826 ((phy_fw_ver[0] != '\0') ? " phy " : ""), phy_fw_ver);
827 strlcpy(info->bus_info, pci_name(bp->pdev), sizeof(info->bus_info)); 827 strlcpy(info->bus_info, pci_name(bp->pdev), sizeof(info->bus_info));
828 info->n_stats = BNX2X_NUM_STATS; 828 info->n_stats = BNX2X_NUM_STATS;
829 info->testinfo_len = BNX2X_NUM_TESTS; 829 info->testinfo_len = BNX2X_NUM_TESTS(bp);
830 info->eedump_len = bp->common.flash_size; 830 info->eedump_len = bp->common.flash_size;
831 info->regdump_len = bnx2x_get_regs_len(dev); 831 info->regdump_len = bnx2x_get_regs_len(dev);
832} 832}
@@ -1533,17 +1533,14 @@ static int bnx2x_set_pauseparam(struct net_device *dev,
1533 return 0; 1533 return 0;
1534} 1534}
1535 1535
1536static const struct { 1536char *bnx2x_tests_str_arr[BNX2X_NUM_TESTS_SF] = {
1537 char string[ETH_GSTRING_LEN]; 1537 "register_test (offline) ",
1538} bnx2x_tests_str_arr[BNX2X_NUM_TESTS] = { 1538 "memory_test (offline) ",
1539 { "register_test (offline)" }, 1539 "int_loopback_test (offline)",
1540 { "memory_test (offline)" }, 1540 "ext_loopback_test (offline)",
1541 { "int_loopback_test (offline)" }, 1541 "nvram_test (online) ",
1542 { "ext_loopback_test (offline)" }, 1542 "interrupt_test (online) ",
1543 { "nvram_test (online)" }, 1543 "link_test (online) "
1544 { "interrupt_test (online)" },
1545 { "link_test (online)" },
1546 { "idle check (online)" }
1547}; 1544};
1548 1545
1549static u32 bnx2x_eee_to_adv(u32 eee_adv) 1546static u32 bnx2x_eee_to_adv(u32 eee_adv)
@@ -2308,6 +2305,8 @@ static void bnx2x_self_test(struct net_device *dev,
2308{ 2305{
2309 struct bnx2x *bp = netdev_priv(dev); 2306 struct bnx2x *bp = netdev_priv(dev);
2310 u8 is_serdes; 2307 u8 is_serdes;
2308 int rc;
2309
2311 if (bp->recovery_state != BNX2X_RECOVERY_DONE) { 2310 if (bp->recovery_state != BNX2X_RECOVERY_DONE) {
2312 netdev_err(bp->dev, 2311 netdev_err(bp->dev,
2313 "Handling parity error recovery. Try again later\n"); 2312 "Handling parity error recovery. Try again later\n");
@@ -2319,17 +2318,18 @@ static void bnx2x_self_test(struct net_device *dev,
2319 (etest->flags & ETH_TEST_FL_OFFLINE), 2318 (etest->flags & ETH_TEST_FL_OFFLINE),
2320 (etest->flags & ETH_TEST_FL_EXTERNAL_LB)>>2); 2319 (etest->flags & ETH_TEST_FL_EXTERNAL_LB)>>2);
2321 2320
2322 memset(buf, 0, sizeof(u64) * BNX2X_NUM_TESTS); 2321 memset(buf, 0, sizeof(u64) * BNX2X_NUM_TESTS(bp));
2323 2322
2324 if (!netif_running(dev)) 2323 if (!netif_running(dev)) {
2324 DP(BNX2X_MSG_ETHTOOL,
2325 "Can't perform self-test when interface is down\n");
2325 return; 2326 return;
2327 }
2326 2328
2327 /* offline tests are not supported in MF mode */
2328 if (IS_MF(bp))
2329 etest->flags &= ~ETH_TEST_FL_OFFLINE;
2330 is_serdes = (bp->link_vars.link_status & LINK_STATUS_SERDES_LINK) > 0; 2329 is_serdes = (bp->link_vars.link_status & LINK_STATUS_SERDES_LINK) > 0;
2331 2330
2332 if (etest->flags & ETH_TEST_FL_OFFLINE) { 2331 /* offline tests are not supported in MF mode */
2332 if ((etest->flags & ETH_TEST_FL_OFFLINE) && !IS_MF(bp)) {
2333 int port = BP_PORT(bp); 2333 int port = BP_PORT(bp);
2334 u32 val; 2334 u32 val;
2335 u8 link_up; 2335 u8 link_up;
@@ -2342,7 +2342,14 @@ static void bnx2x_self_test(struct net_device *dev,
2342 link_up = bp->link_vars.link_up; 2342 link_up = bp->link_vars.link_up;
2343 2343
2344 bnx2x_nic_unload(bp, UNLOAD_NORMAL); 2344 bnx2x_nic_unload(bp, UNLOAD_NORMAL);
2345 bnx2x_nic_load(bp, LOAD_DIAG); 2345 rc = bnx2x_nic_load(bp, LOAD_DIAG);
2346 if (rc) {
2347 etest->flags |= ETH_TEST_FL_FAILED;
2348 DP(BNX2X_MSG_ETHTOOL,
2349 "Can't perform self-test, nic_load (for offline) failed\n");
2350 return;
2351 }
2352
2346 /* wait until link state is restored */ 2353 /* wait until link state is restored */
2347 bnx2x_wait_for_link(bp, 1, is_serdes); 2354 bnx2x_wait_for_link(bp, 1, is_serdes);
2348 2355
@@ -2370,22 +2377,36 @@ static void bnx2x_self_test(struct net_device *dev,
2370 2377
2371 /* restore input for TX port IF */ 2378 /* restore input for TX port IF */
2372 REG_WR(bp, NIG_REG_EGRESS_UMP0_IN_EN + port*4, val); 2379 REG_WR(bp, NIG_REG_EGRESS_UMP0_IN_EN + port*4, val);
2373 2380 rc = bnx2x_nic_load(bp, LOAD_NORMAL);
2374 bnx2x_nic_load(bp, LOAD_NORMAL); 2381 if (rc) {
2382 etest->flags |= ETH_TEST_FL_FAILED;
2383 DP(BNX2X_MSG_ETHTOOL,
2384 "Can't perform self-test, nic_load (for online) failed\n");
2385 return;
2386 }
2375 /* wait until link state is restored */ 2387 /* wait until link state is restored */
2376 bnx2x_wait_for_link(bp, link_up, is_serdes); 2388 bnx2x_wait_for_link(bp, link_up, is_serdes);
2377 } 2389 }
2378 if (bnx2x_test_nvram(bp) != 0) { 2390 if (bnx2x_test_nvram(bp) != 0) {
2379 buf[4] = 1; 2391 if (!IS_MF(bp))
2392 buf[4] = 1;
2393 else
2394 buf[0] = 1;
2380 etest->flags |= ETH_TEST_FL_FAILED; 2395 etest->flags |= ETH_TEST_FL_FAILED;
2381 } 2396 }
2382 if (bnx2x_test_intr(bp) != 0) { 2397 if (bnx2x_test_intr(bp) != 0) {
2383 buf[5] = 1; 2398 if (!IS_MF(bp))
2399 buf[5] = 1;
2400 else
2401 buf[1] = 1;
2384 etest->flags |= ETH_TEST_FL_FAILED; 2402 etest->flags |= ETH_TEST_FL_FAILED;
2385 } 2403 }
2386 2404
2387 if (bnx2x_link_test(bp, is_serdes) != 0) { 2405 if (bnx2x_link_test(bp, is_serdes) != 0) {
2388 buf[6] = 1; 2406 if (!IS_MF(bp))
2407 buf[6] = 1;
2408 else
2409 buf[2] = 1;
2389 etest->flags |= ETH_TEST_FL_FAILED; 2410 etest->flags |= ETH_TEST_FL_FAILED;
2390 } 2411 }
2391 2412
@@ -2430,7 +2451,7 @@ static int bnx2x_get_sset_count(struct net_device *dev, int stringset)
2430 return num_stats; 2451 return num_stats;
2431 2452
2432 case ETH_SS_TEST: 2453 case ETH_SS_TEST:
2433 return BNX2X_NUM_TESTS; 2454 return BNX2X_NUM_TESTS(bp);
2434 2455
2435 default: 2456 default:
2436 return -EINVAL; 2457 return -EINVAL;
@@ -2440,7 +2461,7 @@ static int bnx2x_get_sset_count(struct net_device *dev, int stringset)
2440static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf) 2461static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
2441{ 2462{
2442 struct bnx2x *bp = netdev_priv(dev); 2463 struct bnx2x *bp = netdev_priv(dev);
2443 int i, j, k; 2464 int i, j, k, offset, start;
2444 char queue_name[MAX_QUEUE_NAME_LEN+1]; 2465 char queue_name[MAX_QUEUE_NAME_LEN+1];
2445 2466
2446 switch (stringset) { 2467 switch (stringset) {
@@ -2471,7 +2492,17 @@ static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
2471 break; 2492 break;
2472 2493
2473 case ETH_SS_TEST: 2494 case ETH_SS_TEST:
2474 memcpy(buf, bnx2x_tests_str_arr, sizeof(bnx2x_tests_str_arr)); 2495 /* First 4 tests cannot be done in MF mode */
2496 if (!IS_MF(bp))
2497 start = 0;
2498 else
2499 start = 4;
2500 for (i = 0, j = start; j < (start + BNX2X_NUM_TESTS(bp));
2501 i++, j++) {
2502 offset = sprintf(buf+32*i, "%s",
2503 bnx2x_tests_str_arr[j]);
2504 *(buf+offset) = '\0';
2505 }
2475 break; 2506 break;
2476 } 2507 }
2477} 2508}