[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <10c79ed3d98d6e29dfb785e5fc577f7a861f89ff.1547679599.git.petrm@mellanox.com>
Date: Wed, 16 Jan 2019 23:06:30 +0000
From: Petr Machata <petrm@...lanox.com>
To: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC: "ivecera@...hat.com" <ivecera@...hat.com>,
Jiri Pirko <jiri@...lanox.com>,
Ido Schimmel <idosch@...lanox.com>,
"davem@...emloft.net" <davem@...emloft.net>
Subject: [PATCH net-next 01/13] vxlan: Move up vxlan_fdb_free(),
vxlan_fdb_destroy()
These functions will be needed for rollbacks of vetoed FDB entries. Move
them up so that they are visible at their intended point of use.
Signed-off-by: Petr Machata <petrm@...lanox.com>
---
drivers/net/vxlan.c | 59 ++++++++++++++++++++++++++---------------------------
1 file changed, 29 insertions(+), 30 deletions(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 5209ee9aac47..e4ace5e917a7 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -826,6 +826,35 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan,
return 0;
}
+static void vxlan_fdb_free(struct rcu_head *head)
+{
+ struct vxlan_fdb *f = container_of(head, struct vxlan_fdb, rcu);
+ struct vxlan_rdst *rd, *nd;
+
+ list_for_each_entry_safe(rd, nd, &f->remotes, list) {
+ dst_cache_destroy(&rd->dst_cache);
+ kfree(rd);
+ }
+ kfree(f);
+}
+
+static void vxlan_fdb_destroy(struct vxlan_dev *vxlan, struct vxlan_fdb *f,
+ bool do_notify, bool swdev_notify)
+{
+ struct vxlan_rdst *rd;
+
+ netdev_dbg(vxlan->dev, "delete %pM\n", f->eth_addr);
+
+ --vxlan->addrcnt;
+ if (do_notify)
+ list_for_each_entry(rd, &f->remotes, list)
+ vxlan_fdb_notify(vxlan, f, rd, RTM_DELNEIGH,
+ swdev_notify);
+
+ hlist_del_rcu(&f->hlist);
+ call_rcu(&f->rcu, vxlan_fdb_free);
+}
+
/* Add new entry to forwarding table -- assumes lock held */
static int vxlan_fdb_update(struct vxlan_dev *vxlan,
const u8 *mac, union vxlan_addr *ip,
@@ -912,36 +941,6 @@ static int vxlan_fdb_update(struct vxlan_dev *vxlan,
return 0;
}
-static void vxlan_fdb_free(struct rcu_head *head)
-{
- struct vxlan_fdb *f = container_of(head, struct vxlan_fdb, rcu);
- struct vxlan_rdst *rd, *nd;
-
- list_for_each_entry_safe(rd, nd, &f->remotes, list) {
- dst_cache_destroy(&rd->dst_cache);
- kfree(rd);
- }
- kfree(f);
-}
-
-static void vxlan_fdb_destroy(struct vxlan_dev *vxlan, struct vxlan_fdb *f,
- bool do_notify, bool swdev_notify)
-{
- struct vxlan_rdst *rd;
-
- netdev_dbg(vxlan->dev,
- "delete %pM\n", f->eth_addr);
-
- --vxlan->addrcnt;
- if (do_notify)
- list_for_each_entry(rd, &f->remotes, list)
- vxlan_fdb_notify(vxlan, f, rd, RTM_DELNEIGH,
- swdev_notify);
-
- hlist_del_rcu(&f->hlist);
- call_rcu(&f->rcu, vxlan_fdb_free);
-}
-
static void vxlan_dst_free(struct rcu_head *head)
{
struct vxlan_rdst *rd = container_of(head, struct vxlan_rdst, rcu);
--
2.4.11
Powered by blists - more mailing lists