> -----Original Message-----
> From: dev <[email protected]> On Behalf Of Eli Britstein
> Sent: Wednesday, June 23, 2021 4:53 PM
> To: [email protected]; Ilya Maximets <[email protected]>
> Cc: Eli Britstein <[email protected]>; Ivan Malov <[email protected]>;
> Majd
> Dibbiny <[email protected]>
> Subject: [ovs-dev] [PATCH V7 13/13] netdev-dpdk-offload: Add vxlan pattern
> matching function.
>
> For VXLAN offload, matches should be done on outer header for tunnel
> properties as well as inner packet matches. Add a function for parsing
> VXLAN tunnel matches.
>
> Signed-off-by: Eli Britstein <[email protected]>
> Reviewed-by: Gaetan Rivet <[email protected]>
> Acked-by: Sriharsha Basavapatna <[email protected]>
> Tested-by: Emma Finn <[email protected]>
> Tested-by: Marko Kovacevic <[email protected]>
> Signed-off-by: Ilya Maximets <[email protected]>
> ---
> NEWS | 2 +
> lib/netdev-offload-dpdk.c | 155 +++++++++++++++++++++++++++++++++++++-
> 2 files changed, 156 insertions(+), 1 deletion(-)
>
> diff --git a/NEWS b/NEWS
> index 6f8e62f7f..10b3ab053 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -19,6 +19,8 @@ Post-v2.15.0
> * New debug appctl command 'dpdk/get-malloc-stats'.
> * Add hardware offload support for tunnel pop action (experimental).
> Available only if DPDK experimantal APIs enabled during the build.
> + * Add hardware offload support for VXLAN flows (experimental).
> + Available only if DPDK experimantal APIs enabled during the build.
> - ovsdb-tool:
> * New option '--election-timer' to the 'create-cluster' command to set
> the
> leader election timer during cluster creation.
> diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c
> index 6220394de..6bd5b6c9f 100644
> --- a/lib/netdev-offload-dpdk.c
> +++ b/lib/netdev-offload-dpdk.c
> @@ -372,6 +372,20 @@ dump_flow_pattern(struct ds *s,
> ipv6_mask->hdr.hop_limits);
> }
> ds_put_cstr(s, "/ ");
> + } else if (item->type == RTE_FLOW_ITEM_TYPE_VXLAN) {
> + const struct rte_flow_item_vxlan *vxlan_spec = item->spec;
> + const struct rte_flow_item_vxlan *vxlan_mask = item->mask;
> +
> + ds_put_cstr(s, "vxlan ");
> + if (vxlan_spec) {
> + if (!vxlan_mask) {
> + vxlan_mask = &rte_flow_item_vxlan_mask;
> + }
> + DUMP_PATTERN_ITEM(vxlan_mask->vni, "vni", "%"PRIu32,
> + ntohl(*(ovs_be32 *) vxlan_spec->vni) >> 8,
> + ntohl(*(ovs_be32 *) vxlan_mask->vni) >> 8);
> + }
> + ds_put_cstr(s, "/ ");
> } else {
> ds_put_format(s, "unknown rte flow pattern (%d)\n", item->type);
> }
> @@ -865,15 +879,154 @@ out:
> return ret;
> }
Hi All,
Is there a build failure in OVS master branch since this has been merged?
It seems the above casts (ovs_be32 *) are causing issues with increasing
alignment?
>From DPDK's struct rte_flow_item_vxlan, the vni is a "uint8_t vni[3];"
The VNI is not a 32-bit value, so is not required to be aligned on 32-bits. The
cast here
technically requires the alignment of the casted pointer to be 32-bit/4 byte,
which is
not guaranteed to be true. I think the compiler rightly flags a cast alignment
issue?
Casting through a (void *) might solve, or else using some of the BE/LE
conversion
and alignment helpers in byte-order.h and unaligned.h could perhaps work?
My testing as follows below. Regards, -Harry
Configure:
./configure CFLAGS="-O3 -g -msse4.2 -mpopcnt -Wall -Wextra" --with-dpdk=static
--enable-Werror
Compiler, from Ubuntu 21.04:
gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0
Build Failure:
lib/netdev-offload-dpdk.c: In function 'dump_flow_pattern':
lib/netdev-offload-dpdk.c:385:38: error: cast increases required alignment of
target type [-Werror=cast-align]
385 | ntohl(*(ovs_be32 *) vxlan_spec->vni) >> 8,
| ^
lib/netdev-offload-dpdk.c:189:48: note: in definition of macro
'DUMP_PATTERN_ITEM'
189 | ds_put_format(s, field " is " fmt " ", spec_pri); \
| ^~~~~~~~
lib/netdev-offload-dpdk.c:385:38: error: cast increases required alignment of
target type [-Werror=cast-align]
385 | ntohl(*(ovs_be32 *) vxlan_spec->vni) >> 8,
| ^
lib/netdev-offload-dpdk.c:192:23: note: in definition of macro
'DUMP_PATTERN_ITEM'
192 | spec_pri, mask_pri); \
| ^~~~~~~~
lib/netdev-offload-dpdk.c:386:38: error: cast increases required alignment of
target type [-Werror=cast-align]
386 | ntohl(*(ovs_be32 *) vxlan_mask->vni) >>
8);
| ^
lib/netdev-offload-dpdk.c:192:33: note: in definition of macro
'DUMP_PATTERN_ITEM'
192 | spec_pri, mask_pri); \
| ^~~~~~~~
In file included from /usr/include/netinet/ip6.h:22,
from lib/netdev-offload-dpdk.c:20:
lib/netdev-offload-dpdk.c: In function 'dump_vxlan_encap':
lib/netdev-offload-dpdk.c:421:30: error: cast increases required alignment of
target type [-Werror=cast-align]
421 | ntohl(*(ovs_be32 *) vxlan->vni) >> 8);
| ^
lib/netdev-offload-dpdk.c: In function 'dump_flow_action':
lib/netdev-offload-dpdk.c:572:30: error: cast increases required alignment of
target type [-Werror=cast-align]
572 | ipv6_format_addr((struct in6_addr *) &set_ipv6->ipv6_addr,
s);
| ^
lib/netdev-offload-dpdk.c: In function 'parse_vxlan_match':
lib/netdev-offload-dpdk.c:1002:24: error: cast increases required alignment of
target type [-Werror=cast-align]
1002 | put_unaligned_be32((ovs_be32 *) vx_spec->vni,
| ^
lib/netdev-offload-dpdk.c:1004:24: error: cast increases required alignment of
target type [-Werror=cast-align]
1004 | put_unaligned_be32((ovs_be32 *) vx_mask->vni,
| ^
cc1: all warnings being treated as errors
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev