]> git.openpandora.org Git - pandora-kernel.git/commitdiff
net: replace br_fdb_external_learn_* calls with switchdev notifier events
authorJiri Pirko <jiri@resnulli.us>
Thu, 15 Jan 2015 22:49:37 +0000 (23:49 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 18 Jan 2015 05:23:57 +0000 (00:23 -0500)
This patch benefits from newly introduced switchdev notifier and uses it
to propagate fdb learn events from rocker driver to bridge. That avoids
direct function calls and possible use by other listeners (ovs).

Suggested-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/rocker/rocker.c
include/linux/if_bridge.h
include/net/switchdev.h
net/bridge/br.c
net/bridge/br_fdb.c
net/bridge/br_private.h

index cad8cf962cdf86fba6a1d407bf876fe602b140fc..964d719b150f17dbad58c9df9d4a7b962cece39b 100644 (file)
@@ -3026,11 +3026,17 @@ static void rocker_port_fdb_learn_work(struct work_struct *work)
                container_of(work, struct rocker_fdb_learn_work, work);
        bool removing = (lw->flags & ROCKER_OP_FLAG_REMOVE);
        bool learned = (lw->flags & ROCKER_OP_FLAG_LEARNED);
+       struct netdev_switch_notifier_fdb_info info;
+
+       info.addr = lw->addr;
+       info.vid = lw->vid;
 
        if (learned && removing)
-               br_fdb_external_learn_del(lw->dev, lw->addr, lw->vid);
+               call_netdev_switch_notifiers(NETDEV_SWITCH_FDB_DEL,
+                                            lw->dev, &info.info);
        else if (learned && !removing)
-               br_fdb_external_learn_add(lw->dev, lw->addr, lw->vid);
+               call_netdev_switch_notifiers(NETDEV_SWITCH_FDB_ADD,
+                                            lw->dev, &info.info);
 
        kfree(work);
 }
index 0a8ce762a47fded2031d83ec3535feaed062806a..a57bca2ea97e51058283dfa9305aff9f9244b12e 100644 (file)
@@ -50,24 +50,6 @@ extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __use
 typedef int br_should_route_hook_t(struct sk_buff *skb);
 extern br_should_route_hook_t __rcu *br_should_route_hook;
 
-#if IS_ENABLED(CONFIG_BRIDGE)
-int br_fdb_external_learn_add(struct net_device *dev,
-                             const unsigned char *addr, u16 vid);
-int br_fdb_external_learn_del(struct net_device *dev,
-                             const unsigned char *addr, u16 vid);
-#else
-static inline int br_fdb_external_learn_add(struct net_device *dev,
-                                           const unsigned char *addr, u16 vid)
-{
-       return 0;
-}
-static inline int br_fdb_external_learn_del(struct net_device *dev,
-                                           const unsigned char *addr, u16 vid)
-{
-       return 0;
-}
-#endif
-
 #if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING)
 int br_multicast_list_adjacent(struct net_device *dev,
                               struct list_head *br_ip_list);
index 7f8d74372d87051645492552d426f3c96a7010a3..201120e18e4d6d836501475c29166424fd8eb4b9 100644 (file)
 #include <linux/netdevice.h>
 #include <linux/notifier.h>
 
+enum netdev_switch_notifier_type {
+       NETDEV_SWITCH_FDB_ADD = 1,
+       NETDEV_SWITCH_FDB_DEL,
+};
+
 struct netdev_switch_notifier_info {
        struct net_device *dev;
 };
 
+struct netdev_switch_notifier_fdb_info {
+       struct netdev_switch_notifier_info info; /* must be first */
+       const unsigned char *addr;
+       u16 vid;
+};
+
 static inline struct net_device *
 netdev_switch_notifier_info_to_dev(const struct netdev_switch_notifier_info *info)
 {
diff --cc net/bridge/br.c
Simple merge
Simple merge
Simple merge