]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
net/sched: taprio: pass mqprio queue configuration to ndo_setup_tc()
authorVladimir Oltean <vladimir.oltean@nxp.com>
Sat, 4 Feb 2023 13:53:03 +0000 (15:53 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 6 Feb 2023 10:06:44 +0000 (10:06 +0000)
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: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/pkt_sched.h
net/sched/sch_taprio.c

index 02e3ccfbc7d19df5a61145f8e397ed8ea16bfed0..ace8be520fb032cb3525e0e82c1d03dd07094e5e 100644 (file)
@@ -187,6 +187,7 @@ struct tc_taprio_sched_entry {
 };
 
 struct tc_taprio_qopt_offload {
+       struct tc_mqprio_qopt_offload mqprio;
        u8 enable;
        ktime_t base_time;
        u64 cycle_time;
index 6b3cecbe9f1f4c7dc5d71b9c62769fa04dd8e8a2..aba8a16842c1dbf7dc6f1d01076a06ff972414b1 100644 (file)
@@ -1228,6 +1228,7 @@ static int taprio_enable_offload(struct net_device *dev,
                return -ENOMEM;
        }
        offload->enable = 1;
+       mqprio_qopt_reconstruct(dev, &offload->mqprio.qopt);
        taprio_sched_to_offload(dev, sched, offload);
 
        for (tc = 0; tc < TC_MAX_QUEUE; tc++)