diff options
author | David S. Miller <davem@davemloft.net> | 2009-01-26 20:43:16 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-26 20:43:16 -0500 |
commit | 3eacdf58c2c0b9507afedfc19108e98b992c31e4 (patch) | |
tree | d95e7e022ff6e6181edce43fe97cf2883b5a91ed /drivers/net/bnx2x_main.c | |
parent | dd0a251c8e087bca05e8f9a3657078591ae6e12b (diff) | |
parent | 5376071069ec8a7e6a8112beab16fc24f5139475 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Diffstat (limited to 'drivers/net/bnx2x_main.c')
-rw-r--r-- | drivers/net/bnx2x_main.c | 217 |
1 files changed, 127 insertions, 90 deletions
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c index 21764bfc048e..71f81c79d638 100644 --- a/drivers/net/bnx2x_main.c +++ b/drivers/net/bnx2x_main.c | |||
@@ -57,8 +57,8 @@ | |||
57 | #include "bnx2x.h" | 57 | #include "bnx2x.h" |
58 | #include "bnx2x_init.h" | 58 | #include "bnx2x_init.h" |
59 | 59 | ||
60 | #define DRV_MODULE_VERSION "1.45.24" | 60 | #define DRV_MODULE_VERSION "1.45.26" |
61 | #define DRV_MODULE_RELDATE "2009/01/14" | 61 | #define DRV_MODULE_RELDATE "2009/01/26" |
62 | #define BNX2X_BC_VER 0x040200 | 62 | #define BNX2X_BC_VER 0x040200 |
63 | 63 | ||
64 | /* Time in jiffies before concluding the transmitter is hung */ | 64 | /* Time in jiffies before concluding the transmitter is hung */ |
@@ -740,8 +740,15 @@ static inline int bnx2x_has_tx_work(struct bnx2x_fastpath *fp) | |||
740 | /* Tell compiler that status block fields can change */ | 740 | /* Tell compiler that status block fields can change */ |
741 | barrier(); | 741 | barrier(); |
742 | tx_cons_sb = le16_to_cpu(*fp->tx_cons_sb); | 742 | tx_cons_sb = le16_to_cpu(*fp->tx_cons_sb); |
743 | return ((fp->tx_pkt_prod != tx_cons_sb) || | 743 | return (fp->tx_pkt_cons != tx_cons_sb); |
744 | (fp->tx_pkt_prod != fp->tx_pkt_cons)); | 744 | } |
745 | |||
746 | static inline int bnx2x_has_tx_work_unload(struct bnx2x_fastpath *fp) | ||
747 | { | ||
748 | /* Tell compiler that consumer and producer can change */ | ||
749 | barrier(); | ||
750 | return (fp->tx_pkt_prod != fp->tx_pkt_cons); | ||
751 | |||
745 | } | 752 | } |
746 | 753 | ||
747 | /* free skb in the packet ring at pos idx | 754 | /* free skb in the packet ring at pos idx |
@@ -5148,12 +5155,21 @@ static void enable_blocks_attention(struct bnx2x *bp) | |||
5148 | } | 5155 | } |
5149 | 5156 | ||
5150 | 5157 | ||
5158 | static void bnx2x_reset_common(struct bnx2x *bp) | ||
5159 | { | ||
5160 | /* reset_common */ | ||
5161 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_CLEAR, | ||
5162 | 0xd3ffff7f); | ||
5163 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR, 0x1403); | ||
5164 | } | ||
5165 | |||
5151 | static int bnx2x_init_common(struct bnx2x *bp) | 5166 | static int bnx2x_init_common(struct bnx2x *bp) |
5152 | { | 5167 | { |
5153 | u32 val, i; | 5168 | u32 val, i; |
5154 | 5169 | ||
5155 | DP(BNX2X_MSG_MCP, "starting common init func %d\n", BP_FUNC(bp)); | 5170 | DP(BNX2X_MSG_MCP, "starting common init func %d\n", BP_FUNC(bp)); |
5156 | 5171 | ||
5172 | bnx2x_reset_common(bp); | ||
5157 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 0xffffffff); | 5173 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 0xffffffff); |
5158 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET, 0xfffc); | 5174 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET, 0xfffc); |
5159 | 5175 | ||
@@ -6134,8 +6150,8 @@ static void bnx2x_netif_start(struct bnx2x *bp) | |||
6134 | static void bnx2x_netif_stop(struct bnx2x *bp, int disable_hw) | 6150 | static void bnx2x_netif_stop(struct bnx2x *bp, int disable_hw) |
6135 | { | 6151 | { |
6136 | bnx2x_int_disable_sync(bp, disable_hw); | 6152 | bnx2x_int_disable_sync(bp, disable_hw); |
6153 | bnx2x_napi_disable(bp); | ||
6137 | if (netif_running(bp->dev)) { | 6154 | if (netif_running(bp->dev)) { |
6138 | bnx2x_napi_disable(bp); | ||
6139 | netif_tx_disable(bp->dev); | 6155 | netif_tx_disable(bp->dev); |
6140 | bp->dev->trans_start = jiffies; /* prevent tx timeout */ | 6156 | bp->dev->trans_start = jiffies; /* prevent tx timeout */ |
6141 | } | 6157 | } |
@@ -6319,7 +6335,7 @@ static void bnx2x_set_rx_mode(struct net_device *dev); | |||
6319 | static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | 6335 | static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) |
6320 | { | 6336 | { |
6321 | u32 load_code; | 6337 | u32 load_code; |
6322 | int i, rc; | 6338 | int i, rc = 0; |
6323 | #ifdef BNX2X_STOP_ON_ERROR | 6339 | #ifdef BNX2X_STOP_ON_ERROR |
6324 | if (unlikely(bp->panic)) | 6340 | if (unlikely(bp->panic)) |
6325 | return -EPERM; | 6341 | return -EPERM; |
@@ -6327,48 +6343,6 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
6327 | 6343 | ||
6328 | bp->state = BNX2X_STATE_OPENING_WAIT4_LOAD; | 6344 | bp->state = BNX2X_STATE_OPENING_WAIT4_LOAD; |
6329 | 6345 | ||
6330 | /* Send LOAD_REQUEST command to MCP | ||
6331 | Returns the type of LOAD command: | ||
6332 | if it is the first port to be initialized | ||
6333 | common blocks should be initialized, otherwise - not | ||
6334 | */ | ||
6335 | if (!BP_NOMCP(bp)) { | ||
6336 | load_code = bnx2x_fw_command(bp, DRV_MSG_CODE_LOAD_REQ); | ||
6337 | if (!load_code) { | ||
6338 | BNX2X_ERR("MCP response failure, aborting\n"); | ||
6339 | return -EBUSY; | ||
6340 | } | ||
6341 | if (load_code == FW_MSG_CODE_DRV_LOAD_REFUSED) | ||
6342 | return -EBUSY; /* other port in diagnostic mode */ | ||
6343 | |||
6344 | } else { | ||
6345 | int port = BP_PORT(bp); | ||
6346 | |||
6347 | DP(NETIF_MSG_IFUP, "NO MCP load counts before us %d, %d, %d\n", | ||
6348 | load_count[0], load_count[1], load_count[2]); | ||
6349 | load_count[0]++; | ||
6350 | load_count[1 + port]++; | ||
6351 | DP(NETIF_MSG_IFUP, "NO MCP new load counts %d, %d, %d\n", | ||
6352 | load_count[0], load_count[1], load_count[2]); | ||
6353 | if (load_count[0] == 1) | ||
6354 | load_code = FW_MSG_CODE_DRV_LOAD_COMMON; | ||
6355 | else if (load_count[1 + port] == 1) | ||
6356 | load_code = FW_MSG_CODE_DRV_LOAD_PORT; | ||
6357 | else | ||
6358 | load_code = FW_MSG_CODE_DRV_LOAD_FUNCTION; | ||
6359 | } | ||
6360 | |||
6361 | if ((load_code == FW_MSG_CODE_DRV_LOAD_COMMON) || | ||
6362 | (load_code == FW_MSG_CODE_DRV_LOAD_PORT)) | ||
6363 | bp->port.pmf = 1; | ||
6364 | else | ||
6365 | bp->port.pmf = 0; | ||
6366 | DP(NETIF_MSG_LINK, "pmf %d\n", bp->port.pmf); | ||
6367 | |||
6368 | /* if we can't use MSI-X we only need one fp, | ||
6369 | * so try to enable MSI-X with the requested number of fp's | ||
6370 | * and fallback to inta with one fp | ||
6371 | */ | ||
6372 | if (use_inta) { | 6346 | if (use_inta) { |
6373 | bp->num_queues = 1; | 6347 | bp->num_queues = 1; |
6374 | 6348 | ||
@@ -6383,7 +6357,15 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
6383 | else | 6357 | else |
6384 | bp->num_queues = 1; | 6358 | bp->num_queues = 1; |
6385 | 6359 | ||
6386 | if (bnx2x_enable_msix(bp)) { | 6360 | DP(NETIF_MSG_IFUP, |
6361 | "set number of queues to %d\n", bp->num_queues); | ||
6362 | |||
6363 | /* if we can't use MSI-X we only need one fp, | ||
6364 | * so try to enable MSI-X with the requested number of fp's | ||
6365 | * and fallback to MSI or legacy INTx with one fp | ||
6366 | */ | ||
6367 | rc = bnx2x_enable_msix(bp); | ||
6368 | if (rc) { | ||
6387 | /* failed to enable MSI-X */ | 6369 | /* failed to enable MSI-X */ |
6388 | bp->num_queues = 1; | 6370 | bp->num_queues = 1; |
6389 | if (use_multi) | 6371 | if (use_multi) |
@@ -6391,8 +6373,6 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
6391 | " to enable MSI-X\n"); | 6373 | " to enable MSI-X\n"); |
6392 | } | 6374 | } |
6393 | } | 6375 | } |
6394 | DP(NETIF_MSG_IFUP, | ||
6395 | "set number of queues to %d\n", bp->num_queues); | ||
6396 | 6376 | ||
6397 | if (bnx2x_alloc_mem(bp)) | 6377 | if (bnx2x_alloc_mem(bp)) |
6398 | return -ENOMEM; | 6378 | return -ENOMEM; |
@@ -6401,30 +6381,85 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
6401 | bnx2x_fp(bp, i, disable_tpa) = | 6381 | bnx2x_fp(bp, i, disable_tpa) = |
6402 | ((bp->flags & TPA_ENABLE_FLAG) == 0); | 6382 | ((bp->flags & TPA_ENABLE_FLAG) == 0); |
6403 | 6383 | ||
6384 | for_each_queue(bp, i) | ||
6385 | netif_napi_add(bp->dev, &bnx2x_fp(bp, i, napi), | ||
6386 | bnx2x_poll, 128); | ||
6387 | |||
6388 | #ifdef BNX2X_STOP_ON_ERROR | ||
6389 | for_each_queue(bp, i) { | ||
6390 | struct bnx2x_fastpath *fp = &bp->fp[i]; | ||
6391 | |||
6392 | fp->poll_no_work = 0; | ||
6393 | fp->poll_calls = 0; | ||
6394 | fp->poll_max_calls = 0; | ||
6395 | fp->poll_complete = 0; | ||
6396 | fp->poll_exit = 0; | ||
6397 | } | ||
6398 | #endif | ||
6399 | bnx2x_napi_enable(bp); | ||
6400 | |||
6404 | if (bp->flags & USING_MSIX_FLAG) { | 6401 | if (bp->flags & USING_MSIX_FLAG) { |
6405 | rc = bnx2x_req_msix_irqs(bp); | 6402 | rc = bnx2x_req_msix_irqs(bp); |
6406 | if (rc) { | 6403 | if (rc) { |
6407 | pci_disable_msix(bp->pdev); | 6404 | pci_disable_msix(bp->pdev); |
6408 | goto load_error; | 6405 | goto load_error1; |
6409 | } | 6406 | } |
6407 | printk(KERN_INFO PFX "%s: using MSI-X\n", bp->dev->name); | ||
6410 | } else { | 6408 | } else { |
6411 | bnx2x_ack_int(bp); | 6409 | bnx2x_ack_int(bp); |
6412 | rc = bnx2x_req_irq(bp); | 6410 | rc = bnx2x_req_irq(bp); |
6413 | if (rc) { | 6411 | if (rc) { |
6414 | BNX2X_ERR("IRQ request failed, aborting\n"); | 6412 | BNX2X_ERR("IRQ request failed rc %d, aborting\n", rc); |
6415 | goto load_error; | 6413 | goto load_error1; |
6416 | } | 6414 | } |
6417 | } | 6415 | } |
6418 | 6416 | ||
6419 | for_each_queue(bp, i) | 6417 | /* Send LOAD_REQUEST command to MCP |
6420 | netif_napi_add(bp->dev, &bnx2x_fp(bp, i, napi), | 6418 | Returns the type of LOAD command: |
6421 | bnx2x_poll, 128); | 6419 | if it is the first port to be initialized |
6420 | common blocks should be initialized, otherwise - not | ||
6421 | */ | ||
6422 | if (!BP_NOMCP(bp)) { | ||
6423 | load_code = bnx2x_fw_command(bp, DRV_MSG_CODE_LOAD_REQ); | ||
6424 | if (!load_code) { | ||
6425 | BNX2X_ERR("MCP response failure, aborting\n"); | ||
6426 | rc = -EBUSY; | ||
6427 | goto load_error2; | ||
6428 | } | ||
6429 | if (load_code == FW_MSG_CODE_DRV_LOAD_REFUSED) { | ||
6430 | rc = -EBUSY; /* other port in diagnostic mode */ | ||
6431 | goto load_error2; | ||
6432 | } | ||
6433 | |||
6434 | } else { | ||
6435 | int port = BP_PORT(bp); | ||
6436 | |||
6437 | DP(NETIF_MSG_IFUP, "NO MCP load counts before us %d, %d, %d\n", | ||
6438 | load_count[0], load_count[1], load_count[2]); | ||
6439 | load_count[0]++; | ||
6440 | load_count[1 + port]++; | ||
6441 | DP(NETIF_MSG_IFUP, "NO MCP new load counts %d, %d, %d\n", | ||
6442 | load_count[0], load_count[1], load_count[2]); | ||
6443 | if (load_count[0] == 1) | ||
6444 | load_code = FW_MSG_CODE_DRV_LOAD_COMMON; | ||
6445 | else if (load_count[1 + port] == 1) | ||
6446 | load_code = FW_MSG_CODE_DRV_LOAD_PORT; | ||
6447 | else | ||
6448 | load_code = FW_MSG_CODE_DRV_LOAD_FUNCTION; | ||
6449 | } | ||
6450 | |||
6451 | if ((load_code == FW_MSG_CODE_DRV_LOAD_COMMON) || | ||
6452 | (load_code == FW_MSG_CODE_DRV_LOAD_PORT)) | ||
6453 | bp->port.pmf = 1; | ||
6454 | else | ||
6455 | bp->port.pmf = 0; | ||
6456 | DP(NETIF_MSG_LINK, "pmf %d\n", bp->port.pmf); | ||
6422 | 6457 | ||
6423 | /* Initialize HW */ | 6458 | /* Initialize HW */ |
6424 | rc = bnx2x_init_hw(bp, load_code); | 6459 | rc = bnx2x_init_hw(bp, load_code); |
6425 | if (rc) { | 6460 | if (rc) { |
6426 | BNX2X_ERR("HW init failed, aborting\n"); | 6461 | BNX2X_ERR("HW init failed, aborting\n"); |
6427 | goto load_int_disable; | 6462 | goto load_error2; |
6428 | } | 6463 | } |
6429 | 6464 | ||
6430 | /* Setup NIC internals and enable interrupts */ | 6465 | /* Setup NIC internals and enable interrupts */ |
@@ -6436,7 +6471,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
6436 | if (!load_code) { | 6471 | if (!load_code) { |
6437 | BNX2X_ERR("MCP response failure, aborting\n"); | 6472 | BNX2X_ERR("MCP response failure, aborting\n"); |
6438 | rc = -EBUSY; | 6473 | rc = -EBUSY; |
6439 | goto load_rings_free; | 6474 | goto load_error3; |
6440 | } | 6475 | } |
6441 | } | 6476 | } |
6442 | 6477 | ||
@@ -6445,7 +6480,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
6445 | rc = bnx2x_setup_leading(bp); | 6480 | rc = bnx2x_setup_leading(bp); |
6446 | if (rc) { | 6481 | if (rc) { |
6447 | BNX2X_ERR("Setup leading failed!\n"); | 6482 | BNX2X_ERR("Setup leading failed!\n"); |
6448 | goto load_netif_stop; | 6483 | goto load_error3; |
6449 | } | 6484 | } |
6450 | 6485 | ||
6451 | if (CHIP_IS_E1H(bp)) | 6486 | if (CHIP_IS_E1H(bp)) |
@@ -6458,7 +6493,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
6458 | for_each_nondefault_queue(bp, i) { | 6493 | for_each_nondefault_queue(bp, i) { |
6459 | rc = bnx2x_setup_multi(bp, i); | 6494 | rc = bnx2x_setup_multi(bp, i); |
6460 | if (rc) | 6495 | if (rc) |
6461 | goto load_netif_stop; | 6496 | goto load_error3; |
6462 | } | 6497 | } |
6463 | 6498 | ||
6464 | if (CHIP_IS_E1(bp)) | 6499 | if (CHIP_IS_E1(bp)) |
@@ -6474,18 +6509,18 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
6474 | case LOAD_NORMAL: | 6509 | case LOAD_NORMAL: |
6475 | /* Tx queue should be only reenabled */ | 6510 | /* Tx queue should be only reenabled */ |
6476 | netif_wake_queue(bp->dev); | 6511 | netif_wake_queue(bp->dev); |
6512 | /* Initialize the receive filter. */ | ||
6477 | bnx2x_set_rx_mode(bp->dev); | 6513 | bnx2x_set_rx_mode(bp->dev); |
6478 | break; | 6514 | break; |
6479 | 6515 | ||
6480 | case LOAD_OPEN: | 6516 | case LOAD_OPEN: |
6481 | netif_start_queue(bp->dev); | 6517 | netif_start_queue(bp->dev); |
6518 | /* Initialize the receive filter. */ | ||
6482 | bnx2x_set_rx_mode(bp->dev); | 6519 | bnx2x_set_rx_mode(bp->dev); |
6483 | if (bp->flags & USING_MSIX_FLAG) | ||
6484 | printk(KERN_INFO PFX "%s: using MSI-X\n", | ||
6485 | bp->dev->name); | ||
6486 | break; | 6520 | break; |
6487 | 6521 | ||
6488 | case LOAD_DIAG: | 6522 | case LOAD_DIAG: |
6523 | /* Initialize the receive filter. */ | ||
6489 | bnx2x_set_rx_mode(bp->dev); | 6524 | bnx2x_set_rx_mode(bp->dev); |
6490 | bp->state = BNX2X_STATE_DIAG; | 6525 | bp->state = BNX2X_STATE_DIAG; |
6491 | break; | 6526 | break; |
@@ -6503,20 +6538,25 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
6503 | 6538 | ||
6504 | return 0; | 6539 | return 0; |
6505 | 6540 | ||
6506 | load_netif_stop: | 6541 | load_error3: |
6507 | bnx2x_napi_disable(bp); | 6542 | bnx2x_int_disable_sync(bp, 1); |
6508 | load_rings_free: | 6543 | if (!BP_NOMCP(bp)) { |
6544 | bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_REQ_WOL_MCP); | ||
6545 | bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE); | ||
6546 | } | ||
6547 | bp->port.pmf = 0; | ||
6509 | /* Free SKBs, SGEs, TPA pool and driver internals */ | 6548 | /* Free SKBs, SGEs, TPA pool and driver internals */ |
6510 | bnx2x_free_skbs(bp); | 6549 | bnx2x_free_skbs(bp); |
6511 | for_each_queue(bp, i) | 6550 | for_each_queue(bp, i) |
6512 | bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE); | 6551 | bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE); |
6513 | load_int_disable: | 6552 | load_error2: |
6514 | bnx2x_int_disable_sync(bp, 1); | ||
6515 | /* Release IRQs */ | 6553 | /* Release IRQs */ |
6516 | bnx2x_free_irq(bp); | 6554 | bnx2x_free_irq(bp); |
6517 | load_error: | 6555 | load_error1: |
6556 | bnx2x_napi_disable(bp); | ||
6557 | for_each_queue(bp, i) | ||
6558 | netif_napi_del(&bnx2x_fp(bp, i, napi)); | ||
6518 | bnx2x_free_mem(bp); | 6559 | bnx2x_free_mem(bp); |
6519 | bp->port.pmf = 0; | ||
6520 | 6560 | ||
6521 | /* TBD we really need to reset the chip | 6561 | /* TBD we really need to reset the chip |
6522 | if we want to recover from this */ | 6562 | if we want to recover from this */ |
@@ -6589,6 +6629,7 @@ static int bnx2x_stop_leading(struct bnx2x *bp) | |||
6589 | } | 6629 | } |
6590 | cnt--; | 6630 | cnt--; |
6591 | msleep(1); | 6631 | msleep(1); |
6632 | rmb(); /* Refresh the dsb_sp_prod */ | ||
6592 | } | 6633 | } |
6593 | bp->state = BNX2X_STATE_CLOSING_WAIT4_UNLOAD; | 6634 | bp->state = BNX2X_STATE_CLOSING_WAIT4_UNLOAD; |
6594 | bp->fp[0].state = BNX2X_FP_STATE_CLOSED; | 6635 | bp->fp[0].state = BNX2X_FP_STATE_CLOSED; |
@@ -6640,14 +6681,6 @@ static void bnx2x_reset_port(struct bnx2x *bp) | |||
6640 | /* TODO: Close Doorbell port? */ | 6681 | /* TODO: Close Doorbell port? */ |
6641 | } | 6682 | } |
6642 | 6683 | ||
6643 | static void bnx2x_reset_common(struct bnx2x *bp) | ||
6644 | { | ||
6645 | /* reset_common */ | ||
6646 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_CLEAR, | ||
6647 | 0xd3ffff7f); | ||
6648 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR, 0x1403); | ||
6649 | } | ||
6650 | |||
6651 | static void bnx2x_reset_chip(struct bnx2x *bp, u32 reset_code) | 6684 | static void bnx2x_reset_chip(struct bnx2x *bp, u32 reset_code) |
6652 | { | 6685 | { |
6653 | DP(BNX2X_MSG_MCP, "function %d reset_code %x\n", | 6686 | DP(BNX2X_MSG_MCP, "function %d reset_code %x\n", |
@@ -6688,8 +6721,7 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode) | |||
6688 | bnx2x_set_storm_rx_mode(bp); | 6721 | bnx2x_set_storm_rx_mode(bp); |
6689 | 6722 | ||
6690 | bnx2x_netif_stop(bp, 1); | 6723 | bnx2x_netif_stop(bp, 1); |
6691 | if (!netif_running(bp->dev)) | 6724 | |
6692 | bnx2x_napi_disable(bp); | ||
6693 | del_timer_sync(&bp->timer); | 6725 | del_timer_sync(&bp->timer); |
6694 | SHMEM_WR(bp, func_mb[BP_FUNC(bp)].drv_pulse_mb, | 6726 | SHMEM_WR(bp, func_mb[BP_FUNC(bp)].drv_pulse_mb, |
6695 | (DRV_PULSE_ALWAYS_ALIVE | bp->fw_drv_pulse_wr_seq)); | 6727 | (DRV_PULSE_ALWAYS_ALIVE | bp->fw_drv_pulse_wr_seq)); |
@@ -6704,7 +6736,7 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode) | |||
6704 | 6736 | ||
6705 | cnt = 1000; | 6737 | cnt = 1000; |
6706 | smp_rmb(); | 6738 | smp_rmb(); |
6707 | while (bnx2x_has_tx_work(fp)) { | 6739 | while (bnx2x_has_tx_work_unload(fp)) { |
6708 | 6740 | ||
6709 | bnx2x_tx_int(fp, 1000); | 6741 | bnx2x_tx_int(fp, 1000); |
6710 | if (!cnt) { | 6742 | if (!cnt) { |
@@ -6833,6 +6865,8 @@ unload_error: | |||
6833 | bnx2x_free_skbs(bp); | 6865 | bnx2x_free_skbs(bp); |
6834 | for_each_queue(bp, i) | 6866 | for_each_queue(bp, i) |
6835 | bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE); | 6867 | bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE); |
6868 | for_each_queue(bp, i) | ||
6869 | netif_napi_del(&bnx2x_fp(bp, i, napi)); | ||
6836 | bnx2x_free_mem(bp); | 6870 | bnx2x_free_mem(bp); |
6837 | 6871 | ||
6838 | bp->state = BNX2X_STATE_CLOSED; | 6872 | bp->state = BNX2X_STATE_CLOSED; |
@@ -8723,18 +8757,17 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode, u8 link_up) | |||
8723 | 8757 | ||
8724 | if (loopback_mode == BNX2X_MAC_LOOPBACK) { | 8758 | if (loopback_mode == BNX2X_MAC_LOOPBACK) { |
8725 | bp->link_params.loopback_mode = LOOPBACK_BMAC; | 8759 | bp->link_params.loopback_mode = LOOPBACK_BMAC; |
8726 | bnx2x_acquire_phy_lock(bp); | ||
8727 | bnx2x_phy_init(&bp->link_params, &bp->link_vars); | 8760 | bnx2x_phy_init(&bp->link_params, &bp->link_vars); |
8728 | bnx2x_release_phy_lock(bp); | ||
8729 | 8761 | ||
8730 | } else if (loopback_mode == BNX2X_PHY_LOOPBACK) { | 8762 | } else if (loopback_mode == BNX2X_PHY_LOOPBACK) { |
8763 | u16 cnt = 1000; | ||
8731 | bp->link_params.loopback_mode = LOOPBACK_XGXS_10; | 8764 | bp->link_params.loopback_mode = LOOPBACK_XGXS_10; |
8732 | bnx2x_acquire_phy_lock(bp); | ||
8733 | bnx2x_phy_init(&bp->link_params, &bp->link_vars); | 8765 | bnx2x_phy_init(&bp->link_params, &bp->link_vars); |
8734 | bnx2x_release_phy_lock(bp); | ||
8735 | /* wait until link state is restored */ | 8766 | /* wait until link state is restored */ |
8736 | bnx2x_wait_for_link(bp, link_up); | 8767 | if (link_up) |
8737 | 8768 | while (cnt-- && bnx2x_test_link(&bp->link_params, | |
8769 | &bp->link_vars)) | ||
8770 | msleep(10); | ||
8738 | } else | 8771 | } else |
8739 | return -EINVAL; | 8772 | return -EINVAL; |
8740 | 8773 | ||
@@ -8840,6 +8873,7 @@ static int bnx2x_test_loopback(struct bnx2x *bp, u8 link_up) | |||
8840 | return BNX2X_LOOPBACK_FAILED; | 8873 | return BNX2X_LOOPBACK_FAILED; |
8841 | 8874 | ||
8842 | bnx2x_netif_stop(bp, 1); | 8875 | bnx2x_netif_stop(bp, 1); |
8876 | bnx2x_acquire_phy_lock(bp); | ||
8843 | 8877 | ||
8844 | if (bnx2x_run_loopback(bp, BNX2X_MAC_LOOPBACK, link_up)) { | 8878 | if (bnx2x_run_loopback(bp, BNX2X_MAC_LOOPBACK, link_up)) { |
8845 | DP(NETIF_MSG_PROBE, "MAC loopback failed\n"); | 8879 | DP(NETIF_MSG_PROBE, "MAC loopback failed\n"); |
@@ -8851,6 +8885,7 @@ static int bnx2x_test_loopback(struct bnx2x *bp, u8 link_up) | |||
8851 | rc |= BNX2X_PHY_LOOPBACK_FAILED; | 8885 | rc |= BNX2X_PHY_LOOPBACK_FAILED; |
8852 | } | 8886 | } |
8853 | 8887 | ||
8888 | bnx2x_release_phy_lock(bp); | ||
8854 | bnx2x_netif_start(bp); | 8889 | bnx2x_netif_start(bp); |
8855 | 8890 | ||
8856 | return rc; | 8891 | return rc; |
@@ -9805,6 +9840,8 @@ static int bnx2x_open(struct net_device *dev) | |||
9805 | { | 9840 | { |
9806 | struct bnx2x *bp = netdev_priv(dev); | 9841 | struct bnx2x *bp = netdev_priv(dev); |
9807 | 9842 | ||
9843 | netif_carrier_off(dev); | ||
9844 | |||
9808 | bnx2x_set_power_state(bp, PCI_D0); | 9845 | bnx2x_set_power_state(bp, PCI_D0); |
9809 | 9846 | ||
9810 | return bnx2x_nic_load(bp, LOAD_OPEN); | 9847 | return bnx2x_nic_load(bp, LOAD_OPEN); |
@@ -10310,8 +10347,6 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev, | |||
10310 | goto init_one_exit; | 10347 | goto init_one_exit; |
10311 | } | 10348 | } |
10312 | 10349 | ||
10313 | netif_carrier_off(dev); | ||
10314 | |||
10315 | bp->common.name = board_info[ent->driver_data].name; | 10350 | bp->common.name = board_info[ent->driver_data].name; |
10316 | printk(KERN_INFO "%s: %s (%c%d) PCI-E x%d %s found at mem %lx," | 10351 | printk(KERN_INFO "%s: %s (%c%d) PCI-E x%d %s found at mem %lx," |
10317 | " IRQ %d, ", dev->name, bp->common.name, | 10352 | " IRQ %d, ", dev->name, bp->common.name, |
@@ -10459,6 +10494,8 @@ static int bnx2x_eeh_nic_unload(struct bnx2x *bp) | |||
10459 | bnx2x_free_skbs(bp); | 10494 | bnx2x_free_skbs(bp); |
10460 | for_each_queue(bp, i) | 10495 | for_each_queue(bp, i) |
10461 | bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE); | 10496 | bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE); |
10497 | for_each_queue(bp, i) | ||
10498 | netif_napi_del(&bnx2x_fp(bp, i, napi)); | ||
10462 | bnx2x_free_mem(bp); | 10499 | bnx2x_free_mem(bp); |
10463 | 10500 | ||
10464 | bp->state = BNX2X_STATE_CLOSED; | 10501 | bp->state = BNX2X_STATE_CLOSED; |