Skip to content

Commit 6eb38bf

Browse files
wkzdavem330
authored andcommitted
net: bridge: switchdev: send FDB notifications for host addresses
Treat addresses added to the bridge itself in the same way as regular ports and send out a notification so that drivers may sync it down to the hardware FDB. Signed-off-by: Tobias Waldekranz <[email protected]> Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3e19ae7 commit 6eb38bf

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

net/bridge/br_fdb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
607607
/* fastpath: update of existing entry */
608608
if (unlikely(source != READ_ONCE(fdb->dst) &&
609609
!test_bit(BR_FDB_STICKY, &fdb->flags))) {
610-
br_switchdev_fdb_notify(fdb, RTM_DELNEIGH);
610+
br_switchdev_fdb_notify(br, fdb, RTM_DELNEIGH);
611611
WRITE_ONCE(fdb->dst, source);
612612
fdb_modified = true;
613613
/* Take over HW learned entry */
@@ -800,7 +800,7 @@ static void fdb_notify(struct net_bridge *br,
800800
int err = -ENOBUFS;
801801

802802
if (swdev_notify)
803-
br_switchdev_fdb_notify(fdb, type);
803+
br_switchdev_fdb_notify(br, fdb, type);
804804

805805
skb = nlmsg_new(fdb_nlmsg_size(), GFP_ATOMIC);
806806
if (skb == NULL)

net/bridge/br_private.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,8 +1654,8 @@ int br_switchdev_set_port_flag(struct net_bridge_port *p,
16541654
unsigned long flags,
16551655
unsigned long mask,
16561656
struct netlink_ext_ack *extack);
1657-
void br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb,
1658-
int type);
1657+
void br_switchdev_fdb_notify(struct net_bridge *br,
1658+
const struct net_bridge_fdb_entry *fdb, int type);
16591659
int br_switchdev_port_vlan_add(struct net_device *dev, u16 vid, u16 flags,
16601660
struct netlink_ext_ack *extack);
16611661
int br_switchdev_port_vlan_del(struct net_device *dev, u16 vid);
@@ -1702,7 +1702,8 @@ static inline int br_switchdev_port_vlan_del(struct net_device *dev, u16 vid)
17021702
}
17031703

17041704
static inline void
1705-
br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb, int type)
1705+
br_switchdev_fdb_notify(struct net_bridge *br,
1706+
const struct net_bridge_fdb_entry *fdb, int type)
17061707
{
17071708
}
17081709

net/bridge/br_switchdev.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,11 @@ int br_switchdev_set_port_flag(struct net_bridge_port *p,
108108
}
109109

110110
void
111-
br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb, int type)
111+
br_switchdev_fdb_notify(struct net_bridge *br,
112+
const struct net_bridge_fdb_entry *fdb, int type)
112113
{
113114
const struct net_bridge_port *dst = READ_ONCE(fdb->dst);
115+
struct net_device *dev = dst ? dst->dev : br->dev;
114116
struct switchdev_notifier_fdb_info info = {
115117
.addr = fdb->key.addr.addr,
116118
.vid = fdb->key.vlan_id,
@@ -119,17 +121,14 @@ br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb, int type)
119121
.offloaded = test_bit(BR_FDB_OFFLOADED, &fdb->flags),
120122
};
121123

122-
if (!dst)
123-
return;
124-
125124
switch (type) {
126125
case RTM_DELNEIGH:
127126
call_switchdev_notifiers(SWITCHDEV_FDB_DEL_TO_DEVICE,
128-
dst->dev, &info.info, NULL);
127+
dev, &info.info, NULL);
129128
break;
130129
case RTM_NEWNEIGH:
131130
call_switchdev_notifiers(SWITCHDEV_FDB_ADD_TO_DEVICE,
132-
dst->dev, &info.info, NULL);
131+
dev, &info.info, NULL);
133132
break;
134133
}
135134
}

0 commit comments

Comments
 (0)