aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/vxlan/vxlan_core.c
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@nvidia.com>2025-04-15 15:11:32 +0300
committerPaolo Abeni <pabeni@redhat.com>2025-04-22 11:11:15 +0200
commitccc203b9a846c1d5262b5c60565ff79930c13477 (patch)
treedce308eb98488776b8ca4a19c0a6669f9ee9839f /drivers/net/vxlan/vxlan_core.c
parentvxlan: Insert FDB into hash table in vxlan_fdb_create() (diff)
downloadlinux-ccc203b9a846c1d5262b5c60565ff79930c13477.tar.gz
linux-ccc203b9a846c1d5262b5c60565ff79930c13477.zip
vxlan: Unsplit default FDB entry creation and notification
Commit 0241b836732f ("vxlan: fix default fdb entry netlink notify ordering during netdev create") split the creation of the default FDB entry from its notification to avoid sending a RTM_NEWNEIGH notification before RTM_NEWLINK. Previous patches restructured the code so that the default FDB entry is created after registering the VXLAN device and the notification about the new entry immediately follows its creation. Therefore, simplify the code and revert back to vxlan_fdb_update() which takes care of both creating the FDB entry and notifying user space about it. Hold the FDB hash lock when calling vxlan_fdb_update() like it expects. A subsequent patch will add a lockdep assertion to make sure this is indeed the case. Reviewed-by: Petr Machata <petrm@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/20250415121143.345227-5-idosch@nvidia.com Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'drivers/net/vxlan/vxlan_core.c')
-rw-r--r--drivers/net/vxlan/vxlan_core.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
index 915ce73f0c87..d3dfc4af9556 100644
--- a/drivers/net/vxlan/vxlan_core.c
+++ b/drivers/net/vxlan/vxlan_core.c
@@ -3943,7 +3943,6 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev,
struct vxlan_net *vn = net_generic(net, vxlan_net_id);
struct vxlan_dev *vxlan = netdev_priv(dev);
struct net_device *remote_dev = NULL;
- struct vxlan_fdb *f = NULL;
struct vxlan_rdst *dst;
int err;
@@ -3976,33 +3975,29 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev,
/* create an fdb entry for a valid default destination */
if (!vxlan_addr_any(&dst->remote_ip)) {
- err = vxlan_fdb_create(vxlan, all_zeros_mac,
+ u32 hash_index = fdb_head_index(vxlan, all_zeros_mac,
+ dst->remote_vni);
+
+ spin_lock_bh(&vxlan->hash_lock[hash_index]);
+ err = vxlan_fdb_update(vxlan, all_zeros_mac,
&dst->remote_ip,
NUD_REACHABLE | NUD_PERMANENT,
+ NLM_F_EXCL | NLM_F_CREATE,
vxlan->cfg.dst_port,
dst->remote_vni,
dst->remote_vni,
dst->remote_ifindex,
- NTF_SELF, 0, &f, extack);
+ NTF_SELF, 0, true, extack);
+ spin_unlock_bh(&vxlan->hash_lock[hash_index]);
if (err)
goto unlink;
}
- if (f) {
- /* notify default fdb entry */
- err = vxlan_fdb_notify(vxlan, f, first_remote_rtnl(f),
- RTM_NEWNEIGH, true, extack);
- if (err)
- goto fdb_destroy;
- }
-
list_add(&vxlan->next, &vn->vxlan_list);
if (remote_dev)
dst->remote_dev = remote_dev;
return 0;
-fdb_destroy:
- vxlan_fdb_destroy(vxlan, f, false, false);
unlink:
if (remote_dev)
netdev_upper_dev_unlink(remote_dev, dev);