Skip to content

vxlan: convert configuration to RCU and drop RTNL in vxlan_fill_info()

Eric Dumazet netdev 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest8 patches 2 repliesIn review 1 of 8 applied
  2. v19 patches 12 repliesSuperseded

Patches in v2 1 of 8 applied

#Subject and filesSizeRepliesApplied
1/8vxlan: initialize _md in vxlan_xmit_one()drivers/net/vxlan/vxlan_core.c+1 -10 repliesApplied
2/8vxlan: vnifilter: use list_for_each_entry_rcu() in vxlan_vnifilter_dump_dev()drivers/net/vxlan/vxlan_vnifilter.c+8 -40 replies
3/8vxlan: pass vxlan_config pointer to helper functionsdrivers/net/vxlan/vxlan_core.c drivers/net/vxlan/vxlan_mdb.c drivers/net/vxlan/vxlan_private.h +1 more+208 -1710 replies
4/8vxlan: move VXLAN_F_MDB to struct vxlan_dev flagsdrivers/net/vxlan/vxlan_core.c drivers/net/vxlan/vxlan_mdb.c include/net/vxlan.h+9 -50 replies
5/8vxlan: dynamically allocate struct vxlan_configdrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c drivers/net/vxlan/vxlan_core.c +4 more+187 -1052 replies
6/8vxlan: convert configuration to RCU protectiondrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c drivers/net/vxlan/vxlan_core.c +4 more+132 -770 replies
7/8vxlan: remove default_dst and use vxlan_config and lowerdevdrivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c drivers/net/vxlan/vxlan_core.c drivers/net/vxlan/vxlan_mdb.c +4 more+160 -1370 replies
8/8vxlan: no longer rely on RTNL in vxlan_fill_info()drivers/net/vxlan/vxlan_core.c+11 -20 replies

Reviews trailers per patch

All 8 patches have a Reviewed-by or Acked-by.

PatchKuniyuki Iwashima
1/8R-b
2/8R-b
3/8R-b
4/8R-b
5/8R-b
6/8R-b
7/8R-b
8/8R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 net-next 0/8] vxlan: convert configuration to RCU and drop RTNL in vxlan_fill_info()

This series converts VXLAN device configuration (struct vxlan_config) to RCU protection and removes the RTNL dependency from vxlan_fill_info(), enabling lockless netlink link dumps (RTM_GETLINK) for VXLAN devices.

Patches 1-2 fix pre-existing issues uncovered while auditing RCU and VNIFILTER paths:
- Patch 1 zero-initializes _md on the stack in vxlan_xmit_one() to avoid leaking uninitialized stack bytes into GBP header fields when metadata options are absent.
- Patch 2 fixes lockless iteration over vg->vni_list in vxlan_vnifilter_dump_dev() to use list_for_each_entry_rcu(), and clears cb->args[1] on early returns to avoid leaking dump state across devices.

Patches 3-6 convert vxlan->cfg to an RCU-protected pointer:
- Patch 3 refactors RX, TX, MDB, and VNIFILTER helpers to take a const struct vxlan_config * pointer parameter.
- Patch 4 moves the internal runtime state flag VXLAN_F_MDB out of struct vxlan_config into atomic bitops (VXLAN_DEV_F_MDB) on vxlan->flags, avoiding RCU reallocation of vxlan_config on MDB updates.
- Patch 5 converts struct vxlan_config from an embedded struct in struct vxlan_dev to a dynamically allocated pointer.
- Patch 6 adds RCU annotations (__rcu), updates configuration changes to publish new configs via rcu_assign_pointer() and free old ones via kfree_rcu(), and protects readers under rcu_read_lock().

Patches 7-8 clean up redundant state and remove RTNL from dumps:
- Patch 7 removes vxlan->default_dst (struct vxlan_rdst), tracks the

    lower netdevice via vxlan->lowerdev, and switches remaining readers to
    access attributes directly from vxlan->cfg.

- Patch 8 updates vxlan_fill_info() to dereference vxlan->cfg under rcu_read_lock() instead of relying on RTNL.

v2: removed patch 2/9 from v1 (Kuniyuki)
Added Reviewed-by: tags from Kuniyuki.

Eric Dumazet (8):
vxlan: initialize _md in vxlan_xmit_one()
vxlan: vnifilter: use list_for_each_entry_rcu() in
vxlan_vnifilter_dump_dev()
vxlan: pass vxlan_config pointer to helper functions
vxlan: move VXLAN_F_MDB to struct vxlan_dev flags
vxlan: dynamically allocate struct vxlan_config
vxlan: convert configuration to RCU protection
vxlan: remove default_dst and use vxlan_config and lowerdev
vxlan: no longer rely on RTNL in vxlan_fill_info()

 .../mellanox/mlx5/core/en/tc_tun_vxlan.c      |  11 +-
 .../mellanox/mlxsw/spectrum_nve_vxlan.c       |  14 +-
 .../mellanox/mlxsw/spectrum_switchdev.c       |  57 +-
 drivers/net/vxlan/vxlan_core.c                | 720 +++++++++++-------
 drivers/net/vxlan/vxlan_mdb.c                 |  45 +-
 drivers/net/vxlan/vxlan_multicast.c           |  80 +-
 drivers/net/vxlan/vxlan_private.h             |  18 +-
 drivers/net/vxlan/vxlan_vnifilter.c           |  74 +-
 include/net/vxlan.h                           |  11 +-
 9 files changed, 622 insertions(+), 408 deletions(-)
Signature · 1 line
2.55.0.979.g7e5102b832-goog