net: stmmac: fix mqprio and cbs combination
The channel-mode mqprio offload and the CBS offload can currently not be enabled at the same time. tc_mqprio_validate_chan_mode() refuses the mqprio offload as soon as any TX queue is configured in AVB mode, and tc_setup_cbs() refuses to enable CBS while the strict-priority scheduler is active. As a result the combination is rejected whichever order the two are configured in. The strict-priority scheduler selected by the channel-mode mqprio offload and the per-queue CBS shaper are stored in independent MTL fields on dwmac4/EQoS cores (MTL_OPERATION_MODE.SCHALG vs MTL_ETS_CTRL.AVALG), so the two checks are over-restrictive there. On XGMAC/XLGMAC they are not independent: the TX scheduling algorithm and the CBS shaper share the per-TC MTL_TCx_ETS_CONTROL.TSA field, so programming the scheduler rewrites TSA on every queue and would disable CBS on any queue configured in AVB mode. Drop the checks and re-apply the AVB/CBS configuration with stmmac_configure_cbs() after the TX algorithm is reprogrammed in tc_mqprio_config_queue_prio() and stmmac_reset_tc_mqprio(), so the combination is offloaded correctly on all cores. The stmmac_reinit_queues() check is dropped as well, since a subsequent ndo_open restores the AVB queues. The following configuration, which was previously refused, now works: $ tc qdisc replace dev eth0 handle 100 parent root mqprio \ num_tc 4 \ map 0 0 0 0 0 1 2 3 0 0 0 0 0 0 0 0 \ queues 1@0 1@1 1@2 1@3 mode channel hw 1 $ tc qdisc replace dev eth0 parent 100:2 handle 102: cbs \ idleslope 800000 sendslope -1700000 hicredit 494 \ locredit -1049 offload 0 $ tc qdisc replace dev eth0 parent 100:3 handle 103: cbs \ idleslope 400000 sendslope -2100000 hicredit 247 \ locredit -1296 offload 1 $ tc qdisc replace dev eth0 parent 100:4 handle 104: cbs \ idleslope 200000 sendslope -2300000 hicredit 124 \ locredit -1419 offload 1 Fixes: 47891d501e34 ("net: stmmac: add tc mqprio hw queue priority offload") Tested-by: Daniel Thompson <daniel@riscstar.com> Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Reviewed-by: Daniel Thompson <daniel@riscstar.com> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com> Link: https://patch.msgid.link/20261014-stmmac-mqprio-cbs-combo-v2-1-372249daa81a@oss.qualcomm.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>