]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: change ndo_set_rx_mode_async return type to int
authorStanislav Fomichev <sdf.kernel@gmail.com>
Mon, 8 Jun 2026 15:40:12 +0000 (08:40 -0700)
committerJakub Kicinski <kuba@kernel.org>
Wed, 10 Jun 2026 01:15:29 +0000 (18:15 -0700)
Change the return type of ndo_set_rx_mode_async from void to int to
allow drivers to report failures back to the core stack. This is a
prerequisite for adding retry logic in the core when drivers fail to
program RX filters (e.g. bnxt VF when PF is unavailable).

All existing implementations return 0 for now, maintaining current
behavior.

Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20260608154014.227538-2-sdf@fomichev.me
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/infiniband/ulp/ipoib/ipoib_main.c
drivers/net/dummy.c
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/intel/iavf/iavf_main.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
drivers/net/netdevsim/netdev.c
drivers/net/netkit.c
include/linux/netdevice.h

index 3e1e1e861739443b33732abf91ac8abe6a05560d..16a015b67206327d45572964200bfb4224261856 100644 (file)
@@ -1297,18 +1297,19 @@ static int ipoib_hard_header(struct sk_buff *skb,
        return IPOIB_HARD_LEN;
 }
 
-static void ipoib_set_rx_mode_async(struct net_device *dev,
-                                   struct netdev_hw_addr_list *uc,
-                                   struct netdev_hw_addr_list *mc)
+static int ipoib_set_rx_mode_async(struct net_device *dev,
+                                  struct netdev_hw_addr_list *uc,
+                                  struct netdev_hw_addr_list *mc)
 {
        struct ipoib_dev_priv *priv = ipoib_priv(dev);
 
        if (!test_bit(IPOIB_FLAG_OPER_UP, &priv->flags)) {
                ipoib_dbg(priv, "IPOIB_FLAG_OPER_UP not set");
-               return;
+               return 0;
        }
 
        queue_work(priv->wq, &priv->restart_task);
+       return 0;
 }
 
 static int ipoib_get_iflink(const struct net_device *dev)
index f6732eab5923f02d0164f2a47258b87740f8c593..36a4e85c6668ea71beb40f716b6843668c28446c 100644 (file)
 static int numdummies = 1;
 
 /* fake multicast ability */
