DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ice: fix rte flow framework
@ 2019-10-28 17:43 Ying Wang
  2019-10-29  3:19 ` Zhang, Qi Z
  2019-10-29  6:20 ` Ye Xiaolong
  0 siblings, 2 replies; 3+ messages in thread
From: Ying Wang @ 2019-10-28 17:43 UTC (permalink / raw)
  To: xiaolong.ye, qi.z.zhang; +Cc: dev, qiming.yang, ying.a.wang

In non-pipeline mode, switch should be used as fdir's backup.
The patch fiexed rule can't be created when fdir's flow table is full.

Fixes: 7615a6895009 ("net/ice: rework for generic flow enabling")

Signed-off-by: Ying Wang <ying.a.wang@intel.com>
---
 drivers/net/ice/ice_generic_flow.c | 84 ++++++++++++++++++++++++++------------
 1 file changed, 58 insertions(+), 26 deletions(-)

diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c
index 7133dd7ff..5594f8555 100644
--- a/drivers/net/ice/ice_generic_flow.c
+++ b/drivers/net/ice/ice_generic_flow.c
@@ -1347,6 +1347,14 @@ enum rte_flow_item_type pattern_eth_qinq_pppoes_ipv6_icmp6[] = {
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
+typedef struct ice_flow_engine * (*parse_engine_t)(struct ice_adapter *ad,
+		struct rte_flow *flow,
+		struct ice_parser_list *parser_list,
+		const struct rte_flow_item pattern[],
+		const struct rte_flow_action actions[],
+		void **meta,
+		struct rte_flow_error *error);
+
 void
 ice_register_flow_engine(struct ice_flow_engine *engine)
 {
@@ -1677,7 +1685,42 @@ ice_search_pattern_match_item(const struct rte_flow_item pattern[],
 }
 
 static struct ice_flow_engine *
-ice_parse_engine(struct ice_adapter *ad,
+ice_parse_engine_create(struct ice_adapter *ad,
+		struct rte_flow *flow,
+		struct ice_parser_list *parser_list,
+		const struct rte_flow_item pattern[],
+		const struct rte_flow_action actions[],
+		void **meta,
+		struct rte_flow_error *error)
+{
+	struct ice_flow_engine *engine = NULL;
+	struct ice_flow_parser_node *parser_node;
+	void *temp;
+
+	TAILQ_FOREACH_SAFE(parser_node, parser_list, node, temp) {
+		if (parser_node->parser->parse_pattern_action(ad,
+				parser_node->parser->array,
+				parser_node->parser->array_len,
+				pattern, actions, meta, error) < 0)
+			continue;
+
+		engine = parser_node->parser->engine;
+		if (engine->create == NULL) {
+			rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_HANDLE,
+					NULL, "Invalid engine");
+			continue;
+		}
+
+		if (!(engine->create(ad, flow, *meta, error)))
+			return engine;
+	}
+	return NULL;
+}
+
+static struct ice_flow_engine *
+ice_parse_engine_validate(struct ice_adapter *ad,
+		struct rte_flow *flow __rte_unused,
 		struct ice_parser_list *parser_list,
 		const struct rte_flow_item pattern[],
 		const struct rte_flow_action actions[],
@@ -1702,12 +1745,14 @@ ice_parse_engine(struct ice_adapter *ad,
 }
 
 static int
-ice_flow_validate_filter(struct rte_eth_dev *dev,
+ice_flow_process_filter(struct rte_eth_dev *dev,
+		struct rte_flow *flow,
 		const struct rte_flow_attr *attr,
 		const struct rte_flow_item pattern[],
 		const struct rte_flow_action actions[],
 		struct ice_flow_engine **engine,
 		void **meta,
+		parse_engine_t ice_parse_engine,
 		struct rte_flow_error *error)
 {
 	int ret = ICE_ERR_NOT_SUPPORTED;
@@ -1740,20 +1785,20 @@ ice_flow_validate_filter(struct rte_eth_dev *dev,
 	if (ret)
 		return ret;
 
-	*engine = ice_parse_engine(ad, &pf->rss_parser_list, pattern, actions,
-			meta, error);
+	*engine = ice_parse_engine(ad, flow, &pf->rss_parser_list,
+			pattern, actions, meta, error);
 	if (*engine != NULL)
 		return 0;
 
 	switch (ice_pipeline_stage) {
 	case ICE_FLOW_CLASSIFY_STAGE_DISTRIBUTOR_ONLY:
 	case ICE_FLOW_CLASSIFY_STAGE_DISTRIBUTOR:
-		*engine = ice_parse_engine(ad, &pf->dist_parser_list, pattern,
-				actions, meta, error);
+		*engine = ice_parse_engine(ad, flow, &pf->dist_parser_list,
+				pattern, actions, meta, error);
 		break;
 	case ICE_FLOW_CLASSIFY_STAGE_PERMISSION:
-		*engine = ice_parse_engine(ad, &pf->perm_parser_list, pattern,
-				actions, meta, error);
+		*engine = ice_parse_engine(ad, flow, &pf->perm_parser_list,
+				pattern, actions, meta, error);
 		break;
 	default:
 		return -EINVAL;
@@ -1775,8 +1820,8 @@ ice_flow_validate(struct rte_eth_dev *dev,
 	void *meta;
 	struct ice_flow_engine *engine;
 
-	return ice_flow_validate_filter(dev, attr, pattern, actions,
-			&engine, &meta, error);
+	return ice_flow_process_filter(dev, NULL, attr, pattern, actions,
+			&engine, &meta, ice_parse_engine_validate, error);
 }
 
 static struct rte_flow *
@@ -1789,8 +1834,6 @@ ice_flow_create(struct rte_eth_dev *dev,
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	struct rte_flow *flow = NULL;
 	int ret;
-	struct ice_adapter *ad =
-		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct ice_flow_engine *engine = NULL;
 	void *meta;
 
@@ -1802,24 +1845,13 @@ ice_flow_create(struct rte_eth_dev *dev,
 		return flow;
 	}
 
-	ret = ice_flow_validate_filter(dev, attr, pattern, actions,
-			&engine, &meta, error);
+	ret = ice_flow_process_filter(dev, flow, attr, pattern, actions,
+			&engine, &meta, ice_parse_engine_create, error);
 	if (ret < 0)
 		goto free_flow;
-
-	if (engine->create == NULL) {
-		rte_flow_error_set(error, EINVAL,
-				RTE_FLOW_ERROR_TYPE_HANDLE,
-				NULL, "Invalid engine");
-		goto free_flow;
-	}
-
-	ret = engine->create(ad, flow, meta, error);
-	if (ret)
-		goto free_flow;
-
 	flow->engine = engine;
 	TAILQ_INSERT_TAIL(&pf->flow_list, flow, node);
+	PMD_DRV_LOG(INFO, "Succeeded to create (%d) flow", engine->type);
 	return flow;
 
 free_flow:
-- 
2.15.1


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

* Re: [dpdk-dev] [PATCH] net/ice: fix rte flow framework
  2019-10-28 17:43 [dpdk-dev] [PATCH] net/ice: fix rte flow framework Ying Wang
@ 2019-10-29  3:19 ` Zhang, Qi Z
  2019-10-29  6:20 ` Ye Xiaolong
  1 sibling, 0 replies; 3+ messages in thread
From: Zhang, Qi Z @ 2019-10-29  3:19 UTC (permalink / raw)
  To: Wang, Ying A, Ye, Xiaolong; +Cc: dev, Yang, Qiming



> -----Original Message-----
> From: Wang, Ying A <ying.a.wang@intel.com>
> Sent: Tuesday, October 29, 2019 1:44 AM
> To: Ye, Xiaolong <xiaolong.ye@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Yang, Qiming <qiming.yang@intel.com>; Wang, Ying A
> <ying.a.wang@intel.com>
> Subject: [PATCH] net/ice: fix rte flow framework
> 
> In non-pipeline mode, switch should be used as fdir's backup.
> The patch fiexed rule can't be created when fdir's flow table is full.
> 
> Fixes: 7615a6895009 ("net/ice: rework for generic flow enabling")
> 
> Signed-off-by: Ying Wang <ying.a.wang@intel.com>

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



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

* Re: [dpdk-dev] [PATCH] net/ice: fix rte flow framework
  2019-10-28 17:43 [dpdk-dev] [PATCH] net/ice: fix rte flow framework Ying Wang
  2019-10-29  3:19 ` Zhang, Qi Z
@ 2019-10-29  6:20 ` Ye Xiaolong
  1 sibling, 0 replies; 3+ messages in thread
From: Ye Xiaolong @ 2019-10-29  6:20 UTC (permalink / raw)
  To: Ying Wang; +Cc: qi.z.zhang, dev, qiming.yang

On 10/29, Ying Wang wrote:
>In non-pipeline mode, switch should be used as fdir's backup.
>The patch fiexed rule can't be created when fdir's flow table is full.
>
>Fixes: 7615a6895009 ("net/ice: rework for generic flow enabling")
>
>Signed-off-by: Ying Wang <ying.a.wang@intel.com>
>---
> drivers/net/ice/ice_generic_flow.c | 84 ++++++++++++++++++++++++++------------
> 1 file changed, 58 insertions(+), 26 deletions(-)
>

Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>

Applied to dpdk-next-net-intel. Thanks.

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

end of thread, other threads:[~2019-10-29  6:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-28 17:43 [dpdk-dev] [PATCH] net/ice: fix rte flow framework Ying Wang
2019-10-29  3:19 ` Zhang, Qi Z
2019-10-29  6:20 ` Ye Xiaolong

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).