patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/ice: fix VF index check for DCF
@ 2020-08-10  2:41 Wei Zhao
  2020-08-12  0:56 ` [dpdk-stable] [PATCH v2] " Wei Zhao
  0 siblings, 1 reply; 6+ messages in thread
From: Wei Zhao @ 2020-08-10  2:41 UTC (permalink / raw)
  To: dev; +Cc: stable, qi.z.zhang, nannan.lu, Wei Zhao

The vf index in rte_flow command need to check
in order that larger the actual number.

Fixes: 829c3106812d ("net/ice: enable switch flow on DCF")
Cc: stable@dpdk.org

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/ice/ice_switch_filter.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index c4b00b6a2..e7e03d96b 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -1405,6 +1405,16 @@ ice_switch_parse_dcf_action(struct ice_dcf_adapter *ad,
 		case RTE_FLOW_ACTION_TYPE_VF:
 			rule_info->sw_act.fltr_act = ICE_FWD_TO_VSI;
 			act_vf = action->conf;
+
+			if (act_vf->id >= ad->real_hw.num_vfs &&
+				!act_vf->original) {
+				rte_flow_error_set(error,
+					EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
+					actions,
+					"Invalid vf id");
+				return -rte_errno;
+			}
+
 			if (act_vf->original)
 				rule_info->sw_act.vsi_handle =
 					ad->real_hw.avf.bus.func;
@@ -1667,12 +1677,8 @@ ice_switch_parse_pattern_action(struct ice_adapter *ad,
 	else
 		ret = ice_switch_parse_action(pf, actions, error, &rule_info);
 
-	if (ret) {
-		rte_flow_error_set(error, EINVAL,
-				   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
-				   "Invalid input action");
+	if (ret)
 		goto error;
-	}
 
 	if (meta) {
 		*meta = sw_meta_ptr;
-- 
2.19.1


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

* [dpdk-stable] [PATCH v2] net/ice: fix VF index check for DCF
  2020-08-10  2:41 [dpdk-stable] [PATCH] net/ice: fix VF index check for DCF Wei Zhao
@ 2020-08-12  0:56 ` Wei Zhao
  2020-08-12  2:43   ` Lu, Nannan
  2020-08-12  2:53   ` [dpdk-stable] [PATCH v3] " Wei Zhao
  0 siblings, 2 replies; 6+ messages in thread
From: Wei Zhao @ 2020-08-12  0:56 UTC (permalink / raw)
  To: dev; +Cc: stable, qi.z.zhang, nannan.lu, Wei Zhao

The vf index in rte_flow command need to check
in order that larger the actual number. Also
change some error log for wrong action.

Fixes: 829c3106812d ("net/ice: enable switch flow on DCF")
Cc: stable@dpdk.org

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

---
v2: change error log
---
 drivers/net/ice/ice_switch_filter.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index c4b00b6a2..0e0267c04 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -1405,6 +1405,16 @@ ice_switch_parse_dcf_action(struct ice_dcf_adapter *ad,
 		case RTE_FLOW_ACTION_TYPE_VF:
 			rule_info->sw_act.fltr_act = ICE_FWD_TO_VSI;
 			act_vf = action->conf;
+
+			if (act_vf->id >= ad->real_hw.num_vfs &&
+				!act_vf->original) {
+				rte_flow_error_set(error,
+					EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
+					actions,
+					"Invalid vf id");
+				return -rte_errno;
+			}
+
 			if (act_vf->original)
 				rule_info->sw_act.vsi_handle =
 					ad->real_hw.avf.bus.func;
@@ -1415,7 +1425,7 @@ ice_switch_parse_dcf_action(struct ice_dcf_adapter *ad,
 			rte_flow_error_set(error,
 					   EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
 					   actions,
-					   "Invalid action type or queue number");
+					   "Invalid action type");
 			return -rte_errno;
 		}
 	}
@@ -1667,12 +1677,8 @@ ice_switch_parse_pattern_action(struct ice_adapter *ad,
 	else
 		ret = ice_switch_parse_action(pf, actions, error, &rule_info);
 
-	if (ret) {
-		rte_flow_error_set(error, EINVAL,
-				   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
-				   "Invalid input action");
+	if (ret)
 		goto error;
-	}
 
 	if (meta) {
 		*meta = sw_meta_ptr;
-- 
2.19.1


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

* Re: [dpdk-stable] [PATCH v2] net/ice: fix VF index check for DCF
  2020-08-12  0:56 ` [dpdk-stable] [PATCH v2] " Wei Zhao
@ 2020-08-12  2:43   ` Lu, Nannan
  2020-08-12  2:53   ` [dpdk-stable] [PATCH v3] " Wei Zhao
  1 sibling, 0 replies; 6+ messages in thread
From: Lu, Nannan @ 2020-08-12  2:43 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: stable, Zhang, Qi Z

> -----Original Message-----
> From: Zhao1, Wei <wei.zhao1@intel.com>
> Sent: Wednesday, August 12, 2020 8:57 AM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Lu, Nannan
> <nannan.lu@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> Subject: [PATCH v2] net/ice: fix VF index check for DCF
> 
> The vf index in rte_flow command need to check in order that larger the actual
> number. Also change some error log for wrong action.
> 
> Fixes: 829c3106812d ("net/ice: enable switch flow on DCF")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> 
> ---
> v2: change error log
> ---
>  drivers/net/ice/ice_switch_filter.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 

Tested-by: Nannan Lu <nannan.lu@intel.com>

> --
> 2.19.1


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

* [dpdk-stable] [PATCH v3] net/ice: fix VF index check for DCF
  2020-08-12  0:56 ` [dpdk-stable] [PATCH v2] " Wei Zhao
  2020-08-12  2:43   ` Lu, Nannan
@ 2020-08-12  2:53   ` Wei Zhao
  2020-08-13  2:14     ` [dpdk-stable] [PATCH v4] " Wei Zhao
  1 sibling, 1 reply; 6+ messages in thread
From: Wei Zhao @ 2020-08-12  2:53 UTC (permalink / raw)
  To: dev; +Cc: stable, qi.z.zhang, nannan.lu, Wei Zhao

The vf index in rte_flow command need to check
in order that larger than actual number. Also
change some error log for wrong action.

Fixes: 829c3106812d ("net/ice: enable switch flow on DCF")
Cc: stable@dpdk.org

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

---

v2: change error log

v3: add new error log
---
 drivers/net/ice/ice_switch_filter.c | 36 ++++++++++++++++++++++-------
 1 file changed, 28 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index c4b00b6a2..8579889f3 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -1405,6 +1405,16 @@ ice_switch_parse_dcf_action(struct ice_dcf_adapter *ad,
 		case RTE_FLOW_ACTION_TYPE_VF:
 			rule_info->sw_act.fltr_act = ICE_FWD_TO_VSI;
 			act_vf = action->conf;
+
+			if (act_vf->id >= ad->real_hw.num_vfs &&
+				!act_vf->original) {
+				rte_flow_error_set(error,
+					EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
+					actions,
+					"Invalid vf id");
+				return -rte_errno;
+			}
+
 			if (act_vf->original)
 				rule_info->sw_act.vsi_handle =
 					ad->real_hw.avf.bus.func;
@@ -1415,7 +1425,7 @@ ice_switch_parse_dcf_action(struct ice_dcf_adapter *ad,
 			rte_flow_error_set(error,
 					   EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
 					   actions,
-					   "Invalid action type or queue number");
+					   "Invalid action type");
 			return -rte_errno;
 		}
 	}
@@ -1467,11 +1477,11 @@ ice_switch_parse_action(struct ice_pf *pf,
 			if ((act_qgrop->queue[0] +
 				act_qgrop->queue_num) >
 				dev->data->nb_rx_queues)
-				goto error;
+				goto error1;
 			for (i = 0; i < act_qgrop->queue_num - 1; i++)
 				if (act_qgrop->queue[i + 1] !=
 					act_qgrop->queue[i] + 1)
-					goto error;
+					goto error2;
 			rule_info->sw_act.qgrp_size =
 				act_qgrop->queue_num;
 			break;
@@ -1511,6 +1521,20 @@ ice_switch_parse_action(struct ice_pf *pf,
 		actions,
 		"Invalid action type or queue number");
 	return -rte_errno;
+
+error1:
+	rte_flow_error_set(error,
+		EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
+		actions,
+		"Invalid queue region indexes");
+	return -rte_errno;
+
+error2:
+	rte_flow_error_set(error,
+		EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
+		actions,
+		"Discontinuous queue region");
+	return -rte_errno;
 }
 
 static int
@@ -1667,12 +1691,8 @@ ice_switch_parse_pattern_action(struct ice_adapter *ad,
 	else
 		ret = ice_switch_parse_action(pf, actions, error, &rule_info);
 
-	if (ret) {
-		rte_flow_error_set(error, EINVAL,
-				   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
-				   "Invalid input action");
+	if (ret)
 		goto error;
-	}
 
 	if (meta) {
 		*meta = sw_meta_ptr;
-- 
2.19.1


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

* [dpdk-stable] [PATCH v4] net/ice: fix VF index check for DCF
  2020-08-12  2:53   ` [dpdk-stable] [PATCH v3] " Wei Zhao
@ 2020-08-13  2:14     ` Wei Zhao
  2020-08-31  4:09       ` Zhang, Qi Z
  0 siblings, 1 reply; 6+ messages in thread
From: Wei Zhao @ 2020-08-13  2:14 UTC (permalink / raw)
  To: dev; +Cc: stable, qi.z.zhang, nannan.lu, Wei Zhao

The vf index in rte_flow command need to check in order
that not larger than actual vf number. Also
change some error log for wrong action.

Fixes: 829c3106812d ("net/ice: enable switch flow on DCF")
Cc: stable@dpdk.org

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Tested-by: Nannan Lu <nannan.lu@intel.com>

---

v2: change error log

v3: add new error log

v4: update error log
---
 drivers/net/ice/ice_switch_filter.c | 42 ++++++++++++++++++++---------
 1 file changed, 29 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index c4b00b6a2..24320ac7d 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -1405,6 +1405,16 @@ ice_switch_parse_dcf_action(struct ice_dcf_adapter *ad,
 		case RTE_FLOW_ACTION_TYPE_VF:
 			rule_info->sw_act.fltr_act = ICE_FWD_TO_VSI;
 			act_vf = action->conf;
+
+			if (act_vf->id >= ad->real_hw.num_vfs &&
+				!act_vf->original) {
+				rte_flow_error_set(error,
+					EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
+					actions,
+					"Invalid vf id");
+				return -rte_errno;
+			}
+
 			if (act_vf->original)
 				rule_info->sw_act.vsi_handle =
 					ad->real_hw.avf.bus.func;
@@ -1415,7 +1425,7 @@ ice_switch_parse_dcf_action(struct ice_dcf_adapter *ad,
 			rte_flow_error_set(error,
 					   EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
 					   actions,
-					   "Invalid action type or queue number");
+					   "Invalid action type");
 			return -rte_errno;
 		}
 	}
@@ -1467,11 +1477,11 @@ ice_switch_parse_action(struct ice_pf *pf,
 			if ((act_qgrop->queue[0] +
 				act_qgrop->queue_num) >
 				dev->data->nb_rx_queues)
-				goto error;
+				goto error1;
 			for (i = 0; i < act_qgrop->queue_num - 1; i++)
 				if (act_qgrop->queue[i + 1] !=
 					act_qgrop->queue[i] + 1)
-					goto error;
+					goto error2;
 			rule_info->sw_act.qgrp_size =
 				act_qgrop->queue_num;
 			break;
@@ -1511,6 +1521,20 @@ ice_switch_parse_action(struct ice_pf *pf,
 		actions,
 		"Invalid action type or queue number");
 	return -rte_errno;
+
+error1:
+	rte_flow_error_set(error,
+		EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
+		actions,
+		"Invalid queue region indexes");
+	return -rte_errno;
+
+error2:
+	rte_flow_error_set(error,
+		EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
+		actions,
+		"Discontinuous queue region");
+	return -rte_errno;
 }
 
 static int
@@ -1654,12 +1678,8 @@ ice_switch_parse_pattern_action(struct ice_adapter *ad,
 	rule_info.tun_type = tun_type;
 
 	ret = ice_switch_check_action(actions, error);
-	if (ret) {
-		rte_flow_error_set(error, EINVAL,
-				   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
-				   "Invalid input action number");
+	if (ret)
 		goto error;
-	}
 
 	if (ad->hw.dcf_enabled)
 		ret = ice_switch_parse_dcf_action((void *)ad, actions, error,
@@ -1667,12 +1687,8 @@ ice_switch_parse_pattern_action(struct ice_adapter *ad,
 	else
 		ret = ice_switch_parse_action(pf, actions, error, &rule_info);
 
-	if (ret) {
-		rte_flow_error_set(error, EINVAL,
-				   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
-				   "Invalid input action");
+	if (ret)
 		goto error;
-	}
 
 	if (meta) {
 		*meta = sw_meta_ptr;
-- 
2.19.1


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

* Re: [dpdk-stable] [PATCH v4] net/ice: fix VF index check for DCF
  2020-08-13  2:14     ` [dpdk-stable] [PATCH v4] " Wei Zhao
@ 2020-08-31  4:09       ` Zhang, Qi Z
  0 siblings, 0 replies; 6+ messages in thread
From: Zhang, Qi Z @ 2020-08-31  4:09 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: stable, Lu, Nannan



> -----Original Message-----
> From: Zhao1, Wei <wei.zhao1@intel.com>
> Sent: Thursday, August 13, 2020 10:15 AM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Lu, Nannan
> <nannan.lu@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> Subject: [PATCH v4] net/ice: fix VF index check for DCF
> 
> The vf index in rte_flow command need to check in order that not larger than
> actual vf number. Also change some error log for wrong action.
> 
> Fixes: 829c3106812d ("net/ice: enable switch flow on DCF")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> Tested-by: Nannan Lu <nannan.lu@intel.com>

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

Applied to dpdk-next-net-intel.

Thanks
Qi

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

end of thread, other threads:[~2020-08-31  4:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10  2:41 [dpdk-stable] [PATCH] net/ice: fix VF index check for DCF Wei Zhao
2020-08-12  0:56 ` [dpdk-stable] [PATCH v2] " Wei Zhao
2020-08-12  2:43   ` Lu, Nannan
2020-08-12  2:53   ` [dpdk-stable] [PATCH v3] " Wei Zhao
2020-08-13  2:14     ` [dpdk-stable] [PATCH v4] " Wei Zhao
2020-08-31  4:09       ` Zhang, Qi Z

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/stable/0 stable/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 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

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


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