Skip to content

Commit 09dbdf2

Browse files
vladimirolteanPaolo Abeni
authored andcommitted
net/sched: taprio: fix calculation of maximum gate durations
taprio_calculate_gate_durations() depends on netdev_get_num_tc() and this returns 0. So it calculates the maximum gate durations for no traffic class. I had tested the blamed commit only with another patch in my tree, one which in the end I decided isn't valuable enough to submit ("net/sched: taprio: mask off bits in gate mask that exceed number of TCs"). The problem is that having this patch threw off my testing. By moving the netdev_set_num_tc() call earlier, we implicitly gave to taprio_calculate_gate_durations() the information it needed. Extract only the portion from the unsubmitted change which applies the mqprio configuration to the netdev earlier. Link: https://patchwork.kernel.org/project/netdevbpf/patch/20230130173145.475943-15-vladimir.oltean@nxp.com/ Fixes: a306a90 ("net/sched: taprio: calculate tc gate durations") Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent c078381 commit 09dbdf2

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

net/sched/sch_taprio.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1833,23 +1833,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
18331833
goto free_sched;
18341834
}
18351835

1836-
err = parse_taprio_schedule(q, tb, new_admin, extack);
1837-
if (err < 0)
1838-
goto free_sched;
1839-
1840-
if (new_admin->num_entries == 0) {
1841-
NL_SET_ERR_MSG(extack, "There should be at least one entry in the schedule");
1842-
err = -EINVAL;
1843-
goto free_sched;
1844-
}
1845-
1846-
err = taprio_parse_clockid(sch, tb, extack);
1847-
if (err < 0)
1848-
goto free_sched;
1849-
1850-
taprio_set_picos_per_byte(dev, q);
1851-
taprio_update_queue_max_sdu(q, new_admin, stab);
1852-
18531836
if (mqprio) {
18541837
err = netdev_set_num_tc(dev, mqprio->num_tc);
18551838
if (err)
@@ -1867,6 +1850,23 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
18671850
mqprio->prio_tc_map[i]);
18681851
}
18691852

1853+
err = parse_taprio_schedule(q, tb, new_admin, extack);
1854+
if (err < 0)
1855+
goto free_sched;
1856+
1857+
if (new_admin->num_entries == 0) {
1858+
NL_SET_ERR_MSG(extack, "There should be at least one entry in the schedule");
1859+
err = -EINVAL;
1860+
goto free_sched;
1861+
}
1862+
1863+
err = taprio_parse_clockid(sch, tb, extack);
1864+
if (err < 0)
1865+
goto free_sched;
1866+
1867+
taprio_set_picos_per_byte(dev, q);
1868+
taprio_update_queue_max_sdu(q, new_admin, stab);
1869+
18701870
if (FULL_OFFLOAD_IS_ENABLED(q->flags))
18711871
err = taprio_enable_offload(dev, q, new_admin, extack);
18721872
else

0 commit comments

Comments
 (0)