Commit b148d400 authored by Paolo Abeni's avatar Paolo Abeni

Merge branch 'taprio-queuemaxsdu-fixes'

Vladimir Oltean says:

====================
taprio queueMaxSDU fixes

This fixes 3 issues noticed while attempting to reoffload the
dynamically calculated queueMaxSDU values. These are:
- Dynamic queueMaxSDU is not calculated correctly due to a lost patch
- Dynamically calculated queueMaxSDU needs to be clamped on the low end
- Dynamically calculated queueMaxSDU needs to be clamped on the high end
====================

Link: https://lore.kernel.org/r/20230215224632.2532685-1-vladimir.oltean@nxp.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parents c0783818 64cb6aad
...@@ -279,9 +279,17 @@ static void taprio_update_queue_max_sdu(struct taprio_sched *q, ...@@ -279,9 +279,17 @@ static void taprio_update_queue_max_sdu(struct taprio_sched *q,
u32 max_frm_len; u32 max_frm_len;
max_frm_len = duration_to_length(q, sched->max_open_gate_duration[tc]); max_frm_len = duration_to_length(q, sched->max_open_gate_duration[tc]);
if (stab) /* Compensate for L1 overhead from size table,
* but don't let the frame size go negative
*/
if (stab) {
max_frm_len -= stab->szopts.overhead; max_frm_len -= stab->szopts.overhead;
max_frm_len = max_t(int, max_frm_len,
dev->hard_header_len + 1);
}
max_sdu_dynamic = max_frm_len - dev->hard_header_len; max_sdu_dynamic = max_frm_len - dev->hard_header_len;
if (max_sdu_dynamic > dev->max_mtu)
max_sdu_dynamic = U32_MAX;
} }
max_sdu = min(max_sdu_dynamic, max_sdu_from_user); max_sdu = min(max_sdu_dynamic, max_sdu_from_user);
...@@ -1833,23 +1841,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, ...@@ -1833,23 +1841,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
goto free_sched; goto free_sched;
} }
err = parse_taprio_schedule(q, tb, new_admin, extack);
if (err < 0)
goto free_sched;
if (new_admin->num_entries == 0) {
NL_SET_ERR_MSG(extack, "There should be at least one entry in the schedule");
err = -EINVAL;
goto free_sched;
}
err = taprio_parse_clockid(sch, tb, extack);
if (err < 0)
goto free_sched;
taprio_set_picos_per_byte(dev, q);
taprio_update_queue_max_sdu(q, new_admin, stab);
if (mqprio) { if (mqprio) {
err = netdev_set_num_tc(dev, mqprio->num_tc); err = netdev_set_num_tc(dev, mqprio->num_tc);
if (err) if (err)
...@@ -1867,6 +1858,23 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, ...@@ -1867,6 +1858,23 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
mqprio->prio_tc_map[i]); mqprio->prio_tc_map[i]);
} }
err = parse_taprio_schedule(q, tb, new_admin, extack);
if (err < 0)
goto free_sched;
if (new_admin->num_entries == 0) {
NL_SET_ERR_MSG(extack, "There should be at least one entry in the schedule");
err = -EINVAL;
goto free_sched;
}
err = taprio_parse_clockid(sch, tb, extack);
if (err < 0)
goto free_sched;
taprio_set_picos_per_byte(dev, q);
taprio_update_queue_max_sdu(q, new_admin, stab);
if (FULL_OFFLOAD_IS_ENABLED(q->flags)) if (FULL_OFFLOAD_IS_ENABLED(q->flags))
err = taprio_enable_offload(dev, q, new_admin, extack); err = taprio_enable_offload(dev, q, new_admin, extack);
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment