Commit 8e42aef0 authored by Kalesh AP's avatar Kalesh AP Committed by David S. Miller

bnxt_en: refactor error handling of HWRM_NVM_INSTALL_UPDATE

This is in anticipation of handling more "cmd_err" from FW in the next
patch.
Reviewed-by: default avatarSomnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: default avatarEdwin Peer <edwin.peer@broadcom.com>
Signed-off-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2057b8b7
...@@ -2512,6 +2512,7 @@ int bnxt_flash_package_from_fw_obj(struct net_device *dev, const struct firmware ...@@ -2512,6 +2512,7 @@ int bnxt_flash_package_from_fw_obj(struct net_device *dev, const struct firmware
u8 *kmem = NULL; u8 *kmem = NULL;
u32 modify_len; u32 modify_len;
u32 item_len; u32 item_len;
u8 cmd_err;
u16 index; u16 index;
int rc; int rc;
...@@ -2595,6 +2596,8 @@ int bnxt_flash_package_from_fw_obj(struct net_device *dev, const struct firmware ...@@ -2595,6 +2596,8 @@ int bnxt_flash_package_from_fw_obj(struct net_device *dev, const struct firmware
} }
rc = hwrm_req_send_silent(bp, install); rc = hwrm_req_send_silent(bp, install);
if (!rc)
break;
if (defrag_attempted) { if (defrag_attempted) {
/* We have tried to defragment already in the previous /* We have tried to defragment already in the previous
...@@ -2603,15 +2606,20 @@ int bnxt_flash_package_from_fw_obj(struct net_device *dev, const struct firmware ...@@ -2603,15 +2606,20 @@ int bnxt_flash_package_from_fw_obj(struct net_device *dev, const struct firmware
break; break;
} }
if (rc && ((struct hwrm_err_output *)resp)->cmd_err == cmd_err = ((struct hwrm_err_output *)resp)->cmd_err;
NVM_INSTALL_UPDATE_CMD_ERR_CODE_FRAG_ERR) {
switch (cmd_err) {
case NVM_INSTALL_UPDATE_CMD_ERR_CODE_FRAG_ERR:
install->flags = install->flags =
cpu_to_le16(NVM_INSTALL_UPDATE_REQ_FLAGS_ALLOWED_TO_DEFRAG); cpu_to_le16(NVM_INSTALL_UPDATE_REQ_FLAGS_ALLOWED_TO_DEFRAG);
rc = hwrm_req_send_silent(bp, install); rc = hwrm_req_send_silent(bp, install);
if (!rc)
break;
cmd_err = ((struct hwrm_err_output *)resp)->cmd_err;
if (rc && ((struct hwrm_err_output *)resp)->cmd_err == if (cmd_err == NVM_INSTALL_UPDATE_CMD_ERR_CODE_NO_SPACE) {
NVM_INSTALL_UPDATE_CMD_ERR_CODE_NO_SPACE) {
/* FW has cleared NVM area, driver will create /* FW has cleared NVM area, driver will create
* UPDATE directory and try the flash again * UPDATE directory and try the flash again
*/ */
...@@ -2621,11 +2629,13 @@ int bnxt_flash_package_from_fw_obj(struct net_device *dev, const struct firmware ...@@ -2621,11 +2629,13 @@ int bnxt_flash_package_from_fw_obj(struct net_device *dev, const struct firmware
BNX_DIR_TYPE_UPDATE, BNX_DIR_TYPE_UPDATE,
BNX_DIR_ORDINAL_FIRST, BNX_DIR_ORDINAL_FIRST,
0, 0, item_len, NULL, 0); 0, 0, item_len, NULL, 0);
} else if (rc) { if (!rc)
netdev_err(dev, "HWRM_NVM_INSTALL_UPDATE failure rc :%x\n", rc); break;
} }
} else if (rc) { fallthrough;
netdev_err(dev, "HWRM_NVM_INSTALL_UPDATE failure rc :%x\n", rc); default:
netdev_err(dev, "HWRM_NVM_INSTALL_UPDATE failure rc :%x cmd_err :%x\n",
rc, cmd_err);
} }
} while (defrag_attempted && !rc); } while (defrag_attempted && !rc);
......
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