[dpdk-dev,v4,16/21] ethdev: define structures for configuring flexible payload

Message ID 1413939687-11177-17-git-send-email-jingjing.wu@intel.com (mailing list archive)
State Changes Requested, archived
Headers

Commit Message

Jingjing Wu Oct. 22, 2014, 1:01 a.m. UTC
  define structures for configuring flexible payload

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 lib/librte_ether/rte_eth_ctrl.h | 43 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
  

Comments

Thomas Monjalon Oct. 28, 2014, 2:14 p.m. UTC | #1
2014-10-22 09:01, Jingjing Wu:
> +/**
> + * A structure defined a field vector to specify each field.
> + */
> +struct rte_eth_field_vector {
> +	uint8_t offset;   /**< Source word offset */
> +	uint8_t size;     /**< Field Size defined in word units */
> +};

I'm sorry but I don't understand this patch at all.
I think the reason is that I need more information about flex filter.

> +
> +/**
> + * payload type
> + */
> +enum rte_eth_payload_type {
> +	RTE_ETH_PAYLOAD_UNKNOWN = 0,
> +	RTE_ETH_L2_PAYLOAD,
> +	RTE_ETH_L3_PAYLOAD,
> +	RTE_ETH_L4_PAYLOAD,
> +};
> +
>  /**
>   * flow type
>   */
> @@ -92,6 +111,30 @@ enum rte_eth_flow_type {
>  };
>  
>  /**
> + * A structure used to select fields extracted from the protocol layers to
> + * the Field Vector as flexible payload for filter
> + */
> +struct rte_eth_flex_payload_cfg {
> +	enum rte_eth_payload_type type;  /**< payload type */
> +	uint8_t nb_field;                /**< the number of following fields */
> +	struct rte_eth_field_vector field[0];
> +};
> +
> +#define RTE_ETH_FDIR_CFG_FLX      0x0001
> +/**
> + * A structure used to config FDIR filter global set
> + * to support RTE_ETH_FILTER_FDIR with RTE_ETH_FILTER_SET operation.
> + */
> +struct rte_eth_fdir_cfg {
> +	uint16_t cmd;  /**< sub command  */
> +	/**
> +	 * A pointer to structure for the configuration e.g.
> +	 * struct rte_eth_flex_payload_cfg for FDIR_CFG_FLX
> +	*/
> +	void *cfg;
> +};
  
Jingjing Wu Oct. 29, 2014, 3:21 a.m. UTC | #2
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Tuesday, October 28, 2014 10:15 PM
> To: Wu, Jingjing
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v4 16/21] ethdev: define structures for
> configuring flexible payload
> 
> 2014-10-22 09:01, Jingjing Wu:
> > +/**
> > + * A structure defined a field vector to specify each field.
> > + */
> > +struct rte_eth_field_vector {
> > +	uint8_t offset;   /**< Source word offset */
> > +	uint8_t size;     /**< Field Size defined in word units */
> > +};
> 
> I'm sorry but I don't understand this patch at all.
> I think the reason is that I need more information about flex filter.
> 

Yes, it is a little difficult to understand the behavior. Let me explain it as I can.
<1> flex words:
We can select where the 8 flex words are. It can be constituted of 1-3 partitions.
Each partition is defined as rte_eth_field_vector. 
For example:
if we set 
rte_eth_flex_payload_cfg = {
	.type = RTE_ETH_L4_PAYLOAD;
	.nb_field = 1;
	.field = {
		{0, 8},  /*offset = 0, size =8*/
	};
};
This means the 8 words from the beginning of l4 payload will be consider as flex words.
If we set 
rte_eth_flex_payload_cfg = {
	.type = RTE_ETH_L4_PAYLOAD;
	.nb_field = 1;
	.field = {
		{0, 2},  /*offset = 0, size =2*/
		{4, 6},  /*offset = 4, size =6*/
	};
};
This means the 2 words from the beginning of l4 payload plus 6 words form the offset 4
will be consider as flex words.

<2> flex mask:
As the <1> configuration, we already select 8 words as flex words. Then the flex mask
Will help us to define whether these word will participate in comparing. 
The flex mask can be constituted of 2 partitions. One is word mask, another is bit mask.
Word mask is defined in rte_eth_fdir_flex_masks.words_mask, it means bit i enables word i of flex words.
rte_eth_fdir_flex_masks.field specify each word's bit mask, Fortville support 2 word bitmask.

> > +
> > +/**
> > + * payload type
> > + */
> > +enum rte_eth_payload_type {
> > +	RTE_ETH_PAYLOAD_UNKNOWN = 0,
> > +	RTE_ETH_L2_PAYLOAD,
> > +	RTE_ETH_L3_PAYLOAD,
> > +	RTE_ETH_L4_PAYLOAD,
> > +};
> > +
> >  /**
> >   * flow type
> >   */
> > @@ -92,6 +111,30 @@ enum rte_eth_flow_type {  };
> >
> >  /**
> > + * A structure used to select fields extracted from the protocol
> > +layers to
> > + * the Field Vector as flexible payload for filter  */ struct
> > +rte_eth_flex_payload_cfg {
> > +	enum rte_eth_payload_type type;  /**< payload type */
> > +	uint8_t nb_field;                /**< the number of following fields */
> > +	struct rte_eth_field_vector field[0]; };
> > +
> > +#define RTE_ETH_FDIR_CFG_FLX      0x0001
> > +/**
> > + * A structure used to config FDIR filter global set
> > + * to support RTE_ETH_FILTER_FDIR with RTE_ETH_FILTER_SET operation.
> > + */
> > +struct rte_eth_fdir_cfg {
> > +	uint16_t cmd;  /**< sub command  */
> > +	/**
> > +	 * A pointer to structure for the configuration e.g.
> > +	 * struct rte_eth_flex_payload_cfg for FDIR_CFG_FLX
> > +	*/
> > +	void *cfg;
> > +};
  
