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

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'bnxt_en-2-bug-fixes'

Michael Chan says:

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

The first patch fixes a potential memory leak when sending a FW
message for the RoCE driver. The second patch fixes the potential
issue of DIM modifying the coalescing parameters of a ring that has
been freed.
====================

Link: https://patch.msgid.link/20250104043849.3482067-1-michael.chan@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+35 -6
+33 -5
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 2897 2897 return 0; 2898 2898 } 2899 2899 2900 + static bool bnxt_vnic_is_active(struct bnxt *bp) 2901 + { 2902 + struct bnxt_vnic_info *vnic = &bp->vnic_info[0]; 2903 + 2904 + return vnic->fw_vnic_id != INVALID_HW_RING_ID && vnic->mru > 0; 2905 + } 2906 + 2900 2907 static irqreturn_t bnxt_msix(int irq, void *dev_instance) 2901 2908 { 2902 2909 struct bnxt_napi *bnapi = dev_instance; ··· 3171 3164 break; 3172 3165 } 3173 3166 } 3174 - if (bp->flags & BNXT_FLAG_DIM) { 3167 + if ((bp->flags & BNXT_FLAG_DIM) && bnxt_vnic_is_active(bp)) { 3175 3168 struct dim_sample dim_sample = {}; 3176 3169 3177 3170 dim_update_sample(cpr->event_ctr, ··· 3302 3295 poll_done: 3303 3296 cpr_rx = &cpr->cp_ring_arr[0]; 3304 3297 if (cpr_rx->cp_ring_type == BNXT_NQ_HDL_TYPE_RX && 3305 - (bp->flags & BNXT_FLAG_DIM)) { 3298 + (bp->flags & BNXT_FLAG_DIM) && bnxt_vnic_is_active(bp)) { 3306 3299 struct dim_sample dim_sample = {}; 3307 3300 3308 3301 dim_update_sample(cpr->event_ctr, ··· 7273 7266 return rc; 7274 7267 } 7275 7268 7269 + static void bnxt_cancel_dim(struct bnxt *bp) 7270 + { 7271 + int i; 7272 + 7273 + /* DIM work is initialized in bnxt_enable_napi(). Proceed only 7274 + * if NAPI is enabled. 7275 + */ 7276 + if (!bp->bnapi || test_bit(BNXT_STATE_NAPI_DISABLED, &bp->state)) 7277 + return; 7278 + 7279 + /* Make sure NAPI sees that the VNIC is disabled */ 7280 + synchronize_net(); 7281 + for (i = 0; i < bp->rx_nr_rings; i++) { 7282 + struct bnxt_rx_ring_info *rxr = &bp->rx_ring[i]; 7283 + struct bnxt_napi *bnapi = rxr->bnapi; 7284 + 7285 + cancel_work_sync(&bnapi->cp_ring.dim.work); 7286 + } 7287 + } 7288 + 7276 7289 static int hwrm_ring_free_send_msg(struct bnxt *bp, 7277 7290 struct bnxt_ring_struct *ring, 7278 7291 u32 ring_type, int cmpl_ring_id) ··· 7393 7366 } 7394 7367 } 7395 7368 7369 + bnxt_cancel_dim(bp); 7396 7370 for (i = 0; i < bp->rx_nr_rings; i++) { 7397 7371 bnxt_hwrm_rx_ring_free(bp, &bp->rx_ring[i], close_path); 7398 7372 bnxt_hwrm_rx_agg_ring_free(bp, &bp->rx_ring[i], close_path); ··· 11337 11309 if (bnapi->in_reset) 11338 11310 cpr->sw_stats->rx.rx_resets++; 11339 11311 napi_disable(&bnapi->napi); 11340 - if (bnapi->rx_ring) 11341 - cancel_work_sync(&cpr->dim.work); 11342 11312 } 11343 11313 } 11344 11314 ··· 15598 15572 bnxt_hwrm_vnic_update(bp, vnic, 15599 15573 VNIC_UPDATE_REQ_ENABLES_MRU_VALID); 15600 15574 } 15601 - 15575 + /* Make sure NAPI sees that the VNIC is disabled */ 15576 + synchronize_net(); 15602 15577 rxr = &bp->rx_ring[idx]; 15578 + cancel_work_sync(&rxr->bnapi->cp_ring.dim.work); 15603 15579 bnxt_hwrm_rx_ring_free(bp, rxr, false); 15604 15580 bnxt_hwrm_rx_agg_ring_free(bp, rxr, false); 15605 15581 rxr->rx_next_cons = 0;
+2 -1
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
··· 208 208 209 209 rc = hwrm_req_replace(bp, req, fw_msg->msg, fw_msg->msg_len); 210 210 if (rc) 211 - return rc; 211 + goto drop_req; 212 212 213 213 hwrm_req_timeout(bp, req, fw_msg->timeout); 214 214 resp = hwrm_req_hold(bp, req); ··· 220 220 221 221 memcpy(fw_msg->resp, resp, resp_len); 222 222 } 223 + drop_req: 223 224 hwrm_req_drop(bp, req); 224 225 return rc; 225 226 }