Skip to content

Commit 63c5145

Browse files
vladimirolteandavem330
authored andcommitted
net: dsa: replay the local bridge FDB entries pointing to the bridge dev too
When we join a bridge that already has some local addresses pointing to itself, we do not get those notifications. Similarly, when we leave that bridge, we do not get notifications for the deletion of those entries. The only switchdev notifications we get are those of entries added while the DSA port is enslaved to the bridge. This makes use cases such as the following work properly (with the number of additions and removals properly balanced): ip link add br0 type bridge ip link add br1 type bridge ip link set br0 address 00:01:02:03:04:05 ip link set br1 address 00:01:02:03:04:05 ip link set swp0 up ip link set swp1 up ip link set swp0 master br0 ip link set swp1 master br1 ip link set br0 up ip link set br1 up ip link del br1 # 00:01:02:03:04:05 still installed on the CPU port ip link del br0 # 00:01:02:03:04:05 finally removed from the CPU port Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4bed397 commit 63c5145

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

net/dsa/port.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,17 @@ static int dsa_port_switchdev_sync(struct dsa_port *dp,
199199
if (err && err != -EOPNOTSUPP)
200200
return err;
201201

202+
/* Forwarding and termination FDB entries on the port */
202203
err = br_fdb_replay(br, brport_dev, dp, true,
203204
&dsa_slave_switchdev_notifier);
204205
if (err && err != -EOPNOTSUPP)
205206
return err;
206207

208+
/* Termination FDB entries on the bridge itself */
209+
err = br_fdb_replay(br, br, dp, true, &dsa_slave_switchdev_notifier);
210+
if (err && err != -EOPNOTSUPP)
211+
return err;
212+
207213
err = br_vlan_replay(br, brport_dev, dp, true,
208214
&dsa_slave_switchdev_blocking_notifier, extack);
209215
if (err && err != -EOPNOTSUPP)
@@ -225,11 +231,17 @@ static int dsa_port_switchdev_unsync_objs(struct dsa_port *dp,
225231
if (err && err != -EOPNOTSUPP)
226232
return err;
227233

234+
/* Forwarding and termination FDB entries on the port */
228235
err = br_fdb_replay(br, brport_dev, dp, false,
229236
&dsa_slave_switchdev_notifier);
230237
if (err && err != -EOPNOTSUPP)
231238
return err;
232239

240+
/* Termination FDB entries on the bridge itself */
241+
err = br_fdb_replay(br, br, dp, false, &dsa_slave_switchdev_notifier);
242+
if (err && err != -EOPNOTSUPP)
243+
return err;
244+
233245
err = br_vlan_replay(br, brport_dev, dp, false,
234246
&dsa_slave_switchdev_blocking_notifier, extack);
235247
if (err && err != -EOPNOTSUPP)

0 commit comments

Comments
 (0)