Skip to contentSkip to conversation

net/mlx5: Fix compilation warning for 32-bit platform

PATCH In review Leon Romanovsky 3 participants 6 messages Dec 13, 2020 – Dec 17, 2020

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

PATCH 1/1 net/mlx5: Fix compilation warning for 32-bit platform

From: Parav Pandit <[email protected]>

MLX5_GENERAL_OBJECT_TYPES types bitfield is 64-bit field.

Defining an enum for such bit fields on 32-bit platform results in below warning.

./include/vdso/bits.h:7:26: warning: left shift count >= width of type [-Wshift-count-overflow]

                         ^
./include/linux/mlx5/mlx5_ifc.h:10716:46: note: in expansion of macro ‘BIT’
 MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_SAMPLER = BIT(0x20),
                                             ^~~

Use 32-bit friendly BIT_ULL macro.

Fixes 2a2970891647 ("net/mlx5: Add sample offload hardware bits and structures")
---
 include/linux/mlx5/mlx5_ifc.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/linux/mlx5/mlx5_ifc.h +3 -3
index 2006795fd522..8a359b8bee52 100644
@@ -10709,9 +10709,9 @@ struct mlx5_ifc_affiliated_event_header_bits {
 };
 
 enum {
-	MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_ENCRYPTION_KEY = BIT(0xc),
-	MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_IPSEC = BIT(0x13),
-	MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_SAMPLER = BIT(0x20),
+	MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_ENCRYPTION_KEY = BIT_ULL(0xc),
+	MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_IPSEC = BIT_ULL(0x13),
+	MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_SAMPLER = BIT_ULL(0x20),
 };
 
 enum {

--
2.29.2

#1 lore raw
Quoted 28 lines · Leon Romanovsky

From: Parav Pandit <[email protected]>

MLX5_GENERAL_OBJECT_TYPES types bitfield is 64-bit field.

Defining an enum for such bit fields on 32-bit platform results in below warning.

./include/vdso/bits.h:7:26: warning: left shift count >= width of type [-Wshift-count-overflow]

                         ^
./include/linux/mlx5/mlx5_ifc.h:10716:46: note: in expansion of macro ‘BIT’
 MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_SAMPLER = BIT(0x20),
                                             ^~~

Use 32-bit friendly BIT_ULL macro.

Fixes 2a2970891647 ("net/mlx5: Add sample offload hardware bits and structures")
---
 include/linux/mlx5/mlx5_ifc.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/linux/mlx5/mlx5_ifc.h +0 -0
index 2006795fd522..8a359b8bee52 100644

include/linux/mlx5/mlx5_ifc.h struct mlx5_ifc_affiliated_event_header_bits { · line 10714

Quoted 9 lines
include/linux/mlx5/mlx5_ifc.h +3 -3
@@ -10709,9 +10709,9 @@ struct mlx5_ifc_affiliated_event_header_bits {
 };
 
 enum {
-	MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_ENCRYPTION_KEY = BIT(0xc),
-	MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_IPSEC = BIT(0x13),
-	MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_SAMPLER = BIT(0x20),
+	MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_ENCRYPTION_KEY = BIT_ULL(0xc),
+	MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_IPSEC = BIT_ULL(0x13),
+	MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_SAMPLER = BIT_ULL(0x20),

Or even better is to use "1ULL << 0x20" directly because we are not including bits.h in this mlx5_ifc.h file.

Should I resend?

Thanks

Quoted 6 lines
include/linux/mlx5/mlx5_ifc.h +0 -1
 };
 
 enum {
--

2.29.2

#2 lore raw
Quoted 49 lines · Leon Romanovsky
Quoted 34 lines · Leon Romanovsky

From: Parav Pandit <[email protected]>

MLX5_GENERAL_OBJECT_TYPES types bitfield is 64-bit field.

Defining an enum for such bit fields on 32-bit platform results in below
warning.

./include/vdso/bits.h:7:26: warning: left shift count >= width of type [-Wshift-count-overflow]

                         ^
./include/linux/mlx5/mlx5_ifc.h:10716:46: note: in expansion of
macro ‘BIT’
 MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_SAMPLER = BIT(0x20),
                                             ^~~

Use 32-bit friendly BIT_ULL macro.

Fixes 2a2970891647 ("net/mlx5: Add sample offload hardware bits

and structures")

---
 include/linux/mlx5/mlx5_ifc.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/linux/mlx5/mlx5_ifc.h +0 -0
index 2006795fd522..8a359b8bee52 100644
@@ -10709,9 +10709,9 @@ struct
 mlx5_ifc_affiliated_event_header_bits {

include/linux/mlx5/mlx5_ifc.h struct · line 10716

Quoted 10 lines
include/linux/mlx5/mlx5_ifc.h +3 -3
 };
 
 enum {
-	MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_ENCRYPTION_KEY = BIT(0xc),
-	MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_IPSEC = BIT(0x13),
-	MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_SAMPLER = BIT(0x20),
+	MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_ENCRYPTION_KEY =
 BIT_ULL(0xc),
+	MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_IPSEC = BIT_ULL(0x13),
+	MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_SAMPLER = BIT_ULL(0x20),

Or even better is to use "1ULL << 0x20" directly because we are not including bits.h in this mlx5_ifc.h file.

Quoted 3 lines

Should I resend?

Thanks

I will change this and attach this patch to my PR of the SF support.

Thanks,
Saeed.

maintainer
#3 lore raw
Quoted 1 line · On Mon, 14 Dec 2020 12:08:46 -0800 Saeed Mahameed wrote:

I will change this and attach this patch to my PR of the SF support.

Looks like the SF discussion will not wind down in time to make this merge window, so I think I'm going to take this in after all. Okay?

maintainer
#4 lore raw
Quoted 5 lines · On Wed, 16 Dec 2020 16:14:45 -0800 Jakub Kicinski wrote:
Quoted 1 line · On Mon, 14 Dec 2020 12:08:46 -0800 Saeed Mahameed wrote:

I will change this and attach this patch to my PR of the SF support.

Looks like the SF discussion will not wind down in time to make this merge window, so I think I'm going to take this in after all. Okay?

Done.

#5 lore raw
Quoted 10 lines · Jakub Kicinski
Quoted 7 lines · On Wed, 16 Dec 2020 16:14:45 -0800 Jakub Kicinski wrote:
Quoted 2 lines · On Mon, 14 Dec 2020 12:08:46 -0800 Saeed Mahameed wrote:

I will change this and attach this patch to my PR of the SF support.

Looks like the SF discussion will not wind down in time to make this
merge window, so I think I'm going to take this in after all. Okay?

Done.

Thanks Jakub for your hard work and support!