-static void set_multicast_list(struct net_device *dev,
-                              struct netdev_hw_addr_list *uc,
-                              struct netdev_hw_addr_list *mc)
+static int set_multicast_list(struct net_device *dev,
+                             struct netdev_hw_addr_list *uc,
+                             struct netdev_hw_addr_list *mc)
 {
+       return 0;
 }
 
 static void dummy_get_stats64(struct net_device *dev,
index dbaf9586ee221c317aba4d80f21866a8a277ee06..f3c76ffaa1cac89e54d9262f6e228888fd4e0e39 100644 (file)
@@ -13679,9 +13679,9 @@ static bool bnxt_uc_list_updated(struct bnxt *bp,
        return false;
 }
 
-static void bnxt_set_rx_mode(struct net_device *dev,
-                            struct netdev_hw_addr_list *uc,
-                            struct netdev_hw_addr_list *mc)
+static int bnxt_set_rx_mode(struct net_device *dev,
+                           struct netdev_hw_addr_list *uc,
+                           struct netdev_hw_addr_list *mc)
 {
        struct bnxt *bp = netdev_priv(dev);
        struct bnxt_vnic_info *vnic;
@@ -13690,7 +13690,7 @@ static void bnxt_set_rx_mode(struct net_device *dev,
        u32 mask;
 
        if (!test_bit(BNXT_STATE_OPEN, &bp->state))
-               return;
+               return 0;
 
        vnic = &bp->vnic_info[BNXT_VNIC_DEFAULT];
        mask = vnic->rx_mask;
@@ -13718,6 +13718,8 @@ static void bnxt_set_rx_mode(struct net_device *dev,
 
                bnxt_cfg_rx_mode(bp, uc, uc_update);
        }
+
+       return 0;
 }
 
 static int bnxt_cfg_rx_mode(struct bnxt *bp, struct netdev_hw_addr_list *uc,
index 8b53ffb75650087c29e9fd0cd352dd5a471a956d..29b8403a066bc8fbcf54472a40e85aa251e8975d 100644 (file)
@@ -1134,10 +1134,12 @@ bool iavf_promiscuous_mode_changed(struct iavf_adapter *adapter)
  * @netdev: network interface device structure
  * @uc: snapshot of uc address list
  * @mc: snapshot of mc address list
+ *
+ * Return: 0 on success.
  **/
-static void iavf_set_rx_mode(struct net_device *netdev,
-                            struct netdev_hw_addr_list *uc,
-                            struct netdev_hw_addr_list *mc)
+static int iavf_set_rx_mode(struct net_device *netdev,
+                           struct netdev_hw_addr_list *uc,
+                           struct netdev_hw_addr_list *mc)
 {
        struct iavf_adapter *adapter = netdev_priv(netdev);
 
@@ -1150,6 +1152,8 @@ static void iavf_set_rx_mode(struct net_device *netdev,
        if (iavf_promiscuous_mode_changed(adapter))
                adapter->aq_required |= IAVF_FLAG_AQ_CONFIGURE_PROMISC_MODE;
        spin_unlock_bh(&adapter->current_netdev_promisc_flags_lock);
+
+       return 0;
 }
 
 /**
index c5d26c6829a0d171d14bed7efa677b09f05df457..775f0c6e55c955ebfa6adccee20d821f57c18abd 100644 (file)
@@ -4142,13 +4142,15 @@ static void mlx5e_nic_set_rx_mode(struct mlx5e_priv *priv)
        queue_work(priv->wq, &priv->set_rx_mode_work);
 }
 
-static void mlx5e_set_rx_mode(struct net_device *dev,
-                             struct netdev_hw_addr_list *uc,
-                             struct netdev_hw_addr_list *mc)
+static int mlx5e_set_rx_mode(struct net_device *dev,
+                            struct netdev_hw_addr_list *uc,
+                            struct netdev_hw_addr_list *mc)
 {
        struct mlx5e_priv *priv = netdev_priv(dev);
 
        mlx5e_fs_set_rx_mode_work(priv->fs, dev, uc, mc);
+
+       return 0;
 }
 
 static int mlx5e_set_mac(struct net_device *netdev, void *addr)
index f99ca551c1ceb31cb13b840da072e8296b2ca52b..dd77ab6052c88247ff9ae4c7110ea3ad4c1cc292 100644 (file)
@@ -240,9 +240,9 @@ void __fbnic_set_rx_mode(struct fbnic_dev *fbd,
        fbnic_write_tce_tcam(fbd);
 }
 
-static void fbnic_set_rx_mode(struct net_device *netdev,
-                             struct netdev_hw_addr_list *uc,
-                             struct netdev_hw_addr_list *mc)
+static int fbnic_set_rx_mode(struct net_device *netdev,
+                            struct netdev_hw_addr_list *uc,
+                            struct netdev_hw_addr_list *mc)
 {
        struct fbnic_net *fbn = netdev_priv(netdev);
        struct fbnic_dev *fbd = fbn->fbd;
@@ -250,6 +250,8 @@ static void fbnic_set_rx_mode(struct net_device *netdev,
        /* No need to update the hardware if we are not running */
        if (netif_running(netdev))
                __fbnic_set_rx_mode(fbd, uc, mc);
+
+       return 0;
 }
 
 static int fbnic_set_mac(struct net_device *netdev, void *p)
index a750768912b5a12d174dd1649ed4948339d3570c..27e5f109f933d22e1b34cfc745b2d1f4c21524a6 100644 (file)
@@ -185,10 +185,11 @@ out_drop_cnt:
        return NETDEV_TX_OK;
 }
 
-static void nsim_set_rx_mode(struct net_device *dev,
-                            struct netdev_hw_addr_list *uc,
-                            struct netdev_hw_addr_list *mc)
+static int nsim_set_rx_mode(struct net_device *dev,
+                           struct netdev_hw_addr_list *uc,
+                           struct netdev_hw_addr_list *mc)
 {
+       return 0;
 }
 
 static int nsim_change_mtu(struct net_device *dev, int new_mtu)
index 0ad6a806d7d56747fc1879e0a0153e94d6674544..a3931cd821321c3e4888edf86efc414199127bcf 100644 (file)
@@ -186,11 +186,12 @@ static int netkit_get_iflink(const struct net_device *dev)
        return iflink;
 }
 
-static void netkit_set_multicast(struct net_device *dev,
-                                struct netdev_hw_addr_list *uc,
-                                struct netdev_hw_addr_list *mc)
+static int netkit_set_multicast(struct net_device *dev,
+                               struct netdev_hw_addr_list *uc,
+                               struct netdev_hw_addr_list *mc)
 {
        /* Nothing to do, we receive whatever gets pushed to us! */
+       return 0;
 }
 
 static int netkit_set_macaddr(struct net_device *dev, void *sa)
index 9b876cd930d732f18680b28e2653341365824fc6..51ec2df020943ddc6619c7763d6b2e304b0fb9cf 100644 (file)
@@ -1122,13 +1122,14 @@ struct netdev_net_notifier {
  *     Cannot sleep, called with netif_addr_lock_bh held.
  *     Deprecated in favor of ndo_set_rx_mode_async.
  *
- * void (*ndo_set_rx_mode_async)(struct net_device *dev,
- *                              struct netdev_hw_addr_list *uc,
- *                              struct netdev_hw_addr_list *mc);
+ * int (*ndo_set_rx_mode_async)(struct net_device *dev,
+ *                             struct netdev_hw_addr_list *uc,
+ *                             struct netdev_hw_addr_list *mc);
  *     Async version of ndo_set_rx_mode which runs in process context
  *     with rtnl_lock and netdev_lock_ops(dev) held. The uc/mc parameters
  *     are snapshots of the address lists - iterate with
- *     netdev_hw_addr_list_for_each(ha, uc).
+ *     netdev_hw_addr_list_for_each(ha, uc). Return 0 on success or a
+ *     negative errno to request a retry via the core backoff.
  *
  * int (*ndo_set_mac_address)(struct net_device *dev, void *addr);
  *     This function  is called when the Media Access Control address
@@ -1455,7 +1456,7 @@ struct net_device_ops {
        void                    (*ndo_change_rx_flags)(struct net_device *dev,
                                                       int flags);
        void                    (*ndo_set_rx_mode)(struct net_device *dev);
-       void                    (*ndo_set_rx_mode_async)(
+       int                     (*ndo_set_rx_mode_async)(
                                        struct net_device *dev,
                                        struct netdev_hw_addr_list *uc,
                                        struct netdev_hw_addr_list *mc);