[20.11,1/7] net/ice: add priority check for flow filters

Message ID 20210910080821.18718-2-wenjun1.wu@intel.com (mailing list archive)
State Not Applicable, archived
Delegated to: Qi Zhang
Headers
Series backport feature support to DPDK 20.11 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing warning apply patch failure

Commit Message

Wenjun Wu Sept. 10, 2021, 8:08 a.m. UTC
  From: Yuying Zhang <yuying.zhang@intel.com>

This patch is not for LTS upstream, just for users to cherry-pick.

Priority 0 and 1 were supported in switch filter. However,
FDIR, ACL and RSS don't support priority 1. Add priority check
in FDIR, ACL and RSS filter parse functions.

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
---
 drivers/net/ice/ice_acl_filter.c  | 5 ++++-
 drivers/net/ice/ice_fdir_filter.c | 5 ++++-
 drivers/net/ice/ice_hash.c        | 5 ++++-
 3 files changed, 12 insertions(+), 3 deletions(-)
  

Patch

diff --git a/drivers/net/ice/ice_acl_filter.c b/drivers/net/ice/ice_acl_filter.c
index 14e36aa9f6..201c9fb382 100644
--- a/drivers/net/ice/ice_acl_filter.c
+++ b/drivers/net/ice/ice_acl_filter.c
@@ -904,7 +904,7 @@  ice_acl_parse(struct ice_adapter *ad,
 	       uint32_t array_len,
 	       const struct rte_flow_item pattern[],
 	       const struct rte_flow_action actions[],
-	       uint32_t priority __rte_unused,
+	       uint32_t priority,
 	       void **meta,
 	       struct rte_flow_error *error)
 {
@@ -914,6 +914,9 @@  ice_acl_parse(struct ice_adapter *ad,
 	uint64_t input_set;
 	int ret;
 
+	if (priority >= 1)
+		return -rte_errno;
+
 	memset(filter, 0, sizeof(*filter));
 	item = ice_search_pattern_match_item(pattern, array, array_len, error);
 	if (!item)
diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index be04fcb8f3..1a9280a2eb 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -2029,7 +2029,7 @@  ice_fdir_parse(struct ice_adapter *ad,
 	       uint32_t array_len,
 	       const struct rte_flow_item pattern[],
 	       const struct rte_flow_action actions[],
-	       uint32_t priority __rte_unused,
+	       uint32_t priority,
 	       void **meta,
 	       struct rte_flow_error *error)
 {
@@ -2039,6 +2039,9 @@  ice_fdir_parse(struct ice_adapter *ad,
 	uint64_t input_set;
 	int ret;
 
+	if (priority >= 1)
+		return -rte_errno;
+
 	memset(filter, 0, sizeof(*filter));
 	item = ice_search_pattern_match_item(pattern, array, array_len, error);
 	if (!item)
diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
index ae095eb3cf..b8a87ea1dd 100644
--- a/drivers/net/ice/ice_hash.c
+++ b/drivers/net/ice/ice_hash.c
@@ -1238,7 +1238,7 @@  ice_hash_parse_pattern_action(__rte_unused struct ice_adapter *ad,
 			uint32_t array_len,
 			const struct rte_flow_item pattern[],
 			const struct rte_flow_action actions[],
-			uint32_t priority __rte_unused,
+			uint32_t priority,
 			void **meta,
 			struct rte_flow_error *error)
 {
@@ -1246,6 +1246,9 @@  ice_hash_parse_pattern_action(__rte_unused struct ice_adapter *ad,
 	struct ice_pattern_match_item *pattern_match_item;
 	struct rss_meta *rss_meta_ptr;
 
+	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,