Commit 559b633f authored by Sathya Perla's avatar Sathya Perla Committed by David S. Miller

be2net: move async cmd processing to a separate routine

For some FW cmds, the caller just issues the cmd and doesn't wait for a
response. The response handling is done in the MCCQ compl processing context
only. Move this code into a separate routine to make be_mcc_compl_process()
more manageable.
Signed-off-by: default avatarSathya Perla <sathya.perla@emulex.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4c60005f
...@@ -132,23 +132,16 @@ static bool be_skip_err_log(u8 opcode, u16 base_status, u16 addl_status) ...@@ -132,23 +132,16 @@ static bool be_skip_err_log(u8 opcode, u16 base_status, u16 addl_status)
return false; return false;
} }
static int be_mcc_compl_process(struct be_adapter *adapter, /* Place holder for all the async MCC cmds wherein the caller is not in a busy
struct be_mcc_compl *compl) * loop (has not issued be_mcc_notify_wait())
*/
static void be_async_cmd_process(struct be_adapter *adapter,
struct be_mcc_compl *compl,
struct be_cmd_resp_hdr *resp_hdr)
{ {
enum mcc_base_status base_status; enum mcc_base_status base_status = base_status(compl->status);
enum mcc_addl_status addl_status;
struct be_cmd_resp_hdr *resp_hdr;
u8 opcode = 0, subsystem = 0; u8 opcode = 0, subsystem = 0;
/* Just swap the status to host endian; mcc tag is opaquely copied
* from mcc_wrb */
be_dws_le_to_cpu(compl, 4);
base_status = base_status(compl->status);
addl_status = addl_status(compl->status);
resp_hdr = be_decode_resp_hdr(compl->tag0, compl->tag1);
if (resp_hdr) { if (resp_hdr) {
opcode = resp_hdr->opcode; opcode = resp_hdr->opcode;
subsystem = resp_hdr->subsystem; subsystem = resp_hdr->subsystem;
...@@ -157,36 +150,65 @@ static int be_mcc_compl_process(struct be_adapter *adapter, ...@@ -157,36 +150,65 @@ static int be_mcc_compl_process(struct be_adapter *adapter,
if (opcode == OPCODE_LOWLEVEL_LOOPBACK_TEST && if (opcode == OPCODE_LOWLEVEL_LOOPBACK_TEST &&
subsystem == CMD_SUBSYSTEM_LOWLEVEL) { subsystem == CMD_SUBSYSTEM_LOWLEVEL) {
complete(&adapter->et_cmd_compl); complete(&adapter->et_cmd_compl);
return 0; return;
} }
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->et_cmd_compl); complete(&adapter->et_cmd_compl);
return;
} }
if (base_status == MCC_STATUS_SUCCESS) { if ((opcode == OPCODE_ETH_GET_STATISTICS ||
if (((opcode == OPCODE_ETH_GET_STATISTICS) || opcode == OPCODE_ETH_GET_PPORT_STATS) &&
(opcode == OPCODE_ETH_GET_PPORT_STATS)) && subsystem == CMD_SUBSYSTEM_ETH &&
(subsystem == CMD_SUBSYSTEM_ETH)) { base_status == MCC_STATUS_SUCCESS) {
be_parse_stats(adapter); be_parse_stats(adapter);
adapter->stats_cmd_sent = false; adapter->stats_cmd_sent = false;
return;
} }
if (opcode == OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES && if (opcode == OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES &&
subsystem == CMD_SUBSYSTEM_COMMON) { subsystem == CMD_SUBSYSTEM_COMMON) {
if (base_status == MCC_STATUS_SUCCESS) {
struct be_cmd_resp_get_cntl_addnl_attribs *resp = struct be_cmd_resp_get_cntl_addnl_attribs *resp =
(void *)resp_hdr; (void *)resp_hdr;
adapter->drv_stats.be_on_die_temperature = adapter->drv_stats.be_on_die_temperature =
resp->on_die_temperature; resp->on_die_temperature;
}
} else { } else {
if (opcode == OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES)
adapter->be_get_temp_freq = 0; adapter->be_get_temp_freq = 0;
}
return;
}
}
if (be_skip_err_log(opcode, base_status, addl_status)) static int be_mcc_compl_process(struct be_adapter *adapter,
return compl->status; struct be_mcc_compl *compl)
{
enum mcc_base_status base_status;
enum mcc_addl_status addl_status;
struct be_cmd_resp_hdr *resp_hdr;
u8 opcode = 0, subsystem = 0;
/* Just swap the status to host endian; mcc tag is opaquely copied
* from mcc_wrb */
be_dws_le_to_cpu(compl, 4);
base_status = base_status(compl->status);
addl_status = addl_status(compl->status);
resp_hdr = be_decode_resp_hdr(compl->tag0, compl->tag1);
if (resp_hdr) {
opcode = resp_hdr->opcode;
subsystem = resp_hdr->subsystem;
}
be_async_cmd_process(adapter, compl, resp_hdr);
if (base_status != MCC_STATUS_SUCCESS &&
!be_skip_err_log(opcode, base_status, addl_status)) {
if (base_status == MCC_STATUS_UNAUTHORIZED_REQUEST) { if (base_status == MCC_STATUS_UNAUTHORIZED_REQUEST) {
dev_warn(&adapter->pdev->dev, dev_warn(&adapter->pdev->dev,
......
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