bnxt_en: Bug fixes
Michael Chan
maintainercover bnxt_en: Bug fixes
Patches 1, 3, and 4 are bug fixes related to the FW log tracing driver coredump feature recently added in 6.13. Patch #1 adds the necessary call to shutdown the FW logging DMA during PCI shutdown. Patch #3 fixes a possible null pointer derefernce when using early versions of the FW with this feature. Patch #4 adds the coredump header information unconditionally to make it more robust.
Patch #2 fixes a possible memory leak during PTP shutdown. Patch #5 eliminates a dmesg warning when doing devlink reload.
Gautam R A (1):
bnxt_en: Fix null pointer dereference in bnxt_bs_trace_check_wrap()
Kalesh AP (1):
bnxt_en: Fix a possible memory leak in bnxt_ptp_init
Kashyap Desai (1):
bnxt_en: Always provide max entry and entry size in coredump segments
Michael Chan (1):
bnxt_en: Shutdown FW DMA in bnxt_shutdown()
Shantiprasad Shettar (1):
bnxt_en: Fix warning in bnxt_dl_reload_down()
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 +++++- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 3 ++- drivers/net/ethernet/broadcom/bnxt/bnxt_coredump.c | 5 +++-- drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 4 ++-- 5 files changed, 13 insertions(+), 7 deletions(-)
Signature · 1 line
2.51.0
Michael Chan
maintainerPATCH 1/5 bnxt_en: Shutdown FW DMA in bnxt_shutdown()
The netif_close() call in bnxt_shutdown() only stops packet DMA. There may be FW DMA for trace logging (recently added) that will continue. If we kexec to a new kernel, the DMA will corrupt memory in the new kernel.
Add bnxt_hwrm_func_drv_unrgtr() to unregister the driver from the FW. This will stop the FW DMA. In case the call fails, call pcie_flr() to reset the function and stop the DMA.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +4 -0
@@ -16892,6 +16892,10 @@ static void bnxt_shutdown(struct pci_dev *pdev)if (netif_running (dev))netif_close (dev); +if (bnxt_hwrm_func_drv_unrgtr (bp)) { +pcie_flr (pdev); + goto shutdown_exit; + }bnxt_ptp_clear (bp);bnxt_clear_int_mode (bp);pci_disable_device (pdev);
Signature · 1 line
2.51.0
Michael Chan
maintainerPATCH 2/5 bnxt_en: Fix a possible memory leak in bnxt_ptp_init
In reply to Michael ChanFrom: Kalesh AP <[email protected]>
In bnxt_ptp_init(), when ptp_clock_register() fails, the driver is not freeing the memory allocated for ptp_info->pin_config. Fix it to unconditionally free ptp_info->pin_config in bnxt_ptp_free().
--- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +2 -2
@@ -1051,9 +1051,9 @@ static void bnxt_ptp_free(struct bnxt *bp)if (ptp->ptp_clock) {ptp_clock_unregister (ptp->ptp_clock); ptp->ptp_clock =NULL ; -kfree (ptp->ptp_info.pin_config); - ptp->ptp_info.pin_config =NULL ; } +kfree (ptp->ptp_info.pin_config); + ptp->ptp_info.pin_config =NULL ; }int bnxt_ptp_init (struct bnxt *bp)
Signature · 1 line
2.51.0
Michael Chan
maintainerPATCH 3/5 bnxt_en: Fix null pointer dereference in bnxt_bs_trace_check_wrap()
In reply to Michael ChanFrom: Gautam R A <[email protected]>
With older FW, we may get the ASYNC_EVENT_CMPL_EVENT_ID_DBG_BUF_PRODUCER for FW trace data type that has not been initialized. This will result in a crash in bnxt_bs_trace_type_wrap(). Add a guard to check for a valid magic_byte pointer before proceeding.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.h +1 -1
@@ -2149,7 +2149,7 @@ struct bnxt_bs_trace_info {static inline void bnxt_bs_trace_check_wrap (struct bnxt_bs_trace_info *bs_trace,u32 offset) { -if (!bs_trace->wrapped && +if (!bs_trace->wrapped && bs_trace->magic_byte && *bs_trace->magic_byte !=BNXT_TRACE_BUF_MAGIC_BYTE ) bs_trace->wrapped =1 ; bs_trace->last_offset = offset;
Signature · 1 line
2.51.0
Michael Chan
maintainerPATCH 4/5 bnxt_en: Always provide max entry and entry size in coredump segments
In reply to Michael ChanFrom: Kashyap Desai <[email protected]>
While populating firmware host logging segments for the coredump, it is possible for the FW command that flushes the segment to fail. When that happens, the existing code will not update the max entry and entry size in the segment header and this causes software that decodes the coredump to skip the segment.
The segment most likely has already collected some DMA data, so always update these 2 segment fields in the header to allow the decoder to decode any data in the segment.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_coredump.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_coredump.c +3 -2
@@ -333,13 +333,14 @@ static void bnxt_fill_drv_seg_record(struct bnxt *bp,u32 offset =0 ;int rc =0 ; + record->max_entries =cpu_to_le32 (ctxm->max_entries); + record->entry_size =cpu_to_le32 (ctxm->entry_size); + rc =bnxt_dbg_hwrm_log_buffer_flush (bp, type,0 , &offset);if (rc)return ;bnxt_bs_trace_check_wrap (bs_trace, offset); - record->max_entries =cpu_to_le32 (ctxm->max_entries); - record->entry_size =cpu_to_le32 (ctxm->entry_size); record->offset =cpu_to_le32 (bs_trace->last_offset); record->wrapped = bs_trace->wrapped; }
Signature · 1 line
2.51.0
Michael Chan
maintainerPATCH 5/5 bnxt_en: Fix warning in bnxt_dl_reload_down()
In reply to Michael ChanFrom: Shantiprasad Shettar <[email protected]>
The existing code calls bnxt_cancel_reservations() after bnxt_hwrm_func_drv_unrgtr() in bnxt_dl_reload_down(). bnxt_cancel_reservations() calls the FW and it will always fail since the driver has already unregistered, triggering this warning:
bnxt_en 0000:0a:00.0 ens2np0: resc_qcaps failed
Fix it by calling bnxt_clear_reservations() which will skip the unnecessary FW call since we have unregistered.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -1
@@ -12439,7 +12439,7 @@ static int bnxt_try_recover_fw(struct bnxt *bp)return -ENODEV ; } -static void bnxt_clear_reservations (struct bnxt *bp,bool fw_reset) +void bnxt_clear_reservations (struct bnxt *bp,bool fw_reset) {struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
drivers/net/ethernet/broadcom/bnxt/bnxt.h +1 -0
@@ -2941,6 +2941,7 @@ void bnxt_report_link(struct bnxt *bp);int bnxt_update_link (struct bnxt *bp,bool chng_link_state);int bnxt_hwrm_set_pause (struct bnxt *);int bnxt_hwrm_set_link_setting (struct bnxt *,bool ,bool ); +void bnxt_clear_reservations (struct bnxt *bp,bool fw_reset);int bnxt_cancel_reservations (struct bnxt *bp,bool fw_reset);int bnxt_hwrm_alloc_wol_fltr (struct bnxt *bp);int bnxt_hwrm_free_wol_fltr (struct bnxt *bp);
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +1 -1
@@ -461,7 +461,7 @@ static int bnxt_dl_reload_down(struct devlink *dl, bool netns_change,rtnl_unlock ();break ; } -bnxt_cancel_reservations (bp, false); +bnxt_clear_reservations (bp, false);bnxt_free_ctx_mem (bp, false);break ; }
Signature · 1 line
2.51.0
This series was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Mon, 3 Nov 2025 16:56:54 -0800 you wrote:
Patches 1, 3, and 4 are bug fixes related to the FW log tracing driver coredump feature recently added in 6.13. Patch #1 adds the necessary call to shutdown the FW logging DMA during PCI shutdown. Patch #3 fixes a possible null pointer derefernce when using early versions of the FW with this feature. Patch #4 adds the coredump header information unconditionally to make it more robust.
[...]
Here is the summary with links:
- [net,1/5] bnxt_en: Shutdown FW DMA in bnxt_shutdown()
https://git.kernel.org/netdev/net/c/bc7208ca805a - [net,2/5] bnxt_en: Fix a possible memory leak in bnxt_ptp_init https://git.kernel.org/netdev/net/c/deb8eb391643 - [net,3/5] bnxt_en: Fix null pointer dereference in bnxt_bs_trace_check_wrap() https://git.kernel.org/netdev/net/c/ff02be05f783 - [net,4/5] bnxt_en: Always provide max entry and entry size in coredump segments https://git.kernel.org/netdev/net/c/28d9a84ef0ce - [net,5/5] bnxt_en: Fix warning in bnxt_dl_reload_down() https://git.kernel.org/netdev/net/c/5204943a4c6e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html