diff options
author | Suresh Reddy <suresh.reddy@emulex.com> | 2014-01-06 02:32:24 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-06 13:09:21 -0500 |
commit | 5eeff6354faffb3f140d690eec1cede78de53b06 (patch) | |
tree | c1bf0b7e7392326167e59235c787113624cc262e | |
parent | da1388d655292a11b5e9c011532e9ca83f77e1d3 (diff) |
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: Suresh Reddy <suresh.reddy@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_cmds.c | 30 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_main.c | 2 |
3 files changed, 22 insertions, 12 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index 5878df619b53..2e031f24cd33 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h | |||
@@ -480,7 +480,7 @@ struct be_adapter { | |||
480 | struct list_head entry; | 480 | struct list_head entry; |
481 | 481 | ||
482 | u32 flash_status; | 482 | u32 flash_status; |
483 | struct completion flash_compl; | 483 | struct completion et_cmd_compl; |
484 | 484 | ||
485 | struct be_resources res; /* resources available for the func */ | 485 | struct be_resources res; /* resources available for the func */ |
486 | u16 num_vfs; /* Number of VFs provisioned by PF */ | 486 | u16 num_vfs; /* Number of VFs provisioned by PF */ |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c index b84902e451fa..94c35c8d799d 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c | |||
@@ -141,11 +141,17 @@ static int be_mcc_compl_process(struct be_adapter *adapter, | |||
141 | subsystem = resp_hdr->subsystem; | 141 | subsystem = resp_hdr->subsystem; |
142 | } | 142 | } |
143 | 143 | ||
144 | if (opcode == OPCODE_LOWLEVEL_LOOPBACK_TEST && | ||
145 | subsystem == CMD_SUBSYSTEM_LOWLEVEL) { | ||
146 | complete(&adapter->et_cmd_compl); | ||
147 | return 0; | ||
148 | } | ||
149 | |||
144 | if (((opcode == OPCODE_COMMON_WRITE_FLASHROM) || | 150 | if (((opcode == OPCODE_COMMON_WRITE_FLASHROM) || |
145 | (opcode == OPCODE_COMMON_WRITE_OBJECT)) && | 151 | (opcode == OPCODE_COMMON_WRITE_OBJECT)) && |
146 | (subsystem == CMD_SUBSYSTEM_COMMON)) { | 152 | (subsystem == CMD_SUBSYSTEM_COMMON)) { |
147 | adapter->flash_status = compl_status; | 153 | adapter->flash_status = compl_status; |
148 | complete(&adapter->flash_compl); | 154 | complete(&adapter->et_cmd_compl); |
149 | } | 155 | } |
150 | 156 | ||
151 | if (compl_status == MCC_STATUS_SUCCESS) { | 157 | 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 | be_mcc_notify(adapter); | 2169 | be_mcc_notify(adapter); |
2164 | spin_unlock_bh(&adapter->mcc_lock); | 2170 | spin_unlock_bh(&adapter->mcc_lock); |
2165 | 2171 | ||
2166 | if (!wait_for_completion_timeout(&adapter->flash_compl, | 2172 | if (!wait_for_completion_timeout(&adapter->et_cmd_compl, |
2167 | msecs_to_jiffies(60000))) | 2173 | msecs_to_jiffies(60000))) |
2168 | status = -1; | 2174 | status = -1; |
2169 | else | 2175 | else |
@@ -2258,8 +2264,8 @@ int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, | |||
2258 | be_mcc_notify(adapter); | 2264 | be_mcc_notify(adapter); |
2259 | spin_unlock_bh(&adapter->mcc_lock); | 2265 | spin_unlock_bh(&adapter->mcc_lock); |
2260 | 2266 | ||
2261 | if (!wait_for_completion_timeout(&adapter->flash_compl, | 2267 | if (!wait_for_completion_timeout(&adapter->et_cmd_compl, |
2262 | msecs_to_jiffies(40000))) | 2268 | msecs_to_jiffies(40000))) |
2263 | status = -1; | 2269 | status = -1; |
2264 | else | 2270 | else |
2265 | status = adapter->flash_status; | 2271 | status = adapter->flash_status; |
@@ -2370,6 +2376,7 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, | |||
2370 | { | 2376 | { |
2371 | struct be_mcc_wrb *wrb; | 2377 | struct be_mcc_wrb *wrb; |
2372 | struct be_cmd_req_loopback_test *req; | 2378 | struct be_cmd_req_loopback_test *req; |
2379 | struct be_cmd_resp_loopback_test *resp; | ||
2373 | int status; | 2380 | int status; |
2374 | 2381 | ||
2375 | spin_lock_bh(&adapter->mcc_lock); | 2382 | spin_lock_bh(&adapter->mcc_lock); |
@@ -2384,8 +2391,8 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, | |||
2384 | 2391 | ||
2385 | be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, | 2392 | be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, |
2386 | OPCODE_LOWLEVEL_LOOPBACK_TEST, sizeof(*req), wrb, NULL); | 2393 | OPCODE_LOWLEVEL_LOOPBACK_TEST, sizeof(*req), wrb, NULL); |
2387 | req->hdr.timeout = cpu_to_le32(4); | ||
2388 | 2394 | ||
2395 | req->hdr.timeout = cpu_to_le32(15); | ||
2389 | req->pattern = cpu_to_le64(pattern); | 2396 | req->pattern = cpu_to_le64(pattern); |
2390 | req->src_port = cpu_to_le32(port_num); | 2397 | req->src_port = cpu_to_le32(port_num); |
2391 | req->dest_port = cpu_to_le32(port_num); | 2398 | 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 | req->num_pkts = cpu_to_le32(num_pkts); | 2400 | req->num_pkts = cpu_to_le32(num_pkts); |
2394 | req->loopback_type = cpu_to_le32(loopback_type); | 2401 | req->loopback_type = cpu_to_le32(loopback_type); |
2395 | 2402 | ||
2396 | status = be_mcc_notify_wait(adapter); | 2403 | be_mcc_notify(adapter); |
2397 | if (!status) { | 2404 | |
2398 | struct be_cmd_resp_loopback_test *resp = embedded_payload(wrb); | 2405 | spin_unlock_bh(&adapter->mcc_lock); |
2399 | status = le32_to_cpu(resp->status); | ||
2400 | } | ||
2401 | 2406 | ||
2407 | wait_for_completion(&adapter->et_cmd_compl); | ||
2408 | resp = embedded_payload(wrb); | ||
2409 | status = le32_to_cpu(resp->status); | ||
2410 | |||
2411 | return status; | ||
2402 | err: | 2412 | err: |
2403 | spin_unlock_bh(&adapter->mcc_lock); | 2413 | spin_unlock_bh(&adapter->mcc_lock); |
2404 | return status; | 2414 | return status; |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 6b774a5279af..fa44bba4f93b 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -4208,7 +4208,7 @@ static int be_ctrl_init(struct be_adapter *adapter) | |||
4208 | spin_lock_init(&adapter->mcc_lock); | 4208 | spin_lock_init(&adapter->mcc_lock); |
4209 | spin_lock_init(&adapter->mcc_cq_lock); | 4209 | spin_lock_init(&adapter->mcc_cq_lock); |
4210 | 4210 | ||
4211 | init_completion(&adapter->flash_compl); | 4211 | init_completion(&adapter->et_cmd_compl); |
4212 | pci_save_state(adapter->pdev); | 4212 | pci_save_state(adapter->pdev); |
4213 | return 0; | 4213 | return 0; |
4214 | 4214 | ||