Skip to content

Commit 3068d46

Browse files
vladimirolteandavem330
authored andcommitted
net: dsa: sync static FDB entries on foreign interfaces to hardware
DSA is able to install FDB entries towards the CPU port for addresses which were dynamically learnt by the software bridge on foreign interfaces that are in the same bridge with a DSA switch interface. Since this behavior is opportunistic, it is guarded by the "assisted_learning_on_cpu_port" property which can be enabled by drivers and is not done automatically (since certain switches may support address learning of packets coming from the CPU port). But if those FDB entries added on the foreign interfaces are static (added by the user) instead of dynamically learnt, currently DSA does not do anything (and arguably it should). Because static FDB entries are not supposed to move on their own, there is no downside in reusing the "assisted_learning_on_cpu_port" logic to sync static FDB entries to the DSA CPU port unconditionally, even if assisted_learning_on_cpu_port is not requested by the driver. For example, this situation: br0 / \ swp0 dummy0 $ bridge fdb add 02:00:de:ad:00:01 dev dummy0 vlan 1 master static Results in DSA adding an entry in the hardware FDB, pointing this address towards the CPU port. The same is true for entries added to the bridge itself, e.g: $ bridge fdb add 02:00:de:ad:00:01 dev br0 vlan 1 self local (except that right now, DSA still ignores 'local' FDB entries, this will be changed in a later patch) Signed-off-by: Tobias Waldekranz <[email protected]> Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 26ee7b0 commit 3068d46

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

net/dsa/slave.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2403,9 +2403,12 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused,
24032403

24042404
dp = dsa_slave_to_port(dev);
24052405
} else {
2406-
/* Snoop addresses learnt on foreign interfaces
2407-
* bridged with us, for switches that don't
2408-
* automatically learn SA from CPU-injected traffic
2406+
/* Snoop addresses added to foreign interfaces
2407+
* bridged with us, or the bridge
2408+
* itself. Dynamically learned addresses can
2409+
* also be added for switches that don't
2410+
* automatically learn SA from CPU-injected
2411+
* traffic.
24092412
*/
24102413
struct net_device *br_dev;
24112414
struct dsa_slave_priv *p;
@@ -2424,7 +2427,8 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused,
24242427
dp = p->dp;
24252428
host_addr = true;
24262429

2427-
if (!dp->ds->assisted_learning_on_cpu_port)
2430+
if (!fdb_info->added_by_user &&
2431+
!dp->ds->assisted_learning_on_cpu_port)
24282432
return NOTIFY_DONE;
24292433

24302434
/* When the bridge learns an address on an offloaded

0 commit comments

Comments
 (0)