Re: [PATCH net v1 1/3] taprio: Fix enabling offload with wrong number of traffic classes
From: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Date: 2020-01-27 19:17:37
Hi Andre, Andre Guedes [off-list ref] writes:
Hi Vinicius, Quoting Vinicius Costa Gomes (2020-01-24 16:53:18)quoted
diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index c609373c8661..ad0dadcfcdba 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c@@ -1444,6 +1444,19 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, taprio_set_picos_per_byte(dev, q); + if (mqprio) { + netdev_set_num_tc(dev, mqprio->num_tc); + for (i = 0; i < mqprio->num_tc; i++) + netdev_set_tc_queue(dev, i, + mqprio->count[i], + mqprio->offset[i]); + + /* Always use supplied priority mappings */ + for (i = 0; i <= TC_BITMASK; i++) + netdev_set_prio_tc_map(dev, i, + mqprio->prio_tc_map[i]); + } + if (FULL_OFFLOAD_IS_ENABLED(taprio_flags)) err = taprio_enable_offload(dev, mqprio, q, new_admin, extack); elseIf something goes wrong later within this function (e.g. taprio_enable_offload() returns error), don't we want to roll back these changes to the netdev object?
If something goes wrong, and change() returns an error, taprio_destroy() is called, and the changes are undone. Cheers, -- Vinicius