linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Max Filippov <jcmvbkbc@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: linux-next@vger.kernel.org, netdev@vger.kernel.org,
	Jianbo Liu <jianbol@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Ariel Levkovich <lariel@nvidia.com>, Roi Dayan <roid@nvidia.com>,
	Leon Romanovsky <leon@kernel.org>,
	Max Filippov <jcmvbkbc@gmail.com>
Subject: [PATCH] net/mlx5e: use div64_u64 for long division
Date: Tue,  5 Jul 2022 12:50:25 -0700	[thread overview]
Message-ID: <20220705195025.3348953-1-jcmvbkbc@gmail.com> (raw)

This fixes the following build error on 32-bit architectures visible in
linux-next:

  ERROR: modpost: "__divdi3" [drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko] undefined!
  ERROR: modpost: "__udivdi3" [drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko] undefined!

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

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..81e7fe819017 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 <asm/div64.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);
-- 
2.30.2


             reply	other threads:[~2022-07-05 19:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-05 19:50 Max Filippov [this message]
2022-07-05 21:44 ` [PATCH] net/mlx5e: use div64_u64 for long division Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220705195025.3348953-1-jcmvbkbc@gmail.com \
    --to=jcmvbkbc@gmail.com \
    --cc=jianbol@nvidia.com \
    --cc=lariel@nvidia.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=roid@nvidia.com \
    --cc=saeedm@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).