]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bnxt: convert to core rx_mode retry mechanism
authorStanislav Fomichev <sdf.kernel@gmail.com>
Mon, 8 Jun 2026 15:40:14 +0000 (08:40 -0700)
committerJakub Kicinski <kuba@kernel.org>
Wed, 10 Jun 2026 01:15:30 +0000 (18:15 -0700)
Remove the driver-specific BNXT_STATE_L2_FILTER_RETRY + timer + sp_task
retry mechanism and rely on the core stack's ndo_set_rx_mode_async retry
instead.

bnxt_cfg_rx_mode() now returns errors instead of swallowing them. The
PF-unavailable case (-ENODEV from HWRM on a VF) is normalized to
-EAGAIN at the boundary so callers can match on a single "retry me"
errno without re-implementing the VF/-ENODEV check. Other errors
propagate unchanged.

This removes:
- BNXT_STATE_L2_FILTER_RETRY state bit
- BNXT_RX_MASK_SP_EVENT sp_event bit
- Retry trigger from bnxt_timer()
- BNXT_RX_MASK_SP_EVENT handling from bnxt_sp_task()

bnxt_init_chip() still calls bnxt_cfg_rx_mode() directly during open.
On a fresh open dev->uc is empty and the call effectively cannot fail
on the unicast path. But on FW reset reopen (bnxt_fw_reset_task ->
bnxt_open) a VF may have a populated dev->uc and the PF may be
transiently unavailable; since that path doesn't go through
__dev_open(), the follow-up rx_mode call that would otherwise drive
the core retry doesn't fire. On -EAGAIN, swallow the error and call
netif_rx_mode_schedule_retry() explicitly. The unicast filter loop
truncates vnic->uc_filter_count on failure, so the retry's delta check
sees pending work and reinstalls.

Cc: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Link: https://patch.msgid.link/20260608154014.227538-4-sdf@fomichev.me
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h

index f3c76ffaa1cac89e54d9262f6e228888fd4e0e39..1eb214e4b511e2690d92318e45f4e80de184a0ee 100644 (file)
@@ -11232,8 +11232,12 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init)
        }
 
        rc = bnxt_cfg_rx_mode(bp, &bp->dev->uc, true);
-       if (rc)
+       if (rc == -EAGAIN) {
+               netif_rx_mode_schedule_retry(bp->dev);
+               rc = 0;
+       } else if (rc) {
                goto err_out;
+       }
 
 skip_rx_mask:
        rc = bnxt_hwrm_set_coal(bp);
@@ -13716,7 +13720,7 @@ static int bnxt_set_rx_mode(struct net_device *dev,
        if (mask != vnic->rx_mask || uc_update || mc_update) {
                vnic->rx_mask = mask;
 
-               bnxt_cfg_rx_mode(bp, uc, uc_update);
+               return bnxt_cfg_rx_mode(bp, uc, uc_update);
        }
 
        return 0;
@@ -13758,11 +13762,10 @@ static int bnxt_cfg_rx_mode(struct bnxt *bp, struct netdev_hw_addr_list *uc,
                rc = bnxt_hwrm_set_vnic_filter(bp, 0, i, vnic->uc_list + off);
                if (rc) {
                        if (BNXT_VF(bp) && rc == -ENODEV) {
-                               if (!test_and_set_bit(BNXT_STATE_L2_FILTER_RETRY, &bp->state))
-                                       netdev_warn(bp->dev, "Cannot configure L2 filters while PF is unavailable, will retry\n");
-                               else
-                                       netdev_dbg(bp->dev, "PF still unavailable while configuring L2 filters.\n");
-                               rc = 0;
+                               netdev_warn(bp->dev, "Cannot configure L2 filters while PF is unavailable, will retry\n");
+                               rc = -EAGAIN;
+                       } else if (rc == -EAGAIN) {
+                               netdev_warn(bp->dev, "FW busy while setting vnic filter, will retry\n");
                        } else {
                                netdev_err(bp->dev, "HWRM vnic filter failure rc: %x\n", rc);
                        }
@@ -13770,8 +13773,6 @@ static int bnxt_cfg_rx_mode(struct bnxt *bp, struct netdev_hw_addr_list *uc,
                        return rc;
                }
        }
-       if (test_and_clear_bit(BNXT_STATE_L2_FILTER_RETRY, &bp->state))
-               netdev_notice(bp->dev, "Retry of L2 filter configuration successful.\n");
 
 skip_uc:
        if ((vnic->rx_mask & CFA_L2_SET_RX_MASK_REQ_MASK_PROMISCUOUS) &&
@@ -14362,9 +14363,6 @@ static void bnxt_timer(struct timer_list *t)
                }
        }
 
-       if (test_bit(BNXT_STATE_L2_FILTER_RETRY, &bp->state))
-               bnxt_queue_sp_work(bp, BNXT_RX_MASK_SP_EVENT);
-
        if ((BNXT_CHIP_P5(bp)) && !bp->chip_rev && netif_carrier_ok(dev))
                bnxt_queue_sp_work(bp, BNXT_RING_COAL_NOW_SP_EVENT);
 
@@ -14727,7 +14725,6 @@ static void bnxt_ulp_restart(struct bnxt *bp)
 static void bnxt_sp_task(struct work_struct *work)
 {
        struct bnxt *bp = container_of(work, struct bnxt, sp_task);
-       struct net_device *dev = bp->dev;
 
        set_bit(BNXT_STATE_IN_SP_TASK, &bp->state);
        smp_mb__after_atomic();
@@ -14805,13 +14802,6 @@ static void bnxt_sp_task(struct work_struct *work)
        /* These functions below will clear BNXT_STATE_IN_SP_TASK.  They
         * must be the last functions to be called before exiting.
         */
-       if (test_and_clear_bit(BNXT_RX_MASK_SP_EVENT, &bp->sp_event)) {
-               bnxt_lock_sp(bp);
-               if (test_bit(BNXT_STATE_OPEN, &bp->state))
-                       bnxt_cfg_rx_mode(bp, &dev->uc, true);
-               bnxt_unlock_sp(bp);
-       }
-
        if (test_and_clear_bit(BNXT_RESET_TASK_SP_EVENT, &bp->sp_event))
                bnxt_reset(bp, false);
 
index 1920a161841ea8f2ac39651b370332db36b487c7..29ff5a584d16295f265ac1e53815dff81e954a0d 100644 (file)
@@ -2467,7 +2467,6 @@ struct bnxt {
 #define BNXT_STATE_DRV_REGISTERED      7
 #define BNXT_STATE_PCI_CHANNEL_IO_FROZEN       8
 #define BNXT_STATE_NAPI_DISABLED       9
-#define BNXT_STATE_L2_FILTER_RETRY     10
 #define BNXT_STATE_FW_ACTIVATE         11
 #define BNXT_STATE_RECOVER             12
 #define BNXT_STATE_FW_NON_FATAL_COND   13
@@ -2622,7 +2621,6 @@ struct bnxt {
 
        struct work_struct      sp_task;
        unsigned long           sp_event;
-#define BNXT_RX_MASK_SP_EVENT          0
 #define BNXT_RX_NTP_FLTR_SP_EVENT      1
 #define BNXT_LINK_CHNG_SP_EVENT                2
 #define BNXT_HWRM_EXEC_FWD_REQ_SP_EVENT        3