aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/benet/be_cmds.c
diff options
context:
space:
mode:
authorAjit Khaparde <ajit.khaparde@emulex.com>2011-02-20 06:42:22 -0500
committerDavid S. Miller <davem@davemloft.net>2011-02-22 13:26:47 -0500
commit9e1453c5c5fe670bb98a6097b262122386b0d3fe (patch)
tree12a5c30448e26b98de86e8298961a6c0ed300f9a /drivers/net/benet/be_cmds.c
parent609ff3bb8f6cd38c68c719bbc3c31d6b0b9ce894 (diff)
be2net: use hba_port_num instead of port_num
Use hba_port_num for phy loopback and ethtool phy identification. From: Suresh R <suresh.reddy@emulex.com> Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet/be_cmds.c')
-rw-r--r--drivers/net/benet/be_cmds.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index ff62aaea9a45..1822ecdadc7e 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -1954,3 +1954,57 @@ err:
1954 spin_unlock_bh(&adapter->mcc_lock); 1954 spin_unlock_bh(&adapter->mcc_lock);
1955 return status; 1955 return status;
1956} 1956}
1957
1958int be_cmd_get_cntl_attributes(struct be_adapter *adapter)
1959{
1960 struct be_mcc_wrb *wrb;
1961 struct be_cmd_req_cntl_attribs *req;
1962 struct be_cmd_resp_cntl_attribs *resp;
1963 struct be_sge *sge;
1964 int status;
1965 int payload_len = max(sizeof(*req), sizeof(*resp));
1966 struct mgmt_controller_attrib *attribs;
1967 struct be_dma_mem attribs_cmd;
1968
1969 memset(&attribs_cmd, 0, sizeof(struct be_dma_mem));
1970 attribs_cmd.size = sizeof(struct be_cmd_resp_cntl_attribs);
1971 attribs_cmd.va = pci_alloc_consistent(adapter->pdev, attribs_cmd.size,
1972 &attribs_cmd.dma);
1973 if (!attribs_cmd.va) {
1974 dev_err(&adapter->pdev->dev,
1975 "Memory allocation failure\n");
1976 return -ENOMEM;
1977 }
1978
1979 if (mutex_lock_interruptible(&adapter->mbox_lock))
1980 return -1;
1981
1982 wrb = wrb_from_mbox(adapter);
1983 if (!wrb) {
1984 status = -EBUSY;
1985 goto err;
1986 }
1987 req = attribs_cmd.va;
1988 sge = nonembedded_sgl(wrb);
1989
1990 be_wrb_hdr_prepare(wrb, payload_len, false, 1,
1991 OPCODE_COMMON_GET_CNTL_ATTRIBUTES);
1992 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
1993 OPCODE_COMMON_GET_CNTL_ATTRIBUTES, payload_len);
1994 sge->pa_hi = cpu_to_le32(upper_32_bits(attribs_cmd.dma));
1995 sge->pa_lo = cpu_to_le32(attribs_cmd.dma & 0xFFFFFFFF);
1996 sge->len = cpu_to_le32(attribs_cmd.size);
1997
1998 status = be_mbox_notify_wait(adapter);
1999 if (!status) {
2000 attribs = (struct mgmt_controller_attrib *)( attribs_cmd.va +
2001 sizeof(struct be_cmd_resp_hdr));
2002 adapter->hba_port_num = attribs->hba_attribs.phy_port;
2003 }
2004
2005err:
2006 mutex_unlock(&adapter->mbox_lock);
2007 pci_free_consistent(adapter->pdev, attribs_cmd.size, attribs_cmd.va,
2008 attribs_cmd.dma);
2009 return status;
2010}