Thomas Monjalon Oct. 29, 2014, 9:55 a.m. UTC | #3
2014-10-29 03:21, Wu, Jingjing:
> 
> > -----Original Message-----
> > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> > Sent: Tuesday, October 28, 2014 10:15 PM
> > To: Wu, Jingjing
> > Cc: dev@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH v4 16/21] ethdev: define structures for
> > configuring flexible payload
> > 
> > 2014-10-22 09:01, Jingjing Wu:
> > > +/**
> > > + * A structure defined a field vector to specify each field.
> > > + */
> > > +struct rte_eth_field_vector {
> > > +	uint8_t offset;   /**< Source word offset */
> > > +	uint8_t size;     /**< Field Size defined in word units */
> > > +};
> > 
> > I'm sorry but I don't understand this patch at all.
> > I think the reason is that I need more information about flex filter.
> > 
> 
> Yes, it is a little difficult to understand the behavior. Let me explain it as I can.
> <1> flex words:
> We can select where the 8 flex words are. It can be constituted of 1-3 partitions.
> Each partition is defined as rte_eth_field_vector. 
> For example:
> if we set 
> rte_eth_flex_payload_cfg = {
> 	.type = RTE_ETH_L4_PAYLOAD;
> 	.nb_field = 1;
> 	.field = {
> 		{0, 8},  /*offset = 0, size =8*/
> 	};
> };
> This means the 8 words from the beginning of l4 payload will be consider as flex words.
> If we set 
> rte_eth_flex_payload_cfg = {
> 	.type = RTE_ETH_L4_PAYLOAD;
> 	.nb_field = 1;
> 	.field = {
> 		{0, 2},  /*offset = 0, size =2*/
> 		{4, 6},  /*offset = 4, size =6*/
> 	};
> };
> This means the 2 words from the beginning of l4 payload plus 6 words form the offset 4
> will be consider as flex words.
> 
> <2> flex mask:
> As the <1> configuration, we already select 8 words as flex words. Then the flex mask
> Will help us to define whether these word will participate in comparing. 
> The flex mask can be constituted of 2 partitions. One is word mask, another is bit mask.
> Word mask is defined in rte_eth_fdir_flex_masks.words_mask, it means bit i enables word i of flex words.
> rte_eth_fdir_flex_masks.field specify each word's bit mask, Fortville support 2 word bitmask.

OK thanks.
The most difficult task will be to explain it in the doxygen comment :)
Please try to be precise and concise in doxygen comments. It must be a
reference when using the API. If more examples are required, the developer
can look into the programmer's guide.
  

Patch

diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index 7ca1d6b..ca21313 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -76,6 +76,25 @@  enum rte_filter_op {
  * Define all structures for Flow Director Filter type corresponding with specific operations.
  */
 
+
+/**
+ * A structure defined a field vector to specify each field.
+ */
+struct rte_eth_field_vector {
+	uint8_t offset;   /**< Source word offset */
+	uint8_t size;     /**< Field Size defined in word units */
+};
+
+/**
+ * payload type
+ */
+enum rte_eth_payload_type {
+	RTE_ETH_PAYLOAD_UNKNOWN = 0,
+	RTE_ETH_L2_PAYLOAD,
+	RTE_ETH_L3_PAYLOAD,
+	RTE_ETH_L4_PAYLOAD,
+};
+
 /**
  * flow type
  */
@@ -92,6 +111,30 @@  enum rte_eth_flow_type {
 };
 
 /**
+ * A structure used to select fields extracted from the protocol layers to
+ * the Field Vector as flexible payload for filter
+ */
+struct rte_eth_flex_payload_cfg {
+	enum rte_eth_payload_type type;  /**< payload type */
+	uint8_t nb_field;                /**< the number of following fields */
+	struct rte_eth_field_vector field[0];
+};
+
+#define RTE_ETH_FDIR_CFG_FLX      0x0001
+/**
+ * A structure used to config FDIR filter global set
+ * to support RTE_ETH_FILTER_FDIR with RTE_ETH_FILTER_SET operation.
+ */
+struct rte_eth_fdir_cfg {
+	uint16_t cmd;  /**< sub command  */
+	/**
+	 * A pointer to structure for the configuration e.g.
+	 * struct rte_eth_flex_payload_cfg for FDIR_CFG_FLX
+	*/
+	void *cfg;
+};
+
+/**
  * A structure used to define the input for IPV4 UDP flow
  */
 struct rte_eth_udpv4_flow {