1 From 2e50fd9322047253c327550b4485cf8761035a8c Mon Sep 17 00:00:00 2001
2 From: Tobias Waldekranz <tobias@waldekranz.com>
3 Date: Sat, 16 Jan 2021 02:25:11 +0100
4 Subject: [PATCH] net: bridge: switchdev: Send FDB notifications for host
7 Treat addresses added to the bridge itself in the same way as regular
8 ports and send out a notification so that drivers may sync it down to
11 Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
13 net/bridge/br_fdb.c | 4 ++--
14 net/bridge/br_private.h | 7 ++++---
15 net/bridge/br_switchdev.c | 11 +++++------
16 3 files changed, 11 insertions(+), 11 deletions(-)
18 --- a/net/bridge/br_fdb.c
19 +++ b/net/bridge/br_fdb.c
20 @@ -581,7 +581,7 @@ void br_fdb_update(struct net_bridge *br
22 /* fastpath: update of existing entry */
23 if (unlikely(source != fdb->dst && !fdb->is_sticky)) {
24 - br_switchdev_fdb_notify(fdb, RTM_DELNEIGH);
25 + br_switchdev_fdb_notify(br, fdb, RTM_DELNEIGH);
28 /* Take over HW learned entry */
29 @@ -697,7 +697,7 @@ static void fdb_notify(struct net_bridge
33 - br_switchdev_fdb_notify(fdb, type);
34 + br_switchdev_fdb_notify(br, fdb, type);
36 skb = nlmsg_new(fdb_nlmsg_size(), GFP_ATOMIC);
38 --- a/net/bridge/br_private.h
39 +++ b/net/bridge/br_private.h
40 @@ -1203,8 +1203,8 @@ bool nbp_switchdev_allowed_egress(const
41 int br_switchdev_set_port_flag(struct net_bridge_port *p,
44 -void br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb,
46 +void br_switchdev_fdb_notify(struct net_bridge *br,
47 + const struct net_bridge_fdb_entry *fdb, int type);
48 int br_switchdev_port_vlan_add(struct net_device *dev, u16 vid, u16 flags,
49 struct netlink_ext_ack *extack);
50 int br_switchdev_port_vlan_del(struct net_device *dev, u16 vid);
51 @@ -1250,7 +1250,8 @@ static inline int br_switchdev_port_vlan
55 -br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb, int type)
56 +br_switchdev_fdb_notify(struct net_bridge *br,
57 + const struct net_bridge_fdb_entry *fdb, int type)
61 --- a/net/bridge/br_switchdev.c
62 +++ b/net/bridge/br_switchdev.c
63 @@ -103,7 +103,8 @@ int br_switchdev_set_port_flag(struct ne
67 -br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb, int type)
68 +br_switchdev_fdb_notify(struct net_bridge *br,
69 + const struct net_bridge_fdb_entry *fdb, int type)
71 struct switchdev_notifier_fdb_info info = {
72 .addr = fdb->key.addr.addr,
73 @@ -112,18 +113,16 @@ br_switchdev_fdb_notify(const struct net
74 .local = fdb->is_local,
75 .offloaded = fdb->offloaded,
80 + struct net_device *dev = fdb->dst ? fdb->dst->dev : br->dev;
84 call_switchdev_notifiers(SWITCHDEV_FDB_DEL_TO_DEVICE,
85 - fdb->dst->dev, &info.info, NULL);
86 + dev, &info.info, NULL);
89 call_switchdev_notifiers(SWITCHDEV_FDB_ADD_TO_DEVICE,
90 - fdb->dst->dev, &info.info, NULL);
91 + dev, &info.info, NULL);