net: change ndo_set_rx_mode_async return type to int

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>
This commit is contained in:
Stanislav Fomichev 2026-06-08 08:40:12 -07:00 committed by Jakub Kicinski
parent 41d3e102ed
commit d11706b56a
9 changed files with 46 additions and 31 deletions

View 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)

View File

@ -47,10 +47,11 @@
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,

View 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,

View 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;
}
/**

View 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)

View 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)

View File

@ -185,10 +185,11 @@ static netdev_tx_t nsim_start_xmit(struct sk_buff *skb, struct net_device *dev)
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)

View 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)

View 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);