Commit 09c794c0 authored by Vladimir Oltean's avatar Vladimir Oltean Committed by David S. Miller

net/sched: taprio: pass mqprio queue configuration to ndo_setup_tc()

The taprio qdisc does not currently pass the mqprio queue configuration
down to the offloading device driver. So the driver cannot act upon the
TXQ counts/offsets per TC, or upon the prio->tc map. It was probably
assumed that the driver only wants to offload num_tc (see
TC_MQPRIO_HW_OFFLOAD_TCS), which it can get from netdev_get_num_tc(),
but there's clearly more to the mqprio configuration than that.

I've considered 2 mechanisms to remedy that. First is to pass a struct
tc_mqprio_qopt_offload as part of the tc_taprio_qopt_offload. The second
is to make taprio actually call TC_SETUP_QDISC_MQPRIO, *in addition to*
TC_SETUP_QDISC_TAPRIO.

The difference is that in the first case, existing drivers (offloading
or not) all ignore taprio's mqprio portion currently, whereas in the
second case, we could control whether to call TC_SETUP_QDISC_MQPRIO,
based on a new capability. The question is which approach would be
better.

I'm afraid that calling TC_SETUP_QDISC_MQPRIO unconditionally (not based
on a taprio capability bit) would risk introducing regressions. For
example, taprio doesn't populate (or validate) qopt->hw, as well as
mqprio.flags, mqprio.shaper, mqprio.min_rate, mqprio.max_rate.

In comparison, adding a capability is functionally equivalent to just
passing the mqprio in a way that drivers can ignore it, except it's
slightly more complicated to use it (need to set the capability).

Ultimately, what made me go for the "mqprio in taprio" variant was that
it's easier for offloading drivers to interpret the mqprio qopt slightly
differently when it comes from taprio vs when it comes from mqprio,
should that ever become necessary.
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9dd6ad67
...@@ -187,6 +187,7 @@ struct tc_taprio_sched_entry { ...@@ -187,6 +187,7 @@ struct tc_taprio_sched_entry {
}; };
struct tc_taprio_qopt_offload { struct tc_taprio_qopt_offload {
struct tc_mqprio_qopt_offload mqprio;
u8 enable; u8 enable;
ktime_t base_time; ktime_t base_time;
u64 cycle_time; u64 cycle_time;
......
...@@ -1228,6 +1228,7 @@ static int taprio_enable_offload(struct net_device *dev, ...@@ -1228,6 +1228,7 @@ static int taprio_enable_offload(struct net_device *dev,
return -ENOMEM; return -ENOMEM;
} }
offload->enable = 1; offload->enable = 1;
mqprio_qopt_reconstruct(dev, &offload->mqprio.qopt);
taprio_sched_to_offload(dev, sched, offload); taprio_sched_to_offload(dev, sched, offload);
for (tc = 0; tc < TC_MAX_QUEUE; tc++) for (tc = 0; tc < TC_MAX_QUEUE; tc++)
......
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