Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'bnxt_en-Bug-fixes'

Michael Chan says:

=====================
bnxt_en: Bug fixes

3 patches that fix some issues in the firmware reset logic, starting
with a small patch to refactor the code that re-enables SRIOV. The
last patch fixes a TC queue mapping issue.
====================

Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+24 -13
+24 -13
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 7893 7893 int tcs, i; 7894 7894 7895 7895 tcs = netdev_get_num_tc(dev); 7896 - if (tcs > 1) { 7896 + if (tcs) { 7897 7897 int i, off, count; 7898 7898 7899 7899 for (i = 0; i < tcs; i++) { ··· 9241 9241 bnxt_free_mem(bp, false); 9242 9242 } 9243 9243 9244 + static void bnxt_reenable_sriov(struct bnxt *bp) 9245 + { 9246 + if (BNXT_PF(bp)) { 9247 + struct bnxt_pf_info *pf = &bp->pf; 9248 + int n = pf->active_vfs; 9249 + 9250 + if (n) 9251 + bnxt_cfg_hw_sriov(bp, &n, true); 9252 + } 9253 + } 9254 + 9244 9255 static int bnxt_open(struct net_device *dev) 9245 9256 { 9246 9257 struct bnxt *bp = netdev_priv(dev); ··· 9270 9259 bnxt_hwrm_if_change(bp, false); 9271 9260 } else { 9272 9261 if (test_and_clear_bit(BNXT_STATE_FW_RESET_DET, &bp->state)) { 9273 - if (BNXT_PF(bp)) { 9274 - struct bnxt_pf_info *pf = &bp->pf; 9275 - int n = pf->active_vfs; 9276 - 9277 - if (n) 9278 - bnxt_cfg_hw_sriov(bp, &n, true); 9279 - } 9280 - if (!test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) 9262 + if (!test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) { 9281 9263 bnxt_ulp_start(bp, 0); 9264 + bnxt_reenable_sriov(bp); 9265 + } 9282 9266 } 9283 9267 bnxt_hwmon_open(bp); 9284 9268 } ··· 9313 9307 bnxt_debug_dev_exit(bp); 9314 9308 bnxt_disable_napi(bp); 9315 9309 del_timer_sync(&bp->timer); 9316 - if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state) && 9317 - pci_is_enabled(bp->pdev)) 9318 - pci_disable_device(bp->pdev); 9319 - 9320 9310 bnxt_free_skbs(bp); 9321 9311 9322 9312 /* Save ring stats before shutdown */ ··· 10098 10096 static void bnxt_fw_reset_close(struct bnxt *bp) 10099 10097 { 10100 10098 bnxt_ulp_stop(bp); 10099 + /* When firmware is fatal state, disable PCI device to prevent 10100 + * any potential bad DMAs before freeing kernel memory. 10101 + */ 10102 + if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state)) 10103 + pci_disable_device(bp->pdev); 10101 10104 __bnxt_close_nic(bp, true, false); 10102 10105 bnxt_clear_int_mode(bp); 10103 10106 bnxt_hwrm_func_drv_unrgtr(bp); 10107 + if (pci_is_enabled(bp->pdev)) 10108 + pci_disable_device(bp->pdev); 10104 10109 bnxt_free_ctx_mem(bp); 10105 10110 kfree(bp->ctx); 10106 10111 bp->ctx = NULL; ··· 10840 10831 smp_mb__before_atomic(); 10841 10832 clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state); 10842 10833 bnxt_ulp_start(bp, rc); 10834 + if (!rc) 10835 + bnxt_reenable_sriov(bp); 10843 10836 bnxt_dl_health_recovery_done(bp); 10844 10837 bnxt_dl_health_status_update(bp, true); 10845 10838 rtnl_unlock();