Renamed patches to keep their original numbering from codelinaro.org Fixed minor bugs and added support for the qca-nss-drv-l2tpv2 module
83 lines
2.4 KiB
Diff
83 lines
2.4 KiB
Diff
From 05f608faa62c7f5ecd930908d3fdfbc24d92050b Mon Sep 17 00:00:00 2001
|
|
From: Zhi Chen <zhichen@codeaurora.org>
|
|
Date: Thu, 27 Aug 2015 16:37:09 -0700
|
|
Subject: [PATCH 216/500] 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(+)
|
|
|
|
--- a/include/linux/if_bridge.h
|
|
+++ b/include/linux/if_bridge.h
|
|
@@ -236,4 +236,15 @@ typedef int (br_multicast_handle_hook_t)
|
|
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
|
|
--- a/net/bridge/br_fdb.c
|
|
+++ b/net/bridge/br_fdb.c
|
|
@@ -33,6 +33,20 @@ static const struct rhashtable_params br
|
|
|
|
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",
|
|
@@ -195,6 +209,23 @@ static void fdb_notify(struct net_bridge
|
|
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;
|