diff options
author | Ron Mercer <ron.mercer@qlogic.com> | 2009-10-21 07:07:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-22 00:45:40 -0400 |
commit | bc083ce98eeb42205e99495481c8616d30916f6e (patch) | |
tree | b6111dd22d2d3a9102362b2e2a6b75e8aa928b74 /drivers/net/qlge/qlge_mpi.c | |
parent | d8eb59dc8b9e77bb4fa5420ff80142759ad5cd7b (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_mpi.c')
-rw-r--r-- | drivers/net/qlge/qlge_mpi.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/drivers/net/qlge/qlge_mpi.c b/drivers/net/qlge/qlge_mpi.c index 14d76f13d1db..80b68539c5aa 100644 --- a/drivers/net/qlge/qlge_mpi.c +++ b/drivers/net/qlge/qlge_mpi.c | |||
@@ -702,6 +702,76 @@ int ql_mb_get_port_cfg(struct ql_adapter *qdev) | |||
702 | return status; | 702 | return status; |
703 | } | 703 | } |
704 | 704 | ||
705 | int ql_mb_wol_mode(struct ql_adapter *qdev, u32 wol) | ||
706 | { | ||
707 | struct mbox_params mbc; | ||
708 | struct mbox_params *mbcp = &mbc; | ||
709 | int status; | ||
710 | |||
711 | memset(mbcp, 0, sizeof(struct mbox_params)); | ||
712 | |||
713 | mbcp->in_count = 2; | ||
714 | mbcp->out_count = 1; | ||
715 | |||
716 | mbcp->mbox_in[0] = MB_CMD_SET_WOL_MODE; | ||
717 | mbcp->mbox_in[1] = wol; | ||
718 | |||
719 | |||
720 | status = ql_mailbox_command(qdev, mbcp); | ||
721 | if (status) | ||
722 | return status; | ||
723 | |||
724 | if (mbcp->mbox_out[0] != MB_CMD_STS_GOOD) { | ||
725 | QPRINTK(qdev, DRV, ERR, | ||
726 | "Failed to set WOL mode.\n"); | ||
727 | status = -EIO; | ||
728 | } | ||
729 | return status; | ||
730 | } | ||
731 | |||
732 | int ql_mb_wol_set_magic(struct ql_adapter *qdev, u32 enable_wol) | ||
733 | { | ||
734 | struct mbox_params mbc; | ||
735 | struct mbox_params *mbcp = &mbc; | ||
736 | int status; | ||
737 | u8 *addr = qdev->ndev->dev_addr; | ||
738 | |||
739 | memset(mbcp, 0, sizeof(struct mbox_params)); | ||
740 | |||
741 | mbcp->in_count = 8; | ||
742 | mbcp->out_count = 1; | ||
743 | |||
744 | mbcp->mbox_in[0] = MB_CMD_SET_WOL_MAGIC; | ||
745 | if (enable_wol) { | ||
746 | mbcp->mbox_in[1] = (u32)addr[0]; | ||
747 | mbcp->mbox_in[2] = (u32)addr[1]; | ||
748 | mbcp->mbox_in[3] = (u32)addr[2]; | ||
749 | mbcp->mbox_in[4] = (u32)addr[3]; | ||
750 | mbcp->mbox_in[5] = (u32)addr[4]; | ||
751 | mbcp->mbox_in[6] = (u32)addr[5]; | ||
752 | mbcp->mbox_in[7] = 0; | ||
753 | } else { | ||
754 | mbcp->mbox_in[1] = 0; | ||
755 | mbcp->mbox_in[2] = 1; | ||
756 | mbcp->mbox_in[3] = 1; | ||
757 | mbcp->mbox_in[4] = 1; | ||
758 | mbcp->mbox_in[5] = 1; | ||
759 | mbcp->mbox_in[6] = 1; | ||
760 | mbcp->mbox_in[7] = 0; | ||
761 | } | ||
762 | |||
763 | status = ql_mailbox_command(qdev, mbcp); | ||
764 | if (status) | ||
765 | return status; | ||
766 | |||
767 | if (mbcp->mbox_out[0] != MB_CMD_STS_GOOD) { | ||
768 | QPRINTK(qdev, DRV, ERR, | ||
769 | "Failed to set WOL mode.\n"); | ||
770 | status = -EIO; | ||
771 | } | ||
772 | return status; | ||
773 | } | ||
774 | |||
705 | /* IDC - Inter Device Communication... | 775 | /* IDC - Inter Device Communication... |
706 | * Some firmware commands require consent of adjacent FCOE | 776 | * Some firmware commands require consent of adjacent FCOE |
707 | * function. This function waits for the OK, or a | 777 | * function. This function waits for the OK, or a |