DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] net/iavf: support FDIR TCP/UDP pattern without input set
@ 2020-12-01  8:32 Yuying Zhang
  2020-12-23  8:12 ` Zhang, Qi Z
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Yuying Zhang @ 2020-12-01  8:32 UTC (permalink / raw)
  To: dev, qi.z.zhang, jingjing.wu; +Cc: Yuying Zhang

This patch adds an input set refinement function to support outer
and inner TCP/UDP patterns without input set for flow director filter.

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
---
 drivers/net/iavf/iavf_fdir.c | 67 ++++++++++++++++++++++++++++++------
 1 file changed, 56 insertions(+), 11 deletions(-)

diff --git a/drivers/net/iavf/iavf_fdir.c b/drivers/net/iavf/iavf_fdir.c
index 7054bde0b..2c57313e4 100644
--- a/drivers/net/iavf/iavf_fdir.c
+++ b/drivers/net/iavf/iavf_fdir.c
@@ -448,9 +448,56 @@ iavf_fdir_parse_action(struct iavf_adapter *ad,
 	return 0;
 }
 
+static int
+iavf_fdir_refine_input_set(const uint64_t input_set,
+			   const uint64_t input_set_mask,
+			   struct iavf_fdir_conf *filter)
+{
+	struct virtchnl_proto_hdr *hdr, *hdr_last;
+	struct rte_flow_item_ipv4 ipv4_spec;
+	struct rte_flow_item_ipv6 ipv6_spec;
+	int last_layer;
+	uint8_t proto_id;
+
+	if (input_set & ~input_set_mask)
+		return -rte_errno;
+	else if (input_set)
+		return 0;
+
+	last_layer = filter->add_fltr.rule_cfg.proto_hdrs.count - 1;
+	hdr_last = &filter->add_fltr.rule_cfg.proto_hdrs.proto_hdr[last_layer];
+	if (hdr_last->type == VIRTCHNL_PROTO_HDR_TCP)
+		proto_id = 6;
+	else if (hdr_last->type == VIRTCHNL_PROTO_HDR_UDP)
+		proto_id = 17;
+	else
+		return -rte_errno;
+
+	hdr = &filter->add_fltr.rule_cfg.proto_hdrs.proto_hdr[last_layer - 1];
+	switch (hdr->type) {
+	case VIRTCHNL_PROTO_HDR_IPV4:
+		VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, IPV4, PROT);
+		memset(&ipv4_spec, 0, sizeof(ipv4_spec));
+		ipv4_spec.hdr.next_proto_id = proto_id;
+		rte_memcpy(hdr->buffer, &ipv4_spec.hdr,
+			   sizeof(ipv4_spec.hdr));
+		return 0;
+	case VIRTCHNL_PROTO_HDR_IPV6:
+		VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, IPV6, PROT);
+		memset(&ipv6_spec, 0, sizeof(ipv6_spec));
+		ipv6_spec.hdr.proto = proto_id;
+		rte_memcpy(hdr->buffer, &ipv6_spec.hdr,
+			   sizeof(ipv6_spec.hdr));
+		return 0;
+	default:
+		return -rte_errno;
+	}
+}
+
 static int
 iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad,
 			const struct rte_flow_item pattern[],
+			const uint64_t input_set_mask,
 			struct rte_flow_error *error,
 			struct iavf_fdir_conf *filter)
 {
@@ -924,6 +971,13 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad,
 		return -rte_errno;
 	}
 
+	if (iavf_fdir_refine_input_set(input_set, input_set_mask, filter)) {
+		rte_flow_error_set(error, EINVAL,
+				   RTE_FLOW_ERROR_TYPE_ITEM_SPEC, pattern,
+				   "Invalid input set");
+		return -rte_errno;
+	}
+
 	filter->input_set = input_set;
 
 	return 0;
@@ -941,7 +995,6 @@ iavf_fdir_parse(struct iavf_adapter *ad,
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(ad);
 	struct iavf_fdir_conf *filter = &vf->fdir.conf;
 	struct iavf_pattern_match_item *item = NULL;
-	uint64_t input_set;
 	int ret;
 
 	memset(filter, 0, sizeof(*filter));
@@ -950,19 +1003,11 @@ iavf_fdir_parse(struct iavf_adapter *ad,
 	if (!item)
 		return -rte_errno;
 
-	ret = iavf_fdir_parse_pattern(ad, pattern, error, filter);
+	ret = iavf_fdir_parse_pattern(ad, pattern, item->input_set_mask,
+				      error, filter);
 	if (ret)
 		goto error;
 
-	input_set = filter->input_set;
-	if (!input_set || input_set & ~item->input_set_mask) {
-		rte_flow_error_set(error, EINVAL,
-				RTE_FLOW_ERROR_TYPE_ITEM_SPEC, pattern,
-				"Invalid input set");
-		ret = -rte_errno;
-		goto error;
-	}
-
 	ret = iavf_fdir_parse_action(ad, actions, error, filter);
 	if (ret)
 		goto error;
-- 
2.25.1


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

* Re: [dpdk-dev] [PATCH v1] net/iavf: support FDIR TCP/UDP pattern without input set
  2020-12-01  8:32 [dpdk-dev] [PATCH v1] net/iavf: support FDIR TCP/UDP pattern without input set Yuying Zhang
@ 2020-12-23  8:12 ` Zhang, Qi Z
  2021-01-04 15:21 ` Ferruh Yigit
  2021-01-06 10:49 ` [dpdk-dev] [PATCH v2] " Yuying Zhang
  2 siblings, 0 replies; 5+ messages in thread
From: Zhang, Qi Z @ 2020-12-23  8:12 UTC (permalink / raw)
  To: Zhang, Yuying, dev, Wu, Jingjing



> -----Original Message-----
> From: Zhang, Yuying <yuying.zhang@intel.com>
> Sent: Tuesday, December 1, 2020 4:32 PM
> To: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>
> Cc: Zhang, Yuying <yuying.zhang@intel.com>
> Subject: [PATCH v1] net/iavf: support FDIR TCP/UDP pattern without input set
> 
> This patch adds an input set refinement function to support outer and inner
> TCP/UDP patterns without input set for flow director filter.
> 
> Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>

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

Applied to dpdk-next-net-intel.

Thanks
Qi

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

* Re: [dpdk-dev] [PATCH v1] net/iavf: support FDIR TCP/UDP pattern without input set
  2020-12-01  8:32 [dpdk-dev] [PATCH v1] net/iavf: support FDIR TCP/UDP pattern without input set Yuying Zhang
  2020-12-23  8:12 ` Zhang, Qi Z
@ 2021-01-04 15:21 ` Ferruh Yigit
  2021-01-06 10:49 ` [dpdk-dev] [PATCH v2] " Yuying Zhang
  2 siblings, 0 replies; 5+ messages in thread
From: Ferruh Yigit @ 2021-01-04 15:21 UTC (permalink / raw)
  To: Yuying Zhang, dev, qi.z.zhang, jingjing.wu

On 12/1/2020 8:32 AM, Yuying Zhang wrote:
> This patch adds an input set refinement function to support outer
> and inner TCP/UDP patterns without input set for flow director filter.
> 

Can you please describe more what is supported now, it can be even better to 
give same samples which patter is supported now, which was not supported before?

> Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
> ---
>   drivers/net/iavf/iavf_fdir.c | 67 ++++++++++++++++++++++++++++++------
>   1 file changed, 56 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/iavf/iavf_fdir.c b/drivers/net/iavf/iavf_fdir.c
> index 7054bde0b..2c57313e4 100644
> --- a/drivers/net/iavf/iavf_fdir.c
> +++ b/drivers/net/iavf/iavf_fdir.c
> @@ -448,9 +448,56 @@ iavf_fdir_parse_action(struct iavf_adapter *ad,
>   	return 0;
>   }
>   
> +static int
> +iavf_fdir_refine_input_set(const uint64_t input_set,
> +			   const uint64_t input_set_mask,
> +			   struct iavf_fdir_conf *filter)
> +{
> +	struct virtchnl_proto_hdr *hdr, *hdr_last;
> +	struct rte_flow_item_ipv4 ipv4_spec;
> +	struct rte_flow_item_ipv6 ipv6_spec;
> +	int last_layer;
> +	uint8_t proto_id;
> +
> +	if (input_set & ~input_set_mask)
> +		return -rte_errno;

What is the value of the 'rte_errno' at this stage, why returning it instead of 
setting it?

> +	else if (input_set)
> +		return 0;
> +
> +	last_layer = filter->add_fltr.rule_cfg.proto_hdrs.count - 1;
> +	hdr_last = &filter->add_fltr.rule_cfg.proto_hdrs.proto_hdr[last_layer];
> +	if (hdr_last->type == VIRTCHNL_PROTO_HDR_TCP)
> +		proto_id = 6;
> +	else if (hdr_last->type == VIRTCHNL_PROTO_HDR_UDP)
> +		proto_id = 17;
> +	else
> +		return -rte_errno;
> +
> +	hdr = &filter->add_fltr.rule_cfg.proto_hdrs.proto_hdr[last_layer - 1];

Do we know here that 'last_layer' > 0 ?

> +	switch (hdr->type) {
> +	case VIRTCHNL_PROTO_HDR_IPV4:
> +		VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, IPV4, PROT);
> +		memset(&ipv4_spec, 0, sizeof(ipv4_spec));
> +		ipv4_spec.hdr.next_proto_id = proto_id;
> +		rte_memcpy(hdr->buffer, &ipv4_spec.hdr,
> +			   sizeof(ipv4_spec.hdr));
> +		return 0;
> +	case VIRTCHNL_PROTO_HDR_IPV6:
> +		VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, IPV6, PROT);
> +		memset(&ipv6_spec, 0, sizeof(ipv6_spec));
> +		ipv6_spec.hdr.proto = proto_id;
> +		rte_memcpy(hdr->buffer, &ipv6_spec.hdr,
> +			   sizeof(ipv6_spec.hdr));
> +		return 0;
> +	default:
> +		return -rte_errno;
> +	}
> +}
> +

<...>


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

* [dpdk-dev] [PATCH v2] net/iavf: support FDIR TCP/UDP pattern without input set
  2020-12-01  8:32 [dpdk-dev] [PATCH v1] net/iavf: support FDIR TCP/UDP pattern without input set Yuying Zhang
  2020-12-23  8:12 ` Zhang, Qi Z
  2021-01-04 15:21 ` Ferruh Yigit
@ 2021-01-06 10:49 ` Yuying Zhang
  2021-01-07  4:37   ` Zhang, Qi Z
  2 siblings, 1 reply; 5+ messages in thread
From: Yuying Zhang @ 2021-01-06 10:49 UTC (permalink / raw)
  To: dev, qi.z.zhang, jingjing.wu, ferruh.yigit; +Cc: Yuying Zhang

This patch adds an input set refinement function to support outer
and inner TCP/UDP patterns without input set for flow director filter.

1. flow create 0 ingress pattern eth / ipv4 / udp / end
   actions rss queues 0 1 2 3 end / end
2. flow create 0 ingress pattern eth / ipv6 / tcp / end
   actions queue index 3 / end
This patch supports above patterns which can't be created currently.

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
---
 drivers/net/iavf/iavf_fdir.c | 70 ++++++++++++++++++++++++++++++------
 1 file changed, 59 insertions(+), 11 deletions(-)

diff --git a/drivers/net/iavf/iavf_fdir.c b/drivers/net/iavf/iavf_fdir.c
index d683a468c..c8d53ccab 100644
--- a/drivers/net/iavf/iavf_fdir.c
+++ b/drivers/net/iavf/iavf_fdir.c
@@ -448,9 +448,59 @@ iavf_fdir_parse_action(struct iavf_adapter *ad,
 	return 0;
 }
 
+static bool
+iavf_fdir_refine_input_set(const uint64_t input_set,
+			   const uint64_t input_set_mask,
+			   struct iavf_fdir_conf *filter)
+{
+	struct virtchnl_proto_hdr *hdr, *hdr_last;
+	struct rte_flow_item_ipv4 ipv4_spec;
+	struct rte_flow_item_ipv6 ipv6_spec;
+	int last_layer;
+	uint8_t proto_id;
+
+	if (input_set & ~input_set_mask)
+		return false;
+	else if (input_set)
+		return true;
+
+	last_layer = filter->add_fltr.rule_cfg.proto_hdrs.count - 1;
+	/* Last layer of TCP/UDP pattern isn't less than 2. */
+	if (last_layer < 2)
+		return false;
+	hdr_last = &filter->add_fltr.rule_cfg.proto_hdrs.proto_hdr[last_layer];
+	if (hdr_last->type == VIRTCHNL_PROTO_HDR_TCP)
+		proto_id = 6;
+	else if (hdr_last->type == VIRTCHNL_PROTO_HDR_UDP)
+		proto_id = 17;
+	else
+		return false;
+
+	hdr = &filter->add_fltr.rule_cfg.proto_hdrs.proto_hdr[last_layer - 1];
+	switch (hdr->type) {
+	case VIRTCHNL_PROTO_HDR_IPV4:
+		VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, IPV4, PROT);
+		memset(&ipv4_spec, 0, sizeof(ipv4_spec));
+		ipv4_spec.hdr.next_proto_id = proto_id;
+		rte_memcpy(hdr->buffer, &ipv4_spec.hdr,
+			   sizeof(ipv4_spec.hdr));
+		return true;
+	case VIRTCHNL_PROTO_HDR_IPV6:
+		VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, IPV6, PROT);
+		memset(&ipv6_spec, 0, sizeof(ipv6_spec));
+		ipv6_spec.hdr.proto = proto_id;
+		rte_memcpy(hdr->buffer, &ipv6_spec.hdr,
+			   sizeof(ipv6_spec.hdr));
+		return true;
+	default:
+		return false;
+	}
+}
+
 static int
 iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad,
 			const struct rte_flow_item pattern[],
+			const uint64_t input_set_mask,
 			struct rte_flow_error *error,
 			struct iavf_fdir_conf *filter)
 {
@@ -924,6 +974,13 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad,
 		return -rte_errno;
 	}
 
+	if (!iavf_fdir_refine_input_set(input_set, input_set_mask, filter)) {
+		rte_flow_error_set(error, EINVAL,
+				   RTE_FLOW_ERROR_TYPE_ITEM_SPEC, pattern,
+				   "Invalid input set");
+		return -rte_errno;
+	}
+
 	filter->input_set = input_set;
 
 	return 0;
@@ -941,7 +998,6 @@ iavf_fdir_parse(struct iavf_adapter *ad,
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(ad);
 	struct iavf_fdir_conf *filter = &vf->fdir.conf;
 	struct iavf_pattern_match_item *item = NULL;
-	uint64_t input_set;
 	int ret;
 
 	memset(filter, 0, sizeof(*filter));
@@ -950,19 +1006,11 @@ iavf_fdir_parse(struct iavf_adapter *ad,
 	if (!item)
 		return -rte_errno;
 
-	ret = iavf_fdir_parse_pattern(ad, pattern, error, filter);
+	ret = iavf_fdir_parse_pattern(ad, pattern, item->input_set_mask,
+				      error, filter);
 	if (ret)
 		goto error;
 
-	input_set = filter->input_set;
-	if (!input_set || input_set & ~item->input_set_mask) {
-		rte_flow_error_set(error, EINVAL,
-				RTE_FLOW_ERROR_TYPE_ITEM_SPEC, pattern,
-				"Invalid input set");
-		ret = -rte_errno;
-		goto error;
-	}
-
 	ret = iavf_fdir_parse_action(ad, actions, error, filter);
 	if (ret)
 		goto error;
-- 
2.25.1


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

* Re: [dpdk-dev] [PATCH v2] net/iavf: support FDIR TCP/UDP pattern without input set
  2021-01-06 10:49 ` [dpdk-dev] [PATCH v2] " Yuying Zhang
