net/mlx5: Fix compilation warning for 32-bit platform
Subsystems (4)
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.
--- include/linux/mlx5/mlx5_ifc.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
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 ), };enum {
--
2.29.2
Quoted 28 lines · Leon Romanovsky
From: Parav Pandit <[email protected]>
MLX5_GENERAL_OBJECT_TYPEStypes 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_ULLmacro.Fixes 2a2970891647 ("net/mlx5: Add sample offload hardware bits and structures")Signed-off-by Parav Pandit <[email protected]>Reported-by Stephen Rothwell <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>--- include/linux/mlx5/mlx5_ifc.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)include/linux/mlx5/mlx5_ifc.h +0
-0
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
Quoted 49 lines · Leon Romanovsky
Quoted 34 lines · Leon Romanovsky
From: Parav Pandit <[email protected]>
MLX5_GENERAL_OBJECT_TYPEStypes 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_ULLmacro.Fixes 2a2970891647 ("net/mlx5: Add sample offload hardware bitsand structures")
Signed-off-by Parav Pandit <[email protected]>Reported-by Stephen Rothwell <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>--- include/linux/mlx5/mlx5_ifc.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)include/linux/mlx5/mlx5_ifc.h +0
-0@@ -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 includingbits.hin thismlx5_ifc.hfile.
Quoted 3 lines
Should I resend?
Thanks
I will change this and attach this patch to my PR of the SF support.
Thanks,
Saeed.
Jakub Kicinski
maintainerQuoted 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?
Jakub Kicinski
maintainerQuoted 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.
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!