aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVasundhara Volam <vasundhara.volam@emulex.com>2014-06-30 03:31:30 -0400
committerDavid S. Miller <davem@davemloft.net>2014-07-02 21:40:56 -0400
commitba48c0c92704c68065ffb07661e4f99c800aeca2 (patch)
tree284763a72e868e5090c1a81be3b5abb0c6a7d018
parentbd4578bc84a8c8a390cf6002539e75447e78e935 (diff)
be2net: remove be_cmd_get_profile_config_mbox/mccq() variants
Fix be_cmd_get_profile_cmd() to use be_cmd_notify_wait() routine, which uses MBOX if MCCQ has not been created. Doing this reduces code duplication; we don't need the _mbox/_mccq() variants anymore. Signed-off-by: Vasundhara Volam <vasundhara.volam@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_cmds.c81
1 files changed, 14 insertions, 67 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index f4ea3490f446..0e2f6e1930ba 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -3440,76 +3440,16 @@ err:
3440 return status; 3440 return status;
3441} 3441}
3442 3442
3443/* Uses mbox */ 3443/* Will use MBOX only if MCCQ has not been created */
3444static int be_cmd_get_profile_config_mbox(struct be_adapter *adapter,
3445 u8 domain, struct be_dma_mem *cmd)
3446{
3447 struct be_mcc_wrb *wrb;
3448 struct be_cmd_req_get_profile_config *req;
3449 int status;
3450
3451 if (mutex_lock_interruptible(&adapter->mbox_lock))
3452 return -1;
3453 wrb = wrb_from_mbox(adapter);
3454
3455 req = cmd->va;
3456 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
3457 OPCODE_COMMON_GET_PROFILE_CONFIG,
3458 cmd->size, wrb, cmd);
3459
3460 req->type = ACTIVE_PROFILE_TYPE;
3461 req->hdr.domain = domain;
3462 if (!lancer_chip(adapter))
3463 req->hdr.version = 1;
3464
3465 status = be_mbox_notify_wait(adapter);
3466
3467 mutex_unlock(&adapter->mbox_lock);
3468 return status;
3469}
3470
3471/* Uses sync mcc */
3472static int be_cmd_get_profile_config_mccq(struct be_adapter *adapter,
3473 u8 domain, struct be_dma_mem *cmd)
3474{
3475 struct be_mcc_wrb *wrb;
3476 struct be_cmd_req_get_profile_config *req;
3477 int status;
3478
3479 spin_lock_bh(&adapter->mcc_lock);
3480
3481 wrb = wrb_from_mccq(adapter);
3482 if (!wrb) {
3483 status = -EBUSY;
3484 goto err;
3485 }
3486
3487 req = cmd->va;
3488 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
3489 OPCODE_COMMON_GET_PROFILE_CONFIG,
3490 cmd->size, wrb, cmd);
3491
3492 req->type = ACTIVE_PROFILE_TYPE;
3493 req->hdr.domain = domain;
3494 if (!lancer_chip(adapter))
3495 req->hdr.version = 1;
3496
3497 status = be_mcc_notify_wait(adapter);
3498
3499err:
3500 spin_unlock_bh(&adapter->mcc_lock);
3501 return status;
3502}
3503
3504/* Uses sync mcc, if MCCQ is already created otherwise mbox */
3505int be_cmd_get_profile_config(struct be_adapter *adapter, 3444int be_cmd_get_profile_config(struct be_adapter *adapter,
3506 struct be_resources *res, u8 domain) 3445 struct be_resources *res, u8 domain)
3507{ 3446{
3508 struct be_cmd_resp_get_profile_config *resp; 3447 struct be_cmd_resp_get_profile_config *resp;
3448 struct be_cmd_req_get_profile_config *req;
3509 struct be_pcie_res_desc *pcie; 3449 struct be_pcie_res_desc *pcie;
3510 struct be_port_res_desc *port; 3450 struct be_port_res_desc *port;
3511 struct be_nic_res_desc *nic; 3451 struct be_nic_res_desc *nic;
3512 struct be_queue_info *mccq = &adapter->mcc_obj.q; 3452 struct be_mcc_wrb wrb = {0};
3513 struct be_dma_mem cmd; 3453 struct be_dma_mem cmd;
3514 u32 desc_count; 3454 u32 desc_count;
3515 int status; 3455 int status;
@@ -3520,10 +3460,17 @@ int be_cmd_get_profile_config(struct be_adapter *adapter,
3520 if (!cmd.va) 3460 if (!cmd.va)
3521 return -ENOMEM; 3461 return -ENOMEM;
3522 3462
3523 if (!mccq->created) 3463 req = cmd.va;
3524 status = be_cmd_get_profile_config_mbox(adapter, domain, &cmd); 3464 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
3525 else 3465 OPCODE_COMMON_GET_PROFILE_CONFIG,
3526 status = be_cmd_get_profile_config_mccq(adapter, domain, &cmd); 3466 cmd.size, &wrb, &cmd);
3467
3468 req->hdr.domain = domain;
3469 if (!lancer_chip(adapter))
3470 req->hdr.version = 1;
3471 req->type = ACTIVE_PROFILE_TYPE;
3472
3473 status = be_cmd_notify_wait(adapter, &wrb);
3527 if (status) 3474 if (status)
3528 goto err; 3475 goto err;
3529 3476