[PATCH net-next 03/13] net: Pass portid to ndo_fdb_get through the structure

From
Petr Machata <petrm@nvidia.com>
Date
2026-11-23 18:00:53
Also in
bridge
Reply to
Petr Machata, 2026-11-23
So far, portid was passed as a separate argument to ndo_fdb_get. In
order to get the portid parameter to ndo_fdb_add and _del, we'll be
adding it to struct ndo_fdb_parms. That will make portid as an
explicit argument redundant.

Make the move from argument to structure member for ndo_fdb_get now as
a self-contained change. Proper support for ndo_fdb_add and _del will
be done next.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
---
 drivers/net/vxlan/vxlan_core.c | 4 ++--
 include/linux/netdevice.h      | 4 +++-
 net/bridge/br_fdb.c            | 5 ++---
 net/bridge/br_private.h        | 2 +-
 net/core/rtnetlink.c           | 4 ++--
 5 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
index a9f6bdd52c12..725c6216d56c 100644
--- a/drivers/net/vxlan/vxlan_core.c
+++ b/drivers/net/vxlan/vxlan_core.c
@@ -1399,7 +1399,7 @@ static int vxlan_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb,
 
 static int vxlan_fdb_get(struct sk_buff *skb,
 			 struct nlattr *tb[],
-			 const struct ndo_fdb_parms *parms, u32 portid, u32 seq,
+			 const struct ndo_fdb_parms *parms, u32 seq,
 			 struct netlink_ext_ack *extack)
 {
 	struct vxlan_dev *vxlan = netdev_priv(parms->dev);
@@ -1424,7 +1424,7 @@ static int vxlan_fdb_get(struct sk_buff *skb,
 		goto errout;
 	}
 
-	err = vxlan_fdb_info(skb, vxlan, f, portid, seq,
+	err = vxlan_fdb_info(skb, vxlan, f, parms->portid, seq,
 			     RTM_NEWNEIGH, 0, first_remote_rcu(f));
 errout:
 	rcu_read_unlock();
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 0bfd36057d3a..233584013fc9 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1093,12 +1093,14 @@ struct netdev_net_notifier {
  * @addr: MAC address of the FDB entry
  * @vid: VLAN ID of the FDB entry, 0 if none
  * @flags: netlink message flags (NLM_F_*) of the request
+ * @portid: netlink port ID of the requester
  */
 struct ndo_fdb_parms {
 	struct net_device	*dev;
 	const unsigned char	*addr;
 	u16			vid;
 	u16			flags;
+	u32			portid;
 };
 
 /*
@@ -1645,7 +1647,7 @@ struct net_device_ops {
 	int			(*ndo_fdb_get)(struct sk_buff *skb,
 					       struct nlattr *tb[],
 					       const struct ndo_fdb_parms *parms,
-					       u32 portid, u32 seq,
+					       u32 seq,
 					       struct netlink_ext_ack *extack);
 	int			(*ndo_mdb_add)(struct net_device *dev,
 					       struct nlattr *tb[],
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 8ed7af3e410d..9e2fdcc5ca9b 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -1146,7 +1146,7 @@ int br_fdb_dump(struct sk_buff *skb,
 
 int br_fdb_get(struct sk_buff *skb,
 	       struct nlattr *tb[],
-	       const struct ndo_fdb_parms *parms, u32 portid, u32 seq,
+	       const struct ndo_fdb_parms *parms, u32 seq,
 	       struct netlink_ext_ack *extack)
 {
 	struct net_bridge *br = netdev_priv(parms->dev);
@@ -1161,8 +1161,7 @@ int br_fdb_get(struct sk_buff *skb,
 		goto errout;
 	}
 
-	err = fdb_fill_info(skb, br, f, portid, seq,
-			    RTM_NEWNEIGH, 0);
+	err = fdb_fill_info(skb, br, f, parms->portid, seq, RTM_NEWNEIGH, 0);
 errout:
 	rcu_read_unlock();
 	return err;
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 0062bbe94d1c..f4eaaff816b7 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -1025,7 +1025,7 @@ int br_fdb_add(struct ndmsg *nlh, struct nlattr *tb[],
 int br_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb,
 		struct net_device *dev, struct net_device *fdev, int *idx);
 int br_fdb_get(struct sk_buff *skb, struct nlattr *tb[],
-	       const struct ndo_fdb_parms *parms, u32 portid, u32 seq,
+	       const struct ndo_fdb_parms *parms, u32 seq,
 	       struct netlink_ext_ack *extack);
 int br_fdb_sync_static(struct net_bridge *br, struct net_bridge_port *p);
 void br_fdb_unsync_static(struct net_bridge *br, struct net_bridge_port *p);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index e7d683952838..f31549923848 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -5420,10 +5420,10 @@ static int rtnl_fdb_get(struct sk_buff *in_skb, struct nlmsghdr *nlh,
 		.dev = dev,
 		.addr = addr,
 		.vid = vid,
+		.portid = NETLINK_CB(in_skb).portid,
 	};
 
-	err = ops->ndo_fdb_get(skb, tb, &parms, NETLINK_CB(in_skb).portid,
-			       nlh->nlmsg_seq, extack);
+	err = ops->ndo_fdb_get(skb, tb, &parms, nlh->nlmsg_seq, extack);
 	if (err)
 		goto out;
 
-- 
2.56.1
Thread (17 messages) 17 messages, 3 authors, last reply 5d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help