Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 266193
b: refs/heads/master
c: 04b7117
h: refs/heads/master
i:
  266191: 014f574
v: v3
  • Loading branch information
Sathya Perla authored and David S. Miller committed Sep 27, 2011
1 parent 2912fae commit cdf4b03
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8e7d3f681ef462e6aaa151f231310452dac409ca
refs/heads/master: 04b71175f340d4081680440e1b9cbffcd3f4a13c
31 changes: 18 additions & 13 deletions trunk/drivers/net/ethernet/emulex/benet/be_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -1444,32 +1444,37 @@ void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf)
spin_unlock_bh(&adapter->mcc_lock);
}

/* Uses Mbox */
int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver)
/* Uses synchronous mcc */
int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver,
char *fw_on_flash)
{
struct be_mcc_wrb *wrb;
struct be_cmd_req_get_fw_version *req;
int status;

if (mutex_lock_interruptible(&adapter->mbox_lock))
return -1;
spin_lock_bh(&adapter->mcc_lock);

wrb = wrb_from_mbox(adapter);
req = embedded_payload(wrb);
wrb = wrb_from_mccq(adapter);
if (!wrb) {
status = -EBUSY;
goto err;
}

req = embedded_payload(wrb);
be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0,
OPCODE_COMMON_GET_FW_VERSION);

OPCODE_COMMON_GET_FW_VERSION);
be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_GET_FW_VERSION, sizeof(*req));
OPCODE_COMMON_GET_FW_VERSION, sizeof(*req));

status = be_mbox_notify_wait(adapter);
status = be_mcc_notify_wait(adapter);
if (!status) {
struct be_cmd_resp_get_fw_version *resp = embedded_payload(wrb);
strncpy(fw_ver, resp->firmware_version_string, FW_VER_LEN);
strcpy(fw_ver, resp->firmware_version_string);
if (fw_on_flash)
strcpy(fw_on_flash, resp->fw_on_flash_version_string);
}

mutex_unlock(&adapter->mbox_lock);
err:
spin_unlock_bh(&adapter->mcc_lock);
return status;
}

Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/net/ethernet/emulex/benet/be_cmds.h
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,8 @@ extern int be_cmd_get_stats(struct be_adapter *adapter,
struct be_dma_mem *nonemb_cmd);
extern int lancer_cmd_get_pport_stats(struct be_adapter *adapter,
struct be_dma_mem *nonemb_cmd);
extern int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver);
extern int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver,
char *fw_on_flash);

extern int be_cmd_modify_eqd(struct be_adapter *adapter, u32 eq_id, u32 eqd);
extern int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id,
Expand Down
14 changes: 12 additions & 2 deletions trunk/drivers/net/ethernet/emulex/benet/be_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,24 @@ static const char et_self_tests[][ETH_GSTRING_LEN] = {
#define BE_ONE_PORT_EXT_LOOPBACK 0x2
#define BE_NO_LOOPBACK 0xff

static void
be_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
static void be_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *drvinfo)
{
struct be_adapter *adapter = netdev_priv(netdev);
char fw_on_flash[FW_VER_LEN];

memset(fw_on_flash, 0 , sizeof(fw_on_flash));
be_cmd_get_fw_ver(adapter, adapter->fw_ver, fw_on_flash);

strcpy(drvinfo->driver, DRV_NAME);
strcpy(drvinfo->version, DRV_VER);
strncpy(drvinfo->fw_version, adapter->fw_ver, FW_VER_LEN);
if (memcmp(adapter->fw_ver, fw_on_flash, FW_VER_LEN) != 0) {
strcat(drvinfo->fw_version, " [");
strcat(drvinfo->fw_version, fw_on_flash);
strcat(drvinfo->fw_version, "]");
}

strcpy(drvinfo->bus_info, pci_name(adapter->pdev));
drvinfo->testinfo_len = 0;
drvinfo->regdump_len = 0;
Expand Down
5 changes: 1 addition & 4 deletions trunk/drivers/net/ethernet/emulex/benet/be_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2528,6 +2528,7 @@ static int be_setup(struct be_adapter *adapter)

adapter->link_speed = -1;

be_cmd_get_fw_ver(adapter, adapter->fw_ver, NULL);
return 0;

rx_qs_destroy:
Expand Down Expand Up @@ -3147,10 +3148,6 @@ static int be_get_config(struct be_adapter *adapter)
int status;
u8 mac[ETH_ALEN];

status = be_cmd_get_fw_ver(adapter, adapter->fw_ver);
if (status)
return status;

status = be_cmd_query_fw_cfg(adapter, &adapter->port_num,
&adapter->function_mode, &adapter->function_caps);
if (status)
Expand Down

0 comments on commit cdf4b03

Please sign in to comment.