net/cxgbe: fix build with clang 3.4.2
PATCH 1/1 net/cxgbe: fix build with clang 3.4.2
Build error:.../drivers/net/cxgbe/cxgbe_flow.c:315:2:
error: implicit truncation from 'int' to bitfield changes value from -1 to 7 [-Werror,-Wbitfield-constant-conversion]
CXGBE_FILL_FS(adap->pf, ~0, pf); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.../drivers/net/cxgbe/cxgbe_flow.c:25:2:
note: expanded from macro 'CXGBE_FILL_FS'
__CXGBE_FILL_FS(v, m, fs, elem, e)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../drivers/net/cxgbe/cxgbe_flow.c:15:18: note:
expanded from macro '__CXGBE_FILL_FS'
(fs)->mask.elem = (__m); \
^ ~~~~~Commit in fixes line changes 'PF_BITWIDTH' to '3', which makes 'fs->pf' bitfield size '3', changing '~0' to '0x7' to prevent truncation in assignment.
---
Cc: [email protected]
--- drivers/net/cxgbe/cxgbe_flow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/cxgbe/cxgbe_flow.c +1 -1
@@ -312,7 +312,7 @@ ch_rte_parsetype_pf(const void *dmask __rte_unused,CXGBE_FILL_FS (1 ,1 , pfvf_vld); -CXGBE_FILL_FS (adap->pf, ~0 , pf); +CXGBE_FILL_FS (adap->pf,0x7 , pf);return 0 ; }
Signature · 1 line
2.25.1
Quoted 18 lines · Ferruh Yigit
Build error:
.../drivers/net/cxgbe/cxgbe_flow.c:315:2:
error: implicit truncation from 'int' to bitfield changes value from -1 to 7 [-Werror,-Wbitfield-constant-conversion]
CXGBE_FILL_FS(adap->pf, ~0, pf); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.../drivers/net/cxgbe/cxgbe_flow.c:25:2:note: expanded from macro 'CXGBE_FILL_FS' __CXGBE_FILL_FS(v, m, fs, elem, e) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .../drivers/net/cxgbe/cxgbe_flow.c:15:18: note: expanded from macro '__CXGBE_FILL_FS' (fs)->mask.elem = (__m); \ ^ ~~~~~Commit in fixes line changes '
PF_BITWIDTH' to '3', which makes 'fs->pf' bitfield size '3', changing '~0' to '0x7' to prevent truncation in assignment.
Quoted 5 lines
Fixes dcd456abe46f ("net/cxgbe: support flow API for matching all packets on PF")Reported-by Raslan Darawsheh <[email protected]>Reported-by Xueming Zhang <[email protected]>Signed-off-by Ferruh Yigit <[email protected]>
Hi Raslan, Xueming,
Can you please confirm the above patch on top of next-net fixes the build issue?
Thanks,
ferruh
Many thanks Ferruh.
In dpdk-next-net and dpdk-next-net-intel, the patch verified.
Quoted 45 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, March 18, 2020 9:10 PM
To: Raslan Darawsheh <[email protected]>; Zhang, XuemingX <[email protected]>
Cc: Rahul Lakkireddy <[email protected]>; Karra Satwik <[email protected]>; [email protected]
Subject: Re: [PATCH] net/cxgbe: fix build with clang 3.4.2Quoted 3 lines · Ferruh Yigit
Build error:
.../drivers/net/cxgbe/cxgbe_flow.c:315:2:
error: implicit truncation from 'int' to bitfield changesvalue
Quoted 11 lines
from -1 to 7 [-Werror,-Wbitfield-constant-conversion] CXGBE_FILL_FS(adap->pf, ~0, pf); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .../drivers/net/cxgbe/cxgbe_flow.c:25:2: note: expanded from macro 'CXGBE_FILL_FS' __CXGBE_FILL_FS(v, m, fs, elem, e) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .../drivers/net/cxgbe/cxgbe_flow.c:15:18: note: expanded from macro '__CXGBE_FILL_FS' (fs)->mask.elem = (__m); \ ^ ~~~~~Quoted 1 line
Commit in fixes line changes '
PF_BITWIDTH' to '3', which makes'
fs->pf'Quoted 9 lines
bitfield size '3', changing '~0' to '
0x7' to prevent truncation in assignment.Fixes dcd456abe46f ("net/cxgbe: support flow API for matching allpackets on PF")
Reported-by Raslan Darawsheh <[email protected]>Reported-by Xueming Zhang <[email protected]>Signed-off-by Ferruh Yigit <[email protected]>Hi Raslan, Xueming,
Can you please confirm the above patch on top of next-net fixes the build issue?
Thanks,
ferruh
Quoted 18 lines · Ferruh Yigit
Build error:
.../drivers/net/cxgbe/cxgbe_flow.c:315:2:
error: implicit truncation from 'int' to bitfield changes value from -1 to 7 [-Werror,-Wbitfield-constant-conversion]
CXGBE_FILL_FS(adap->pf, ~0, pf); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.../drivers/net/cxgbe/cxgbe_flow.c:25:2:note: expanded from macro 'CXGBE_FILL_FS' __CXGBE_FILL_FS(v, m, fs, elem, e) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .../drivers/net/cxgbe/cxgbe_flow.c:15:18: note: expanded from macro '__CXGBE_FILL_FS' (fs)->mask.elem = (__m); \ ^ ~~~~~Commit in fixes line changes '
PF_BITWIDTH' to '3', which makes 'fs->pf' bitfield size '3', changing '~0' to '0x7' to prevent truncation in assignment.
Quoted 5 lines
Fixes dcd456abe46f ("net/cxgbe: support flow API for matching all packets on PF")Reported-by Raslan Darawsheh <[email protected]>Reported-by Xueming Zhang <[email protected]>Signed-off-by Ferruh Yigit <[email protected]>
I've tested CLANG compilation with 9.0.1 without this patch, but couldn't hit the above mentioned error.
# clang --version clang version 9.0.1 (Fedora 9.0.1-2.fc31)
However, after grabbing CLANG 3.4.2, I could see the error.
# clang --version clang version 3.4.2 (tags/RELEASE_34/dot2-final)
This patch fixes it and the fix is correct too.
Thanks for fixing it.
Quoted 22 lines
---
Cc: [email protected]--- drivers/net/cxgbe/cxgbe_flow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/cxgbe/cxgbe_flow.c +1
-1@@ -312,7 +312,7 @@ ch_rte_parsetype_pf(const void *dmask __rte_unused,CXGBE_FILL_FS (1 ,1 , pfvf_vld); -CXGBE_FILL_FS (adap->pf, ~0 , pf); +CXGBE_FILL_FS (adap->pf,0x7 , pf);return 0 ; }Signature · 1 line
2.25.1
Raslan Darawsheh
Tested-byHi,
Quoted 41 lines
-----Original Message-----
From: Rahul Lakkireddy <[email protected]>
Sent: Wednesday, March 18, 2020 3:48 PM
To: Ferruh Yigit <[email protected]>
Cc: Karra Satwik <[email protected]>; [email protected]; Raslan Darawsheh <[email protected]>; Xueming Zhang <[email protected]>
Subject: Re: [PATCH] net/cxgbe: fix build with clang 3.4.2Quoted 14 lines · Ferruh Yigit
Build error:
.../drivers/net/cxgbe/cxgbe_flow.c:315:2:
error: implicit truncation from 'int' to bitfield changes value from -1 to 7 [-Werror,-Wbitfield-constant-conversion]
CXGBE_FILL_FS(adap->pf, ~0, pf); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.../drivers/net/cxgbe/cxgbe_flow.c:25:2:note: expanded from macro 'CXGBE_FILL_FS' __CXGBE_FILL_FS(v, m, fs, elem, e) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .../drivers/net/cxgbe/cxgbe_flow.c:15:18: note: expanded from macro '__CXGBE_FILL_FS' (fs)->mask.elem = (__m); \ ^ ~~~~~Quoted 5 lines
Commit in fixes line changes '
PF_BITWIDTH' to '3', which makes 'fs->pf' bitfield size '3', changing '~0' to '0x7' to prevent truncation in assignment.Fixes dcd456abe46f ("net/cxgbe: support flow API for matching all packetson PF")
Quoted 4 lines
Reported-by Raslan Darawsheh <[email protected]>Reported-by Xueming Zhang <[email protected]>Signed-off-by Ferruh Yigit <[email protected]>I've tested CLANG compilation with 9.0.1 without this patch, but couldn't hit the above mentioned error.
# clang --version clang version 9.0.1 (Fedora 9.0.1-2.fc31)
Quoted 9 lines
However, after grabbing CLANG 3.4.2, I could see the error.
# clang --version clang version 3.4.2 (tags/RELEASE_34/dot2-final)This patch fixes it and the fix is correct too.
Thanks for fixing it.
Working just fine for me as well, thanks for the update
Quoted 26 lines
Acked-by Rahul Lakkireddy <[email protected]>Review
Quoted 7 lines
---
Cc: [email protected]--- drivers/net/cxgbe/cxgbe_flow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/net/cxgbe/cxgbe_flow.cdrivers/net/cxgbe/cxgbe_flow.c ch_rte_parsetype_pf(const void *dmask
Quoted 4 lines
index
13fd78aaf..a46515d3b100644drivers/net/cxgbe/cxgbe_flow.c +0
-0@@ -312,7 +312,7 @@ ch_rte_parsetype_pf(const void *dmask
__rte_unused,Quoted 11 lines
drivers/net/cxgbe/cxgbe_flow.c +1
-2CXGBE_FILL_FS (1 ,1 , pfvf_vld); -CXGBE_FILL_FS (adap->pf, ~0 , pf); +CXGBE_FILL_FS (adap->pf,0x7 , pf);return 0 ; } --2.25.1
Quoted 33 lines · Rahul Lakkireddy
Quoted 18 lines · Ferruh Yigit
Build error:
.../drivers/net/cxgbe/cxgbe_flow.c:315:2:
error: implicit truncation from 'int' to bitfield changes value from -1 to 7 [-Werror,-Wbitfield-constant-conversion]
CXGBE_FILL_FS(adap->pf, ~0, pf); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.../drivers/net/cxgbe/cxgbe_flow.c:25:2:note: expanded from macro 'CXGBE_FILL_FS' __CXGBE_FILL_FS(v, m, fs, elem, e) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .../drivers/net/cxgbe/cxgbe_flow.c:15:18: note: expanded from macro '__CXGBE_FILL_FS' (fs)->mask.elem = (__m); \ ^ ~~~~~Commit in fixes line changes '
PF_BITWIDTH' to '3', which makes 'fs->pf' bitfield size '3', changing '~0' to '0x7' to prevent truncation in assignment.Quoted 5 lines
Fixes dcd456abe46f ("net/cxgbe: support flow API for matching all packets on PF")Reported-by Raslan Darawsheh <[email protected]>Reported-by Xueming Zhang <[email protected]>Signed-off-by Ferruh Yigit <[email protected]>I've tested CLANG compilation with 9.0.1 without this patch, but couldn't hit the above mentioned error.
# clang --version clang version 9.0.1 (Fedora 9.0.1-2.fc31)However, after grabbing CLANG 3.4.2, I could see the error.
Quoted 8 lines
# clang --version clang version 3.4.2 (tags/RELEASE_34/dot2-final)This patch fixes it and the fix is correct too.
Thanks for fixing it.
Acked-by Rahul Lakkireddy <[email protected]>
Squashed into relevant commit in next-net, thanks.