ethdev: fix VXLAN mask initialization value
PATCH 1/1 ethdev: fix VXLAN mask initialization value
In GCC compiler, __builtin_constant_p(exp) is a function. The function returns the integer 1 if the argument is known to be a compile-time constant.
Therefore, __builtin_constant_p(0xffffff << 8) returned 1. As the result, rte_flow_item_vxlan_mask was initiated to {{
{flags = 0x0, rsvd0 = {0x0, 0x0, 0x0},
vni = {0x0, 0x0, 0x0}, rsvd1 = 0x1},
hdr = {vx_flags = 0x0, vx_vni = 0x1000000}}}
}}
GCC fails initialization rte_flow_item_vxlan_mask.hdr.vni = (0xffffff << 8)
with "initializer element is not a constant expression" error. Use immediate 0xffffff00 value instead.
--- lib/librte_ethdev/rte_flow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_ethdev/rte_flow.h +1 -1
@@ -976,7 +976,7 @@ struct rte_flow_item_vxlan {/** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN. */ #ifndef __cplusplusstatic const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = { - .hdr.vx_vni =RTE_BE32 (__builtin_constant_p (0xffffff <<8 )), + .hdr.vx_vni =RTE_BE32 (0xffffff00 ),/* (0xffffff << 8) */ };#endif
Signature · 1 line
2.25.1
Quoted 15 lines · Gregory Etelson
In GCC compiler,
__builtin_constant_p(exp)is a function. The function returns the integer 1 if the argument is known to be a compile-time constant.
Therefore,__builtin_constant_p(0xffffff << 8)returned 1. As the result,rte_flow_item_vxlan_maskwas initiated to{{ {flags = 0x0, rsvd0 = {0x0, 0x0, 0x0}, vni = {0x0, 0x0, 0x0}, rsvd1 = 0x1}, hdr = {vx_flags = 0x0, vx_vni = 0x1000000}}} }}GCC fails initialization rte_flow_item_vxlan_mask.hdr.vni = (
0xffffff<< 8) with "initializer element is not a constant expression" error. Use immediate0xffffff00value instead.
Quoted 5 lines
Fixes 43af98e687cf ("ethdev: reuse VXLAN header definition in flow item")Signed-off-by Gregory Etelson <[email protected]>
Ivan Malov
Reviewed-byQuoted 15 lines · Gregory Etelson
In GCC compiler,
__builtin_constant_p(exp)is a function. The function returns the integer 1 if the argument is known to be a compile-time constant.
Therefore,__builtin_constant_p(0xffffff << 8)returned 1. As the result,rte_flow_item_vxlan_maskwas initiated to{{ {flags = 0x0, rsvd0 = {0x0, 0x0, 0x0}, vni = {0x0, 0x0, 0x0}, rsvd1 = 0x1}, hdr = {vx_flags = 0x0, vx_vni = 0x1000000}}} }}GCC fails initialization rte_flow_item_vxlan_mask.hdr.vni = (
0xffffff<< 8) with "initializer element is not a constant expression" error. Use immediate0xffffff00value instead.
Quoted 5 lines
Fixes 43af98e687cf ("ethdev: reuse VXLAN header definition in flow item")Signed-off-by Gregory Etelson <[email protected]>
Signature · 1 line
Ivan M
Ferruh Yigit
AppliedQuoted 16 lines · Ivan Malov
Quoted 15 lines · Gregory Etelson
In GCC compiler,
__builtin_constant_p(exp)is a function. The function returns the integer 1 if the argument is known to be a compile-time constant.
Therefore,__builtin_constant_p(0xffffff << 8)returned 1. As the result,rte_flow_item_vxlan_maskwas initiated to {{
{flags =0x0, rsvd0 = {0x0,0x0,0x0},
vni = {0x0,0x0,0x0}, rsvd1 =0x1},
hdr = {vx_flags=0x0,vx_vni=0x1000000}}}
}}
GCC fails initialization rte_flow_item_vxlan_mask.hdr.vni = (0xffffff<< 8)
with "initializer element is not a constant expression" error. Use immediate0xffffff00value instead.
Quoted 9 lines
Quoted 2 lines
Fixes 43af98e687cf ("ethdev: reuse VXLAN header definition in flowitem")
Quoted 3 lines
Signed-off-by Gregory Etelson <[email protected]>Reviewed-by Ivan Malov <[email protected]>
Applied to dpdk-next-net/main, thanks.