DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2 0/3] ixgbe: enable flex filter for rte_flow
@ 2017-05-31 19:45 Qi Zhang
  2017-05-31 19:45 ` [dpdk-dev] [PATCH v2 1/3] net/ixgbe: remove reduandent code Qi Zhang
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Qi Zhang @ 2017-05-31 19:45 UTC (permalink / raw)
  To: wenzhuo.lu, helin.zhang; +Cc: dev, Qi Zhang

Enable fdir flex byte support for rte_flow APIs.

v2:
- fix couple checkpatch errors.

Qi Zhang (3):
  net/ixgbe: remove reduandent code
  net/ixgbe: fix fdir mask not be reset
  net/ixgbe: enable flex bytes for generic flow API

 drivers/net/ixgbe/ixgbe_ethdev.h |   3 +
 drivers/net/ixgbe/ixgbe_fdir.c   |  31 +++++++-
 drivers/net/ixgbe/ixgbe_flow.c   | 149 ++++++++++++++++++++++++++++++++++++---
 3 files changed, 172 insertions(+), 11 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [dpdk-dev] [PATCH v2 1/3] net/ixgbe: remove reduandent code
  2017-05-31 19:45 [dpdk-dev] [PATCH v2 0/3] ixgbe: enable flex filter for rte_flow Qi Zhang
@ 2017-05-31 19:45 ` Qi Zhang
  2017-06-01  7:05   ` Lu, Wenzhuo
  2017-05-31 19:45 ` [dpdk-dev] [PATCH v2 2/3] net/ixgbe: fix fdir mask not be reset Qi Zhang
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 15+ messages in thread
From: Qi Zhang @ 2017-05-31 19:45 UTC (permalink / raw)
  To: wenzhuo.lu, helin.zhang; +Cc: dev, Qi Zhang

Remove reduandent code.
item->type != RTE_FLOW_ITEM_TYPE_END already cover
item->type == RTE_FLOW_ITEM_TYPE_VLAN.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ixgbe/ixgbe_flow.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index da7b1cc..2c09444 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -1549,13 +1549,7 @@ ixgbe_parse_fdir_filter_normal(const struct rte_flow_attr *attr,
 		 */
 		index++;
 		NEXT_ITEM_OF_PATTERN(item, pattern, index);
-		if (item->type == RTE_FLOW_ITEM_TYPE_VLAN) {
-			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
-			rte_flow_error_set(error, EINVAL,
-				RTE_FLOW_ERROR_TYPE_ITEM,
-				item, "Not supported by fdir filter");
-			return -rte_errno;
-		} else if (item->type != RTE_FLOW_ITEM_TYPE_END) {
+		if (item->type != RTE_FLOW_ITEM_TYPE_END) {
 			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
 			rte_flow_error_set(error, EINVAL,
 				RTE_FLOW_ERROR_TYPE_ITEM,
-- 
2.7.4

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [dpdk-dev] [PATCH v2 2/3] net/ixgbe: fix fdir mask not be reset
  2017-05-31 19:45 [dpdk-dev] [PATCH v2 0/3] ixgbe: enable flex filter for rte_flow Qi Zhang
  2017-05-31 19:45 ` [dpdk-dev] [PATCH v2 1/3] net/ixgbe: remove reduandent code Qi Zhang
@ 2017-05-31 19:45 ` Qi Zhang
  2017-06-01  7:17   ` Lu, Wenzhuo
  2017-05-31 19:45 ` [dpdk-dev] [PATCH v2 3/3] net/ixgbe: enable flex bytes for generic flow API Qi Zhang
  2017-06-01 17:36 ` [dpdk-dev] [PATCH v3 0/3] ixgbe: enable flex filter for rte_flow Qi Zhang
  3 siblings, 1 reply; 15+ messages in thread
From: Qi Zhang @ 2017-05-31 19:45 UTC (permalink / raw)
  To: wenzhuo.lu, helin.zhang; +Cc: dev, Qi Zhang, stable

When the last fdir flow be destroyed, the flag "mask_added"
should be reset, so the remain mask info will not take effect
when a new flow be added.

Fixes: a14de8b498d1 ("net/ixgbe: destroy consistent filter")
Cc: stable@dpdk.org

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ixgbe/ixgbe_flow.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index 2c09444..886180e 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -2641,6 +2641,8 @@ ixgbe_flow_destroy(struct rte_eth_dev *dev,
 	struct ixgbe_eth_l2_tunnel_conf_ele *l2_tn_filter_ptr;
 	struct ixgbe_fdir_rule_ele *fdir_rule_ptr;
 	struct ixgbe_flow_mem *ixgbe_flow_mem_ptr;
+	struct ixgbe_hw_fdir_info *fdir_info =
+		IXGBE_DEV_PRIVATE_TO_FDIR_INFO(dev->data->dev_private);
 
 	switch (filter_type) {
 	case RTE_ETH_FILTER_NTUPLE:
@@ -2693,6 +2695,8 @@ ixgbe_flow_destroy(struct rte_eth_dev *dev,
 			TAILQ_REMOVE(&filter_fdir_list,
 				fdir_rule_ptr, entries);
 			rte_free(fdir_rule_ptr);
+			if (TAILQ_EMPTY(&filter_fdir_list))
+				fdir_info->mask_added = false;
 		}
 		break;
 	case RTE_ETH_FILTER_L2_TUNNEL:
-- 
2.7.4

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [dpdk-dev] [PATCH v2 3/3] net/ixgbe: enable flex bytes for generic flow API
  2017-05-31 19:45 [dpdk-dev] [PATCH v2 0/3] ixgbe: enable flex filter for rte_flow Qi Zhang
  2017-05-31 19:45 ` [dpdk-dev] [PATCH v2 1/3] net/ixgbe: remove reduandent code Qi Zhang
  2017-05-31 19:45 ` [dpdk-dev] [PATCH v2 2/3] net/ixgbe: fix fdir mask not be reset Qi Zhang
@ 2017-05-31 19:45 ` Qi Zhang
  2017-06-02  1:49   ` Lu, Wenzhuo
  2017-06-01 17:36 ` [dpdk-dev] [PATCH v3 0/3] ixgbe: enable flex filter for rte_flow Qi Zhang
  3 siblings, 1 reply; 15+ messages in thread
From: Qi Zhang @ 2017-05-31 19:45 UTC (permalink / raw)
  To: wenzhuo.lu, helin.zhang; +Cc: dev, Qi Zhang

Add fdir flex byte support for rte_flow APIs.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---

v2:
- fix couple checkpatch errors.

 drivers/net/ixgbe/ixgbe_ethdev.h |   3 +
 drivers/net/ixgbe/ixgbe_fdir.c   |  31 ++++++++-
 drivers/net/ixgbe/ixgbe_flow.c   | 137 ++++++++++++++++++++++++++++++++++++++-
 3 files changed, 167 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index b576a6f..c6449b5 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -189,6 +189,7 @@ struct ixgbe_fdir_rule {
 	uint32_t fdirflags; /* drop or forward */
 	uint32_t soft_id; /* an unique value for this rule */
 	uint8_t queue; /* assigned rx queue */
+	uint8_t flex_bytes_offset;
 };
 
 struct ixgbe_hw_fdir_info {
@@ -624,6 +625,8 @@ void ixgbe_filterlist_flush(void);
  */
 int ixgbe_fdir_configure(struct rte_eth_dev *dev);
 int ixgbe_fdir_set_input_mask(struct rte_eth_dev *dev);
+int ixgbe_fdir_set_flexbytes_offset(struct rte_eth_dev *dev,
+				    uint16_t offset);
 int ixgbe_fdir_filter_program(struct rte_eth_dev *dev,
 			      struct ixgbe_fdir_rule *rule,
 			      bool del, bool update);
diff --git a/drivers/net/ixgbe/ixgbe_fdir.c b/drivers/net/ixgbe/ixgbe_fdir.c
index 7f6c7b5..950f5ba 100644
--- a/drivers/net/ixgbe/ixgbe_fdir.c
+++ b/drivers/net/ixgbe/ixgbe_fdir.c
@@ -302,7 +302,7 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev)
 	 * mask VM pool and DIPv6 since there are currently not supported
 	 * mask FLEX byte, it will be set in flex_conf
 	 */
-	uint32_t fdirm = IXGBE_FDIRM_POOL | IXGBE_FDIRM_DIPv6 | IXGBE_FDIRM_FLEX;
+	uint32_t fdirm = IXGBE_FDIRM_POOL | IXGBE_FDIRM_DIPv6;
 	uint32_t fdirtcpm;  /* TCP source and destination port masks. */
 	uint32_t fdiripv6m; /* IPv6 source and destination masks. */
 	volatile uint32_t *reg;
@@ -333,6 +333,10 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev)
 		return -EINVAL;
 	}
 
+	/* flex byte mask */
+	if (info->mask.flex_bytes_mask == 0)
+		fdirm |= IXGBE_FDIRM_FLEX;
+
 	IXGBE_WRITE_REG(hw, IXGBE_FDIRM, fdirm);
 
 	/* store the TCP/UDP port masks, bit reversed from port layout */
@@ -533,6 +537,31 @@ ixgbe_fdir_set_input_mask(struct rte_eth_dev *dev)
 	return -ENOTSUP;
 }
 
+int
+ixgbe_fdir_set_flexbytes_offset(struct rte_eth_dev *dev,
+				uint16_t offset)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	uint32_t fdirctrl;
+	int i;
+
+	fdirctrl = IXGBE_READ_REG(hw, IXGBE_FDIRCTRL);
+
+	fdirctrl &= ~IXGBE_FDIRCTRL_FLEX_MASK;
+	fdirctrl |= ((offset >> 1) /* convert to word offset */
+		<< IXGBE_FDIRCTRL_FLEX_SHIFT);
+
+	IXGBE_WRITE_REG(hw, IXGBE_FDIRCTRL, fdirctrl);
+	IXGBE_WRITE_FLUSH(hw);
+	for (i = 0; i < IXGBE_FDIR_INIT_DONE_POLL; i++) {
+		if (IXGBE_READ_REG(hw, IXGBE_FDIRCTRL) &
+			IXGBE_FDIRCTRL_INIT_DONE)
+			break;
+		msec_delay(1);
+	}
+	return 0;
+}
+
 static int
 fdir_set_input_mask(struct rte_eth_dev *dev,
 		    const struct rte_eth_fdir_masks *input_mask)
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index 886180e..cd599b3 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -78,6 +78,7 @@
 
 #define IXGBE_MIN_N_TUPLE_PRIO 1
 #define IXGBE_MAX_N_TUPLE_PRIO 7
+#define IXGBE_MAX_FLX_SOURCE_OFF 62
 #define NEXT_ITEM_OF_PATTERN(item, pattern, index)\
 	do {		\
 		item = pattern + index;\
@@ -1316,7 +1317,8 @@ ixgbe_parse_fdir_act_attr(const struct rte_flow_attr *attr,
  * UDP/TCP/SCTP PATTERN:
  * The first not void item can be ETH or IPV4.
  * The second not void item must be IPV4 if the first one is ETH.
- * The third not void item must be UDP or TCP or SCTP.
+ * The next not void item could be UDP or TCP or SCTP (optional)
+ * The next not void item could be RAW (for flexbyte, optional)
  * The next not void item must be END.
  * MAC VLAN PATTERN:
  * The first not void item must be ETH.
@@ -1334,6 +1336,14 @@ ixgbe_parse_fdir_act_attr(const struct rte_flow_attr *attr,
  *		dst_addr 192.167.3.50	0xFFFFFFFF
  * UDP/TCP/SCTP	src_port	80	0xFFFF
  *		dst_port	80	0xFFFF
+ * FLEX	relative	0	0x1
+ *		search		0	0x1
+ *		reserved	0	0
+ *		offset		12	0xFFFFFFFF
+ *		limit		0	0xFFFF
+ *		length		2	0xFFFF
+ *		pattern[0]	0x86	0xFF
+ *		pattern[1]	0xDD	0xFF
  * END
  * MAC VLAN pattern example:
  * ITEM		Spec			Mask
@@ -1365,6 +1375,8 @@ ixgbe_parse_fdir_filter_normal(const struct rte_flow_attr *attr,
 	const struct rte_flow_item_sctp *sctp_mask;
 	const struct rte_flow_item_vlan *vlan_spec;
 	const struct rte_flow_item_vlan *vlan_mask;
+	const struct rte_flow_item_raw *raw_mask;
+	const struct rte_flow_item_raw *raw_spec;
 
 	uint32_t index, j;
 
@@ -1396,6 +1408,7 @@ ixgbe_parse_fdir_filter_normal(const struct rte_flow_attr *attr,
 	memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
 	memset(&rule->mask, 0xFF, sizeof(struct ixgbe_hw_fdir_mask));
 	rule->mask.vlan_tci_mask = 0;
+	rule->mask.flex_bytes_mask = 0;
 
 	/* parse pattern */
 	index = 0;
@@ -1623,7 +1636,8 @@ ixgbe_parse_fdir_filter_normal(const struct rte_flow_attr *attr,
 		if (item->type != RTE_FLOW_ITEM_TYPE_TCP &&
 		    item->type != RTE_FLOW_ITEM_TYPE_UDP &&
 		    item->type != RTE_FLOW_ITEM_TYPE_SCTP &&
-		    item->type != RTE_FLOW_ITEM_TYPE_END) {
+		    item->type != RTE_FLOW_ITEM_TYPE_END &&
+		    item->type != RTE_FLOW_ITEM_TYPE_RAW) {
 			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
 			rte_flow_error_set(error, EINVAL,
 				RTE_FLOW_ERROR_TYPE_ITEM,
@@ -1684,6 +1698,18 @@ ixgbe_parse_fdir_filter_normal(const struct rte_flow_attr *attr,
 			rule->ixgbe_fdir.formatted.dst_port =
 				tcp_spec->hdr.dst_port;
 		}
+
+		index++;
+		NEXT_ITEM_OF_PATTERN(item, pattern, index);
+		if (item->type != RTE_FLOW_ITEM_TYPE_RAW &&
+		    item->type != RTE_FLOW_ITEM_TYPE_END) {
+			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
+			rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_ITEM,
+				item, "Not supported by fdir filter");
+			return -rte_errno;
+		}
+
 	}
 
 	/* Get the UDP info */
@@ -1733,6 +1759,18 @@ ixgbe_parse_fdir_filter_normal(const struct rte_flow_attr *attr,
 			rule->ixgbe_fdir.formatted.dst_port =
 				udp_spec->hdr.dst_port;
 		}
+
+		index++;
+		NEXT_ITEM_OF_PATTERN(item, pattern, index);
+		if (item->type != RTE_FLOW_ITEM_TYPE_RAW &&
+		    item->type != RTE_FLOW_ITEM_TYPE_END) {
+			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
+			rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_ITEM,
+				item, "Not supported by fdir filter");
+			return -rte_errno;
+		}
+
 	}
 
 	/* Get the SCTP info */
@@ -1784,6 +1822,88 @@ ixgbe_parse_fdir_filter_normal(const struct rte_flow_attr *attr,
 			rule->ixgbe_fdir.formatted.dst_port =
 				sctp_spec->hdr.dst_port;
 		}
+
+		index++;
+		NEXT_ITEM_OF_PATTERN(item, pattern, index);
+		if (item->type != RTE_FLOW_ITEM_TYPE_RAW &&
+		    item->type != RTE_FLOW_ITEM_TYPE_END) {
+			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
+			rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_ITEM,
+				item, "Not supported by fdir filter");
+			return -rte_errno;
+		}
+	}
+
+	/* Get the flex byte info */
+	if (item->type == RTE_FLOW_ITEM_TYPE_RAW) {
+		/* Not supported last point for range*/
+		if (item->last) {
+			rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+				item, "Not supported last point for range");
+			return -rte_errno;
+		}
+		/* mask should not be null */
+		if (!item->mask || !item->spec) {
+			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
+			rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_ITEM,
+				item, "Not supported by fdir filter");
+			return -rte_errno;
+		}
+
+		raw_mask = (const struct rte_flow_item_raw *)item->mask;
+
+		/* check mask */
+		if (raw_mask->relative != 0x1 ||
+		    raw_mask->search != 0x1 ||
+		    raw_mask->reserved != 0x0 ||
+		    (uint32_t)raw_mask->offset != 0xffffffff ||
+		    raw_mask->limit != 0xffff ||
+		    raw_mask->length != 0xffff) {
+			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
+			rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_ITEM,
+				item, "Not supported by fdir filter");
+			return -rte_errno;
+		}
+
+		raw_spec = (const struct rte_flow_item_raw *)item->spec;
+
+		/* check spec */
+		if (raw_spec->relative != 0 ||
+		    raw_spec->search != 0 ||
+		    raw_spec->reserved != 0 ||
+		    raw_spec->offset > IXGBE_MAX_FLX_SOURCE_OFF ||
+		    raw_spec->offset % 2 ||
+		    raw_spec->limit != 0 ||
+		    raw_spec->length != 2 ||
+		    /* pattern can't be 0xffff */
+		    (raw_spec->pattern[0] == 0xff &&
+		     raw_spec->pattern[1] == 0xff)) {
+			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
+			rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_ITEM,
+				item, "Not supported by fdir filter");
+			return -rte_errno;
+		}
+
+		/* check pattern mask */
+		if (raw_mask->pattern[0] != 0xff ||
+		    raw_mask->pattern[1] != 0xff) {
+			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
+			rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_ITEM,
+				item, "Not supported by fdir filter");
+			return -rte_errno;
+		}
+
+		rule->mask.flex_bytes_mask = 0xffff;
+		rule->ixgbe_fdir.formatted.flex_bytes =
+			(((uint16_t)raw_spec->pattern[1]) << 8) |
+			raw_spec->pattern[0];
+		rule->flex_bytes_offset = raw_spec->offset;
 	}
 
 	if (item->type != RTE_FLOW_ITEM_TYPE_END) {
@@ -1921,7 +2041,7 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr,
 				item, "Not supported by fdir filter");
 			return -rte_errno;
 		}
-		/*Not supported last point for range*/
+		/* Not supported last point for range*/
 		if (item->last) {
 			rte_flow_error_set(error, EINVAL,
 				RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
@@ -2499,6 +2619,13 @@ ixgbe_flow_create(struct rte_eth_dev *dev,
 				rte_memcpy(&fdir_info->mask,
 					&fdir_rule.mask,
 					sizeof(struct ixgbe_hw_fdir_mask));
+				fdir_info->flex_bytes_offset =
+					fdir_rule.flex_bytes_offset;
+
+				if (fdir_rule.mask.flex_bytes_mask)
+					ixgbe_fdir_set_flexbytes_offset(dev,
+						fdir_rule.flex_bytes_offset);
+
 				ret = ixgbe_fdir_set_input_mask(dev);
 				if (ret)
 					goto out;
@@ -2514,6 +2641,10 @@ ixgbe_flow_create(struct rte_eth_dev *dev,
 					sizeof(struct ixgbe_hw_fdir_mask));
 				if (ret)
 					goto out;
+
+				if (fdir_info->flex_bytes_offset !=
+						fdir_rule.flex_bytes_offset)
+					goto out;
 			}
 		}
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/3] net/ixgbe: remove reduandent code
  2017-05-31 19:45 ` [dpdk-dev] [PATCH v2 1/3] net/ixgbe: remove reduandent code Qi Zhang
@ 2017-06-01  7:05   ` Lu, Wenzhuo
  0 siblings, 0 replies; 15+ messages in thread
From: Lu, Wenzhuo @ 2017-06-01  7:05 UTC (permalink / raw)
  To: Zhang, Qi Z, Zhang, Helin; +Cc: dev

Hi Qi,

> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Thursday, June 1, 2017 3:46 AM
> To: Lu, Wenzhuo; Zhang, Helin
> Cc: dev@dpdk.org; Zhang, Qi Z
> Subject: [PATCH v2 1/3] net/ixgbe: remove reduandent code
> 
> Remove reduandent code.
> item->type != RTE_FLOW_ITEM_TYPE_END already cover type ==
> item->RTE_FLOW_ITEM_TYPE_VLAN.
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> ---
>  drivers/net/ixgbe/ixgbe_flow.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
> index da7b1cc..2c09444 100644
> --- a/drivers/net/ixgbe/ixgbe_flow.c
> +++ b/drivers/net/ixgbe/ixgbe_flow.c
> @@ -1549,13 +1549,7 @@ ixgbe_parse_fdir_filter_normal(const struct
> rte_flow_attr *attr,
>  		 */
Please change the above comments too.

>  		index++;
>  		NEXT_ITEM_OF_PATTERN(item, pattern, index);
> -		if (item->type == RTE_FLOW_ITEM_TYPE_VLAN) {
> -			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
> -			rte_flow_error_set(error, EINVAL,
> -				RTE_FLOW_ERROR_TYPE_ITEM,
> -				item, "Not supported by fdir filter");
> -			return -rte_errno;
> -		} else if (item->type != RTE_FLOW_ITEM_TYPE_END) {
> +		if (item->type != RTE_FLOW_ITEM_TYPE_END) {
>  			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
>  			rte_flow_error_set(error, EINVAL,
>  				RTE_FLOW_ERROR_TYPE_ITEM,
> --
> 2.7.4

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/3] net/ixgbe: fix fdir mask not be reset
  2017-05-31 19:45 ` [dpdk-dev] [PATCH v2 2/3] net/ixgbe: fix fdir mask not be reset Qi Zhang
@ 2017-06-01  7:17   ` Lu, Wenzhuo
  0 siblings, 0 replies; 15+ messages in thread
From: Lu, Wenzhuo @ 2017-06-01  7:17 UTC (permalink / raw)
  To: Zhang, Qi Z, Zhang, Helin; +Cc: dev, stable

Hi,

> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Thursday, June 1, 2017 3:46 AM
> To: Lu, Wenzhuo; Zhang, Helin
> Cc: dev@dpdk.org; Zhang, Qi Z; stable@dpdk.org
> Subject: [PATCH v2 2/3] net/ixgbe: fix fdir mask not be reset
> 
> When the last fdir flow be destroyed, the flag "mask_added"
> should be reset, so the remain mask info will not take effect when a new
> flow be added.
> 
> Fixes: a14de8b498d1 ("net/ixgbe: destroy consistent filter")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [dpdk-dev] [PATCH v3 0/3] ixgbe: enable flex filter for rte_flow
  2017-05-31 19:45 [dpdk-dev] [PATCH v2 0/3] ixgbe: enable flex filter for rte_flow Qi Zhang
                   ` (2 preceding siblings ...)
  2017-05-31 19:45 ` [dpdk-dev] [PATCH v2 3/3] net/ixgbe: enable flex bytes for generic flow API Qi Zhang
@ 2017-06-01 17:36 ` Qi Zhang
  2017-06-01 17:36   ` [dpdk-dev] [PATCH v3 1/3] net/ixgbe: remove reduandent code Qi Zhang
                     ` (3 more replies)
  3 siblings, 4 replies; 15+ messages in thread
From: Qi Zhang @ 2017-06-01 17:36 UTC (permalink / raw)
  To: wenzhuo.lu, helin.zhang; +Cc: dev, Qi Zhang

Enable fdir flex byte support for rte_flow APIs.

v2:
- fix couple checkpatch errors.

v3:
- fix comment.

Qi Zhang (3):
  net/ixgbe: remove reduandent code
  net/ixgbe: fix fdir mask not be reset
  net/ixgbe: enable flex bytes for generic flow API

 drivers/net/ixgbe/ixgbe_ethdev.h |   3 +
 drivers/net/ixgbe/ixgbe_fdir.c   |  31 +++++++-
 drivers/net/ixgbe/ixgbe_flow.c   | 153 +++++++++++++++++++++++++++++++++++----
 3 files changed, 173 insertions(+), 14 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [dpdk-dev] [PATCH v3 1/3] net/ixgbe: remove reduandent code
  2017-06-01 17:36 ` [dpdk-dev] [PATCH v3 0/3] ixgbe: enable flex filter for rte_flow Qi Zhang
@ 2017-06-01 17:36   ` Qi Zhang
  2017-06-02  1:19     ` Lu, Wenzhuo
  2017-06-01 17:36   ` [dpdk-dev] [PATCH v3 2/3] net/ixgbe: fix fdir mask not be reset Qi Zhang
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 15+ messages in thread
From: Qi Zhang @ 2017-06-01 17:36 UTC (permalink / raw)
  To: wenzhuo.lu, helin.zhang; +Cc: dev, Qi Zhang

Remove reduandent code.
item->type != RTE_FLOW_ITEM_TYPE_END already cover
item->type == RTE_FLOW_ITEM_TYPE_VLAN.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---

v3:
-fix comments.

 drivers/net/ixgbe/ixgbe_flow.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index da7b1cc..60ca8d8 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -1544,18 +1544,10 @@ ixgbe_parse_fdir_filter_normal(const struct rte_flow_attr *attr,
 		rule->mask.vlan_tci_mask &= rte_cpu_to_be_16(0xEFFF);
 		/* More than one tags are not supported. */
 
-		/**
-		 * Check if the next not void item is not vlan.
-		 */
+		/* Next not void item must be END */
 		index++;
 		NEXT_ITEM_OF_PATTERN(item, pattern, index);
-		if (item->type == RTE_FLOW_ITEM_TYPE_VLAN) {
-			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
-			rte_flow_error_set(error, EINVAL,
-				RTE_FLOW_ERROR_TYPE_ITEM,
-				item, "Not supported by fdir filter");
-			return -rte_errno;
-		} else if (item->type != RTE_FLOW_ITEM_TYPE_END) {
+		if (item->type != RTE_FLOW_ITEM_TYPE_END) {
 			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
 			rte_flow_error_set(error, EINVAL,
 				RTE_FLOW_ERROR_TYPE_ITEM,
-- 
2.7.4

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [dpdk-dev] [PATCH v3 2/3] net/ixgbe: fix fdir mask not be reset
  2017-06-01 17:36 ` [dpdk-dev] [PATCH v3 0/3] ixgbe: enable flex filter for rte_flow Qi Zhang
  2017-06-01 17:36   ` [dpdk-dev] [PATCH v3 1/3] net/ixgbe: remove reduandent code Qi Zhang
@ 2017-06-01 17:36   ` Qi Zhang
  2017-06-01 17:36   ` [dpdk-dev] [PATCH v3 3/3] net/ixgbe: enable flex bytes for generic flow API Qi Zhang
  2017-06-06 10:26   ` [dpdk-dev] [PATCH v3 0/3] ixgbe: enable flex filter for rte_flow Ferruh Yigit
  3 siblings, 0 replies; 15+ messages in thread
From: Qi Zhang @ 2017-06-01 17:36 UTC (permalink / raw)
  To: wenzhuo.lu, helin.zhang; +Cc: dev, Qi Zhang, stable

When the last fdir flow be destroyed, the flag "mask_added"
should be reset, so the remain mask info will not take effect
when a new flow be added.

Fixes: a14de8b498d1 ("net/ixgbe: destroy consistent filter")
Cc: stable@dpdk.org

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ixgbe/ixgbe_flow.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index 60ca8d8..4e64d8d 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -2639,6 +2639,8 @@ ixgbe_flow_destroy(struct rte_eth_dev *dev,
 	struct ixgbe_eth_l2_tunnel_conf_ele *l2_tn_filter_ptr;
 	struct ixgbe_fdir_rule_ele *fdir_rule_ptr;
 	struct ixgbe_flow_mem *ixgbe_flow_mem_ptr;
+	struct ixgbe_hw_fdir_info *fdir_info =
+		IXGBE_DEV_PRIVATE_TO_FDIR_INFO(dev->data->dev_private);
 
 	switch (filter_type) {
 	case RTE_ETH_FILTER_NTUPLE:
@@ -2691,6 +2693,8 @@ ixgbe_flow_destroy(struct rte_eth_dev *dev,
 			TAILQ_REMOVE(&filter_fdir_list,
 				fdir_rule_ptr, entries);
 			rte_free(fdir_rule_ptr);
+			if (TAILQ_EMPTY(&filter_fdir_list))
+				fdir_info->mask_added = false;
 		}
 		break;
 	case RTE_ETH_FILTER_L2_TUNNEL:
-- 
2.7.4

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [dpdk-dev] [PATCH v3 3/3] net/ixgbe: enable flex bytes for generic flow API
  2017-06-01 17:36 ` [dpdk-dev] [PATCH v3 0/3] ixgbe: enable flex filter for rte_flow Qi Zhang
  2017-06-01 17:36   ` [dpdk-dev] [PATCH v3 1/3] net/ixgbe: remove reduandent code Qi Zhang
  2017-06-01 17:36   ` [dpdk-dev] [PATCH v3 2/3] net/ixgbe: fix fdir mask not be reset Qi Zhang
@ 2017-06-01 17:36   ` Qi Zhang
  2017-06-06 10:26   ` [dpdk-dev] [PATCH v3 0/3] ixgbe: enable flex filter for rte_flow Ferruh Yigit
  3 siblings, 0 replies; 15+ messages in thread
From: Qi Zhang @ 2017-06-01 17:36 UTC (permalink / raw)
  To: wenzhuo.lu, helin.zhang; +Cc: dev, Qi Zhang

Add fdir flex byte support for rte_flow APIs.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.h |   3 +
 drivers/net/ixgbe/ixgbe_fdir.c   |  31 ++++++++-
 drivers/net/ixgbe/ixgbe_flow.c   | 137 ++++++++++++++++++++++++++++++++++++++-
 3 files changed, 167 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index b576a6f..c6449b5 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -189,6 +189,7 @@ struct ixgbe_fdir_rule {
 	uint32_t fdirflags; /* drop or forward */
 	uint32_t soft_id; /* an unique value for this rule */
 	uint8_t queue; /* assigned rx queue */
+	uint8_t flex_bytes_offset;
 };
 
 struct ixgbe_hw_fdir_info {
@@ -624,6 +625,8 @@ void ixgbe_filterlist_flush(void);
  */
 int ixgbe_fdir_configure(struct rte_eth_dev *dev);
 int ixgbe_fdir_set_input_mask(struct rte_eth_dev *dev);
+int ixgbe_fdir_set_flexbytes_offset(struct rte_eth_dev *dev,
+				    uint16_t offset);
 int ixgbe_fdir_filter_program(struct rte_eth_dev *dev,
 			      struct ixgbe_fdir_rule *rule,
 			      bool del, bool update);
diff --git a/drivers/net/ixgbe/ixgbe_fdir.c b/drivers/net/ixgbe/ixgbe_fdir.c
index 7f6c7b5..950f5ba 100644
--- a/drivers/net/ixgbe/ixgbe_fdir.c
+++ b/drivers/net/ixgbe/ixgbe_fdir.c
@@ -302,7 +302,7 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev)
 	 * mask VM pool and DIPv6 since there are currently not supported
 	 * mask FLEX byte, it will be set in flex_conf
 	 */
-	uint32_t fdirm = IXGBE_FDIRM_POOL | IXGBE_FDIRM_DIPv6 | IXGBE_FDIRM_FLEX;
+	uint32_t fdirm = IXGBE_FDIRM_POOL | IXGBE_FDIRM_DIPv6;
 	uint32_t fdirtcpm;  /* TCP source and destination port masks. */
 	uint32_t fdiripv6m; /* IPv6 source and destination masks. */
 	volatile uint32_t *reg;
@@ -333,6 +333,10 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev)
 		return -EINVAL;
 	}
 
+	/* flex byte mask */
+	if (info->mask.flex_bytes_mask == 0)
+		fdirm |= IXGBE_FDIRM_FLEX;
+
 	IXGBE_WRITE_REG(hw, IXGBE_FDIRM, fdirm);
 
 	/* store the TCP/UDP port masks, bit reversed from port layout */
@@ -533,6 +537,31 @@ ixgbe_fdir_set_input_mask(struct rte_eth_dev *dev)
 	return -ENOTSUP;
 }
 
+int
+ixgbe_fdir_set_flexbytes_offset(struct rte_eth_dev *dev,
+				uint16_t offset)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	uint32_t fdirctrl;
+	int i;
+
+	fdirctrl = IXGBE_READ_REG(hw, IXGBE_FDIRCTRL);
+
+	fdirctrl &= ~IXGBE_FDIRCTRL_FLEX_MASK;
+	fdirctrl |= ((offset >> 1) /* convert to word offset */
+		<< IXGBE_FDIRCTRL_FLEX_SHIFT);
+
+	IXGBE_WRITE_REG(hw, IXGBE_FDIRCTRL, fdirctrl);
+	IXGBE_WRITE_FLUSH(hw);
+	for (i = 0; i < IXGBE_FDIR_INIT_DONE_POLL; i++) {
+		if (IXGBE_READ_REG(hw, IXGBE_FDIRCTRL) &
+			IXGBE_FDIRCTRL_INIT_DONE)
+			break;
+		msec_delay(1);
+	}
+	return 0;
+}
+
 static int
 fdir_set_input_mask(struct rte_eth_dev *dev,
 		    const struct rte_eth_fdir_masks *input_mask)
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index 4e64d8d..cae123e 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -78,6 +78,7 @@
 
 #define IXGBE_MIN_N_TUPLE_PRIO 1
 #define IXGBE_MAX_N_TUPLE_PRIO 7
+#define IXGBE_MAX_FLX_SOURCE_OFF 62
 #define NEXT_ITEM_OF_PATTERN(item, pattern, index)\
 	do {		\
 		item = pattern + index;\
@@ -1316,7 +1317,8 @@ ixgbe_parse_fdir_act_attr(const struct rte_flow_attr *attr,
  * UDP/TCP/SCTP PATTERN:
  * The first not void item can be ETH or IPV4.
  * The second not void item must be IPV4 if the first one is ETH.
- * The third not void item must be UDP or TCP or SCTP.
+ * The next not void item could be UDP or TCP or SCTP (optional)
+ * The next not void item could be RAW (for flexbyte, optional)
  * The next not void item must be END.
  * MAC VLAN PATTERN:
  * The first not void item must be ETH.
@@ -1334,6 +1336,14 @@ ixgbe_parse_fdir_act_attr(const struct rte_flow_attr *attr,
  *		dst_addr 192.167.3.50	0xFFFFFFFF
  * UDP/TCP/SCTP	src_port	80	0xFFFF
  *		dst_port	80	0xFFFF
+ * FLEX	relative	0	0x1
+ *		search		0	0x1
+ *		reserved	0	0
+ *		offset		12	0xFFFFFFFF
+ *		limit		0	0xFFFF
+ *		length		2	0xFFFF
+ *		pattern[0]	0x86	0xFF
+ *		pattern[1]	0xDD	0xFF
  * END
  * MAC VLAN pattern example:
  * ITEM		Spec			Mask
@@ -1365,6 +1375,8 @@ ixgbe_parse_fdir_filter_normal(const struct rte_flow_attr *attr,
 	const struct rte_flow_item_sctp *sctp_mask;
 	const struct rte_flow_item_vlan *vlan_spec;
 	const struct rte_flow_item_vlan *vlan_mask;
+	const struct rte_flow_item_raw *raw_mask;
+	const struct rte_flow_item_raw *raw_spec;
 
 	uint32_t index, j;
 
@@ -1396,6 +1408,7 @@ ixgbe_parse_fdir_filter_normal(const struct rte_flow_attr *attr,
 	memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
 	memset(&rule->mask, 0xFF, sizeof(struct ixgbe_hw_fdir_mask));
 	rule->mask.vlan_tci_mask = 0;
+	rule->mask.flex_bytes_mask = 0;
 
 	/* parse pattern */
 	index = 0;
@@ -1621,7 +1634,8 @@ ixgbe_parse_fdir_filter_normal(const struct rte_flow_attr *attr,
 		if (item->type != RTE_FLOW_ITEM_TYPE_TCP &&
 		    item->type != RTE_FLOW_ITEM_TYPE_UDP &&
 		    item->type != RTE_FLOW_ITEM_TYPE_SCTP &&
-		    item->type != RTE_FLOW_ITEM_TYPE_END) {
+		    item->type != RTE_FLOW_ITEM_TYPE_END &&
+		    item->type != RTE_FLOW_ITEM_TYPE_RAW) {
 			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
 			rte_flow_error_set(error, EINVAL,
 				RTE_FLOW_ERROR_TYPE_ITEM,
@@ -1682,6 +1696,18 @@ ixgbe_parse_fdir_filter_normal(const struct rte_flow_attr *attr,
 			rule->ixgbe_fdir.formatted.dst_port =
 				tcp_spec->hdr.dst_port;
 		}
+
+		index++;
+		NEXT_ITEM_OF_PATTERN(item, pattern, index);
+		if (item->type != RTE_FLOW_ITEM_TYPE_RAW &&
+		    item->type != RTE_FLOW_ITEM_TYPE_END) {
+			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
+			rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_ITEM,
+				item, "Not supported by fdir filter");
+			return -rte_errno;
+		}
+
 	}
 
 	/* Get the UDP info */
@@ -1731,6 +1757,18 @@ ixgbe_parse_fdir_filter_normal(const struct rte_flow_attr *attr,
 			rule->ixgbe_fdir.formatted.dst_port =
 				udp_spec->hdr.dst_port;
 		}
+
+		index++;
+		NEXT_ITEM_OF_PATTERN(item, pattern, index);
+		if (item->type != RTE_FLOW_ITEM_TYPE_RAW &&
+		    item->type != RTE_FLOW_ITEM_TYPE_END) {
+			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
+			rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_ITEM,
+				item, "Not supported by fdir filter");
+			return -rte_errno;
+		}
+
 	}
 
 	/* Get the SCTP info */
@@ -1782,6 +1820,88 @@ ixgbe_parse_fdir_filter_normal(const struct rte_flow_attr *attr,
 			rule->ixgbe_fdir.formatted.dst_port =
 				sctp_spec->hdr.dst_port;
 		}
+
+		index++;
+		NEXT_ITEM_OF_PATTERN(item, pattern, index);
+		if (item->type != RTE_FLOW_ITEM_TYPE_RAW &&
+		    item->type != RTE_FLOW_ITEM_TYPE_END) {
+			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
+			rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_ITEM,
+				item, "Not supported by fdir filter");
+			return -rte_errno;
+		}
+	}
+
+	/* Get the flex byte info */
+	if (item->type == RTE_FLOW_ITEM_TYPE_RAW) {
+		/* Not supported last point for range*/
+		if (item->last) {
+			rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+				item, "Not supported last point for range");
+			return -rte_errno;
+		}
+		/* mask should not be null */
+		if (!item->mask || !item->spec) {
+			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
+			rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_ITEM,
+				item, "Not supported by fdir filter");
+			return -rte_errno;
+		}
+
+		raw_mask = (const struct rte_flow_item_raw *)item->mask;
+
+		/* check mask */
+		if (raw_mask->relative != 0x1 ||
+		    raw_mask->search != 0x1 ||
+		    raw_mask->reserved != 0x0 ||
+		    (uint32_t)raw_mask->offset != 0xffffffff ||
+		    raw_mask->limit != 0xffff ||
+		    raw_mask->length != 0xffff) {
+			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
+			rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_ITEM,
+				item, "Not supported by fdir filter");
+			return -rte_errno;
+		}
+
+		raw_spec = (const struct rte_flow_item_raw *)item->spec;
+
+		/* check spec */
+		if (raw_spec->relative != 0 ||
+		    raw_spec->search != 0 ||
+		    raw_spec->reserved != 0 ||
+		    raw_spec->offset > IXGBE_MAX_FLX_SOURCE_OFF ||
+		    raw_spec->offset % 2 ||
+		    raw_spec->limit != 0 ||
+		    raw_spec->length != 2 ||
+		    /* pattern can't be 0xffff */
+		    (raw_spec->pattern[0] == 0xff &&
+		     raw_spec->pattern[1] == 0xff)) {
+			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
+			rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_ITEM,
+				item, "Not supported by fdir filter");
+			return -rte_errno;
+		}
+
+		/* check pattern mask */
+		if (raw_mask->pattern[0] != 0xff ||
+		    raw_mask->pattern[1] != 0xff) {
+			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
+			rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_ITEM,
+				item, "Not supported by fdir filter");
+			return -rte_errno;
+		}
+
+		rule->mask.flex_bytes_mask = 0xffff;
+		rule->ixgbe_fdir.formatted.flex_bytes =
+			(((uint16_t)raw_spec->pattern[1]) << 8) |
+			raw_spec->pattern[0];
+		rule->flex_bytes_offset = raw_spec->offset;
 	}
 
 	if (item->type != RTE_FLOW_ITEM_TYPE_END) {
@@ -1919,7 +2039,7 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr,
 				item, "Not supported by fdir filter");
 			return -rte_errno;
 		}
-		/*Not supported last point for range*/
+		/* Not supported last point for range*/
 		if (item->last) {
 			rte_flow_error_set(error, EINVAL,
 				RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
@@ -2497,6 +2617,13 @@ ixgbe_flow_create(struct rte_eth_dev *dev,
 				rte_memcpy(&fdir_info->mask,
 					&fdir_rule.mask,
 					sizeof(struct ixgbe_hw_fdir_mask));
+				fdir_info->flex_bytes_offset =
+					fdir_rule.flex_bytes_offset;
+
+				if (fdir_rule.mask.flex_bytes_mask)
+					ixgbe_fdir_set_flexbytes_offset(dev,
+						fdir_rule.flex_bytes_offset);
+
 				ret = ixgbe_fdir_set_input_mask(dev);
 				if (ret)
 					goto out;
@@ -2512,6 +2639,10 @@ ixgbe_flow_create(struct rte_eth_dev *dev,
 					sizeof(struct ixgbe_hw_fdir_mask));
 				if (ret)
 					goto out;
+
+				if (fdir_info->flex_bytes_offset !=
+						fdir_rule.flex_bytes_offset)
+					goto out;
 			}
 		}
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/3] net/ixgbe: remove reduandent code
  2017-06-01 17:36   ` [dpdk-dev] [PATCH v3 1/3] net/ixgbe: remove reduandent code Qi Zhang
@ 2017-06-02  1:19     ` Lu, Wenzhuo
  0 siblings, 0 replies; 15+ messages in thread
From: Lu, Wenzhuo @ 2017-06-02  1:19 UTC (permalink / raw)
  To: Zhang, Qi Z, Zhang, Helin; +Cc: dev

Hi,

> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Friday, June 2, 2017 1:37 AM
> To: Lu, Wenzhuo; Zhang, Helin
> Cc: dev@dpdk.org; Zhang, Qi Z
> Subject: [PATCH v3 1/3] net/ixgbe: remove reduandent code
> 
> Remove reduandent code.
> item->type != RTE_FLOW_ITEM_TYPE_END already cover type ==
> item->RTE_FLOW_ITEM_TYPE_VLAN.
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/3] net/ixgbe: enable flex bytes for generic flow API
  2017-05-31 19:45 ` [dpdk-dev] [PATCH v2 3/3] net/ixgbe: enable flex bytes for generic flow API Qi Zhang
@ 2017-06-02  1:49   ` Lu, Wenzhuo
  2017-06-02  2:00     ` Zhang, Qi Z
  0 siblings, 1 reply; 15+ messages in thread
From: Lu, Wenzhuo @ 2017-06-02  1:49 UTC (permalink / raw)
  To: Zhang, Qi Z, Zhang, Helin; +Cc: dev

Hi Qi,


> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Thursday, June 1, 2017 3:46 AM
> To: Lu, Wenzhuo; Zhang, Helin
> Cc: dev@dpdk.org; Zhang, Qi Z
> Subject: [PATCH v2 3/3] net/ixgbe: enable flex bytes for generic flow API
> 
> Add fdir flex byte support for rte_flow APIs.
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> ---
> 
> v2:
> - fix couple checkpatch errors.
> 
>  drivers/net/ixgbe/ixgbe_ethdev.h |   3 +
>  drivers/net/ixgbe/ixgbe_fdir.c   |  31 ++++++++-
>  drivers/net/ixgbe/ixgbe_flow.c   | 137
> ++++++++++++++++++++++++++++++++++++++-
>  3 files changed, 167 insertions(+), 4 deletions(-)


> diff --git a/drivers/net/ixgbe/ixgbe_fdir.c b/drivers/net/ixgbe/ixgbe_fdir.c
> index 7f6c7b5..950f5ba 100644
> --- a/drivers/net/ixgbe/ixgbe_fdir.c
> +++ b/drivers/net/ixgbe/ixgbe_fdir.c
> @@ -302,7 +302,7 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev)
>  	 * mask VM pool and DIPv6 since there are currently not supported
>  	 * mask FLEX byte, it will be set in flex_conf
>  	 */
> -	uint32_t fdirm = IXGBE_FDIRM_POOL | IXGBE_FDIRM_DIPv6 |
> IXGBE_FDIRM_FLEX;
> +	uint32_t fdirm = IXGBE_FDIRM_POOL | IXGBE_FDIRM_DIPv6;
>  	uint32_t fdirtcpm;  /* TCP source and destination port masks. */
>  	uint32_t fdiripv6m; /* IPv6 source and destination masks. */
>  	volatile uint32_t *reg;
> @@ -333,6 +333,10 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev)
>  		return -EINVAL;
>  	}
> 
> +	/* flex byte mask */
> +	if (info->mask.flex_bytes_mask == 0)
> +		fdirm |= IXGBE_FDIRM_FLEX;
> +
>  	IXGBE_WRITE_REG(hw, IXGBE_FDIRM, fdirm);
Should the same change be done for x550?

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/3] net/ixgbe: enable flex bytes for generic flow API
  2017-06-02  1:49   ` Lu, Wenzhuo
@ 2017-06-02  2:00     ` Zhang, Qi Z
  2017-06-02  2:14       ` Lu, Wenzhuo
  0 siblings, 1 reply; 15+ messages in thread
From: Zhang, Qi Z @ 2017-06-02  2:00 UTC (permalink / raw)
  To: Lu, Wenzhuo, Zhang, Helin; +Cc: dev



> -----Original Message-----
> From: Lu, Wenzhuo
> Sent: Friday, June 2, 2017 9:49 AM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Zhang, Helin
> <helin.zhang@intel.com>
> Cc: dev@dpdk.org
> Subject: RE: [PATCH v2 3/3] net/ixgbe: enable flex bytes for generic flow API
> 
> Hi Qi,
> 
> 
> > -----Original Message-----
> > From: Zhang, Qi Z
> > Sent: Thursday, June 1, 2017 3:46 AM
> > To: Lu, Wenzhuo; Zhang, Helin
> > Cc: dev@dpdk.org; Zhang, Qi Z
> > Subject: [PATCH v2 3/3] net/ixgbe: enable flex bytes for generic flow
> > API
> >
> > Add fdir flex byte support for rte_flow APIs.
> >
> > Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> > ---
> >
> > v2:
> > - fix couple checkpatch errors.
> >
> >  drivers/net/ixgbe/ixgbe_ethdev.h |   3 +
> >  drivers/net/ixgbe/ixgbe_fdir.c   |  31 ++++++++-
> >  drivers/net/ixgbe/ixgbe_flow.c   | 137
> > ++++++++++++++++++++++++++++++++++++++-
> >  3 files changed, 167 insertions(+), 4 deletions(-)
> 
> 
> > diff --git a/drivers/net/ixgbe/ixgbe_fdir.c
> > b/drivers/net/ixgbe/ixgbe_fdir.c index 7f6c7b5..950f5ba 100644
> > --- a/drivers/net/ixgbe/ixgbe_fdir.c
> > +++ b/drivers/net/ixgbe/ixgbe_fdir.c
> > @@ -302,7 +302,7 @@ fdir_set_input_mask_82599(struct rte_eth_dev
> *dev)
> >  	 * mask VM pool and DIPv6 since there are currently not supported
> >  	 * mask FLEX byte, it will be set in flex_conf
> >  	 */
> > -	uint32_t fdirm = IXGBE_FDIRM_POOL | IXGBE_FDIRM_DIPv6 |
> > IXGBE_FDIRM_FLEX;
> > +	uint32_t fdirm = IXGBE_FDIRM_POOL | IXGBE_FDIRM_DIPv6;
> >  	uint32_t fdirtcpm;  /* TCP source and destination port masks. */
> >  	uint32_t fdiripv6m; /* IPv6 source and destination masks. */
> >  	volatile uint32_t *reg;
> > @@ -333,6 +333,10 @@ fdir_set_input_mask_82599(struct rte_eth_dev
> *dev)
> >  		return -EINVAL;
> >  	}
> >
> > +	/* flex byte mask */
> > +	if (info->mask.flex_bytes_mask == 0)
> > +		fdirm |= IXGBE_FDIRM_FLEX;
> > +
> >  	IXGBE_WRITE_REG(hw, IXGBE_FDIRM, fdirm);
> Should the same change be done for x550?
> 
Currently I didn't see it is necessary.
Because I saw fdir_set_input_mask_x550 will only be used for mac-vlan and tunneling filter
where flex byte is not considered in this patch. so keep it disabled
Please correct if I miss something.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/3] net/ixgbe: enable flex bytes for generic flow API
  2017-06-02  2:00     ` Zhang, Qi Z
@ 2017-06-02  2:14       ` Lu, Wenzhuo
  0 siblings, 0 replies; 15+ messages in thread
From: Lu, Wenzhuo @ 2017-06-02  2:14 UTC (permalink / raw)
  To: Zhang, Qi Z, Zhang, Helin; +Cc: dev

Hi Qi,

> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Friday, June 2, 2017 10:00 AM
> To: Lu, Wenzhuo; Zhang, Helin
> Cc: dev@dpdk.org
> Subject: RE: [PATCH v2 3/3] net/ixgbe: enable flex bytes for generic flow API
> 
> 
> 
> > -----Original Message-----
> > From: Lu, Wenzhuo
> > Sent: Friday, June 2, 2017 9:49 AM
> > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Zhang, Helin
> > <helin.zhang@intel.com>
> > Cc: dev@dpdk.org
> > Subject: RE: [PATCH v2 3/3] net/ixgbe: enable flex bytes for generic
> > flow API
> >
> > Hi Qi,
> >
> >
> > > -----Original Message-----
> > > From: Zhang, Qi Z
> > > Sent: Thursday, June 1, 2017 3:46 AM
> > > To: Lu, Wenzhuo; Zhang, Helin
> > > Cc: dev@dpdk.org; Zhang, Qi Z
> > > Subject: [PATCH v2 3/3] net/ixgbe: enable flex bytes for generic
> > > flow API
> > >
> > > Add fdir flex byte support for rte_flow APIs.
> > >
> > > Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> > > ---
> > >
> > > v2:
> > > - fix couple checkpatch errors.
> > >
> > >  drivers/net/ixgbe/ixgbe_ethdev.h |   3 +
> > >  drivers/net/ixgbe/ixgbe_fdir.c   |  31 ++++++++-
> > >  drivers/net/ixgbe/ixgbe_flow.c   | 137
> > > ++++++++++++++++++++++++++++++++++++++-
> > >  3 files changed, 167 insertions(+), 4 deletions(-)
> >
> >
> > > diff --git a/drivers/net/ixgbe/ixgbe_fdir.c
> > > b/drivers/net/ixgbe/ixgbe_fdir.c index 7f6c7b5..950f5ba 100644
> > > --- a/drivers/net/ixgbe/ixgbe_fdir.c
> > > +++ b/drivers/net/ixgbe/ixgbe_fdir.c
> > > @@ -302,7 +302,7 @@ fdir_set_input_mask_82599(struct rte_eth_dev
> > *dev)
> > >  	 * mask VM pool and DIPv6 since there are currently not supported
> > >  	 * mask FLEX byte, it will be set in flex_conf
> > >  	 */
> > > -	uint32_t fdirm = IXGBE_FDIRM_POOL | IXGBE_FDIRM_DIPv6 |
> > > IXGBE_FDIRM_FLEX;
> > > +	uint32_t fdirm = IXGBE_FDIRM_POOL | IXGBE_FDIRM_DIPv6;
> > >  	uint32_t fdirtcpm;  /* TCP source and destination port masks. */
> > >  	uint32_t fdiripv6m; /* IPv6 source and destination masks. */
> > >  	volatile uint32_t *reg;
> > > @@ -333,6 +333,10 @@ fdir_set_input_mask_82599(struct rte_eth_dev
> > *dev)
> > >  		return -EINVAL;
> > >  	}
> > >
> > > +	/* flex byte mask */
> > > +	if (info->mask.flex_bytes_mask == 0)
> > > +		fdirm |= IXGBE_FDIRM_FLEX;
> > > +
> > >  	IXGBE_WRITE_REG(hw, IXGBE_FDIRM, fdirm);
> > Should the same change be done for x550?
> >
> Currently I didn't see it is necessary.
> Because I saw fdir_set_input_mask_x550 will only be used for mac-vlan and
> tunneling filter where flex byte is not considered in this patch. so keep it
> disabled Please correct if I miss something.
O, this patch only enables flexible bytes for IP flow. You already say that in the comments. It's not necessary to change the x550 code.

Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/3] ixgbe: enable flex filter for rte_flow
  2017-06-01 17:36 ` [dpdk-dev] [PATCH v3 0/3] ixgbe: enable flex filter for rte_flow Qi Zhang
                     ` (2 preceding siblings ...)
  2017-06-01 17:36   ` [dpdk-dev] [PATCH v3 3/3] net/ixgbe: enable flex bytes for generic flow API Qi Zhang
@ 2017-06-06 10:26   ` Ferruh Yigit
  3 siblings, 0 replies; 15+ messages in thread
From: Ferruh Yigit @ 2017-06-06 10:26 UTC (permalink / raw)
  To: Qi Zhang, wenzhuo.lu, helin.zhang; +Cc: dev

On 6/1/2017 6:36 PM, Qi Zhang wrote:
> Enable fdir flex byte support for rte_flow APIs.
> 
> v2:
> - fix couple checkpatch errors.
> 
> v3:
> - fix comment.
> 
> Qi Zhang (3):
>   net/ixgbe: remove reduandent code
>   net/ixgbe: fix fdir mask not be reset
>   net/ixgbe: enable flex bytes for generic flow API

Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>

Series applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-06-06 10:26 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-31 19:45 [dpdk-dev] [PATCH v2 0/3] ixgbe: enable flex filter for rte_flow Qi Zhang
2017-05-31 19:45 ` [dpdk-dev] [PATCH v2 1/3] net/ixgbe: remove reduandent code Qi Zhang
2017-06-01  7:05   ` Lu, Wenzhuo
2017-05-31 19:45 ` [dpdk-dev] [PATCH v2 2/3] net/ixgbe: fix fdir mask not be reset Qi Zhang
2017-06-01  7:17   ` Lu, Wenzhuo
2017-05-31 19:45 ` [dpdk-dev] [PATCH v2 3/3] net/ixgbe: enable flex bytes for generic flow API Qi Zhang
2017-06-02  1:49   ` Lu, Wenzhuo
2017-06-02  2:00     ` Zhang, Qi Z
2017-06-02  2:14       ` Lu, Wenzhuo
2017-06-01 17:36 ` [dpdk-dev] [PATCH v3 0/3] ixgbe: enable flex filter for rte_flow Qi Zhang
2017-06-01 17:36   ` [dpdk-dev] [PATCH v3 1/3] net/ixgbe: remove reduandent code Qi Zhang
2017-06-02  1:19     ` Lu, Wenzhuo
2017-06-01 17:36   ` [dpdk-dev] [PATCH v3 2/3] net/ixgbe: fix fdir mask not be reset Qi Zhang
2017-06-01 17:36   ` [dpdk-dev] [PATCH v3 3/3] net/ixgbe: enable flex bytes for generic flow API Qi Zhang
2017-06-06 10:26   ` [dpdk-dev] [PATCH v3 0/3] ixgbe: enable flex filter for rte_flow Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).