From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <adrien.mazarguil@6wind.com>
Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com [74.125.82.44])
 by dpdk.org (Postfix) with ESMTP id 112B937A4
 for <dev@dpdk.org>; Tue,  3 Jan 2017 15:08:22 +0100 (CET)
Received: by mail-wm0-f44.google.com with SMTP id c85so200199386wmi.1
 for <dev@dpdk.org>; Tue, 03 Jan 2017 06:08:22 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=6wind-com.20150623.gappssmtp.com; s=20150623;
 h=date:from:to:cc:subject:message-id:references:mime-version
 :content-disposition:in-reply-to;
 bh=tkmy3AbJVVZJ9B+SpUkNlngKTRzKPBNHv6B/QsnmP+g=;
 b=skVh05KAMG+xi9jQClLIvKlVPIapC9ogmK6eGpMiTXC7R6Inn0uIblAbZnlzRS8egm
 exr7OlnaHN0AvbvVcY8T7S45S6vav9fBkkZY/u++BBoRjbcJR+EIylpbUNOqPwwCiQMF
 kKWjAaO+cEaIlWLO7pyzpHnsWQ+angjbfcIdi6WWPcL7k+potPcGETooddAgHHQkH7q+
 4lsKAZlaEmZOFQcjtaMEk6RTULsNN/Cu9EJNIj+ZQK82tfipdqWIwZR2322Jgy3NcT7W
 NMZRFLiFDtAKBrR5PZzOUVqFkZNmSm/x8frRy1t7+HELarAsEGEU5mRnJxngRzVPY10o
 aZbw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:references
 :mime-version:content-disposition:in-reply-to;
 bh=tkmy3AbJVVZJ9B+SpUkNlngKTRzKPBNHv6B/QsnmP+g=;
 b=QdUOa1dXRsz6Xfbw14sOgtRgjITm9y2XTbFbBh3raxnGx7mYlN6MQ6xfYhoKytcbh3
 bQQX8UFedkeN2qrnACVo7n2a1OcPu1GkKz0zco2fT2LiNBXIqW9L1Bqw5eEd1yEJEO1x
 4GkUziSUgujR7Jv4E+BmQvqy/4Essz0j78yOHCS6OysbzOGs60X95WJq/a11J8B1iiR7
 GWQuNRe222zZxdZFYh1J/se3j+tVH5er9F1y0PGoOiVMgVNwCQZp+lpgASYs0pTK58TH
 xsVZCak80waa1oBv9xBCtDnloePEICuiz5ZC6ovPkncNffAaRmZ9xn057BJi0hYD/6o+
 gWTw==
X-Gm-Message-State: AIkVDXLAZV3QxKy60GnRQi+y+XL2E+jAcE0SYn34M0gqORtVEFIyyp/ko5CaEmoN60CuOhm2
X-Received: by 10.28.64.67 with SMTP id n64mr50161358wma.34.1483452502600;
 Tue, 03 Jan 2017 06:08:22 -0800 (PST)
Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net.
 [82.239.227.177])
 by smtp.gmail.com with ESMTPSA id d8sm89719534wmi.21.2017.01.03.06.08.21
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 03 Jan 2017 06:08:21 -0800 (PST)
Date: Tue, 3 Jan 2017 15:08:14 +0100
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: Wei Zhao <wei.zhao1@intel.com>
Cc: dev@dpdk.org, Wenzhuo Lu <wenzhuo.lu@intel.com>
Message-ID: <20170103140814.GB12822@6wind.com>
References: <1483084390-53159-1-git-send-email-wei.zhao1@intel.com>
 <1483084390-53159-16-git-send-email-wei.zhao1@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1483084390-53159-16-git-send-email-wei.zhao1@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2 15/18] net/ixgbe: parse flow director
	filter
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Jan 2017 14:08:23 -0000

Hi Wei,

On Fri, Dec 30, 2016 at 03:53:07PM +0800, Wei Zhao wrote:
> check if the rule is a flow director rule, and get the flow director info.
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> 
> ---
> 
> v2:add new error set function
> ---
>  drivers/net/ixgbe/ixgbe_ethdev.c | 1467 +++++++++++++++++++++++++++++++++-----
>  drivers/net/ixgbe/ixgbe_ethdev.h |   16 +
>  drivers/net/ixgbe/ixgbe_fdir.c   |  247 ++++---
>  lib/librte_ether/rte_flow.h      |   23 +
>  4 files changed, 1495 insertions(+), 258 deletions(-)
[...]
> diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h
> index e9e6220..e59f458 100644
> --- a/lib/librte_ether/rte_flow.h
> +++ b/lib/librte_ether/rte_flow.h
> @@ -275,6 +275,13 @@ enum rte_flow_item_type {
>  	  * See struct rte_flow_item_e_tag.
>  	  */
>  	RTE_FLOW_ITEM_TYPE_E_TAG,
> +
> +	/**
> +	 * Matches a NVGRE header.
> +	 *
> +	 * See struct rte_flow_item_nvgre.
> +	 */
> +	RTE_FLOW_ITEM_TYPE_NVGRE,
>  };
>  
>  /**
> @@ -486,6 +493,22 @@ struct rte_flow_item_e_tag {
>  };
>  
>  /**
> + * RTE_FLOW_ITEM_TYPE_NVGRE.
> + *
> + * Matches a NVGRE header.
> + */
> +struct rte_flow_item_nvgre {
> +	uint32_t flags0:1; /**< 0 */
> +	uint32_t rsvd1:1; /**< 1 bit not defined */
> +	uint32_t flags1:2; /**< 2 bits, 1 0 */
> +	uint32_t rsvd0:9; /**< Reserved0 */
> +	uint32_t ver:3; /**< version */
> +	uint32_t protocol:16; /**< protocol type, 0x6558 */
> +	uint8_t tni[3]; /**< tenant network ID or virtual subnet ID */
> +	uint8_t flow_id; /**< flow ID or Reserved */
> +};
[...]

See my previous reply [1], this definition is not endian-safe due to the use
of bit-fields and should look more like the VXLAN item. Here is an untested
suggestion (not sure about all values):

 struct rte_flow_item_nvgre {
     /**
      * Checksum (1b), undefined (1b), key bit (1b), sequence number (1b),
      * reserved 0 (9b), version (3b).
      *
      * \c_k_s_rsvd0_ver must have value 0x2000 according to RFC 7637.
      */ 
     uint16_t c_k_s_rsvd0_ver;
     uint16_t proto; /**< Protocol type (0x6558). */
     uint8_t vsid[3]; /**< Virtual subnet ID. */
     uint8_t flow_id; /**< Flow ID. */     
 };

Like for E-Tag, applications are responsibile for breaking down and filling
individual fields properly.

[1] http://dpdk.org/ml/archives/dev/2016-December/053181.html
    Message ID: 20161223081310.GH10340@6wind.com

-- 
Adrien Mazarguil
6WIND