[PATCH net 1/1] net: stmmac: set TxQ mode back to DCB after disabling CBS

From: Song Yoong Siang
Date: Thu Feb 04 2021 - 01:11:47 EST


From: Mohammad Athari Bin Ismail <mohammad.athari.ismail@xxxxxxxxx>

When disable CBS, mode_to_use parameter is not updated even the operation
mode of Tx Queue is changed to Data Centre Bridging (DCB). Therefore,
when tc_setup_cbs() function is called to re-enable CBS, the operation
mode of Tx Queue remains at DCB, which causing CBS fails to work.

This patch updates the value of mode_to_use parameter to MTL_QUEUE_DCB
after operation mode of Tx Queue is changed to DCB in stmmac_dma_qmode()
callback function.

Fixes: 1f705bc61aee ("net: stmmac: Add support for CBS QDISC")
Suggested-by: Gomes, Vinicius <vinicius.gomes@xxxxxxxxx>
Signed-off-by: Mohammad Athari Bin Ismail <mohammad.athari.ismail@xxxxxxxxx>
Signed-off-by: Song, Yoong Siang <yoong.siang.song@xxxxxxxxx>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
index 8ed3b2c..5698554 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
@@ -324,7 +324,12 @@ static int tc_setup_cbs(struct stmmac_priv *priv,

priv->plat->tx_queues_cfg[queue].mode_to_use = MTL_QUEUE_AVB;
} else if (!qopt->enable) {
- return stmmac_dma_qmode(priv, priv->ioaddr, queue, MTL_QUEUE_DCB);
+ ret = stmmac_dma_qmode(priv, priv->ioaddr, queue,
+ MTL_QUEUE_DCB);
+ if (ret)
+ return ret;
+
+ priv->plat->tx_queues_cfg[queue].mode_to_use = MTL_QUEUE_DCB;
}

/* Port Transmit Rate and Speed Divider */
--
2.7.4