diff options
| author | Jakub Kicinski <kuba@kernel.org> | 2021-02-06 14:51:53 -0800 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2021-02-06 14:51:53 -0800 |
| commit | bfc213f15918a991b1aefbb3cf0c2cb618559efd (patch) | |
| tree | 6ab5fc32ec80cc2b113d606a6f021c1d9611df06 /net | |
| parent | 8d9dbce4e8c4a270c05eac48798d44e5676520f9 (diff) | |
| parent | 8fe6832e96acbf9d5777fc0b13e3e680ff46ba11 (diff) | |
| download | linux-bfc213f15918a991b1aefbb3cf0c2cb618559efd.tar.gz linux-bfc213f15918a991b1aefbb3cf0c2cb618559efd.tar.bz2 linux-bfc213f15918a991b1aefbb3cf0c2cb618559efd.zip | |
Merge branch 'lag-offload-for-ocelot-dsa-switches'
Vladimir Oltean says:
====================
LAG offload for Ocelot DSA switches
This patch series reworks the ocelot switchdev driver such that it could
share the same implementation for LAG offload as the felix DSA driver.
Testing has been done in the following topology:
+----------------------------------+
| Board 1 br0 |
| +---------+ |
| / \ |
| | | |
| | bond0 |
| | +-----+ |
| | / \ |
| eno0 swp0 swp1 swp2 |
+---|--------|-------|-------|-----+
| | | |
+--------+ | |
Cable | |
Cable| |Cable
Cable | |
+--------+ | |
| | | |
+---|--------|-------|-------|-----+
| eno0 swp0 swp1 swp2 |
| | \ / |
| | +-----+ |
| | bond0 |
| | | |
| \ / |
| +---------+ |
| Board 2 br0 |
+----------------------------------+
The same script can be run on both Board 1 and Board 2 to set this up:
ip link del bond0
ip link add bond0 type bond mode balance-xor miimon 1
OR
ip link add bond0 type bond mode 802.3ad
ip link set swp1 down && ip link set swp1 master bond0 && ip link set swp1 up
ip link set swp2 down && ip link set swp2 master bond0 && ip link set swp2 up
ip link del br0
ip link add br0 type bridge
ip link set bond0 master br0
ip link set swp0 master br0
Then traffic can be tested between eno0 of Board 1 and eno0 of Board 2.
====================
Link: https://lore.kernel.org/r/20210205220221.255646-1-olteanv@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net')
| -rw-r--r-- | net/dsa/dsa_priv.h | 13 | ||||
| -rw-r--r-- | net/dsa/slave.c | 8 |
2 files changed, 21 insertions, 0 deletions
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index 263593ce94a8..8a1bcb2b4208 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -209,6 +209,19 @@ static inline bool dsa_port_offloads_netdev(struct dsa_port *dp, return false; } +/* Returns true if any port of this tree offloads the given net_device */ +static inline bool dsa_tree_offloads_netdev(struct dsa_switch_tree *dst, + struct net_device *dev) +{ + struct dsa_port *dp; + + list_for_each_entry(dp, &dst->ports, list) + if (dsa_port_offloads_netdev(dp, dev)) + return true; + + return false; +} + /* slave.c */ extern const struct dsa_device_ops notag_netdev_ops; void dsa_slave_mii_bus_init(struct dsa_switch *ds); diff --git a/net/dsa/slave.c b/net/dsa/slave.c index f77e9eeb1a62..431bdbdd8473 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -2242,6 +2242,14 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused, if (!dp->ds->assisted_learning_on_cpu_port) return NOTIFY_DONE; + + /* When the bridge learns an address on an offloaded + * LAG we don't want to send traffic to the CPU, the + * other ports bridged with the LAG should be able to + * autonomously forward towards it. + */ + if (dsa_tree_offloads_netdev(dp->ds->dst, dev)) + return NOTIFY_DONE; } if (!dp->ds->ops->port_fdb_add || !dp->ds->ops->port_fdb_del) |
