aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/emulex/benet/be_main.c
diff options
context:
space:
mode:
authorKalesh AP <kalesh.purayil@emulex.com>2014-05-30 19:06:26 +0530
committerDavid S. Miller <davem@davemloft.net>2014-05-30 17:27:33 -0700
commit4c60005fe792255cb785c16019e8e0391a931b48 (patch)
treecd73ac01cc5ca52bc987642c9b32fcf5c3a98470 /drivers/net/ethernet/emulex/benet/be_main.c
parentbe2net: support flashing new regions on Skyhawk-R (diff)
downloadlinux-dev-4c60005fe792255cb785c16019e8e0391a931b48.tar.xz
linux-dev-4c60005fe792255cb785c16019e8e0391a931b48.zip
be2net: re-factor MCCQ error status handling code
This patch improves MCCQ error status handling in the following ways: a) A MCC cmd completion returns a base-status and an addl-status. So far, the routine be_mcc_compl_process() returned only the "status" value. Now, embedd both statuses in the return value and let the caller routine access the value of interest using base_status() and addl_status() macros. b) Rename variables accordingly (base/addl) to avoid confusion while error checking. b) Some of the errors returned by FW are harmless and so an error msg is not logged for such errors. Capture this logic in a separate routine to make the code more readable. Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com> Signed-off-by: Sathya Perla <sathya.perla@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index d2b4efabdc35..6822b3d76d85 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1111,7 +1111,8 @@ static int be_vid_config(struct be_adapter *adapter)
status = be_cmd_vlan_config(adapter, adapter->if_handle, vids, num);
if (status) {
/* Set to VLAN promisc mode as setting VLAN filter failed */
- if (status == MCC_ADDL_STS_INSUFFICIENT_RESOURCES)
+ if (addl_status(status) ==
+ MCC_ADDL_STATUS_INSUFFICIENT_RESOURCES)
goto set_vlan_promisc;
dev_err(&adapter->pdev->dev,
"Setting HW VLAN filtering failed.\n");
@@ -3729,7 +3730,7 @@ static int be_flash(struct be_adapter *adapter, const u8 *img,
img += num_bytes;
status = be_cmd_write_flashrom(adapter, flash_cmd, optype,
flash_op, num_bytes);
- if (status == MCC_STATUS_ILLEGAL_REQUEST &&
+ if (base_status(status) == MCC_STATUS_ILLEGAL_REQUEST &&
optype == OPTYPE_PHY_FW)
break;
else if (status)
@@ -3952,8 +3953,8 @@ static int be_flash_skyhawk(struct be_adapter *adapter,
* new FLASH op_type. To complete the remaining process,
* download the same FW again after the reboot.
*/
- if (status == MCC_STATUS_ILLEGAL_REQUEST ||
- status == MCC_STATUS_ILLEGAL_FIELD) {
+ if (base_status(status) == MCC_STATUS_ILLEGAL_REQUEST ||
+ base_status(status) == MCC_STATUS_ILLEGAL_FIELD) {
dev_err(dev, "Flash incomplete. Reset the server\n");
dev_err(dev, "Download FW image again after reset\n");
return -EAGAIN;
@@ -3975,9 +3976,10 @@ flash:
/* For old FW images ignore ILLEGAL_FIELD error or errors on
* UFI_DIR region
*/
- if (old_fw_img && (status == MCC_STATUS_ILLEGAL_FIELD ||
- (img_optype == OPTYPE_UFI_DIR &&
- status == MCC_STATUS_FAILED))) {
+ if (old_fw_img &&
+ (base_status(status) == MCC_STATUS_ILLEGAL_FIELD ||
+ (img_optype == OPTYPE_UFI_DIR &&
+ base_status(status) == MCC_STATUS_FAILED))) {
continue;
} else if (status) {
dev_err(dev, "Flashing section type 0x%x failed\n",