Thread (7 messages) 7 messages, 3 authors, 25d ago

Re: [PATCH net-next v3 1/2] rtnetlink: pass extack to ndo_bridge_getlink()

flat view

From: Nikolay Aleksandrov <razor@blackwall.org>
Date: 2026-09-20 07:08:36
Also in: bridge, intel-wired-lan, linux-s390

On 19/09/2026 16:43, Artem Lytkin wrote:
So the bridge can say why filling the link info failed.
No functional change.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Artem Lytkin <redacted>
---
  drivers/net/ethernet/broadcom/bnxt/bnxt.c      |  4 ++--
  drivers/net/ethernet/emulex/benet/be_main.c    |  4 ++--
  drivers/net/ethernet/intel/i40e/i40e_main.c    |  6 ++++--
  drivers/net/ethernet/intel/ice/ice_main.c      |  6 ++++--
  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c  |  5 +++--
  .../net/ethernet/mellanox/mlx5/core/en_main.c  |  4 ++--
  .../ethernet/netronome/nfp/nfp_net_common.c    |  4 ++--
  drivers/s390/net/qeth_l2_main.c                |  4 ++--
  include/linux/netdevice.h                      |  5 +++--
  include/linux/rtnetlink.h                      |  3 ++-
  net/bridge/br_netlink.c                        |  3 ++-
  net/bridge/br_private.h                        |  2 +-
  net/core/rtnetlink.c                           | 18 +++++++++++-------
  13 files changed, 40 insertions(+), 28 deletions(-)
Why do you add extack to ndo_dflt_bridge_getlink() at all? It doesn't use it and
just causes unnecessary churn in drivers.
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index ca99f4b1a63c3..a752e66bf6368 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -16154,12 +16154,12 @@ static const struct udp_tunnel_nic_info bnxt_udp_tunnels = {
  
  static int bnxt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
  			       struct net_device *dev, u32 filter_mask,
-			       int nlflags)
+			       int nlflags, struct netlink_ext_ack *extack)
  {
  	struct bnxt *bp = netdev_priv(dev);
  
  	return ndo_dflt_bridge_getlink(skb, pid, seq, dev, bp->br_mode, 0, 0,
-				       nlflags, filter_mask, NULL);
+				       nlflags, filter_mask, NULL, extack);
  }
  
  static int bnxt_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index ed302f5ec4768..cc9c87539a429 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -5011,7 +5011,7 @@ static int be_ndo_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
  
  static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
  				 struct net_device *dev, u32 filter_mask,
-				 int nlflags)
+				 int nlflags, struct netlink_ext_ack *extack)
  {
  	struct be_adapter *adapter = netdev_priv(dev);
  	int status = 0;
@@ -5037,7 +5037,7 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
  	return ndo_dflt_bridge_getlink(skb, pid, seq, dev,
  				       hsw_mode == PORT_FWD_TYPE_VEPA ?
  				       BRIDGE_MODE_VEPA : BRIDGE_MODE_VEB,
-				       0, 0, nlflags, filter_mask, NULL);
+				       0, 0, nlflags, filter_mask, NULL, extack);
  }
  
  static struct be_cmd_work *be_alloc_work(struct be_adapter *adapter,
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index abbc71e815ae3..52c2b393aacd2 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -13151,6 +13151,7 @@ static int i40e_ndo_bridge_setlink(struct net_device *dev,
   * @dev: the netdev being configured
   * @filter_mask: unused
   * @nlflags: netlink flags passed in
+ * @extack: netlink extended ack
   *
   * Return the mode in which the hardware bridge is operating in
   * i.e VEB or VEPA.
@@ -13158,7 +13159,8 @@ static int i40e_ndo_bridge_setlink(struct net_device *dev,
  static int i40e_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
  				   struct net_device *dev,
  				   u32 __always_unused filter_mask,
-				   int nlflags)
+				   int nlflags,
+				   struct netlink_ext_ack *extack)
  {
  	struct i40e_netdev_priv *np = netdev_priv(dev);
  	struct i40e_vsi *vsi = np->vsi;
@@ -13175,7 +13177,7 @@ static int i40e_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
  		return 0;
  
  	return ndo_dflt_bridge_getlink(skb, pid, seq, dev, veb->bridge_mode,
-				       0, 0, nlflags, filter_mask, NULL);
+				       0, 0, nlflags, filter_mask, NULL, extack);
  }
  
  /**
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 707c7431b91a6..f98295438df78 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -8095,12 +8095,14 @@ int ice_set_rss_hfunc(struct ice_vsi *vsi, u8 hfunc)
   * @dev: the netdev being configured
   * @filter_mask: filter mask passed in
   * @nlflags: netlink flags passed in
+ * @extack: netlink extended ack
   *
   * Return the bridge mode (VEB/VEPA)
   */
  static int
  ice_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
