Commit 10fae4ac authored by Tobias Waldekranz's avatar Tobias Waldekranz Committed by David S. Miller

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: default avatarTobias Waldekranz <tobias@waldekranz.com>
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3068d466
...@@ -2398,10 +2398,12 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused, ...@@ -2398,10 +2398,12 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused,
fdb_info = ptr; fdb_info = ptr;
if (dsa_slave_dev_check(dev)) { if (dsa_slave_dev_check(dev)) {
if (!fdb_info->added_by_user || fdb_info->is_local)
return NOTIFY_OK;
dp = dsa_slave_to_port(dev); dp = dsa_slave_to_port(dev);
if (fdb_info->is_local)
host_addr = true;
else if (!fdb_info->added_by_user)
return NOTIFY_OK;
} else { } else {
/* Snoop addresses added to foreign interfaces /* Snoop addresses added to foreign interfaces
* bridged with us, or the bridge * bridged with us, or the bridge
...@@ -2425,9 +2427,15 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused, ...@@ -2425,9 +2427,15 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused,
return NOTIFY_DONE; return NOTIFY_DONE;
dp = p->dp; dp = p->dp;
host_addr = true; host_addr = fdb_info->is_local;
if (!fdb_info->added_by_user && /* FDB entries learned by the software bridge should
* be installed as host addresses only if the driver
* requests assisted learning.
* On the other hand, FDB entries for local termination
* should always be installed.
*/
if (!fdb_info->added_by_user && !fdb_info->is_local &&
!dp->ds->assisted_learning_on_cpu_port) !dp->ds->assisted_learning_on_cpu_port)
return NOTIFY_DONE; return NOTIFY_DONE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment