aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlge/qlge_main.c
diff options
context:
space:
mode:
authorRon Mercer <ron.mercer@qlogic.com>2009-07-02 02:06:12 -0400
committerDavid S. Miller <davem@davemloft.net>2009-07-03 22:10:46 -0400
commit6a47330892e697ae27d2d56a3c4c7fec2015be93 (patch)
tree18dacc2ae53a0ee2250bacd1c35a4623d898f2bf /drivers/net/qlge/qlge_main.c
parent7fab3bfe08a2c5c4221685499ec4fef83ad82f83 (diff)
qlge: Add/use function for link up/down.
We need to set/clear the mac address register when the link goes up/down respectively. Without this both ports of a 2-port device can end up with the same mac address in a bonding scenario. The new ql_link_on() and ql_link_off() will also be used in handling certain firmware events. Signed-off-by: Ron Mercer <ron.mercer@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlge/qlge_main.c')
-rw-r--r--drivers/net/qlge/qlge_main.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index 46dea2bd94d0..35ba95a9b5db 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -448,6 +448,22 @@ static int ql_set_mac_addr(struct ql_adapter *qdev, int set)
448 return status; 448 return status;
449} 449}
450 450
451void ql_link_on(struct ql_adapter *qdev)
452{
453 QPRINTK(qdev, LINK, ERR, "%s: Link is up.\n",
454 qdev->ndev->name);
455 netif_carrier_on(qdev->ndev);
456 ql_set_mac_addr(qdev, 1);
457}
458
459void ql_link_off(struct ql_adapter *qdev)
460{
461 QPRINTK(qdev, LINK, ERR, "%s: Link is down.\n",
462 qdev->ndev->name);
463 netif_carrier_off(qdev->ndev);
464 ql_set_mac_addr(qdev, 0);
465}
466
451/* Get a specific frame routing value from the CAM. 467/* Get a specific frame routing value from the CAM.
452 * Used for debug and reg dump. 468 * Used for debug and reg dump.
453 */ 469 */
@@ -1696,13 +1712,13 @@ static void ql_process_mac_tx_intr(struct ql_adapter *qdev,
1696/* Fire up a handler to reset the MPI processor. */ 1712/* Fire up a handler to reset the MPI processor. */
1697void ql_queue_fw_error(struct ql_adapter *qdev) 1713void ql_queue_fw_error(struct ql_adapter *qdev)
1698{ 1714{
1699 netif_carrier_off(qdev->ndev); 1715 ql_link_off(qdev);
1700 queue_delayed_work(qdev->workqueue, &qdev->mpi_reset_work, 0); 1716 queue_delayed_work(qdev->workqueue, &qdev->mpi_reset_work, 0);
1701} 1717}
1702 1718
1703void ql_queue_asic_error(struct ql_adapter *qdev) 1719void ql_queue_asic_error(struct ql_adapter *qdev)
1704{ 1720{
1705 netif_carrier_off(qdev->ndev); 1721 ql_link_off(qdev);
1706 ql_disable_interrupts(qdev); 1722 ql_disable_interrupts(qdev);
1707 /* Clear adapter up bit to signal the recovery 1723 /* Clear adapter up bit to signal the recovery
1708 * process that it shouldn't kill the reset worker 1724 * process that it shouldn't kill the reset worker
@@ -3312,7 +3328,7 @@ static int ql_adapter_down(struct ql_adapter *qdev)
3312 int i, status = 0; 3328 int i, status = 0;
3313 struct rx_ring *rx_ring; 3329 struct rx_ring *rx_ring;
3314 3330
3315 netif_carrier_off(qdev->ndev); 3331 ql_link_off(qdev);
3316 3332
3317 /* Don't kill the reset worker thread if we 3333 /* Don't kill the reset worker thread if we
3318 * are in the process of recovery. 3334 * are in the process of recovery.
@@ -3384,7 +3400,7 @@ static int ql_adapter_up(struct ql_adapter *qdev)
3384 */ 3400 */
3385 if ((ql_read32(qdev, STS) & qdev->port_init) && 3401 if ((ql_read32(qdev, STS) & qdev->port_init) &&
3386 (ql_read32(qdev, STS) & qdev->port_link_up)) 3402 (ql_read32(qdev, STS) & qdev->port_link_up))
3387 netif_carrier_on(qdev->ndev); 3403 ql_link_on(qdev);
3388 ql_enable_interrupts(qdev); 3404 ql_enable_interrupts(qdev);
3389 ql_enable_all_completion_interrupts(qdev); 3405 ql_enable_all_completion_interrupts(qdev);
3390 netif_tx_start_all_queues(qdev->ndev); 3406 netif_tx_start_all_queues(qdev->ndev);
@@ -4035,7 +4051,7 @@ static int __devinit qlge_probe(struct pci_dev *pdev,
4035 pci_disable_device(pdev); 4051 pci_disable_device(pdev);
4036 return err; 4052 return err;
4037 } 4053 }
4038 netif_carrier_off(ndev); 4054 ql_link_off(qdev);
4039 ql_display_dev_info(ndev); 4055 ql_display_dev_info(ndev);
4040 cards_found++; 4056 cards_found++;
4041 return 0; 4057 return 0;