-		   struct net_device *dev, u32 filter_mask, int nlflags)
+		   struct net_device *dev, u32 filter_mask, int nlflags,
+		   struct netlink_ext_ack *extack)
  {
  	struct ice_pf *pf = ice_netdev_to_pf(dev);
  	u16 bmode;
@@ -8108,7 +8110,7 @@ ice_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
  	bmode = pf->first_sw->bridge_mode;
  
  	return ndo_dflt_bridge_getlink(skb, pid, seq, dev, bmode, 0, 0, nlflags,
-				       filter_mask, NULL);
+				       filter_mask, NULL, extack);
  }
  
  /**
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index f91856498eb2d..77dfd80a6e368 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -10726,7 +10726,8 @@ static int ixgbe_ndo_bridge_setlink(struct net_device *dev,
  
  static int ixgbe_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
  				    struct net_device *dev,
-				    u32 filter_mask, int nlflags)
+				    u32 filter_mask, int nlflags,
+				    struct netlink_ext_ack *extack)
  {
  	struct ixgbe_adapter *adapter = ixgbe_from_netdev(dev);
  
@@ -10735,7 +10736,7 @@ static int ixgbe_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
  
  	return ndo_dflt_bridge_getlink(skb, pid, seq, dev,
  				       adapter->bridge_mode, 0, 0, nlflags,
-				       filter_mask, NULL);
+				       filter_mask, NULL, extack);
  }
  
  static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index fc110a7d16e8d..53bf79dbe08de 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -5277,7 +5277,7 @@ static int mlx5e_xdp(struct net_device *dev, struct netdev_bpf *xdp)
  #ifdef CONFIG_MLX5_ESWITCH
  static int mlx5e_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
  				struct net_device *dev, u32 filter_mask,
-				int nlflags)
+				int nlflags, struct netlink_ext_ack *extack)
  {
  	struct mlx5e_priv *priv = netdev_priv(dev);
  	struct mlx5_core_dev *mdev = priv->mdev;
@@ -5288,7 +5288,7 @@ static int mlx5e_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
  	mode = setting ? BRIDGE_MODE_VEPA : BRIDGE_MODE_VEB;
  	return ndo_dflt_bridge_getlink(skb, pid, seq, dev,
  				       mode,
-				       0, 0, nlflags, filter_mask, NULL);
+				       0, 0, nlflags, filter_mask, NULL, extack);
  }
  
  static int mlx5e_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
index 7928e76da723e..cb751dddb6887 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
@@ -2257,7 +2257,7 @@ static int nfp_net_set_mac_address(struct net_device *netdev, void *addr)
  
  static int nfp_net_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
  				  struct net_device *dev, u32 filter_mask,
-				  int nlflags)
+				  int nlflags, struct netlink_ext_ack *extack)
  {
  	struct nfp_net *nn = netdev_priv(dev);
  	u16 mode;
@@ -2269,7 +2269,7 @@ static int nfp_net_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
  	       BRIDGE_MODE_VEPA : BRIDGE_MODE_VEB;
  
  	return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0,
-				       nlflags, filter_mask, NULL);
+				       nlflags, filter_mask, NULL, extack);
  }
  
  static int nfp_net_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 2935c2ecc314b..f960cf5a97a29 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -935,7 +935,7 @@ static void qeth_l2_br2dev_put(void)
  
  static int qeth_l2_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
  				  struct net_device *dev, u32 filter_mask,
-				  int nlflags)
+				  int nlflags, struct netlink_ext_ack *extack)
  {
  	struct qeth_priv *priv = netdev_priv(dev);
  	struct qeth_card *card = dev->ml_priv;
@@ -949,7 +949,7 @@ static int qeth_l2_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
  	return ndo_dflt_bridge_getlink(skb, pid, seq, dev,
  				       mode, priv->brport_features,
  				       priv->brport_hw_features,
-				       nlflags, filter_mask, NULL);
+				       nlflags, filter_mask, NULL, extack);
  }
  
  static const struct nla_policy qeth_brport_policy[IFLA_BRPORT_MAX + 1] = {
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 1f0710eef185b..02238b1e33453 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1360,7 +1360,7 @@ struct netdev_net_notifier {
   *			     u16 flags, struct netlink_ext_ack *extack)
   * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq,
   *			     struct net_device *dev, u32 filter_mask,
- *			     int nlflags)
+ *			     int nlflags, struct netlink_ext_ack *extack)
   * int (*ndo_bridge_dellink)(struct net_device *dev, struct nlmsghdr *nlh,
   *			     u16 flags);
   *
@@ -1659,7 +1659,8 @@ struct net_device_ops {
  						      u32 pid, u32 seq,
  						      struct net_device *dev,
  						      u32 filter_mask,
-						      int nlflags);
+						      int nlflags,
+						      struct netlink_ext_ack *extack);
  	int			(*ndo_bridge_dellink)(struct net_device *dev,
  						      struct nlmsghdr *nlh,
  						      u16 flags);
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 95729339e7a54..a408c36a7b558 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -222,7 +222,8 @@ extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
  				   u32 filter_mask,
  				   int (*vlan_fill)(struct sk_buff *skb,
  						    struct net_device *dev,
-						    u32 filter_mask));
+						    u32 filter_mask),
+				   struct netlink_ext_ack *extack);
  
  extern void rtnl_offload_xstats_notify(struct net_device *dev);
  
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index ae76df0de05a0..855a46aec3a89 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -680,7 +680,8 @@ void br_ifinfo_notify(int event, const struct net_bridge *br,
   * Dump information about all ports, in response to GETLINK
   */
  int br_getlink(struct sk_buff *skb, u32 pid, u32 seq,
-	       struct net_device *dev, u32 filter_mask, int nlflags)
+	       struct net_device *dev, u32 filter_mask, int nlflags,
+	       struct netlink_ext_ack *extack)
  {
  	struct net_bridge_port *port = br_port_get_rtnl(dev);
  
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 09c397e303307..edbe7a1f57363 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -2179,7 +2179,7 @@ int br_setlink(struct net_device *dev, struct nlmsghdr *nlmsg, u16 flags,
  	       struct netlink_ext_ack *extack);
  int br_dellink(struct net_device *dev, struct nlmsghdr *nlmsg, u16 flags);
  int br_getlink(struct sk_buff *skb, u32 pid, u32 seq, struct net_device *dev,
-	       u32 filter_mask, int nlflags);
+	       u32 filter_mask, int nlflags, struct netlink_ext_ack *extack);
  int br_process_vlan_info(struct net_bridge *br,
  			 struct net_bridge_port *p, int cmd,
  			 struct bridge_vlan_info *vinfo_curr,
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index e3444fd240615..a341e06f47d31 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -5420,7 +5420,8 @@ int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
  			    u32 filter_mask,
  			    int (*vlan_fill)(struct sk_buff *skb,
  					     struct net_device *dev,
-					     u32 filter_mask))
+					     u32 filter_mask),
+			    struct netlink_ext_ack *extack)
  {
  	struct nlmsghdr *nlh;
  	struct ifinfomsg *ifm;
@@ -5596,7 +5597,8 @@ static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb)
  			if (idx >= cb->args[0]) {
  				err = br_dev->netdev_ops->ndo_bridge_getlink(
  						skb, portid, seq, dev,
-						filter_mask, NLM_F_MULTI);
+						filter_mask, NLM_F_MULTI,
+						cb->extack);
  				if (err < 0 && err != -EOPNOTSUPP) {
  					if (likely(skb->len))
  						break;
@@ -5612,7 +5614,8 @@ static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb)
  				err = ops->ndo_bridge_getlink(skb, portid,
  							      seq, dev,
  							      filter_mask,
-							      NLM_F_MULTI);
+							      NLM_F_MULTI,
+							      cb->extack);
  				if (err < 0 && err != -EOPNOTSUPP) {
  					if (likely(skb->len))
  						break;
@@ -5646,7 +5649,8 @@ static inline size_t bridge_nlmsg_size(void)
  		+ nla_total_size(sizeof(u16));	/* IFLA_BRIDGE_MODE */
  }
  
