diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2023-02-04 16:53:02 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-02-06 13:06:44 +0300 |
commit | 9dd6ad674cc74a62cc85de6e02cb29d47e9c4eb5 (patch) | |
tree | e193209fedbbf8e51baf1dbf7f9165c74a0cc61e /net/sched/sch_mqprio.c | |
parent | 1dfe086dd7efb36d3d619a90782c6ca186a1bae9 (diff) | |
download | linux-9dd6ad674cc74a62cc85de6e02cb29d47e9c4eb5.tar.xz |
net/sched: refactor mqprio qopt reconstruction to a library function
The taprio qdisc will need to reconstruct a struct tc_mqprio_qopt from
netdev settings once more in a future patch, but this code was already
written twice, once in taprio and once in mqprio.
Refactor the code to a helper in the common mqprio library.
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>
Diffstat (limited to 'net/sched/sch_mqprio.c')
-rw-r--r-- | net/sched/sch_mqprio.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c index 9303d2a1e840..48ed87b91086 100644 --- a/net/sched/sch_mqprio.c +++ b/net/sched/sch_mqprio.c @@ -406,7 +406,7 @@ static int mqprio_dump(struct Qdisc *sch, struct sk_buff *skb) struct nlattr *nla = (struct nlattr *)skb_tail_pointer(skb); struct tc_mqprio_qopt opt = { 0 }; struct Qdisc *qdisc; - unsigned int ntx, tc; + unsigned int ntx; sch->q.qlen = 0; gnet_stats_basic_sync_init(&sch->bstats); @@ -430,15 +430,9 @@ static int mqprio_dump(struct Qdisc *sch, struct sk_buff *skb) spin_unlock_bh(qdisc_lock(qdisc)); } - opt.num_tc = netdev_get_num_tc(dev); - memcpy(opt.prio_tc_map, dev->prio_tc_map, sizeof(opt.prio_tc_map)); + mqprio_qopt_reconstruct(dev, &opt); opt.hw = priv->hw_offload; - for (tc = 0; tc < netdev_get_num_tc(dev); tc++) { - opt.count[tc] = dev->tc_to_txq[tc].count; - opt.offset[tc] = dev->tc_to_txq[tc].offset; - } - if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt)) goto nla_put_failure; |