From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 72B71A0542;
	Wed, 26 Oct 2022 10:45:23 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 63B6640A7F;
	Wed, 26 Oct 2022 10:45:23 +0200 (CEST)
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [170.10.133.124])
 by mails.dpdk.org (Postfix) with ESMTP id 41D05400D6
 for <dev@dpdk.org>; Wed, 26 Oct 2022 10:45:22 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1666773921;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=+AUzbpijjoxqT9WlVCg1yirbg05C/6w0kvsXMWM8hGk=;
 b=CXATGurj48VP1Ij3493wnMH1WOTLi+BkOMqufqA5ywcXdMp70wk7jozSbLpauCUPzx0Yil
 g26z325Mdyfl7B/xxwgNWWbVVkZaXwnSGCgnWDE4M9mQeKS4UxtDaQM6hM/oPZ3Zl8eFdP
 03Yx4EOfWHwcfTuySzf/SF53u5zuni4=
Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com
 [209.85.216.69]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id
 us-mta-64-qpIpZ_1mOrKLDYx_Ze0TWA-1; Wed, 26 Oct 2022 04:45:16 -0400
X-MC-Unique: qpIpZ_1mOrKLDYx_Ze0TWA-1
Received: by mail-pj1-f69.google.com with SMTP id
 n9-20020a17090a2bc900b0021010dca313so5671128pje.7
 for <dev@dpdk.org>; Wed, 26 Oct 2022 01:45:16 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=+AUzbpijjoxqT9WlVCg1yirbg05C/6w0kvsXMWM8hGk=;
 b=tJ9mL9yZRh+WuBQcRnFeIRN8VcoK9eVaJzFYybab53//JorCbZQ/lrY7JwVSsKzJaU
 1XxtdD5Afr3uPvFrE2Nqpmo9BV8R4fsO/et7kQbdec05P+tamuxDECaVFwOTjriNJ4DX
 dJR0+2fyTSAAyrrIe/YElGc/pVRBYspyxbzyFHIQ/AgY3f8cpDHOMl1mu3r2dWcoJE0z
 Kj0WzwdLjAwo262OGSAGIF3Go8RXr9I5c6eAmkc/qRMkD7vNpt1rStEWRHl2W12xFksV
 rQgEwLAIogI05KzBUV8GMbXi0pGQmki/a2MdQQ3YCGQNhtWPPZM116IeZJvxu9wVjbuQ
 vVxw==
X-Gm-Message-State: ACrzQf3/mv+P99OAT356TZVXMcb/7HfFa57lzDtUFKKeJz8hmaRaXhEc
 q2JVKCkJ2TTvNasit445xL7y0mpduD5x6fpjDmRsQ+A2qqhpy53lr0eBYGKnPZwbUSuW6HMSUE2
 PhpoqXqB6wTyp8eX55Ng=
X-Received: by 2002:a17:902:7786:b0:178:48c0:a083 with SMTP id
 o6-20020a170902778600b0017848c0a083mr43596635pll.125.1666773915226; 
 Wed, 26 Oct 2022 01:45:15 -0700 (PDT)
X-Google-Smtp-Source: AMsMyM6UmlvHbtqTL1zJejEpfgELaz/3hkGDWoIm+ro//bbw6WcE2y3Nll9lc7YuWfOM7JpPYYZDk4DI/gl3KCU9m3A=
X-Received: by 2002:a17:902:7786:b0:178:48c0:a083 with SMTP id
 o6-20020a170902778600b0017848c0a083mr43596606pll.125.1666773914972; Wed, 26
 Oct 2022 01:45:14 -0700 (PDT)
MIME-Version: 1.0
References: <20221025214410.715864-1-thomas@monjalon.net>
 <20221025214410.715864-5-thomas@monjalon.net>
In-Reply-To: <20221025214410.715864-5-thomas@monjalon.net>
From: David Marchand <david.marchand@redhat.com>
Date: Wed, 26 Oct 2022 10:45:03 +0200
Message-ID: <CAJFAV8z_f3uztcba6Ym2vgONovK4QZe610=0HjWPyG_bE0tBVg@mail.gmail.com>
Subject: Re: [PATCH 4/8] ethdev: use GRE protocol struct for flow matching
To: Thomas Monjalon <thomas@monjalon.net>
Cc: dev@dpdk.org, ferruh.yigit@amd.com, andrew.rybchenko@oktetlabs.ru, 
 Wisam Jaddo <wisamm@nvidia.com>, Ori Kam <orika@nvidia.com>, 
 Aman Singh <aman.deep.singh@intel.com>, Yuying Zhang <yuying.zhang@intel.com>, 
 Ajit Khaparde <ajit.khaparde@broadcom.com>,
 Somnath Kotur <somnath.kotur@broadcom.com>, 
 Hemant Agrawal <hemant.agrawal@nxp.com>,
 Sachin Saxena <sachin.saxena@oss.nxp.com>, 
 Matan Azrad <matan@nvidia.com>, Viacheslav Ovsiienko <viacheslavo@nvidia.com>
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Type: text/plain; charset="UTF-8"
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

On Tue, Oct 25, 2022 at 11:45 PM Thomas Monjalon <thomas@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]


-- 
David Marchand