Skip to contentSkip to conversation

net/mlx5: Use secs_to_jiffies() instead of msecs_to_jiffies()

PATCH In review Thorsten Blum 4 participants 6 messages Feb 19, 2025 – Feb 20, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: Use secs_to_jiffies() instead of msecs_to_jiffies()

Use secs_to_jiffies() and simplify the code.

---
 drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c +1 -1
index 3dbd4efa21a2..19dce1ba512d 100644
@@ -220,7 +220,7 @@ static int hws_bwc_queue_poll(struct mlx5hws_context *ctx,
 			      bool drain)
 {
 	unsigned long timeout = jiffies +
-				msecs_to_jiffies(MLX5HWS_BWC_POLLING_TIMEOUT * MSEC_PER_SEC);
+				secs_to_jiffies(MLX5HWS_BWC_POLLING_TIMEOUT);
 	struct mlx5hws_flow_op_result comp[MLX5HWS_BWC_MATCHER_REHASH_BURST_TH];
 	u16 burst_th = hws_bwc_get_burst_th(ctx, queue_id);
 	bool got_comp = *pending_rules >= burst_th;
Signature · 1 line
2.48.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Thorsten Blum

Use secs_to_jiffies() and simplify the code.

nit: this is a cleanup which should have the net-next prefix applied, since this doesn't fix any user visible behavior.

Otherwise, seems like an ok change.

Quoted 9 lines
---
 drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c +0 -0
index 3dbd4efa21a2..19dce1ba512d 100644

drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c static int hws_bwc_queue_poll(struct mlx5hws_context *ctx, · line 224

Quoted 6 lines
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c +1 -1
@@ -220,7 +220,7 @@ static int hws_bwc_queue_poll(struct mlx5hws_context *ctx,
 			      bool drain)
 {
 	unsigned long timeout = jiffies +
-				msecs_to_jiffies(MLX5HWS_BWC_POLLING_TIMEOUT * MSEC_PER_SEC);
+				secs_to_jiffies(MLX5HWS_BWC_POLLING_TIMEOUT);
 	struct mlx5hws_flow_op_result comp[MLX5HWS_BWC_MATCHER_REHASH_BURST_TH];

This looks like it violates RCT ordering now though.

Thanks,
Jake

Quoted 2 lines
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c +0 -0
 	u16 burst_th = hws_bwc_get_burst_th(ctx, queue_id);
 	bool got_comp = *pending_rules >= burst_th;
#2 lore raw
Quoted 11 lines · Jacob Keller
Quoted 3 lines · Thorsten Blum

Use secs_to_jiffies() and simplify the code.

nit: this is a cleanup which should have the net-next prefix applied, since this doesn't fix any user visible behavior.

Otherwise, seems like an ok change.

IMHO, completely useless change for old code. I can see a value in new secs_to_jiffies() function for new code, but not for old code. I want to believe that people who write kernel patches aware that 1000 msec equal to 1 sec.

Thanks

#3 lore raw
Quoted 9 lines · Leon Romanovsky
Quoted 8 lines · Jacob Keller
Quoted 3 lines · Thorsten Blum

Use secs_to_jiffies() and simplify the code.

nit: this is a cleanup which should have the net-next prefix applied, since this doesn't fix any user visible behavior.

Quoted 6 lines
Quoted 1 line

Otherwise, seems like an ok change.

IMHO, completely useless change for old code. I can see a value in new secs_to_jiffies() function for new code, but not for old code. I want to believe that people who write kernel patches aware that 1000 msec equal to 1 sec.

Using secs_to_jiffies() is shorter and requires less cognitive load to read imo. Plus, it now fits within the preferred 80 columns limit.

This "old code" was added in d74ee6e197a2c ("net/mlx5: HWS, set timeout on polling for completion") in January 2025.

Thanks,
Thorsten

#4 lore raw
Quoted 12 lines · Thorsten Blum
Quoted 11 lines · Leon Romanovsky
Quoted 9 lines · Jacob Keller
Quoted 3 lines · Thorsten Blum

Use secs_to_jiffies() and simplify the code.

nit: this is a cleanup which should have the net-next prefix applied, since this doesn't fix any user visible behavior.

Otherwise, seems like an ok change.

Quoted 7 lines
Quoted 4 lines

IMHO, completely useless change for old code. I can see a value in new secs_to_jiffies() function for new code, but not for old code. I want to believe that people who write kernel patches aware that 1000 msec equal to 1 sec.

Using secs_to_jiffies() is shorter and requires less cognitive load to read imo. Plus, it now fits within the preferred 80 columns limit.

Unfortunately, I see this change as a churn and not an improvement.

Quoted 3 lines

This "old code" was added in d74ee6e197a2c ("net/mlx5: HWS, set timeout on polling for completion") in January 2025.

I got same conversion patches for RDMA.
https://lore.kernel.org/all/20250219-rdma-secs-to-jiffies-v1-0-b506746561a9@linux.microsoft.com

Thanks

Quoted 4 lines

Thanks,
Thorsten

Reviewed-by
#5 lore raw
Quoted 18 lines · Leon Romanovsky
Quoted 17 lines · Thorsten Blum
Quoted 15 lines · Leon Romanovsky
Quoted 9 lines · Jacob Keller
Quoted 3 lines · Thorsten Blum

Use secs_to_jiffies() and simplify the code.

nit: this is a cleanup which should have the net-next prefix applied, since this doesn't fix any user visible behavior.

Otherwise, seems like an ok change.

IMHO, completely useless change for old code. I can see a value in new secs_to_jiffies() function for new code, but not for old code. I want to believe that people who write kernel patches aware that 1000 msec equal to 1 sec.

Quoted 4 lines
Quoted 2 lines

Using secs_to_jiffies() is shorter and requires less cognitive load to read imo. Plus, it now fits within the preferred 80 columns limit.

Unfortunately, I see this change as a churn and not an improvement.

All patches with any justified improvement are welcome, as long as they are not automated or bot generated spam.

This patch is reasonable, you need to add [PATCH net-next] prefix in the title for this patch to get into the pipeline.

Feel free to add:

Quoted 15 lines
Quoted 4 lines

This "old code" was added in d74ee6e197a2c ("net/mlx5: HWS, set timeout on polling for completion") in January 2025.

I got same conversion patches for RDMA.
https://lore.kernel.org/all/20250219-rdma-secs-to-jiffies-v1-0-b506746561a9@linux.microsoft.com

Thanks

Quoted 4 lines

Thanks,
Thorsten