diff options
author | Ron Mercer <ron.mercer@qlogic.com> | 2009-07-02 02:06:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-07-03 22:10:46 -0400 |
commit | 6a47330892e697ae27d2d56a3c4c7fec2015be93 (patch) | |
tree | 18dacc2ae53a0ee2250bacd1c35a4623d898f2bf /drivers/net/qlge | |
parent | 7fab3bfe08a2c5c4221685499ec4fef83ad82f83 (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')
-rw-r--r-- | drivers/net/qlge/qlge.h | 2 | ||||
-rw-r--r-- | drivers/net/qlge/qlge_main.c | 26 | ||||
-rw-r--r-- | drivers/net/qlge/qlge_mpi.c | 6 |
3 files changed, 26 insertions, 8 deletions
diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h index 156e02e8905d..6ed5317ab1c0 100644 --- a/drivers/net/qlge/qlge.h +++ b/drivers/net/qlge/qlge.h | |||
@@ -1607,6 +1607,8 @@ int ql_mb_get_fw_state(struct ql_adapter *qdev); | |||
1607 | int ql_cam_route_initialize(struct ql_adapter *qdev); | 1607 | int ql_cam_route_initialize(struct ql_adapter *qdev); |
1608 | int ql_read_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 *data); | 1608 | int ql_read_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 *data); |
1609 | int ql_mb_about_fw(struct ql_adapter *qdev); | 1609 | int ql_mb_about_fw(struct ql_adapter *qdev); |
1610 | void ql_link_on(struct ql_adapter *qdev); | ||
1611 | void ql_link_off(struct ql_adapter *qdev); | ||
1610 | 1612 | ||
1611 | #if 1 | 1613 | #if 1 |
1612 | #define QL_ALL_DUMP | 1614 | #define QL_ALL_DUMP |
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 | ||
451 | void 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 | |||
459 | void 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. */ |
1697 | void ql_queue_fw_error(struct ql_adapter *qdev) | 1713 | void 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 | ||
1703 | void ql_queue_asic_error(struct ql_adapter *qdev) | 1719 | void 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; |
diff --git a/drivers/net/qlge/qlge_mpi.c b/drivers/net/qlge/qlge_mpi.c index 71afbf8b9c50..6685bd97da91 100644 --- a/drivers/net/qlge/qlge_mpi.c +++ b/drivers/net/qlge/qlge_mpi.c | |||
@@ -238,7 +238,7 @@ static void ql_link_up(struct ql_adapter *qdev, struct mbox_params *mbcp) | |||
238 | &qdev->mpi_port_cfg_work, 0); | 238 | &qdev->mpi_port_cfg_work, 0); |
239 | } | 239 | } |
240 | 240 | ||
241 | netif_carrier_on(qdev->ndev); | 241 | ql_link_on(qdev); |
242 | } | 242 | } |
243 | 243 | ||
244 | static void ql_link_down(struct ql_adapter *qdev, struct mbox_params *mbcp) | 244 | static void ql_link_down(struct ql_adapter *qdev, struct mbox_params *mbcp) |
@@ -251,7 +251,7 @@ static void ql_link_down(struct ql_adapter *qdev, struct mbox_params *mbcp) | |||
251 | if (status) | 251 | if (status) |
252 | QPRINTK(qdev, DRV, ERR, "Link down AEN broken!\n"); | 252 | QPRINTK(qdev, DRV, ERR, "Link down AEN broken!\n"); |
253 | 253 | ||
254 | netif_carrier_off(qdev->ndev); | 254 | ql_link_off(qdev); |
255 | } | 255 | } |
256 | 256 | ||
257 | static int ql_sfp_in(struct ql_adapter *qdev, struct mbox_params *mbcp) | 257 | static int ql_sfp_in(struct ql_adapter *qdev, struct mbox_params *mbcp) |
@@ -849,7 +849,7 @@ void ql_mpi_idc_work(struct work_struct *work) | |||
849 | case MB_CMD_PORT_RESET: | 849 | case MB_CMD_PORT_RESET: |
850 | case MB_CMD_SET_PORT_CFG: | 850 | case MB_CMD_SET_PORT_CFG: |
851 | case MB_CMD_STOP_FW: | 851 | case MB_CMD_STOP_FW: |
852 | netif_carrier_off(qdev->ndev); | 852 | ql_link_off(qdev); |
853 | /* Signal the resulting link up AEN | 853 | /* Signal the resulting link up AEN |
854 | * that the frame routing and mac addr | 854 | * that the frame routing and mac addr |
855 | * needs to be set. | 855 | * needs to be set. |