mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-21 19:31:55 +00:00
90 lines
2.7 KiB
Diff
90 lines
2.7 KiB
Diff
From 781701738687f5cc13ae949410b162a2cdda817f Mon Sep 17 00:00:00 2001
|
|
From: Zhi Chen <zhichen@codeaurora.org>
|
|
Date: Thu, 27 Aug 2015 16:37:09 -0700
|
|
Subject: [PATCH 227/281] bridge: add fdb events in linux bridge
|
|
|
|
Notify fdb changing events to those modules which are interested in
|
|
hosts joining/leaving or bridge port changing. This is required by
|
|
RFS feature.
|
|
|
|
Change-Id: I7b592ba09109e1785a5834b56987a19bc35886fe
|
|
Signed-off-by: Zhi Chen <zhichen@codeaurora.org>
|
|
Signed-off-by: Murat Sezgin <msezgin@codeaurora.org>
|
|
---
|
|
include/linux/if_bridge.h | 11 +++++++++++
|
|
net/bridge/br_fdb.c | 31 +++++++++++++++++++++++++++++++
|
|
2 files changed, 42 insertions(+)
|
|
|
|
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
|
|
index ca636185994f..c31c298de564 100644
|
|
--- a/include/linux/if_bridge.h
|
|
+++ b/include/linux/if_bridge.h
|
|
@@ -235,4 +235,15 @@ typedef int (br_multicast_handle_hook_t)(const struct net_bridge_port *src,
|
|
struct sk_buff *skb);
|
|
extern br_multicast_handle_hook_t __rcu *br_multicast_handle_hook;
|
|
|
|
+#define BR_FDB_EVENT_ADD 0x01
|
|
+#define BR_FDB_EVENT_DEL 0x02
|
|
+
|
|
+struct br_fdb_event {
|
|
+ struct net_device *dev;
|
|
+ unsigned char addr[6];
|
|
+ unsigned char is_local;
|
|
+};
|
|
+
|
|
+extern void br_fdb_register_notify(struct notifier_block *nb);
|
|
+extern void br_fdb_unregister_notify(struct notifier_block *nb);
|
|
#endif
|
|
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
|
|
index 676b44dc6aed..46b0fbdc4453 100644
|
|
--- a/net/bridge/br_fdb.c
|
|
+++ b/net/bridge/br_fdb.c
|
|
@@ -34,6 +34,20 @@ static const struct rhashtable_params br_fdb_rht_params = {
|
|
|
|
static struct kmem_cache *br_fdb_cache __read_mostly;
|
|
|
|
+ATOMIC_NOTIFIER_HEAD(br_fdb_notifier_list);
|
|
+
|
|
+void br_fdb_register_notify(struct notifier_block *nb)
|
|
+{
|
|
+ atomic_notifier_chain_register(&br_fdb_notifier_list, nb);
|
|
+}
|
|
+EXPORT_SYMBOL_GPL(br_fdb_register_notify);
|
|
+
|
|
+void br_fdb_unregister_notify(struct notifier_block *nb)
|
|
+{
|
|
+ atomic_notifier_chain_unregister(&br_fdb_notifier_list, nb);
|
|
+}
|
|
+EXPORT_SYMBOL_GPL(br_fdb_unregister_notify);
|
|
+
|
|
int __init br_fdb_init(void)
|
|
{
|
|
br_fdb_cache = kmem_cache_create("bridge_fdb_cache",
|
|
@@ -191,6 +205,23 @@ static void fdb_notify(struct net_bridge *br,
|
|
if (swdev_notify)
|
|
br_switchdev_fdb_notify(br, fdb, type);
|
|
|
|
+ if (fdb->dst) {
|
|
+ int event;
|
|
+ struct br_fdb_event fdb_event;
|
|
+
|
|
+ if (type == RTM_NEWNEIGH)
|
|
+ event = BR_FDB_EVENT_ADD;
|
|
+ else
|
|
+ event = BR_FDB_EVENT_DEL;
|
|
+
|
|
+ fdb_event.dev = fdb->dst->dev;
|
|
+ ether_addr_copy(fdb_event.addr, fdb->key.addr.addr);
|
|
+ fdb_event.is_local = test_bit(BR_FDB_LOCAL, &fdb->flags);
|
|
+ atomic_notifier_call_chain(&br_fdb_notifier_list,
|
|
+ event,
|
|
+ (void *)&fdb_event);
|
|
+ }
|
|
+
|
|
skb = nlmsg_new(fdb_nlmsg_size(), GFP_ATOMIC);
|
|
if (skb == NULL)
|
|
goto errout;
|
|
--
|
|
2.17.1
|
|
|