All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: <netdev@vger.kernel.org>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<edumazet@google.com>, <andrew+netdev@lunn.ch>,
	<horms@kernel.org>, <petrm@nvidia.com>, <razor@blackwall.org>,
	Ido Schimmel <idosch@nvidia.com>
Subject: [PATCH net-next 3/8] vxlan: Always refresh FDB 'updated' time when learning is enabled
Date: Tue, 4 Feb 2025 16:55:44 +0200	[thread overview]
Message-ID: <20250204145549.1216254-4-idosch@nvidia.com> (raw)
In-Reply-To: <20250204145549.1216254-1-idosch@nvidia.com>

Currently, when learning is enabled and a packet is received from the
expected remote, the 'updated' field of the FDB entry is not refreshed.
This will become a problem when we switch the VXLAN driver to age out
entries based on the 'updated' field.

Solve this by always refreshing an FDB entry when we receive a packet
with a matching source MAC address, regardless if it was received via
the expected remote or not as it indicates the host is alive. This is
consistent with the bridge driver's FDB.

Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 drivers/net/vxlan/vxlan_core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
index 676a93ce3a19..36cb06a56aca 100644
--- a/drivers/net/vxlan/vxlan_core.c
+++ b/drivers/net/vxlan/vxlan_core.c
@@ -1466,6 +1466,10 @@ static enum skb_drop_reason vxlan_snoop(struct net_device *dev,
 	f = vxlan_find_mac(vxlan, src_mac, vni);
 	if (likely(f)) {
 		struct vxlan_rdst *rdst = first_remote_rcu(f);
+		unsigned long now = jiffies;
+
+		if (READ_ONCE(f->updated) != now)
+			WRITE_ONCE(f->updated, now);
 
 		if (likely(vxlan_addr_equal(&rdst->remote_ip, src_ip) &&
 			   rdst->remote_ifindex == ifindex))
@@ -1485,7 +1489,6 @@ static enum skb_drop_reason vxlan_snoop(struct net_device *dev,
 				    src_mac, &rdst->remote_ip.sa, &src_ip->sa);
 
 		rdst->remote_ip = *src_ip;
-		WRITE_ONCE(f->updated, jiffies);
 		vxlan_fdb_notify(vxlan, f, rdst, RTM_NEWNEIGH, true, NULL);
 	} else {
 		u32 hash_index = fdb_head_index(vxlan, src_mac, vni);
-- 
2.48.1


  parent reply	other threads:[~2025-02-04 14:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-04 14:55 [PATCH net-next 0/8] vxlan: Age FDB entries based on Rx traffic Ido Schimmel
2025-02-04 14:55 ` [PATCH net-next 1/8] vxlan: Annotate FDB data races Ido Schimmel
2025-02-04 15:41   ` Eric Dumazet
2025-02-04 16:36   ` Nikolay Aleksandrov
2025-02-04 14:55 ` [PATCH net-next 2/8] vxlan: Read jiffies once when updating FDB 'used' time Ido Schimmel
2025-02-04 15:42   ` Eric Dumazet
2025-02-04 16:36   ` Nikolay Aleksandrov
2025-02-04 14:55 ` Ido Schimmel [this message]
2025-02-04 16:37   ` [PATCH net-next 3/8] vxlan: Always refresh FDB 'updated' time when learning is enabled Nikolay Aleksandrov
2025-02-04 14:55 ` [PATCH net-next 4/8] vxlan: Refresh FDB 'updated' time upon 'NTF_USE' Ido Schimmel
2025-02-04 16:37   ` Nikolay Aleksandrov
2025-02-04 14:55 ` [PATCH net-next 5/8] vxlan: Refresh FDB 'updated' time upon user space updates Ido Schimmel
2025-02-04 16:37   ` Nikolay Aleksandrov
2025-02-04 14:55 ` [PATCH net-next 6/8] vxlan: Age out FDB entries based on 'updated' time Ido Schimmel
2025-02-04 16:38   ` Nikolay Aleksandrov
2025-02-04 14:55 ` [PATCH net-next 7/8] vxlan: Avoid unnecessary updates to FDB 'used' time Ido Schimmel
2025-02-04 16:38   ` Nikolay Aleksandrov
2025-02-04 14:55 ` [PATCH net-next 8/8] selftests: forwarding: vxlan_bridge_1d: Check aging while forwarding Ido Schimmel
2025-02-04 16:38   ` Nikolay Aleksandrov
2025-02-06  4:40 ` [PATCH net-next 0/8] vxlan: Age FDB entries based on Rx traffic patchwork-bot+netdevbpf

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=20250204145549.1216254-4-idosch@nvidia.com \
    --to=idosch@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.