[dpdk-dev] [PATCH v2 15/18] net/ixgbe: parse flow director filter

Adrien Mazarguil adrien.mazarguil at 6wind.com
Tue Jan 3 15:08:14 CET 2017


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 at intel.com>
> Signed-off-by: Wenzhuo Lu <wenzhuo.lu at 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 at 6wind.com

-- 
Adrien Mazarguil
6WIND


More information about the dev mailing list