Netdev List
 help / color / mirror / Atom feed
From: Petr Machata <petrm@nvidia.com>
To: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>, <netdev@vger.kernel.org>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	<bridge@lists.linux.dev>, Ido Schimmel <idosch@nvidia.com>,
	Petr Machata <petrm@nvidia.com>, Andy Roulin <aroulin@nvidia.com>,
	<mlxsw@nvidia.com>
Subject: [PATCH net-next v2 09/13] net: rtnetlink: Report port ID in fallback FDB notifications
Date: Mon, 30 Nov 2026 14:03:25 +0100	[thread overview]
Message-ID: <034e11193d800cd2777b30ae62d03212654db20f.1796041491.git.petrm@nvidia.com> (raw)
In-Reply-To: <cover.1796041491.git.petrm@nvidia.com>

The previous patch made the bridge and VXLAN drivers report the port ID of
the requester in the FDB notifications that they emit. Other drivers that
implement ndo_fdb_add and ndo_fdb_del, as well as the default
implementations ndo_dflt_fdb_add() and ndo_dflt_fdb_del(), do not send
notifications themselves. Instead rtnl_fdb_add() and rtnl_fdb_del() send
one on their behalf through rtnl_fdb_notify(), and that always uses port ID
of zero.

Pass the port ID of the requester to rtnl_fdb_notify() as well, so that
the notifications sent for these devices carry it in nlmsg_pid just like
the ones from bridge and VXLAN.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
---
 net/core/rtnetlink.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index e1607a3232c7..51713666f0e3 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -4721,7 +4721,7 @@ static inline size_t rtnl_fdb_nlmsg_size(const struct net_device *dev)
 }
 
 static void rtnl_fdb_notify(struct net_device *dev, u8 *addr, u16 vid, int type,
-			    u16 ndm_state)
+			    u16 ndm_state, u32 portid)
 {
 	struct net *net = dev_net(dev);
 	struct sk_buff *skb;
@@ -4732,7 +4732,7 @@ static void rtnl_fdb_notify(struct net_device *dev, u8 *addr, u16 vid, int type,
 		goto errout;
 
 	err = nlmsg_populate_fdb_fill(skb, dev, addr, vid,
-				      0, 0, type, NTF_SELF, 0, ndm_state);
+				      portid, 0, type, NTF_SELF, 0, ndm_state);
 	if (err < 0) {
 		kfree_skb(skb);
 		goto errout;
@@ -4888,7 +4888,7 @@ static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh,
 
 		if (!err && !notified) {
 			rtnl_fdb_notify(dev, addr, vid, RTM_NEWNEIGH,
-					ndm->ndm_state);
+					ndm->ndm_state, parms.portid);
 			ndm->ndm_flags &= ~NTF_SELF;
 		}
 	}
@@ -5033,7 +5033,7 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,
 		if (!err) {
 			if (!del_bulk && !notified)
 				rtnl_fdb_notify(dev, addr, vid, RTM_DELNEIGH,
-						ndm->ndm_state);
+						ndm->ndm_state, portid);
 			ndm->ndm_flags &= ~NTF_SELF;
 		}
 	}
-- 
2.56.1


  parent reply	other threads:[~2026-11-30 13:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 13:03 [PATCH net-next v2 00/13] net: Report requester's port ID in FDB notifications Petr Machata
2026-11-30 13:03 ` [PATCH net-next v2 01/13] net: Introduce struct ndo_fdb_parms Petr Machata
2026-11-30 13:03 ` [PATCH net-next v2 02/13] net: Pass struct ndo_fdb_parms to ndo_dflt_fdb_{add, del}() Petr Machata
2026-11-30 13:03 ` [PATCH net-next v2 03/13] net: Pass portid to ndo_fdb_get through the structure Petr Machata
2026-11-30 13:03 ` [PATCH net-next v2 04/13] net: bridge: Pass struct ndo_fdb_parms a bit further Petr Machata
2026-11-30 13:03 ` [PATCH net-next v2 05/13] net: bridge: Pass portid through FDB notifications Petr Machata
2026-11-30 13:03 ` [PATCH net-next v2 06/13] net: vxlan: " Petr Machata
2026-11-30 13:03 ` [PATCH net-next v2 07/13] net: rtnetlink: Report port ID in bridge and VXLAN " Petr Machata
2026-11-30 13:03 ` [PATCH net-next v2 08/13] net: rtnetlink: Report port ID in bulk FDB delete notifications Petr Machata
2026-11-30 13:03 ` Petr Machata [this message]
2026-11-30 13:03 ` [PATCH net-next v2 10/13] netlink: specs: rt-neigh: Extend the delneigh request attributes Petr Machata
2026-11-30 13:03 ` [PATCH net-next v2 11/13] tools: ynl: Add NLM_F_BULK Petr Machata
2026-11-30 13:03 ` [PATCH net-next v2 12/13] selftests: net: lib: py: Add RtnlNeighFamily Petr Machata
2026-11-30 13:03 ` [PATCH net-next v2 13/13] selftests: net: Add a test for port ID in FDB notifications Petr Machata
2026-11-30 13:24 ` [PATCH net-next v2 00/13] net: Report requester's " Przemek Kitszel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=034e11193d800cd2777b30ae62d03212654db20f.1796041491.git.petrm@nvidia.com \
    --to=petrm@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=aroulin@nvidia.com \
    --cc=bridge@lists.linux.dev \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=mlxsw@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=razor@blackwall.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox