DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jie Wang <jie1x.wang@intel.com>
To: dev@dpdk.org
Cc: qiming.yang@intel.com, qi.z.zhang@intel.com,
	jingjing.wu@intel.com, beilei.xing@intel.com,
	stevex.yang@intel.com, Jie Wang <jie1x.wang@intel.com>
Subject: [PATCH v5 5/5] net/iavf: support priority of flow rule
Date: Wed,  7 Sep 2022 13:10:40 +0800	[thread overview]
Message-ID: <20220907051040.119588-6-jie1x.wang@intel.com> (raw)
In-Reply-To: <20220907051040.119588-1-jie1x.wang@intel.com>

Add flow rule attribute "priority" support for AVF.

Lower values denote higher priority, the highest priority for
a flow rule is 0.

All subscription rule will have a lower priority than the rules
that be created by host.

Signed-off-by: Jie Wang <jie1x.wang@intel.com>
---
 drivers/net/iavf/iavf_fdir.c         |  4 ++++
 drivers/net/iavf/iavf_fsub.c         |  2 +-
 drivers/net/iavf/iavf_generic_flow.c | 23 +++++++++++++----------
 drivers/net/iavf/iavf_generic_flow.h |  1 +
 drivers/net/iavf/iavf_hash.c         |  5 +++++
 drivers/net/iavf/iavf_ipsec_crypto.c | 16 ++++++++++------
 6 files changed, 34 insertions(+), 17 deletions(-)

