diff mbox series

[net-next,3/4] net: dsa: return -EOPNOTSUPP if .port_lag_join is not implemented

Message ID 20210214155326.1783266-4-olteanv@gmail.com
State New
Headers show
Series Software fallback for bridging in DSA | expand

Commit Message

Vladimir Oltean Feb. 14, 2021, 3:53 p.m. UTC
From: Vladimir Oltean <vladimir.oltean@nxp.com>

There is currently some provisioning for DSA to use the software
fallback for link aggregation, but only if the .port_lag_join is
implemented but it fails (for example because there are more link
aggregation groups than the switch supports, or because the xmit hash
policy cannot be done in hardware, or ...).

But when .port_lag_join is not implemented at all, the DSA switch
notifier returns zero and software fallback does not kick in.
Change that.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 net/dsa/switch.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Tobias Waldekranz Feb. 25, 2021, 7:24 p.m. UTC | #1
On Sun, Feb 14, 2021 at 17:53, Vladimir Oltean <olteanv@gmail.com> wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>

>

> There is currently some provisioning for DSA to use the software

> fallback for link aggregation, but only if the .port_lag_join is

> implemented but it fails (for example because there are more link

> aggregation groups than the switch supports, or because the xmit hash

> policy cannot be done in hardware, or ...).

>

> But when .port_lag_join is not implemented at all, the DSA switch

> notifier returns zero and software fallback does not kick in.

> Change that.

>

> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

> ---


Reviewed-by: Tobias Waldekranz <tobias@waldekranz.com>
diff mbox series

Patch

diff --git a/net/dsa/switch.c b/net/dsa/switch.c
index 4137716d0de5..15b0c936ba01 100644
--- a/net/dsa/switch.c
+++ b/net/dsa/switch.c
@@ -203,9 +203,13 @@  static int dsa_switch_lag_change(struct dsa_switch *ds,
 static int dsa_switch_lag_join(struct dsa_switch *ds,
 			       struct dsa_notifier_lag_info *info)
 {
-	if (ds->index == info->sw_index && ds->ops->port_lag_join)
+	if (ds->index == info->sw_index) {
+		if (!ds->ops->port_lag_join)
+			return -EOPNOTSUPP;
+
 		return ds->ops->port_lag_join(ds, info->port, info->lag,
 					      info->info);
+	}
 
 	if (ds->index != info->sw_index && ds->ops->crosschip_lag_join)
 		return ds->ops->crosschip_lag_join(ds, info->sw_index,