Skip to content

Commit 8d45673

Browse files
idoschPaolo Abeni
authored andcommitted
vxlan: Add a linked list of FDB entries
Currently, FDB entries are stored in a hash table with a fixed number of buckets. The table is used for both lookups and entry traversal. Subsequent patches will convert the table to rhashtable which is not suitable for entry traversal. In preparation for this conversion, add FDB entries to a linked list. Subsequent patches will convert the driver to use this list when traversing entries during dump, flush, etc. Reviewed-by: Petr Machata <petrm@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/20250415121143.345227-8-idosch@nvidia.com Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 094adad commit 8d45673

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

drivers/net/vxlan/vxlan_core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,7 @@ int vxlan_fdb_create(struct vxlan_dev *vxlan,
908908
++vxlan->addrcnt;
909909
hlist_add_head_rcu(&f->hlist,
910910
vxlan_fdb_head(vxlan, mac, src_vni));
911+
hlist_add_head_rcu(&f->fdb_node, &vxlan->fdb_list);
911912

912913
*fdb = f;
913914

@@ -962,6 +963,7 @@ static void vxlan_fdb_destroy(struct vxlan_dev *vxlan, struct vxlan_fdb *f,
962963
swdev_notify, NULL);
963964
}
964965

966+
hlist_del_init_rcu(&f->fdb_node);
965967
hlist_del_rcu(&f->hlist);
966968
list_del_rcu(&f->nh_list);
967969
call_rcu(&f->rcu, vxlan_fdb_free);
@@ -3360,6 +3362,7 @@ static void vxlan_setup(struct net_device *dev)
33603362

33613363
for (h = 0; h < FDB_HASH_SIZE; ++h)
33623364
INIT_HLIST_HEAD(&vxlan->fdb_head[h]);
3365+
INIT_HLIST_HEAD(&vxlan->fdb_list);
33633366
}
33643367

33653368
static void vxlan_ether_setup(struct net_device *dev)

drivers/net/vxlan/vxlan_private.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ struct vxlan_fdb {
3636
__be32 vni;
3737
u16 flags; /* see ndm_flags and below */
3838
struct list_head nh_list;
39+
struct hlist_node fdb_node;
3940
struct nexthop __rcu *nh;
4041
struct vxlan_dev __rcu *vdev;
4142
};

include/net/vxlan.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ struct vxlan_dev {
307307
struct hlist_head fdb_head[FDB_HASH_SIZE];
308308

309309
struct rhashtable mdb_tbl;
310+
struct hlist_head fdb_list;
310311
struct hlist_head mdb_list;
311312
unsigned int mdb_seq;
312313
};

0 commit comments

Comments
 (0)