realtek: dsa: map DSA LAG ids to zero-based trunk groups

DSA numbers LAGs from 1 to num_lag_ids. The driver uses the id as it is
to index its LAG arrays and as the hardware trunk group, both of which
start at 0. Group 0 is therefore never used and the last id is refused,
so one LAG fewer than the switch supports can be offloaded.

Accept ids from 1 to num_lag_ids and subtract one where the id becomes
a group.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Quinn O'Shea <qoshea@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/25792
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
This commit is contained in:
Quinn O'Shea authored and Markus Stockhausen committed 2026-10-11 08:54:06 +02:00
1 parent 2433508b51
commit 7f31e15de4
1 file changed
+3 -3
@@ -1358,7 +1358,7 @@ static bool rtldsa_83xx_lag_can_offload(struct dsa_switch *ds,
int id;
id = dsa_lag_id(ds->dst, lag);
if (id < 0 || id >= ds->num_lag_ids)
if (id < 1 || id > ds->num_lag_ids)
return false;
if (info->tx_type != NETDEV_LAG_TX_TYPE_HASH)
@@ -1418,7 +1418,7 @@ static int rtldsa_port_lag_join(struct dsa_switch *ds,
goto out;
}
group = lag.id;
group = lag.id - 1;
pr_info("port_lag_join: group %d, port %d\n", group, port);
@@ -1450,7 +1450,7 @@ static int rtldsa_port_lag_leave(struct dsa_switch *ds, int port,
mutex_lock(&priv->reg_mutex);
group = lag.id;
group = lag.id - 1;
if (port >= priv->r->cpu_port) {
err = -EINVAL;