Skip to content

vxlan: Convert FDB table to rhashtable

Ido Schimmel netdev 1 version Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest15 patches 5 repliesApplied 15/15

Patches in v1 All 15 applied

#Subject and filesSizeRepliesApplied
1/15vxlan: Add RCU read-side critical sections in the Tx pathdrivers/net/vxlan/vxlan_core.c+8 -60 repliesApplied
2/15vxlan: Simplify creation of default FDB entrydrivers/net/vxlan/vxlan_core.c+25 -530 repliesApplied
3/15vxlan: Insert FDB into hash table in vxlan_fdb_create()drivers/net/vxlan/vxlan_core.c+4 -110 repliesApplied
4/15vxlan: Unsplit default FDB entry creation and notificationdrivers/net/vxlan/vxlan_core.c+8 -130 repliesApplied
5/15vxlan: Relocate assignment of default remote devicedrivers/net/vxlan/vxlan_core.c+3 -20 repliesApplied
6/15vxlan: Use a single lock to protect the FDB tabledrivers/net/vxlan/vxlan_core.c drivers/net/vxlan/vxlan_vnifilter.c include/net/vxlan.h+34 -580 repliesApplied
7/15vxlan: Add a linked list of FDB entriesdrivers/net/vxlan/vxlan_core.c drivers/net/vxlan/vxlan_private.h include/net/vxlan.h+5 -00 repliesApplied
8/15vxlan: Use linked list to traverse FDB entriesdrivers/net/vxlan/vxlan_core.c+75 -970 repliesApplied
9/15vxlan: Convert FDB garbage collection to RCUdrivers/net/vxlan/vxlan_core.c+11 -80 repliesApplied
10/15vxlan: Convert FDB flushing to RCUdrivers/net/vxlan/vxlan_core.c+10 -50 repliesApplied
11/15vxlan: Rename FDB Tx lookup functiondrivers/net/vxlan/vxlan_core.c+7 -70 repliesApplied
12/15vxlan: Create wrappers for FDB lookupdrivers/net/vxlan/vxlan_core.c+24 -102 repliesApplied
13/15vxlan: Do not treat dst cache initialization errors as fataldrivers/net/vxlan/vxlan_core.c+4 -42 repliesApplied
14/15vxlan: Introduce FDB key structuredrivers/net/vxlan/vxlan_core.c drivers/net/vxlan/vxlan_private.h+29 -230 repliesApplied
15/15vxlan: Convert FDB table to rhashtabledrivers/net/vxlan/vxlan_core.c drivers/net/vxlan/vxlan_private.h include/net/vxlan.h+43 -630 repliesApplied

Reviews trailers per patch

All 15 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchPetr MachataNikolay Aleksandrov
SeriesR-b
1/15R-b
2/15R-b
3/15R-b
4/15R-b
5/15R-b
6/15R-b
7/15R-b
8/15R-b
9/15R-b
10/15R-b
11/15R-b
12/15R-b
13/15R-b
14/15R-b
15/15R-b

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

Read the v1 thread

Cover letter [PATCH net-next 00/15] vxlan: Convert FDB table to rhashtable

The VXLAN driver currently stores FDB entries in a hash table with a fixed number of buckets (256), resulting in reduced performance as the number of entries grows. This patchset solves the issue by converting the driver to use rhashtable which maintains a more or less constant performance regardless of the number of entries.

Measured transmitted packets per second using a single pktgen thread with varying number of entries when the transmitted packet always hits the default entry (worst case):

Number of entries | Improvement
------------------|------------
1k                | +1.12%
4k                | +9.22%
16k               | +55%
64k               | +585%
256k              | +2460%

The first patches are preparations for the conversion in the last patch. Specifically, the series is structured as follows:

Patch #1 adds RCU read-side critical sections in the Tx path when accessing FDB entries. Targeting at net-next as I am not aware of any issues due to this omission despite the code being structured that way for a long time. Without it, traces will be generated when converting FDB lookup to rhashtable_lookup().

Patch #2-#5 simplify the creation of the default FDB entry (all-zeroes). Current code assumes that insertion into the hash table cannot fail, which will no longer be true with rhashtable.

Patches #6-#10 add FDB entries to a linked list for entry traversal instead of traversing over them using the fixed size hash table which is removed in the last patch.

Patches #11-#12 add wrappers for FDB lookup that make it clear when each should be used along with lockdep annotations. Needed as a preparation for rhashtable_lookup() that must be called from an RCU read-side critical section.

Patch #13 treats dst cache initialization errors as non-fatal. See more info in the commit message. The current code happens to work because insertion into the fixed size hash table is slow enough for the per-CPU allocator to be able to create new chunks of per-CPU memory.

Patch #14 adds an FDB key structure that includes the MAC address and source VNI. To be used as rhashtable key.

Patch #15 does the conversion to rhashtable.

Ido Schimmel (15):
vxlan: Add RCU read-side critical sections in the Tx path
vxlan: Simplify creation of default FDB entry
vxlan: Insert FDB into hash table in vxlan_fdb_create()
vxlan: Unsplit default FDB entry creation and notification
vxlan: Relocate assignment of default remote device
vxlan: Use a single lock to protect the FDB table
vxlan: Add a linked list of FDB entries
vxlan: Use linked list to traverse FDB entries
vxlan: Convert FDB garbage collection to RCU
vxlan: Convert FDB flushing to RCU
vxlan: Rename FDB Tx lookup function
vxlan: Create wrappers for FDB lookup
vxlan: Do not treat dst cache initialization errors as fatal
vxlan: Introduce FDB key structure
vxlan: Convert FDB table to rhashtable

 drivers/net/vxlan/vxlan_core.c      | 542 ++++++++++++----------------
 drivers/net/vxlan/vxlan_private.h   |  11 +-
 drivers/net/vxlan/vxlan_vnifilter.c |   8 +-
 include/net/vxlan.h                 |   5 +-
 4 files changed, 248 insertions(+), 318 deletions(-)
Signature · 1 line
2.49.0