net: dsa: qca8k: Fix inconsistent use of jiffies vs milliseconds
Andrew Lunn
maintainerPATCH 1/1 net: dsa: qca8k: Fix inconsistent use of jiffies vs milliseconds
wait_for_complete_timeout() expects a timeout in jiffies. With the driver, some call sites converted QCA8K_ETHERNET_TIMEOUT to jiffies, others did not. Make the code consistent by changes the #define to include a call to msecs_to_jiffies, and remove all other calls to msecs_to_jiffies.
--- drivers/net/dsa/qca/qca8k-8xxx.c | 4 ++-- drivers/net/dsa/qca/qca8k.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/dsa/qca/qca8k-8xxx.c +2 -2
@@ -342,7 +342,7 @@ static int qca8k_read_eth(struct qca8k_priv *priv, u32 reg, u32 *val, int len)dev_queue_xmit (skb); ret =wait_for_completion_timeout (&mgmt_eth_data->rw_done, -msecs_to_jiffies (QCA8K_ETHERNET_TIMEOUT )); +QCA8K_ETHERNET_TIMEOUT ); *val = mgmt_eth_data->data[0 ];if (len >QCA_HDR_MGMT_DATA1_LEN )
@@ -394,7 +394,7 @@ static int qca8k_write_eth(struct qca8k_priv *priv, u32 reg, u32 *val, int len)dev_queue_xmit (skb); ret =wait_for_completion_timeout (&mgmt_eth_data->rw_done, -msecs_to_jiffies (QCA8K_ETHERNET_TIMEOUT )); +QCA8K_ETHERNET_TIMEOUT ); ack = mgmt_eth_data->ack;
drivers/net/dsa/qca/qca8k.h +1 -1
@@ -16,7 +16,7 @@#define QCA8K_ETHERNET_MDIO_PRIORITY 7#define QCA8K_ETHERNET_PHY_PRIORITY 6 -#define QCA8K_ETHERNET_TIMEOUT 5 +#define QCA8K_ETHERNET_TIMEOUT msecs_to_jiffies(5)#define QCA8K_NUM_PORTS 7#define QCA8K_NUM_CPU_PORTS 2
---
base-commit: 2c2b61d2138f472e50b5531ec0cb4a1485837e21
change-id: 20241215-qca8k-jiffies-01e8c5dd5099
Best regards,
Signature · 1 line
Andrew Lunn <[email protected]>
Vladimir Oltean
maintainerQuoted 8 lines · Andrew Lunn
wait_for_complete_timeout()expects a timeout in jiffies. With the driver, some call sites convertedQCA8K_ETHERNET_TIMEOUTto jiffies, others did not. Make the code consistent by changes the #define to include a call tomsecs_to_jiffies, and remove all other calls tomsecs_to_jiffies.Signed-off-by Andrew Lunn <[email protected]>---
If my calculations are correct, for CONFIG_HZ=100, 5 jiffies last 50 ms. So, assuming that configuration, the patch would be _decreasing_ the timeout from 50 ms to 5 ms. The change should be tested to confirm it's enough. Christian, could you do that?
Andrew Lunn
maintainerQuoted 7 lines · Vladimir Oltean
Quoted 6 lines · Andrew Lunn
wait_for_complete_timeout()expects a timeout in jiffies. With the driver, some call sites convertedQCA8K_ETHERNET_TIMEOUTto jiffies, others did not. Make the code consistent by changes the #define to include a call tomsecs_to_jiffies, and remove all other calls tomsecs_to_jiffies.
Quoted 7 lines
Quoted 2 lines
Signed-off-by Andrew Lunn <[email protected]>---
If my calculations are correct, for
CONFIG_HZ=100, 5 jiffies last 50 ms. So, assuming that configuration, the patch would be _decreasing_ the timeout from 50 ms to 5 ms. The change should be tested to confirm it's enough. Christian, could you do that?
I've have an qca8k system now, and have tested this patch. However, a
Tested-by: from Christian would be very welcome.
Andrew
Christian Marangi
maintainerQuoted 11 lines · Andrew Lunn
Quoted 10 lines · Vladimir Oltean
Quoted 8 lines · Andrew Lunn
wait_for_complete_timeout()expects a timeout in jiffies. With the driver, some call sites convertedQCA8K_ETHERNET_TIMEOUTto jiffies, others did not. Make the code consistent by changes the #define to include a call tomsecs_to_jiffies, and remove all other calls tomsecs_to_jiffies.Signed-off-by Andrew Lunn <[email protected]>---
Quoted 8 lines
Quoted 4 lines
If my calculations are correct, for
CONFIG_HZ=100, 5 jiffies last 50 ms. So, assuming that configuration, the patch would be _decreasing_ the timeout from 50 ms to 5 ms. The change should be tested to confirm it's enough. Christian, could you do that?I've have an qca8k system now, and have tested this patch. However, a
Tested-by: from Christian would be very welcome.
Hi need 1-2 days to test this, hope that is O.K.
Signature · 1 line
Ansuel
Andrew Lunn
maintainerQuoted 17 lines · Christian Marangi
Quoted 16 lines · Andrew Lunn
Quoted 14 lines · Vladimir Oltean
Quoted 8 lines · Andrew Lunn
wait_for_complete_timeout()expects a timeout in jiffies. With the driver, some call sites convertedQCA8K_ETHERNET_TIMEOUTto jiffies, others did not. Make the code consistent by changes the #define to include a call tomsecs_to_jiffies, and remove all other calls tomsecs_to_jiffies.Signed-off-by Andrew Lunn <[email protected]>---
If my calculations are correct, for
CONFIG_HZ=100, 5 jiffies last 50 ms. So, assuming that configuration, the patch would be _decreasing_ the timeout from 50 ms to 5 ms. The change should be tested to confirm it's enough. Christian, could you do that?
Quoted 5 lines
Quoted 3 lines
I've have an qca8k system now, and have tested this patch. However, a
Tested-by: from Christian would be very welcome.Hi need 1-2 days to test this, hope that is O.K.
That is fine, I don't really expect the remaining patches will go anywhere until next year, with net-next closing soon.
Andrew
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Quoted 9 lines · On Sun, 15 Dec 2024 17:43:55 +0000 you wrote:
wait_for_complete_timeout()expects a timeout in jiffies. With the driver, some call sites convertedQCA8K_ETHERNET_TIMEOUTto jiffies, others did not. Make the code consistent by changes the #define to include a call tomsecs_to_jiffies, and remove all other calls tomsecs_to_jiffies.Signed-off-by Andrew Lunn <[email protected]>[...]
Here is the summary with links:
- [net-next] net: dsa: qca8k: Fix inconsistent use of jiffies vs milliseconds
https://git.kernel.org/netdev/net-next/c/5a49edec44f6
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html