Re: [PATCH net v2 1/3] taprio: Fix enabling offload with wrong number of traffic classes
From: David Miller <davem@davemloft.net>
Date: 2020-01-29 10:11:22
From: David Miller <davem@davemloft.net>
Date: 2020-01-29 10:11:22
From: Vinicius Costa Gomes <vinicius.gomes@intel.com> Date: Tue, 28 Jan 2020 15:52:25 -0800
@@ -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); else
This feedback applies to the existing code too, but don't we need to have a call to netdev_reset_tc() in the error paths after we commit these settings? Because ->num_tc for the device should be reset to zero for sure if we can't complete this configuration change successfully.