diff --git a/drivers/net/iavf/iavf_fdir.c b/drivers/net/iavf/iavf_fdir.c
index a397047fdb..8f80873925 100644
--- a/drivers/net/iavf/iavf_fdir.c
+++ b/drivers/net/iavf/iavf_fdir.c
@@ -1583,6 +1583,7 @@ iavf_fdir_parse(struct iavf_adapter *ad,
 		uint32_t array_len,
 		const struct rte_flow_item pattern[],
 		const struct rte_flow_action actions[],
+		uint32_t priority,
 		void **meta,
 		struct rte_flow_error *error)
 {
@@ -1593,6 +1594,9 @@ iavf_fdir_parse(struct iavf_adapter *ad,
 
 	memset(filter, 0, sizeof(*filter));
 
+	if (priority >= 1)
+		return -rte_errno;
+
 	item = iavf_search_pattern_match_item(pattern, array, array_len, error);
 	if (!item)
 		return -rte_errno;
diff --git a/drivers/net/iavf/iavf_fsub.c b/drivers/net/iavf/iavf_fsub.c
index 28857d7577..3bb6c30d3c 100644
--- a/drivers/net/iavf/iavf_fsub.c
+++ b/drivers/net/iavf/iavf_fsub.c
@@ -649,13 +649,13 @@ iavf_fsub_parse(struct iavf_adapter *ad,
 		uint32_t array_len,
 		const struct rte_flow_item pattern[],
 		const struct rte_flow_action actions[],
+		uint32_t priority,
 		void **meta,
 		struct rte_flow_error *error)
 {
 	struct iavf_fsub_conf *filter;
 	struct iavf_pattern_match_item *pattern_match_item = NULL;
 	int ret = 0;
-	uint32_t priority = 0;
 
 	filter = rte_zmalloc(NULL, sizeof(*filter), 0);
 	if (!filter) {
diff --git a/drivers/net/iavf/iavf_generic_flow.c b/drivers/net/iavf/iavf_generic_flow.c
index b04614ba6e..f33c764764 100644
--- a/drivers/net/iavf/iavf_generic_flow.c
+++ b/drivers/net/iavf/iavf_generic_flow.c
@@ -1785,6 +1785,7 @@ enum rte_flow_item_type iavf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv6_tcp[] = {
 typedef struct iavf_flow_engine * (*parse_engine_t)(struct iavf_adapter *ad,
 		struct rte_flow *flow,
 		struct iavf_parser_list *parser_list,
+		uint32_t priority,
 		const struct rte_flow_item pattern[],
 		const struct rte_flow_action actions[],
 		struct rte_flow_error *error);
@@ -1951,11 +1952,11 @@ iavf_flow_valid_attr(const struct rte_flow_attr *attr,
 		return -rte_errno;
 	}
 
-	/* Not supported */
-	if (attr->priority) {
+	/* support priority for flow subscribe */
+	if (attr->priority > 1) {
 		rte_flow_error_set(error, EINVAL,
 				RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY,
-				attr, "Not support priority.");
+				attr, "Only support priority 0 and 1.");
 		return -rte_errno;
 	}
 
@@ -2098,6 +2099,7 @@ static struct iavf_flow_engine *
 iavf_parse_engine_create(struct iavf_adapter *ad,
 		struct rte_flow *flow,
 		struct iavf_parser_list *parser_list,
+		uint32_t priority,
 		const struct rte_flow_item pattern[],
 		const struct rte_flow_action actions[],
 		struct rte_flow_error *error)
@@ -2111,7 +2113,7 @@ iavf_parse_engine_create(struct iavf_adapter *ad,
 		if (parser_node->parser->parse_pattern_action(ad,
 				parser_node->parser->array,
 				parser_node->parser->array_len,
-				pattern, actions, &meta, error) < 0)
+				pattern, actions, priority, &meta, error) < 0)
 			continue;
 
 		engine = parser_node->parser->engine;
@@ -2127,6 +2129,7 @@ static struct iavf_flow_engine *
 iavf_parse_engine_validate(struct iavf_adapter *ad,
 		struct rte_flow *flow,
 		struct iavf_parser_list *parser_list,
+		uint32_t priority,
 		const struct rte_flow_item pattern[],
 		const struct rte_flow_action actions[],
 		struct rte_flow_error *error)
@@ -2140,7 +2143,7 @@ iavf_parse_engine_validate(struct iavf_adapter *ad,
 		if (parser_node->parser->parse_pattern_action(ad,
 				parser_node->parser->array,
 				parser_node->parser->array_len,
-				pattern, actions, &meta,  error) < 0)
+				pattern, actions, priority, &meta, error) < 0)
 			continue;
 
 		engine = parser_node->parser->engine;
@@ -2201,18 +2204,18 @@ iavf_flow_process_filter(struct rte_eth_dev *dev,
 	if (ret)
 		return ret;
 
-	*engine = iavf_parse_engine(ad, flow, &vf->rss_parser_list, pattern,
-				    actions, error);
+	*engine = iavf_parse_engine(ad, flow, &vf->rss_parser_list,
+				    attr->priority, pattern, actions, error);
 	if (*engine)
 		return 0;
 
-	*engine = iavf_parse_engine(ad, flow, &vf->dist_parser_list, pattern,
-				    actions, error);
+	*engine = iavf_parse_engine(ad, flow, &vf->dist_parser_list,
+				    attr->priority, pattern, actions, error);
 	if (*engine)
 		return 0;
 
 	*engine = iavf_parse_engine(ad, flow, &vf->ipsec_crypto_parser_list,
-			pattern, actions, error);
+				    attr->priority, pattern, actions, error);
 	if (*engine)
 		return 0;
 
diff --git a/drivers/net/iavf/iavf_generic_flow.h b/drivers/net/iavf/iavf_generic_flow.h
index 448facffa5..60d8ab02b4 100644
--- a/drivers/net/iavf/iavf_generic_flow.h
+++ b/drivers/net/iavf/iavf_generic_flow.h
@@ -471,6 +471,7 @@ typedef int (*parse_pattern_action_t)(struct iavf_adapter *ad,
 		uint32_t array_len,
 		const struct rte_flow_item pattern[],
 		const struct rte_flow_action actions[],
+		uint32_t priority,
 		void **meta,
 		struct rte_flow_error *error);
 
diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index 42df7c4e48..dea4e0aa0a 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -86,6 +86,7 @@ iavf_hash_parse_pattern_action(struct iavf_adapter *ad,
 			       uint32_t array_len,
 			       const struct rte_flow_item pattern[],
 			       const struct rte_flow_action actions[],
+			       uint32_t priority,
 			       void **meta,
 			       struct rte_flow_error *error);
 
@@ -1509,6 +1510,7 @@ iavf_hash_parse_pattern_action(__rte_unused struct iavf_adapter *ad,
 			       uint32_t array_len,
 			       const struct rte_flow_item pattern[],
 			       const struct rte_flow_action actions[],
+			       uint32_t priority,
 			       void **meta,
 			       struct rte_flow_error *error)
 {
@@ -1517,6 +1519,9 @@ iavf_hash_parse_pattern_action(__rte_unused struct iavf_adapter *ad,
 	uint64_t phint = IAVF_PHINT_NONE;
 	int ret = 0;
 
+	if (priority >= 1)
+		return -rte_errno;
+
 	rss_meta_ptr = rte_zmalloc(NULL, sizeof(*rss_meta_ptr), 0);
 	if (!rss_meta_ptr) {
 		rte_flow_error_set(error, EINVAL,
diff --git a/drivers/net/iavf/iavf_ipsec_crypto.c b/drivers/net/iavf/iavf_ipsec_crypto.c
index 1d465b4419..cec1b968fe 100644
--- a/drivers/net/iavf/iavf_ipsec_crypto.c
+++ b/drivers/net/iavf/iavf_ipsec_crypto.c
@@ -1933,16 +1933,20 @@ static struct iavf_flow_engine iavf_ipsec_flow_engine = {
 
 static int
 iavf_ipsec_flow_parse(struct iavf_adapter *ad,
-		       struct iavf_pattern_match_item *array,
-		       uint32_t array_len,
-		       const struct rte_flow_item pattern[],
-		       const struct rte_flow_action actions[],
-		       void **meta,
-		       struct rte_flow_error *error)
+		      struct iavf_pattern_match_item *array,
+		      uint32_t array_len,
+		      const struct rte_flow_item pattern[],
+		      const struct rte_flow_action actions[],
+		      uint32_t priority,
+		      void **meta,
+		      struct rte_flow_error *error)
 {
 	struct iavf_pattern_match_item *item = NULL;
 	int ret = -1;
 
+	if (priority >= 1)
+		return -rte_errno;
+
 	item = iavf_search_pattern_match_item(pattern, array, array_len, error);
 	if (item && item->meta) {
 		uint32_t type = (uint64_t)(item->meta);
-- 
2.25.1


  parent reply	other threads:[~2022-09-07  5:11 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-09  6:21 [PATCH 0/2] support flow subscription Jie Wang
2022-08-09  6:21 ` [PATCH 1/2] common/iavf: " Jie Wang
2022-08-09  6:21 ` [PATCH 2/2] net/iavf: enable flow subscription rule support for AVF Jie Wang
2022-08-12 17:04 ` [PATCH v2 0/5] support flow subscription Jie Wang
2022-08-12 17:04   ` [PATCH v2 1/5] common/iavf: " Jie Wang
2022-08-12 17:04   ` [PATCH v2 2/5] net/iavf: add flow subscription to AVF Jie Wang
2022-08-12 17:04   ` [PATCH v2 3/5] net/iavf: support flow subscrption pattern Jie Wang
2022-08-12 17:04   ` [PATCH v2 4/5] net/iavf: support flow subscription rule Jie Wang
2022-08-12 17:04   ` [PATCH v2 5/5] net/iavf: support priority of flow rule Jie Wang
2022-08-30 18:05 ` [PATCH v3 0/5] support flow subscription Jie Wang
2022-08-30 18:05   ` [PATCH v3 1/5] common/iavf: " Jie Wang
2022-08-30 18:05   ` [PATCH v3 2/5] net/iavf: add flow subscription to AVF Jie Wang
2022-08-30 18:05   ` [PATCH v3 3/5] net/iavf: support flow subscrption pattern Jie Wang
2022-09-06  7:30     ` Zhang, Qi Z
2022-08-30 18:05   ` [PATCH v3 4/5] net/iavf: support flow subscription rule Jie Wang
2022-08-30 18:05   ` [PATCH v3 5/5] net/iavf: support priority of flow rule Jie Wang
2022-08-31 10:56   ` [PATCH v3 0/5] support flow subscription Ferruh Yigit
2022-08-31 12:28     ` Zhang, Qi Z
2022-08-31 12:53       ` Ferruh Yigit
2022-09-01  0:59         ` Zhang, Qi Z
2022-09-07  3:35 ` [PATCH v4 " Jie Wang
2022-09-07  3:35   ` [PATCH v4 1/5] common/iavf: " Jie Wang
2022-09-07  3:35   ` [PATCH v4 2/5] net/iavf: add flow subscription to AVF Jie Wang
2022-09-07  3:35   ` [PATCH v4 3/5] net/iavf: support flow subscrption pattern Jie Wang
2022-09-07  3:35   ` [PATCH v4 4/5] net/iavf: support flow subscription rule Jie Wang
2022-09-07  3:35   ` [PATCH v4 5/5] net/iavf: support priority of flow rule Jie Wang
2022-09-07  4:38 ` [PATCH v4 0/5] support flow subscription Jie Wang
2022-09-07  4:38   ` [PATCH v4 1/5] common/iavf: " Jie Wang
2022-09-07  4:38   ` [PATCH v4 2/5] net/iavf: add flow subscription to AVF Jie Wang
2022-09-07  4:38   ` [PATCH v4 3/5] net/iavf: support flow subscrption pattern Jie Wang
2022-09-07  4:38   ` [PATCH v4 4/5] net/iavf: support flow subscription rule Jie Wang
2022-09-07  4:38   ` [PATCH v4 5/5] net/iavf: support priority of flow rule Jie Wang
2022-09-07  5:10 ` [PATCH v5 0/5] support flow subscription Jie Wang
2022-09-07  5:10   ` [PATCH v5 1/5] common/iavf: " Jie Wang
2022-09-07  5:10   ` [PATCH v5 2/5] net/iavf: add flow subscription to AVF Jie Wang
2022-09-07  5:10   ` [PATCH v5 3/5] net/iavf: support flow subscrption pattern Jie Wang
2022-09-07  5:27     ` Zhang, Qi Z
2022-09-07  5:10   ` [PATCH v5 4/5] net/iavf: support flow subscription rule Jie Wang
2022-09-07  5:10   ` Jie Wang [this message]
2022-09-07  5:28   ` [PATCH v5 0/5] support flow subscription Zhang, Qi Z

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220907051040.119588-6-jie1x.wang@intel.com \
    --to=jie1x.wang@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=stevex.yang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).