net: stmmac: No need to calculate speed divider when offload is disabled

commit be27b89652 ("net: stmmac: replace priv->speed with
the portTransmitRate from the tc-cbs parameters") introduced
a problem. When deleting, it prompts "Invalid portTransmitRate
0 (idleSlope - sendSlope)" and exits. Add judgment on cbs.enable.
Only when offload is enabled, speed divider needs to be calculated.

Fixes: be27b89652 ("net: stmmac: replace priv->speed with the portTransmitRate from the tc-cbs parameters")
Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240617013922.1035854-1-xiaolei.wang@windriver.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Xiaolei Wang 2024-06-17 09:39:22 +08:00 committed by Jakub Kicinski
parent 40a64cc967
commit b8c43360f6

View File

@ -358,6 +358,7 @@ static int tc_setup_cbs(struct stmmac_priv *priv,
port_transmit_rate_kbps = qopt->idleslope - qopt->sendslope;
if (qopt->enable) {
/* Port Transmit Rate and Speed Divider */
switch (div_s64(port_transmit_rate_kbps, 1000)) {
case SPEED_10000:
@ -377,6 +378,9 @@ static int tc_setup_cbs(struct stmmac_priv *priv,
port_transmit_rate_kbps);
return -EINVAL;
}
} else {
ptr = 0;
}
mode_to_use = priv->plat->tx_queues_cfg[queue].mode_to_use;
if (mode_to_use == MTL_QUEUE_DCB && qopt->enable) {