diff mbox series

[net-next] net/mlx5: fix 32bit build

Message ID ecb00ddd1197b4f8a4882090206bd2eee1eb8b5b.1657005206.git.pabeni@redhat.com (mailing list archive)
State Accepted
Commit 55ae465222d0296e81f707c2b9447e715b59b9ac
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net/mlx5: fix 32bit build | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 5 this patch: 0
netdev/cc_maintainers warning 1 maintainers not CCed: linux-rdma@vger.kernel.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Paolo Abeni July 5, 2022, 7:17 a.m. UTC
We can't use the division operator on 64 bits integers, that breaks
32 bits build. Instead use the relevant helper.

Fixes: 6ddac26cf763 ("net/mlx5e: Add support to modify hardware flow meter parameters")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en/tc/meter.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Saeed Mahameed July 5, 2022, 7:39 a.m. UTC | #1
On 05 Jul 09:17, Paolo Abeni wrote:
>We can't use the division operator on 64 bits integers, that breaks
>32 bits build. Instead use the relevant helper.
>
>Fixes: 6ddac26cf763 ("net/mlx5e: Add support to modify hardware flow meter parameters")
>Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Acked-by: Saeed Mahameed <saeedm@nvidia.com>

sorry for the mess. I sent v2 too soon, forgot to squash the 2nd fix to it.
Paolo Abeni July 5, 2022, 7:57 a.m. UTC | #2
On Tue, 2022-07-05 at 00:39 -0700, Saeed Mahameed wrote:
> On 05 Jul 09:17, Paolo Abeni wrote:
> > We can't use the division operator on 64 bits integers, that breaks
> > 32 bits build. Instead use the relevant helper.
> > 
> > Fixes: 6ddac26cf763 ("net/mlx5e: Add support to modify hardware flow meter parameters")
> > Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> 
> Acked-by: Saeed Mahameed <saeedm@nvidia.com>
> 
> sorry for the mess. I sent v2 too soon, forgot to squash the 2nd fix to it.

No problems, it happens. 

Unless someone raises some concerns soon, I'm going to merge this one
well before the usual 24h staging time, to keep PW and the tree okish.

Cheers,

Paolo
patchwork-bot+netdevbpf@kernel.org July 5, 2022, 10:20 a.m. UTC | #3
Hello:

This patch was applied to netdev/net-next.git (master)
by Paolo Abeni <pabeni@redhat.com>:

On Tue,  5 Jul 2022 09:17:04 +0200 you wrote:
> We can't use the division operator on 64 bits integers, that breaks
> 32 bits build. Instead use the relevant helper.
> 
> Fixes: 6ddac26cf763 ("net/mlx5e: Add support to modify hardware flow meter parameters")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/en/tc/meter.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Here is the summary with links:
  - [net-next] net/mlx5: fix 32bit build
    https://git.kernel.org/netdev/net-next/c/55ae465222d0

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/meter.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/meter.c
index 28962b2134c7..ca33f673396f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/meter.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/meter.c
@@ -1,6 +1,7 @@ 
 // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
 // Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 
+#include <linux/math64.h>
 #include "lib/aso.h"
 #include "en/tc/post_act.h"
 #include "meter.h"
@@ -61,7 +62,7 @@  mlx5e_flow_meter_cir_calc(u64 cir, u8 *man, u8 *exp)
 		m = cir << e;
 		if ((s64)m < 0) /* overflow */
 			break;
-		m /= MLX5_CONST_CIR;
+		m = div64_u64(m, MLX5_CONST_CIR);
 		if (m > 0xFF) /* man width 8 bit */
 			continue;
 		_cir = MLX5_CALC_CIR(m, e);