[PATCH 4/8] ethdev: use GRE protocol struct for flow matching
Ferruh Yigit
ferruh.yigit at amd.com
Fri Jan 20 18:21:11 CET 2023
On 10/26/2022 9:45 AM, David Marchand wrote:
> On Tue, Oct 25, 2022 at 11:45 PM Thomas Monjalon <thomas at monjalon.net> wrote:
>> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
>> index 6045a352ae..fd9be56e31 100644
>> --- a/lib/ethdev/rte_flow.h
>> +++ b/lib/ethdev/rte_flow.h
>> @@ -1069,19 +1069,29 @@ static const struct rte_flow_item_mpls rte_flow_item_mpls_mask = {
>> *
>> * Matches a GRE header.
>> */
>> +RTE_STD_C11
>> struct rte_flow_item_gre {
>> - /**
>> - * Checksum (1b), reserved 0 (12b), version (3b).
>> - * Refer to RFC 2784.
>> - */
>> - rte_be16_t c_rsvd0_ver;
>> - rte_be16_t protocol; /**< Protocol type. */
>> + union {
>> + struct {
>> + /*
>> + * These are old fields kept for compatibility.
>> + * Please prefer hdr field below.
>> + */
>> + /**
>> + * Checksum (1b), reserved 0 (12b), version (3b).
>> + * Refer to RFC 2784.
>> + */
>> + rte_be16_t c_rsvd0_ver;
>> + rte_be16_t protocol; /**< Protocol type. */
>> + };
>> + struct rte_gre_hdr hdr; /**< GRE header definition. */
>> + };
>> };
>>
>> /** Default mask for RTE_FLOW_ITEM_TYPE_GRE. */
>> #ifndef __cplusplus
>> static const struct rte_flow_item_gre rte_flow_item_gre_mask = {
>> - .protocol = RTE_BE16(0xffff),
>> + .hdr.proto = RTE_BE16(UINT16_MAX),
>
>
> The proto field in struct rte_gre_hdr from lib/net lacks endianness annotation.
> This triggers a sparse warning (from OVS dpdk-latest build):
>
> /home/runner/work/ovs/ovs/dpdk-dir/build/include/rte_flow.h:1095:22:
> error: incorrect type in initializer (different base types)
> /home/runner/work/ovs/ovs/dpdk-dir/build/include/rte_flow.h:1095:22:
> expected unsigned short [usertype] proto
> /home/runner/work/ovs/ovs/dpdk-dir/build/include/rte_flow.h:1095:22:
> got restricted ovs_be16 [usertype]
>
>
added endianness annotation for GRE 'proto' field in v2, can you please
check if it fixes the warning?
More information about the dev
mailing list