diff options
author | Petr Machata <petrm@mellanox.com> | 2018-12-07 19:55:06 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-12-07 12:59:08 -0800 |
commit | e5ff4b1952893fb75aa75067fce31c8567341ed7 (patch) | |
tree | a07859a0b365af97fb147a696fbc5c577f0f6041 /drivers/net/vxlan.c | |
parent | 4f89f5b5353cae2e056713e823819f24cad92bc3 (diff) | |
download | lwn-e5ff4b1952893fb75aa75067fce31c8567341ed7.tar.gz lwn-e5ff4b1952893fb75aa75067fce31c8567341ed7.zip |
vxlan: Add vxlan_fdb_clear_offload()
When a driver unoffloads all FDB entries en bloc, it's inefficient to
send the switchdev notification one by one. Add a helper that walks the
FDB table, unsetting the offload flag on RDST with a given VNI.
Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vxlan.c')
-rw-r--r-- | drivers/net/vxlan.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index d9cb0d903283..b56ef684ecac 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -599,6 +599,28 @@ out: } EXPORT_SYMBOL_GPL(vxlan_fdb_replay); +void vxlan_fdb_clear_offload(const struct net_device *dev, __be32 vni) +{ + struct vxlan_dev *vxlan; + struct vxlan_rdst *rdst; + struct vxlan_fdb *f; + unsigned int h; + + if (!netif_is_vxlan(dev)) + return; + vxlan = netdev_priv(dev); + + spin_lock_bh(&vxlan->hash_lock); + for (h = 0; h < FDB_HASH_SIZE; ++h) { + hlist_for_each_entry(f, &vxlan->fdb_head[h], hlist) + if (f->vni == vni) + list_for_each_entry(rdst, &f->remotes, list) + rdst->offloaded = false; + } + spin_unlock_bh(&vxlan->hash_lock); +} +EXPORT_SYMBOL_GPL(vxlan_fdb_clear_offload); + /* Replace destination of unicast mac */ static int vxlan_fdb_replace(struct vxlan_fdb *f, union vxlan_addr *ip, __be16 port, __be32 vni, |