aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--drivers/net/benet/be.h1
-rw-r--r--drivers/net/benet/be_cmds.c54
-rw-r--r--drivers/net/benet/be_cmds.h12
-rw-r--r--drivers/net/benet/be_ethtool.c12
-rw-r--r--drivers/net/benet/be_hw.h47
-rw-r--r--drivers/net/benet/be_main.c4
6 files changed, 124 insertions, 6 deletions
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index 46b951f2b045..ed709a5d07d7 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -318,6 +318,7 @@ struct be_adapter {
318 struct be_vf_cfg vf_cfg[BE_MAX_VF]; 318 struct be_vf_cfg vf_cfg[BE_MAX_VF];
319 u8 is_virtfn; 319 u8 is_virtfn;
320 u32 sli_family; 320 u32 sli_family;
321 u8 hba_port_num;
321 u16 pvid; 322 u16 pvid;
322}; 323};
323 324
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}
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h
index 6e89de82a5e9..93e5768fc705 100644
--- a/drivers/net/benet/be_cmds.h
+++ b/drivers/net/benet/be_cmds.h
@@ -169,6 +169,7 @@ struct be_mcc_mailbox {
169#define OPCODE_COMMON_SET_QOS 28 169#define OPCODE_COMMON_SET_QOS 28
170#define OPCODE_COMMON_MCC_CREATE_EXT 90 170#define OPCODE_COMMON_MCC_CREATE_EXT 90
171#define OPCODE_COMMON_SEEPROM_READ 30 171#define OPCODE_COMMON_SEEPROM_READ 30
172#define OPCODE_COMMON_GET_CNTL_ATTRIBUTES 32
172#define OPCODE_COMMON_NTWK_RX_FILTER 34 173#define OPCODE_COMMON_NTWK_RX_FILTER 34
173#define OPCODE_COMMON_GET_FW_VERSION 35 174#define OPCODE_COMMON_GET_FW_VERSION 35
174#define OPCODE_COMMON_SET_FLOW_CONTROL 36 175#define OPCODE_COMMON_SET_FLOW_CONTROL 36
@@ -1030,6 +1031,16 @@ struct be_cmd_resp_set_qos {
1030 u32 rsvd; 1031 u32 rsvd;
1031}; 1032};
1032 1033
1034/*********************** Controller Attributes ***********************/
1035struct be_cmd_req_cntl_attribs {
1036 struct be_cmd_req_hdr hdr;
1037};
1038
1039struct be_cmd_resp_cntl_attribs {
1040 struct be_cmd_resp_hdr hdr;
1041 struct mgmt_controller_attrib attribs;
1042};
1043
1033extern int be_pci_fnum_get(struct be_adapter *adapter); 1044extern int be_pci_fnum_get(struct be_adapter *adapter);
1034extern int be_cmd_POST(struct be_adapter *adapter); 1045extern int be_cmd_POST(struct be_adapter *adapter);
1035extern int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr, 1046extern int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr,
@@ -1115,4 +1126,5 @@ extern int be_cmd_get_phy_info(struct be_adapter *adapter,
1115extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain); 1126extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain);
1116extern void be_detect_dump_ue(struct be_adapter *adapter); 1127extern void be_detect_dump_ue(struct be_adapter *adapter);
1117extern int be_cmd_get_die_temperature(struct be_adapter *adapter); 1128extern int be_cmd_get_die_temperature(struct be_adapter *adapter);
1129extern int be_cmd_get_cntl_attributes(struct be_adapter *adapter);
1118 1130
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
index 47666933c55a..6e5e43380c2a 100644
--- a/drivers/net/benet/be_ethtool.c
+++ b/drivers/net/benet/be_ethtool.c
@@ -513,7 +513,7 @@ be_phys_id(struct net_device *netdev, u32 data)
513 int status; 513 int status;
514 u32 cur; 514 u32 cur;
515 515
516 be_cmd_get_beacon_state(adapter, adapter->port_num, &cur); 516 be_cmd_get_beacon_state(adapter, adapter->hba_port_num, &cur);
517 517
518 if (cur == BEACON_STATE_ENABLED) 518 if (cur == BEACON_STATE_ENABLED)
519 return 0; 519 return 0;
@@ -521,12 +521,12 @@ be_phys_id(struct net_device *netdev, u32 data)
521 if (data < 2) 521 if (data < 2)
522 data = 2; 522 data = 2;
523 523
524 status = be_cmd_set_beacon_state(adapter, adapter->port_num, 0, 0, 524 status = be_cmd_set_beacon_state(adapter, adapter->hba_port_num, 0, 0,
525 BEACON_STATE_ENABLED); 525 BEACON_STATE_ENABLED);
526 set_current_state(TASK_INTERRUPTIBLE); 526 set_current_state(TASK_INTERRUPTIBLE);
527 schedule_timeout(data*HZ); 527 schedule_timeout(data*HZ);
528 528
529 status = be_cmd_set_beacon_state(adapter, adapter->port_num, 0, 0, 529 status = be_cmd_set_beacon_state(adapter, adapter->hba_port_num, 0, 0,
530 BEACON_STATE_DISABLED); 530 BEACON_STATE_DISABLED);
531 531
532 return status; 532 return status;
@@ -605,12 +605,12 @@ err:
605static u64 be_loopback_test(struct be_adapter *adapter, u8 loopback_type, 605static u64 be_loopback_test(struct be_adapter *adapter, u8 loopback_type,
606 u64 *status) 606 u64 *status)
607{ 607{
608 be_cmd_set_loopback(adapter, adapter->port_num, 608 be_cmd_set_loopback(adapter, adapter->hba_port_num,
609 loopback_type, 1); 609 loopback_type, 1);
610 *status = be_cmd_loopback_test(adapter, adapter->port_num, 610 *status = be_cmd_loopback_test(adapter, adapter->hba_port_num,
611 loopback_type, 1500, 611 loopback_type, 1500,
612 2, 0xabc); 612 2, 0xabc);
613 be_cmd_set_loopback(adapter, adapter->port_num, 613 be_cmd_set_loopback(adapter, adapter->hba_port_num,
614 BE_NO_LOOPBACK, 1); 614 BE_NO_LOOPBACK, 1);
615 return *status; 615 return *status;
616} 616}
diff --git a/drivers/net/benet/be_hw.h b/drivers/net/benet/be_hw.h
index 4096d9778234..3f459f76cd1d 100644
--- a/drivers/net/benet/be_hw.h
+++ b/drivers/net/benet/be_hw.h
@@ -327,6 +327,53 @@ struct be_eth_rx_compl {
327 u32 dw[4]; 327 u32 dw[4];
328}; 328};
329 329
330struct mgmt_hba_attribs {
331 u8 flashrom_version_string[32];
332 u8 manufacturer_name[32];
333 u32 supported_modes;
334 u32 rsvd0[3];
335 u8 ncsi_ver_string[12];
336 u32 default_extended_timeout;
337 u8 controller_model_number[32];
338 u8 controller_description[64];
339 u8 controller_serial_number[32];
340 u8 ip_version_string[32];
341 u8 firmware_version_string[32];
342 u8 bios_version_string[32];
343 u8 redboot_version_string[32];
344 u8 driver_version_string[32];
345 u8 fw_on_flash_version_string[32];
346 u32 functionalities_supported;
347 u16 max_cdblength;
348 u8 asic_revision;
349 u8 generational_guid[16];
350 u8 hba_port_count;
351 u16 default_link_down_timeout;
352 u8 iscsi_ver_min_max;
353 u8 multifunction_device;
354 u8 cache_valid;
355 u8 hba_status;
356 u8 max_domains_supported;
357 u8 phy_port;
358 u32 firmware_post_status;
359 u32 hba_mtu[8];
360 u32 rsvd1[4];
361};
362
363struct mgmt_controller_attrib {
364 struct mgmt_hba_attribs hba_attribs;
365 u16 pci_vendor_id;
366 u16 pci_device_id;
367 u16 pci_sub_vendor_id;
368 u16 pci_sub_system_id;
369 u8 pci_bus_number;
370 u8 pci_device_number;
371 u8 pci_function_number;
372 u8 interface_type;
373 u64 unique_identifier;
374 u32 rsvd0[5];
375};
376
330struct controller_id { 377struct controller_id {
331 u32 vendor; 378 u32 vendor;
332 u32 device; 379 u32 device;
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index cd6fda776d8d..0bdccb10aac5 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -2868,6 +2868,10 @@ static int be_get_config(struct be_adapter *adapter)
2868 else 2868 else
2869 adapter->max_vlans = BE_NUM_VLANS_SUPPORTED; 2869 adapter->max_vlans = BE_NUM_VLANS_SUPPORTED;
2870 2870
2871 status = be_cmd_get_cntl_attributes(adapter);
2872 if (status)
2873 return status;
2874
2871 return 0; 2875 return 0;
2872} 2876}
2873 2877