-static int rtnl_bridge_notify(struct net_device *dev)
+static int rtnl_bridge_notify(struct net_device *dev,
+			      struct netlink_ext_ack *extack)
  {
  	struct net *net = dev_net(dev);
  	struct sk_buff *skb;
@@ -5661,7 +5665,7 @@ static int rtnl_bridge_notify(struct net_device *dev)
  		goto errout;
  	}
  
-	err = dev->netdev_ops->ndo_bridge_getlink(skb, 0, 0, dev, 0, 0);
+	err = dev->netdev_ops->ndo_bridge_getlink(skb, 0, 0, dev, 0, 0, extack);
  	if (err < 0)
  		goto errout;
  
@@ -5752,7 +5756,7 @@ static int rtnl_bridge_setlink(struct sk_buff *skb, struct nlmsghdr *nlh,
  			/* Generate event to notify upper layer of bridge
  			 * change
  			 */
-			err = rtnl_bridge_notify(dev);
+			err = rtnl_bridge_notify(dev, extack);
  		}
  	}
  
@@ -5827,7 +5831,7 @@ static int rtnl_bridge_dellink(struct sk_buff *skb, struct nlmsghdr *nlh,
  			/* Generate event to notify upper layer of bridge
  			 * change
  			 */
-			err = rtnl_bridge_notify(dev);
+			err = rtnl_bridge_notify(dev, extack);
  		}
  	}
  
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help