Skip to content

Commit 0099cf6

Browse files
LorenzoBianconiNipaLocal
authored andcommitted
net: airoha: Fix ETS priomap validation
ETS Qdisc schedules SP bands in a priority order assigning band-0 the highest priority (band-0 > band-1 > .. > band-n) while EN7581 arranges SP bands in a priority order assigning band-7 the highest priority (band-7 > band-6, .. > band-n). Fix priomap check in airoha_qdma_set_tx_ets_sched routine in order to align ETS Qdisc and airoha_eth driver SP priority ordering. Fixes: b56e4d6 ("net: airoha: Enforce ETS Qdisc priomap") Signed-off-by: Lorenzo Bianconi <[email protected]> Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Davide Caratti <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent f830eba commit 0099cf6

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/net/ethernet/airoha/airoha_eth.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2028,7 +2028,7 @@ static int airoha_qdma_set_tx_ets_sched(struct airoha_gdm_port *port,
20282028
struct tc_ets_qopt_offload_replace_params *p = &opt->replace_params;
20292029
enum tx_sched_mode mode = TC_SCH_SP;
20302030
u16 w[AIROHA_NUM_QOS_QUEUES] = {};
2031-
int i, nstrict = 0, nwrr, qidx;
2031+
int i, nstrict = 0;
20322032

20332033
if (p->bands > AIROHA_NUM_QOS_QUEUES)
20342034
return -EINVAL;
@@ -2046,17 +2046,17 @@ static int airoha_qdma_set_tx_ets_sched(struct airoha_gdm_port *port,
20462046
* lowest priorities with respect to SP ones.
20472047
* e.g: WRR0, WRR1, .., WRRm, SP0, SP1, .., SPn
20482048
*/
2049-
nwrr = p->bands - nstrict;
2050-
qidx = nstrict && nwrr ? nstrict : 0;
2051-
for (i = 1; i <= p->bands; i++) {
2052-
if (p->priomap[i % AIROHA_NUM_QOS_QUEUES] != qidx)
2049+
for (i = 0; i < nstrict; i++) {
2050+
if (p->priomap[p->bands - i - 1] != i)
20532051
return -EINVAL;
2054-
2055-
qidx = i == nwrr ? 0 : qidx + 1;
20562052
}
20572053

2058-
for (i = 0; i < nwrr; i++)
2054+
for (i = 0; i < p->bands - nstrict; i++) {
2055+
if (p->priomap[i] != nstrict + i)
2056+
return -EINVAL;
2057+
20592058
w[i] = p->weights[nstrict + i];
2059+
}
20602060

20612061
if (!nstrict)
20622062
mode = TC_SCH_WRR8;

0 commit comments

Comments
 (0)