Skip to content

Commit 10fae4a

Browse files
wkzdavem330
authored andcommitted
net: dsa: include bridge addresses which are local in the host fdb list
The bridge automatically creates local (not forwarded) fdb entries pointing towards physical ports with their interface MAC addresses. For switchdev, the significance of these fdb entries is the exact opposite of that of non-local entries: instead of sending these frame outwards, we must send them inwards (towards the host). NOTE: The bridge's own MAC address is also "local". If that address is not shared with any port, the bridge's MAC is not be added by this functionality - but the following commit takes care of that case. NOTE 2: We mark these addresses as host-filtered regardless of the value of ds->assisted_learning_on_cpu_port. This is because, as opposed to the speculative logic done for dynamic address learning on foreign interfaces, the local FDB entries are rather fixed, so there isn't any risk of them migrating from one bridge port to another. Signed-off-by: Tobias Waldekranz <[email protected]> Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3068d46 commit 10fae4a

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

net/dsa/slave.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2398,10 +2398,12 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused,
23982398
fdb_info = ptr;
23992399

24002400
if (dsa_slave_dev_check(dev)) {
2401-
if (!fdb_info->added_by_user || fdb_info->is_local)
2402-
return NOTIFY_OK;
2403-
24042401
dp = dsa_slave_to_port(dev);
2402+
2403+
if (fdb_info->is_local)
2404+
host_addr = true;
2405+
else if (!fdb_info->added_by_user)
2406+
return NOTIFY_OK;
24052407
} else {
24062408
/* Snoop addresses added to foreign interfaces
24072409
* bridged with us, or the bridge
@@ -2425,9 +2427,15 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused,
24252427
return NOTIFY_DONE;
24262428

24272429
dp = p->dp;
2428-
host_addr = true;
2430+
host_addr = fdb_info->is_local;
24292431

2430-
if (!fdb_info->added_by_user &&
2432+
/* FDB entries learned by the software bridge should
2433+
* be installed as host addresses only if the driver
2434+
* requests assisted learning.
2435+
* On the other hand, FDB entries for local termination
2436+
* should always be installed.
2437+
*/
2438+
if (!fdb_info->added_by_user && !fdb_info->is_local &&
24312439
!dp->ds->assisted_learning_on_cpu_port)
24322440
return NOTIFY_DONE;
24332441

0 commit comments

Comments
 (0)