@ 2021-01-07  4:37   ` Zhang, Qi Z
  0 siblings, 0 replies; 5+ messages in thread
From: Zhang, Qi Z @ 2021-01-07  4:37 UTC (permalink / raw)
  To: Zhang, Yuying, dev, Wu, Jingjing, Yigit, Ferruh



> -----Original Message-----
> From: Zhang, Yuying <yuying.zhang@intel.com>
> Sent: Wednesday, January 6, 2021 6:49 PM
> To: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>
> Cc: Zhang, Yuying <yuying.zhang@intel.com>
> Subject: [PATCH v2] net/iavf: support FDIR TCP/UDP pattern without input set
> 
> This patch adds an input set refinement function to support outer and inner
> TCP/UDP patterns without input set for flow director filter.
> 
> 1. flow create 0 ingress pattern eth / ipv4 / udp / end
>    actions rss queues 0 1 2 3 end / end
> 2. flow create 0 ingress pattern eth / ipv6 / tcp / end
>    actions queue index 3 / end
> This patch supports above patterns which can't be created currently.

Refine the commit a little bit as below:

This patch will refine the inputset when it is empty and generate
a dummy proto type as inputset in l3 header which is required
by the hardware.

> 
> Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>

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

Applied to dpdk-next-net-intel after reverted v1.

Thanks
Qi

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

end of thread, other threads:[~2021-01-07  4:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-01  8:32 [dpdk-dev] [PATCH v1] net/iavf: support FDIR TCP/UDP pattern without input set Yuying Zhang
2020-12-23  8:12 ` Zhang, Qi Z
2021-01-04 15:21 ` Ferruh Yigit
2021-01-06 10:49 ` [dpdk-dev] [PATCH v2] " Yuying Zhang
2021-01-07  4:37   ` Zhang, Qi Z

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git