aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlge/qlge_main.c
diff options
context:
space:
mode:
authorRon Mercer <ron.mercer@qlogic.com>2009-10-21 07:07:40 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-22 00:45:40 -0400
commitbc083ce98eeb42205e99495481c8616d30916f6e (patch)
treeb6111dd22d2d3a9102362b2e2a6b75e8aa928b74 /drivers/net/qlge/qlge_main.c
parentd8eb59dc8b9e77bb4fa5420ff80142759ad5cd7b (diff)
qlge: Add ethtool wake on LAN function.
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.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index 34242fbcadff..dd0ea0277550 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -3335,6 +3335,22 @@ static int ql_adapter_initialize(struct ql_adapter *qdev)
3335 * the same MAC address. 3335 * the same MAC address.
3336 */ 3336 */
3337 ql_write32(qdev, RST_FO, RST_FO_RR_MASK | RST_FO_RR_RCV_FUNC_CQ); 3337 ql_write32(qdev, RST_FO, RST_FO_RR_MASK | RST_FO_RR_RCV_FUNC_CQ);
3338 /* Reroute all packets to our Interface.
3339 * They may have been routed to MPI firmware
3340 * due to WOL.
3341 */
3342 value = ql_read32(qdev, MGMT_RCV_CFG);
3343 value &= ~MGMT_RCV_CFG_RM;
3344 mask = 0xffff0000;
3345
3346 /* Sticky reg needs clearing due to WOL. */
3347 ql_write32(qdev, MGMT_RCV_CFG, mask);
3348 ql_write32(qdev, MGMT_RCV_CFG, mask | value);
3349
3350 /* Default WOL is enable on Mezz cards */
3351 if (qdev->pdev->subsystem_device == 0x0068 ||
3352 qdev->pdev->subsystem_device == 0x0180)
3353 qdev->wol = WAKE_MAGIC;
3338 3354
3339 /* Start up the rx queues. */ 3355 /* Start up the rx queues. */
3340 for (i = 0; i < qdev->rx_ring_count; i++) { 3356 for (i = 0; i < qdev->rx_ring_count; i++) {
@@ -3449,6 +3465,55 @@ static void ql_display_dev_info(struct net_device *ndev)
3449 QPRINTK(qdev, PROBE, INFO, "MAC address %pM\n", ndev->dev_addr); 3465 QPRINTK(qdev, PROBE, INFO, "MAC address %pM\n", ndev->dev_addr);
3450} 3466}
3451 3467
3468int ql_wol(struct ql_adapter *qdev)
3469{
3470 int status = 0;
3471 u32 wol = MB_WOL_DISABLE;
3472
3473 /* The CAM is still intact after a reset, but if we
3474 * are doing WOL, then we may need to program the
3475 * routing regs. We would also need to issue the mailbox
3476 * commands to instruct the MPI what to do per the ethtool
3477 * settings.
3478 */
3479
3480 if (qdev->wol & (WAKE_ARP | WAKE_MAGICSECURE | WAKE_PHY | WAKE_UCAST |
3481 WAKE_MCAST | WAKE_BCAST)) {
3482 QPRINTK(qdev, IFDOWN, ERR,
3483 "Unsupported WOL paramter. qdev->wol = 0x%x.\n",
3484 qdev->wol);
3485 return -EINVAL;
3486 }
3487
3488 if (qdev->wol & WAKE_MAGIC) {
3489 status = ql_mb_wol_set_magic(qdev, 1);
3490 if (status) {
3491 QPRINTK(qdev, IFDOWN, ERR,
3492 "Failed to set magic packet on %s.\n",
3493 qdev->ndev->name);
3494 return status;
3495 } else
3496 QPRINTK(qdev, DRV, INFO,
3497 "Enabled magic packet successfully on %s.\n",
3498 qdev->ndev->name);
3499
3500 wol |= MB_WOL_MAGIC_PKT;
3501 }
3502
3503 if (qdev->wol) {
3504 /* Reroute all packets to Management Interface */
3505 ql_write32(qdev, MGMT_RCV_CFG, (MGMT_RCV_CFG_RM |
3506 (MGMT_RCV_CFG_RM << 16)));
3507 wol |= MB_WOL_MODE_ON;
3508 status = ql_mb_wol_mode(qdev, wol);
3509 QPRINTK(qdev, DRV, ERR, "WOL %s (wol code 0x%x) on %s\n",
3510 (status == 0) ? "Sucessfully set" : "Failed", wol,
3511 qdev->ndev->name);
3512 }
3513
3514 return status;
3515}
3516
3452static int ql_adapter_down(struct ql_adapter *qdev) 3517static int ql_adapter_down(struct ql_adapter *qdev)
3453{ 3518{
3454 int i, status = 0; 3519 int i, status = 0;
@@ -4285,6 +4350,7 @@ static int qlge_suspend(struct pci_dev *pdev, pm_message_t state)
4285 return err; 4350 return err;
4286 } 4351 }
4287 4352
4353 ql_wol(qdev);
4288 err = pci_save_state(pdev); 4354 err = pci_save_state(pdev);
4289 if (err) 4355 if (err)
4290 return err; 4356 return err;