bnxt_en: 2 bug fixes.
Michael Chan
maintainercover bnxt_en: 2 bug fixes.
This first patch fixes a rare but possible crash in pci_disable_msix() when the MTU is changed. The 2nd patch fixes a regression in error code handling when flashing a file to NVRAM.
Please also queue these for -stable. Thanks.
Edwin Peer (1):
bnxt_en: fix error handling when flashing from file
Vasundhara Volam (1):
bnxt_en: reinitialize IRQs when MTU is modified
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 ++-- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 24 +++++++++++------------ 2 files changed, 13 insertions(+), 15 deletions(-)
Signature · 1 line
2.5.1
Michael Chan
maintainerPATCH 1/2 bnxt_en: reinitialize IRQs when MTU is modified
From: Vasundhara Volam <[email protected]>
MTU changes may affect the number of IRQs so we must call bnxt_close_nic()/bnxt_open_nic() with the irq_re_init parameter set to true. The reason is that a larger MTU may require aggregation rings not needed with smaller MTU. We may not be able to allocate the required number of aggregation rings and so we reduce the number of channels which will change the number of IRQs. Without this patch, it may crash eventually in pci_disable_msix() when the IRQs are not properly unwound.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +2 -2
@@ -10982,13 +10982,13 @@ static int bnxt_change_mtu(struct net_device *dev, int new_mtu)struct bnxt *bp =netdev_priv (dev);if (netif_running (dev)) -bnxt_close_nic (bp, false, false); +bnxt_close_nic (bp, true, false); dev->mtu = new_mtu;bnxt_set_ring_params (bp);if (netif_running (dev)) -return bnxt_open_nic (bp, false, false); +return bnxt_open_nic (bp, true, false);return 0 ; }
Signature · 1 line
2.5.1
Michael Chan
maintainerPATCH 2/2 bnxt_en: fix error handling when flashing from file
In reply to Michael ChanFrom: Edwin Peer <[email protected]>
After bnxt_hwrm_do_send_message() was updated to return standard error codes in a recent commit, a regression in bnxt_flash_package_from_file() was introduced. The return value does not properly reflect all possible firmware errors when calling firmware to flash the package.
Fix it by consolidating all errors in one local variable rc instead of having 2 variables for different errors.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 24 +++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +11 -13
@@ -2007,8 +2007,8 @@ int bnxt_flash_package_from_file(struct net_device *dev, const char *filename,struct hwrm_nvm_install_update_output *resp = bp->hwrm_cmd_resp_addr;struct hwrm_nvm_install_update_input install = {0 };const struct firmware *fw; -int rc, hwrm_err =0 ;u32 item_len; +int rc =0 ;u16 index;bnxt_hwrm_fw_set_time (bp);
@@ -2052,15 +2052,14 @@ int bnxt_flash_package_from_file(struct net_device *dev, const char *filename,memcpy (kmem, fw->data, fw->size); modify.host_src_addr =cpu_to_le64 (dma_handle); - hwrm_err =hwrm_send_message (bp, &modify, -sizeof (modify), -FLASH_PACKAGE_TIMEOUT ); + rc =hwrm_send_message (bp, &modify,sizeof (modify), +FLASH_PACKAGE_TIMEOUT );dma_free_coherent (&bp->pdev->dev, fw->size, kmem, dma_handle); } }release_firmware (fw); -if (rc || hwrm_err) +if (rc) goto err_exit;if ((install_type &0xffff ) ==0 )
@@ -2069,20 +2068,19 @@ int bnxt_flash_package_from_file(struct net_device *dev, const char *filename, install.install_type =cpu_to_le32 (install_type);mutex_lock (&bp->hwrm_cmd_lock); - hwrm_err =_hwrm_send_message (bp, &install,sizeof (install), -INSTALL_PACKAGE_TIMEOUT ); -if (hwrm_err) { + rc =_hwrm_send_message (bp, &install,sizeof (install), +INSTALL_PACKAGE_TIMEOUT ); +if (rc) {u8 error_code = ((struct hwrm_err_output *)resp)->cmd_err;if (resp->error_code && error_code ==NVM_INSTALL_UPDATE_CMD_ERR_CODE_FRAG_ERR ) { install.flags |=cpu_to_le16 (NVM_INSTALL_UPDATE_REQ_FLAGS_ALLOWED_TO_DEFRAG ); - hwrm_err =_hwrm_send_message (bp, &install, -sizeof (install), -INSTALL_PACKAGE_TIMEOUT ); + rc =_hwrm_send_message (bp, &install,sizeof (install), +INSTALL_PACKAGE_TIMEOUT ); } -if (hwrm_err) +if (rc) goto flash_pkg_exit; }
@@ -2094,7 +2092,7 @@ int bnxt_flash_package_from_file(struct net_device *dev, const char *filename, flash_pkg_exit:mutex_unlock (&bp->hwrm_cmd_lock); err_exit: -if (hwrm_err == -EACCES ) +if (rc == -EACCES )bnxt_print_admin_err (bp);return rc; }
Signature · 1 line
2.5.1
From: Michael Chan <[email protected]>
Date: Sun, 1 Mar 2020 22:07:16 -0500
Quoted 3 lines
This first patch fixes a rare but possible crash in
pci_disable_msix()when the MTU is changed. The 2nd patch fixes a regression in error code handling when flashing a file to NVRAM.
Applied.
Quoted 1 line
Please also queue these for -stable. Thanks.
Queued up, thanks Michael.