Re: [net PATCH] net: stmmac: No need to calculate speed divider when offload is disabled

From: xiaolei wang
Date: Mon Jun 17 2024 - 22:32:10 EST



On 6/17/24 18:29, Simon Horman wrote:
CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

On Sun, Jun 16, 2024 at 09:15:05AM +0800, xiaolei wang wrote:
On 6/15/24 22:47, Simon Horman wrote:
On Fri, Jun 14, 2024 at 04:19:16PM +0800, Xiaolei Wang wrote:
...

/* Final adjustments for HW */
value = div_s64(qopt->idleslope * 1024ll * ptr, port_transmit_rate_kbps);
priv->plat->tx_queues_cfg[queue].idle_slope = value & GENMASK(31, 0);

value = div_s64(-qopt->sendslope * 1024ll * ptr, port_transmit_rate_kbps);
priv->plat->tx_queues_cfg[queue].send_slope = value & GENMASK(31, 0);

And the div_s64() lines above appear to use
ptr uninitialised in the !qopt->enable case.
Oh, when deleting the configuration, idleslope and sendslope are both 0, do
you mean we also need to set ptr to 0?
Understood, if idleslope and sendslope are 0, then ptr could be set to any
value and the result would be the same. And, based on my limited
understanding, 0 does not seem to be a bad choice.

My point is that ptr shouldn't be uninitialised at this point.

OK, I have sent the v2 version

https://patchwork.kernel.org/project/netdevbpf/patch/20240617013922.1035854-1-xiaolei.wang@xxxxxxxxxxxxx/

thanks

xiaolei


...