Skip to contentSkip to conversation

drivers/net: fix unresolved 64bit math in mellanox/mlx4/en_dcb_nl.c

PATCH Superseded Paul Gortmaker 2 participants 4 messages Apr 16, 2012

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

PATCH 1/1 drivers/net: fix unresolved 64bit math in mellanox/mlx4/en_dcb_nl.c

Commit 109d2446052a484c58f07f71f9457bf7b71017f8

"net/mlx4_en: Set max rate-limit for a TC"

introduced 64 bit math operations into mlx4_en_dcbnl_ieee_setmaxrate()

causing the following final link failure on an x86_32 allmodconfig

ERROR: "__udivdi3" [drivers/net/ethernet/mellanox/mlx4/mlx4_en.ko] undefined!

Convert it to use div_u64() instead.

Cc Amir Vadai <[email protected]>
Cc David S. Miller <[email protected]>

---

[seen in linux-next: http://kisskb.ellerman.id.au/kisskb/buildresult/6091475/]

drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c +3 -3
index 0cc6c96..720cb55 100644
@@ -227,9 +227,9 @@ static int mlx4_en_dcbnl_ieee_setmaxrate(struct net_device *dev,
 		/* Convert from Kbps into HW units, rounding result up.
 		 * Setting to 0, means unlimited BW.
 		 */
-		tmp[i] =
-			(maxrate->tc_maxrate[i] + MLX4_RATELIMIT_UNITS_IN_KB -
-			 1) / MLX4_RATELIMIT_UNITS_IN_KB;
+		tmp[i] = div_u64(maxrate->tc_maxrate[i] +
+				 MLX4_RATELIMIT_UNITS_IN_KB - 1,
+				 MLX4_RATELIMIT_UNITS_IN_KB);
 	}
 
 	err = mlx4_en_config_port_scheduler(priv, NULL, tmp);
Signature · 1 line
1.7.9.1
maintainer
#1 lore raw

From: Paul Gortmaker <[email protected]>
Date: Sun, 15 Apr 2012 23:09:54 -0400

Quoted 8 lines

Commit 109d2446052a484c58f07f71f9457bf7b71017f8

"net/mlx4_en: Set max rate-limit for a TC"

introduced 64 bit math operations into mlx4_en_dcbnl_ieee_setmaxrate()

causing the following final link failure on an x86_32 allmodconfig

Quoted 7 lines

ERROR: "__udivdi3" [drivers/net/ethernet/mellanox/mlx4/mlx4_en.ko] undefined!

Convert it to use div_u64() instead.

Cc Amir Vadai <[email protected]>
Cc David S. Miller <[email protected]>

Please add an explicit linux/math64.h include here too, thanks.

#2 lore raw

PATCH v2 1/1 drivers/net: fix unresolved 64bit math in mellanox/mlx4/en_dcb_nl.c

Commit 109d2446052a484c58f07f71f9457bf7b71017f8

"net/mlx4_en: Set max rate-limit for a TC"

introduced 64 bit math operations into mlx4_en_dcbnl_ieee_setmaxrate()

causing the following final link failure on an x86_32 allmodconfig

ERROR: "__udivdi3" [drivers/net/ethernet/mellanox/mlx4/mlx4_en.ko] undefined!

Convert it to use div_u64() instead.

Cc Amir Vadai <[email protected]>
Cc David S. Miller <[email protected]>

---

[ v2: add an explicit linux/math64.h include as per davem req ]

drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c +4 -3
index 0cc6c96..5d367958 100644
@@ -32,6 +32,7 @@
  */
 
 #include <linux/dcbnl.h>
+#include <linux/math64.h>
 
 #include "mlx4_en.h"
 
@@ -227,9 +228,9 @@ static int mlx4_en_dcbnl_ieee_setmaxrate(struct net_device *dev,
 		/* Convert from Kbps into HW units, rounding result up.
 		 * Setting to 0, means unlimited BW.
 		 */
-		tmp[i] =
-			(maxrate->tc_maxrate[i] + MLX4_RATELIMIT_UNITS_IN_KB -
-			 1) / MLX4_RATELIMIT_UNITS_IN_KB;
+		tmp[i] = div_u64(maxrate->tc_maxrate[i] +
+				 MLX4_RATELIMIT_UNITS_IN_KB - 1,
+				 MLX4_RATELIMIT_UNITS_IN_KB);
 	}
 
 	err = mlx4_en_config_port_scheduler(priv, NULL, tmp);
Signature · 1 line
1.7.9.1
maintainer Applied
#3 lore raw

From: Paul Gortmaker <[email protected]>
Date: Mon, 16 Apr 2012 00:17:34 -0400

Quoted 8 lines

Commit 109d2446052a484c58f07f71f9457bf7b71017f8

"net/mlx4_en: Set max rate-limit for a TC"

introduced 64 bit math operations into mlx4_en_dcbnl_ieee_setmaxrate()

causing the following final link failure on an x86_32 allmodconfig

Quoted 7 lines

ERROR: "__udivdi3" [drivers/net/ethernet/mellanox/mlx4/mlx4_en.ko] undefined!

Convert it to use div_u64() instead.

Cc Amir Vadai <[email protected]>
Cc David S. Miller <[email protected]>

Applied, thanks Paul.