[dpdk-dev] [PATCH 20.11 2/7] net/ice: refine flow priority usage

Wenjun Wu wenjun1.wu at intel.com
Fri Sep 10 10:08:16 CEST 2021


From: Yuying Zhang <yuying.zhang at intel.com>

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

Current code uses switch filter as backup of FDIR in non-pipeline
mode and Value 1 denotes higher priority. This patch refines priority
usage to match the original design of rte_flow attribute. When priority
is 0, rules are create in switch filter first and FDIR is used as backup.
When priority is 1, only switch filter is supported and has lower priority.

Signed-off-by: Yuying Zhang <yuying.zhang at intel.com>
---
 drivers/net/ice/ice_generic_flow.c  | 4 ++--
 drivers/net/ice/ice_switch_filter.c | 7 +++++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c
index ec141e8fa0..e195161a18 100644
--- a/drivers/net/ice/ice_generic_flow.c
+++ b/drivers/net/ice/ice_generic_flow.c
@@ -1927,9 +1927,9 @@ ice_register_parser(struct ice_flow_parser *parser,
 	} else {
 		if (parser->engine->type == ICE_FLOW_ENGINE_SWITCH ||
 				parser->engine->type == ICE_FLOW_ENGINE_HASH)
-			TAILQ_INSERT_TAIL(list, parser_node, node);
-		else if (parser->engine->type == ICE_FLOW_ENGINE_FDIR)
 			TAILQ_INSERT_HEAD(list, parser_node, node);
+		else if (parser->engine->type == ICE_FLOW_ENGINE_FDIR)
+			TAILQ_INSERT_TAIL(list, parser_node, node);
 		else if (parser->engine->type == ICE_FLOW_ENGINE_ACL)
 			TAILQ_INSERT_HEAD(list, parser_node, node);
 		else
diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index db1586c970..45fa9723d2 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -1560,7 +1560,7 @@ ice_switch_parse_dcf_action(struct ice_dcf_adapter *ad,
 	rule_info->sw_act.src = rule_info->sw_act.vsi_handle;
 	rule_info->sw_act.flag = ICE_FLTR_RX;
 	rule_info->rx = 1;
-	rule_info->priority = priority + 5;
+	rule_info->priority = 6 - priority;
 
 	return 0;
 }
@@ -1639,7 +1639,7 @@ ice_switch_parse_action(struct ice_pf *pf,
 	rule_info->sw_act.vsi_handle = vsi->idx;
 	rule_info->rx = 1;
 	rule_info->sw_act.src = vsi->idx;
-	rule_info->priority = priority + 5;
+	rule_info->priority = 6 - priority;
 
 	return 0;
 
@@ -1749,6 +1749,9 @@ ice_switch_parse_pattern_action(struct ice_adapter *ad,
 			ICE_NON_TUN;
 	struct ice_pattern_match_item *pattern_match_item = NULL;
 
+	if (priority != 0 && priority != 1)
+		return rte_errno;
+
 	for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
 		item_num++;
 		if (item->type == RTE_FLOW_ITEM_TYPE_ETH) {
-- 
2.25.1



More information about the dev mailing list