Commit 5eeff635 authored by Suresh Reddy's avatar Suresh Reddy Committed by David S. Miller

be2net: increase the timeout value for loopback-test FW cmd

The loopback test FW cmd may need upto 15 seconds to complete on
certain PHYs. This patch also fixes the name of the completion variable
used to synchronize FW cmd completions as it not used by the flashing
cmd alone anymore.
Signed-off-by: default avatarSuresh Reddy <suresh.reddy@emulex.com>
Signed-off-by: default avatarSathya Perla <sathya.perla@emulex.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent da1388d6
...@@ -480,7 +480,7 @@ struct be_adapter { ...@@ -480,7 +480,7 @@ struct be_adapter {
struct list_head entry; struct list_head entry;
u32 flash_status; u32 flash_status;
struct completion flash_compl; struct completion et_cmd_compl;
struct be_resources res; /* resources available for the func */ struct be_resources res; /* resources available for the func */
u16 num_vfs; /* Number of VFs provisioned by PF */ u16 num_vfs; /* Number of VFs provisioned by PF */
......
...@@ -141,11 +141,17 @@ static int be_mcc_compl_process(struct be_adapter *adapter, ...@@ -141,11 +141,17 @@ static int be_mcc_compl_process(struct be_adapter *adapter,
subsystem = resp_hdr->subsystem; subsystem = resp_hdr->subsystem;
} }
if (opcode == OPCODE_LOWLEVEL_LOOPBACK_TEST &&
subsystem == CMD_SUBSYSTEM_LOWLEVEL) {
complete(&adapter->et_cmd_compl);
return 0;
}
if (((opcode == OPCODE_COMMON_WRITE_FLASHROM) || if (((opcode == OPCODE_COMMON_WRITE_FLASHROM) ||
(opcode == OPCODE_COMMON_WRITE_OBJECT)) && (opcode == OPCODE_COMMON_WRITE_OBJECT)) &&
(subsystem == CMD_SUBSYSTEM_COMMON)) { (subsystem == CMD_SUBSYSTEM_COMMON)) {
adapter->flash_status = compl_status; adapter->flash_status = compl_status;
complete(&adapter->flash_compl); complete(&adapter->et_cmd_compl);
} }
if (compl_status == MCC_STATUS_SUCCESS) { if (compl_status == MCC_STATUS_SUCCESS) {
...@@ -2163,7 +2169,7 @@ int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd, ...@@ -2163,7 +2169,7 @@ int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
be_mcc_notify(adapter); be_mcc_notify(adapter);
spin_unlock_bh(&adapter->mcc_lock); spin_unlock_bh(&adapter->mcc_lock);
if (!wait_for_completion_timeout(&adapter->flash_compl, if (!wait_for_completion_timeout(&adapter->et_cmd_compl,
msecs_to_jiffies(60000))) msecs_to_jiffies(60000)))
status = -1; status = -1;
else else
...@@ -2258,8 +2264,8 @@ int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, ...@@ -2258,8 +2264,8 @@ int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd,
be_mcc_notify(adapter); be_mcc_notify(adapter);
spin_unlock_bh(&adapter->mcc_lock); spin_unlock_bh(&adapter->mcc_lock);
if (!wait_for_completion_timeout(&adapter->flash_compl, if (!wait_for_completion_timeout(&adapter->et_cmd_compl,
msecs_to_jiffies(40000))) msecs_to_jiffies(40000)))
status = -1; status = -1;
else else
status = adapter->flash_status; status = adapter->flash_status;
...@@ -2370,6 +2376,7 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, ...@@ -2370,6 +2376,7 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num,
{ {
struct be_mcc_wrb *wrb; struct be_mcc_wrb *wrb;
struct be_cmd_req_loopback_test *req; struct be_cmd_req_loopback_test *req;
struct be_cmd_resp_loopback_test *resp;
int status; int status;
spin_lock_bh(&adapter->mcc_lock); spin_lock_bh(&adapter->mcc_lock);
...@@ -2384,8 +2391,8 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, ...@@ -2384,8 +2391,8 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num,
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL,
OPCODE_LOWLEVEL_LOOPBACK_TEST, sizeof(*req), wrb, NULL); OPCODE_LOWLEVEL_LOOPBACK_TEST, sizeof(*req), wrb, NULL);
req->hdr.timeout = cpu_to_le32(4);
req->hdr.timeout = cpu_to_le32(15);
req->pattern = cpu_to_le64(pattern); req->pattern = cpu_to_le64(pattern);
req->src_port = cpu_to_le32(port_num); req->src_port = cpu_to_le32(port_num);
req->dest_port = cpu_to_le32(port_num); req->dest_port = cpu_to_le32(port_num);
...@@ -2393,12 +2400,15 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, ...@@ -2393,12 +2400,15 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num,
req->num_pkts = cpu_to_le32(num_pkts); req->num_pkts = cpu_to_le32(num_pkts);
req->loopback_type = cpu_to_le32(loopback_type); req->loopback_type = cpu_to_le32(loopback_type);
status = be_mcc_notify_wait(adapter); be_mcc_notify(adapter);
if (!status) {
struct be_cmd_resp_loopback_test *resp = embedded_payload(wrb); spin_unlock_bh(&adapter->mcc_lock);
status = le32_to_cpu(resp->status);
}
wait_for_completion(&adapter->et_cmd_compl);
resp = embedded_payload(wrb);
status = le32_to_cpu(resp->status);
return status;
err: err:
spin_unlock_bh(&adapter->mcc_lock); spin_unlock_bh(&adapter->mcc_lock);
return status; return status;
......
...@@ -4208,7 +4208,7 @@ static int be_ctrl_init(struct be_adapter *adapter) ...@@ -4208,7 +4208,7 @@ static int be_ctrl_init(struct be_adapter *adapter)
spin_lock_init(&adapter->mcc_lock); spin_lock_init(&adapter->mcc_lock);
spin_lock_init(&adapter->mcc_cq_lock); spin_lock_init(&adapter->mcc_cq_lock);
init_completion(&adapter->flash_compl); init_completion(&adapter->et_cmd_compl);
pci_save_state(adapter->pdev); pci_save_state(adapter->pdev);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment