Commit b8c43360 authored by Xiaolei Wang's avatar Xiaolei Wang Committed by Jakub Kicinski

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

commit be27b896 ("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: be27b896 ("net: stmmac: replace priv->speed with the portTransmitRate from the tc-cbs parameters")
Signed-off-by: default avatarXiaolei Wang <xiaolei.wang@windriver.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240617013922.1035854-1-xiaolei.wang@windriver.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 40a64cc9
...@@ -358,6 +358,7 @@ static int tc_setup_cbs(struct stmmac_priv *priv, ...@@ -358,6 +358,7 @@ static int tc_setup_cbs(struct stmmac_priv *priv,
port_transmit_rate_kbps = qopt->idleslope - qopt->sendslope; port_transmit_rate_kbps = qopt->idleslope - qopt->sendslope;
if (qopt->enable) {
/* Port Transmit Rate and Speed Divider */ /* Port Transmit Rate and Speed Divider */
switch (div_s64(port_transmit_rate_kbps, 1000)) { switch (div_s64(port_transmit_rate_kbps, 1000)) {
case SPEED_10000: case SPEED_10000:
...@@ -377,6 +378,9 @@ static int tc_setup_cbs(struct stmmac_priv *priv, ...@@ -377,6 +378,9 @@ static int tc_setup_cbs(struct stmmac_priv *priv,
port_transmit_rate_kbps); port_transmit_rate_kbps);
return -EINVAL; return -EINVAL;
} }
} else {
ptr = 0;
}
mode_to_use = priv->plat->tx_queues_cfg[queue].mode_to_use; mode_to_use = priv->plat->tx_queues_cfg[queue].mode_to_use;
if (mode_to_use == MTL_QUEUE_DCB && qopt->enable) { if (mode_to_use == MTL_QUEUE_DCB && qopt->enable) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment