vxlan: vxlan_core: Support FDB flushing by destination VNI
authorAmit Cohen <amcohen@nvidia.com>
Mon, 9 Oct 2023 10:06:14 +0000 (13:06 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 13 Oct 2023 09:00:31 +0000 (10:00 +0100)
commitc499fccb71cb85902b5c5b9ce9c9ae6683e54a8f
treea225a13a97aeb18b8a5ca456e7c92c28513bc52a
parent36c111233b561b8337997b2b4b4eff0c43a77fc0
vxlan: vxlan_core: Support FDB flushing by destination VNI

Add support for flush VXLAN FDB entries by destination VNI. FDB entry is
stored as {MAC, SRC_VNI} + remote. The destination VNI is an attribute
of the remote. For multicast entries, the VXLAN driver stores a linked list
of remotes for a given key.

In user space, each remote is represented as a separate entry, so when
flush is sent with filter of 'destination VNI', flush only the match
remotes. In case that there are no additional remotes, destroy the entry.

For example, the following are stored as one entry with several remotes:
$ bridge fdb show dev vx10
00:00:00:00:00:00 dst 192.1.1.1 vni 3000 self permanent
00:00:00:00:00:00 dst 192.1.1.1 vni 4000 self permanent
00:00:00:00:00:00 dst 192.1.1.1 vni 2000 self permanent
00:00:00:00:00:00 dst 192.1.1.2 vni 2000 self permanent

When user flush by VNI x, only the relevant remotes will be flushed:
$ bridge fdb flush dev vx10 vni 2000

$ bridge fdb show dev vx10
00:00:00:00:00:00 dst 192.1.1.1 vni 3000 self permanent
00:00:00:00:00:00 dst 192.1.1.1 vni 4000 self permanent

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/vxlan/vxlan_core.c