ethdev: fix VXLAN mask initialization
authorGregory Etelson <getelson@nvidia.com>
Thu, 8 Apr 2021 06:48:22 +0000 (09:48 +0300)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 9 Apr 2021 09:27:40 +0000 (11:27 +0200)
commitf8e7132572ac49968e5ecf72c70402e4aad63564
tree83f82e1542537044710b9b3d37b6050508138c50
parent74299cc7591192cbc72e8f411dff0c7f3cfdf309
ethdev: fix VXLAN mask initialization

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.

Fixes: 43af98e687cf ("ethdev: reuse VXLAN header definition in flow item")

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
lib/librte_ethdev/rte_flow.h