From: Vladimir Oltean <[email protected]>

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 <[email protected]>
---
 net/dsa/switch.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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,
-- 
2.25.1

Reply via email to