Skip to contentSkip to conversation

ice: flow inputset/action validation fix and add ipv6 tc support

PATCH Applied Wang Ying A 4 participants 15 messages Jul 18, 2019 – Jul 19, 2019 Network drivers

lore
Share & tools
lore
#0 lore raw

cover ice: flow inputset/action validation fix and add ipv6 tc support

Patch 1/3 avoids set error for RTE_FLOW_ITEM_TYPE_VOID in inputset check. Patch 2/3 adds check for each element of action list.
Patch 3/3 adds ipv6 tc support for flow rule.

Wang Ying A (3):
net/ice: fix flow get inputset check
net/ice: fix flow action validation
net/ice: add flow ipv6 tc support

 drivers/net/ice/ice_generic_flow.c | 53 ++++++++++++++++++++++----------------
 1 file changed, 31 insertions(+), 22 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/3 net/ice: fix flow get inputset check

ice_get_flow_field should not set error if item->type is RTE_FLOW_ITEM_TYPE_VOID.
This patch fixes this issue.

Fixes d76116a4678f ("net/ice: add generic flow API")
---
 drivers/net/ice/ice_generic_flow.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ice/ice_generic_flow.c +3 -1
index c2931a1..464f6ec 100644
@@ -465,7 +465,7 @@ static uint64_t ice_get_flow_field(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_NVGRE:
 			nvgre_spec = item->spec;
 			nvgre_mask = item->mask;
-			/* Check if VXLAN item is used to describe protocol.
+			/* Check if NVGRE item is used to describe protocol.
 			 * If yes, both spec and mask should be NULL.
 			 * If no, both spec and mask shouldn't be NULL.
 			 */
@@ -480,6 +480,8 @@ static uint64_t ice_get_flow_field(const struct rte_flow_item pattern[],
 			is_tunnel = 1;
 
 			break;
+		case RTE_FLOW_ITEM_TYPE_VOID:
+			break;
 		default:
 			rte_flow_error_set(error, EINVAL,
 					   RTE_FLOW_ERROR_TYPE_ITEM,
Signature · 1 line
1.8.3.1
#2 lore raw

Re: [dpdk-dev] [PATCH 1/3] net/ice: fix flow get inputset check

It's no need to add RTE_FLOW_ITEM_TYPE_VOID because we have skipped all the VOID items.

-----Original Message-----
From: Wang, Ying A
Sent: Thursday, July 18, 2019 9:39 AM
To: Zhang, Qi Z <[email protected]>
Cc: Yang, Qiming <[email protected]>; [email protected]; Wang, Ying A <[email protected]>; [email protected]
Subject: [PATCH 1/3] net/ice: fix flow get inputset check

ice_get_flow_field should not set error if item->type is RTE_FLOW_ITEM_TYPE_VOID. This patch fixes this issue.

Fixes d76116a4678f ("net/ice: add generic flow API")
---
 drivers/net/ice/ice_generic_flow.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ice/ice_generic_flow.c +3 -1
index c2931a1..464f6ec 100644
@@ -465,7 +465,7 @@ static uint64_t ice_get_flow_field(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_NVGRE:
 			nvgre_spec = item->spec;
 			nvgre_mask = item->mask;
-			/* Check if VXLAN item is used to describe protocol.
+			/* Check if NVGRE item is used to describe protocol.
 			 * If yes, both spec and mask should be NULL.
 			 * If no, both spec and mask shouldn't be NULL.
 			 */
@@ -480,6 +480,8 @@ static uint64_t ice_get_flow_field(const struct rte_flow_item pattern[],
 			is_tunnel = 1;
 
 			break;
+		case RTE_FLOW_ITEM_TYPE_VOID:
+			break;
 		default:
 			rte_flow_error_set(error, EINVAL,
 					   RTE_FLOW_ERROR_TYPE_ITEM,

--
1.8.3.1

#3 lore raw

Re: [dpdk-dev] [PATCH 1/3] net/ice: fix flow get inputset check

Quoted 11 lines

-----Original Message-----
From: Yang, Qiming
Sent: Thursday, July 18, 2019 10:33 AM
To: Wang, Ying A <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH 1/3] net/ice: fix flow get inputset check

It's no need to add RTE_FLOW_ITEM_TYPE_VOID because we have skipped all the VOID items.

But actually, we passed the original pattern to this function, not the one skipped all the VOID items.

Quoted 48 lines

-----Original Message-----
From: Wang, Ying A
Sent: Thursday, July 18, 2019 9:39 AM
To: Zhang, Qi Z <[email protected]>
Cc: Yang, Qiming <[email protected]>; [email protected]; Wang, Ying A <[email protected]>; [email protected]
Subject: [PATCH 1/3] net/ice: fix flow get inputset check

ice_get_flow_field should not set error if item->type is RTE_FLOW_ITEM_TYPE_VOID.
This patch fixes this issue.

Fixes d76116a4678f ("net/ice: add generic flow API")
---
 drivers/net/ice/ice_generic_flow.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ice/ice_generic_flow.c +1 -1
index c2931a1..464f6ec 100644
@@ -465,7 +465,7 @@ static uint64_t ice_get_flow_field(const struct
 rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_NVGRE:
 			nvgre_spec = item->spec;
 			nvgre_mask = item->mask;
-			/* Check if VXLAN item is used to describe protocol.
+			/* Check if NVGRE item is used to describe protocol.
 			 * If yes, both spec and mask should be NULL.
 			 * If no, both spec and mask shouldn't be NULL.
drivers/net/ice/ice_generic_flow.c +2 -0
 			 */
@@ -480,6 +480,8 @@ static uint64_t ice_get_flow_field(const struct
 rte_flow_item pattern[],
 			is_tunnel = 1;
 
 			break;
+		case RTE_FLOW_ITEM_TYPE_VOID:
+			break;
 		default:
 			rte_flow_error_set(error, EINVAL,

RTE_FLOW_ERROR_TYPE_ITEM,
--
1.8.3.1

#4 lore raw

Re: [dpdk-dev] [PATCH 1/3] net/ice: fix flow get inputset check

So I think the bug is the skipped pattern don't pass to the next function.

-----Original Message-----
From: Wang, Ying A
Sent: Thursday, July 18, 2019 10:40 AM
To: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH 1/3] net/ice: fix flow get inputset check

Quoted 10 lines

-----Original Message-----
From: Yang, Qiming
Sent: Thursday, July 18, 2019 10:33 AM
To: Wang, Ying A <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH 1/3] net/ice: fix flow get inputset check

It's no need to add RTE_FLOW_ITEM_TYPE_VOID because we have skipped all the VOID items.

But actually, we passed the original pattern to this function, not the one skipped all the VOID items.

Quoted 48 lines

-----Original Message-----
From: Wang, Ying A
Sent: Thursday, July 18, 2019 9:39 AM
To: Zhang, Qi Z <[email protected]>
Cc: Yang, Qiming <[email protected]>; [email protected]; Wang, Ying A <[email protected]>; [email protected]
Subject: [PATCH 1/3] net/ice: fix flow get inputset check

ice_get_flow_field should not set error if item->type is RTE_FLOW_ITEM_TYPE_VOID.
This patch fixes this issue.

Fixes d76116a4678f ("net/ice: add generic flow API")
---
 drivers/net/ice/ice_generic_flow.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ice/ice_generic_flow.c +1 -1
index c2931a1..464f6ec 100644
@@ -465,7 +465,7 @@ static uint64_t ice_get_flow_field(const struct 
 rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_NVGRE:
 			nvgre_spec = item->spec;
 			nvgre_mask = item->mask;
-			/* Check if VXLAN item is used to describe protocol.
+			/* Check if NVGRE item is used to describe protocol.
 			 * If yes, both spec and mask should be NULL.
 			 * If no, both spec and mask shouldn't be NULL.
drivers/net/ice/ice_generic_flow.c +2 -0
 			 */
@@ -480,6 +480,8 @@ static uint64_t ice_get_flow_field(const struct 
 rte_flow_item pattern[],
 			is_tunnel = 1;
 
 			break;
+		case RTE_FLOW_ITEM_TYPE_VOID:
+			break;
 		default:
 			rte_flow_error_set(error, EINVAL,

RTE_FLOW_ERROR_TYPE_ITEM,
--
1.8.3.1

#5 lore raw

Re: [dpdk-dev] [PATCH 1/3] net/ice: fix flow get inputset check

Quoted 10 lines

-----Original Message-----
From: Yang, Qiming
Sent: Thursday, July 18, 2019 10:47 AM
To: Wang, Ying A <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH 1/3] net/ice: fix flow get inputset check

So I think the bug is the skipped pattern don't pass to the next function.

Yes, this is another solution. But maybe, this solution will change more codes. Anyway, if you think this is the better solution, I will modify it.

Quoted 73 lines

-----Original Message-----
From: Wang, Ying A
Sent: Thursday, July 18, 2019 10:40 AM
To: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH 1/3] net/ice: fix flow get inputset check

Quoted 10 lines

-----Original Message-----
From: Yang, Qiming
Sent: Thursday, July 18, 2019 10:33 AM
To: Wang, Ying A <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH 1/3] net/ice: fix flow get inputset check

It's no need to add RTE_FLOW_ITEM_TYPE_VOID because we have skipped all the VOID items.

But actually, we passed the original pattern to this function, not the one skipped all the VOID items.

Quoted 48 lines

-----Original Message-----
From: Wang, Ying A
Sent: Thursday, July 18, 2019 9:39 AM
To: Zhang, Qi Z <[email protected]>
Cc: Yang, Qiming <[email protected]>; [email protected]; Wang, Ying A <[email protected]>; [email protected]
Subject: [PATCH 1/3] net/ice: fix flow get inputset check

ice_get_flow_field should not set error if item->type is RTE_FLOW_ITEM_TYPE_VOID.
This patch fixes this issue.

Fixes d76116a4678f ("net/ice: add generic flow API")
---
 drivers/net/ice/ice_generic_flow.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ice/ice_generic_flow.c +1 -1
index c2931a1..464f6ec 100644
@@ -465,7 +465,7 @@ static uint64_t ice_get_flow_field(const struct
 rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_NVGRE:
 			nvgre_spec = item->spec;
 			nvgre_mask = item->mask;
-			/* Check if VXLAN item is used to describe protocol.
+			/* Check if NVGRE item is used to describe protocol.
 			 * If yes, both spec and mask should be NULL.
 			 * If no, both spec and mask shouldn't be NULL.
drivers/net/ice/ice_generic_flow.c +2 -0
 			 */
@@ -480,6 +480,8 @@ static uint64_t ice_get_flow_field(const struct
 rte_flow_item pattern[],
 			is_tunnel = 1;
 
 			break;
+		case RTE_FLOW_ITEM_TYPE_VOID:
+			break;
 		default:
 			rte_flow_error_set(error, EINVAL,

RTE_FLOW_ERROR_TYPE_ITEM,
--
1.8.3.1

Acked-by Applied
#6 lore raw

Re: [dpdk-dev] [PATCH 1/3] net/ice: fix flow get inputset check

Quoted 20 lines

-----Original Message-----
From: Wang, Ying A
Sent: Thursday, July 18, 2019 10:52 AM
To: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH 1/3] net/ice: fix flow get inputset check

Quoted 8 lines

-----Original Message-----
From: Yang, Qiming
Sent: Thursday, July 18, 2019 10:47 AM
To: Wang, Ying A <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH 1/3] net/ice: fix flow get inputset check

Quoted 4 lines
Quoted 1 line

So I think the bug is the skipped pattern don't pass to the next function.

Yes, this is another solution. But maybe, this solution will change more codes. Anyway, if you think this is the better solution, I will modify it.

Let's keep current fix so far.
code refactoring to avoid duplicate void item handle can be done on a separate patch later.

Applied to dpdk-next-net-intel.

Thanks
Qi

#7 lore raw

PATCH 2/3 net/ice: fix flow action validation

In reply to Wang Ying A

Action is a list. We should check each element of the action rather than the first one.
This patch fixes this issue.

Fixes d76116a4678f ("net/ice: add generic flow API")
---
 drivers/net/ice/ice_generic_flow.c | 39 ++++++++++++++++++++------------------
 1 file changed, 21 insertions(+), 18 deletions(-)
drivers/net/ice/ice_generic_flow.c +21 -18
index 464f6ec..2c57276 100644
@@ -517,28 +517,31 @@ static int ice_flow_valid_action(struct rte_eth_dev *dev,
 {
 	const struct rte_flow_action_queue *act_q;
 	uint16_t queue;
-
-	switch (actions->type) {
-	case RTE_FLOW_ACTION_TYPE_QUEUE:
-		act_q = actions->conf;
-		queue = act_q->index;
-		if (queue >= dev->data->nb_rx_queues) {
+	const struct rte_flow_action *action;
+	for (action = actions; action->type !=
+			RTE_FLOW_ACTION_TYPE_END; action++) {
+		switch (action->type) {
+		case RTE_FLOW_ACTION_TYPE_QUEUE:
+			act_q = action->conf;
+			queue = act_q->index;
+			if (queue >= dev->data->nb_rx_queues) {
+				rte_flow_error_set(error, EINVAL,
+						RTE_FLOW_ERROR_TYPE_ACTION,
+						actions, "Invalid queue ID for"
+						" switch filter.");
+				return -rte_errno;
+			}
+			break;
+		case RTE_FLOW_ACTION_TYPE_DROP:
+		case RTE_FLOW_ACTION_TYPE_VOID:
+			break;
+		default:
 			rte_flow_error_set(error, EINVAL,
-					   RTE_FLOW_ERROR_TYPE_ACTION,
-					   actions, "Invalid queue ID for"
-					   " switch filter.");
+					   RTE_FLOW_ERROR_TYPE_ACTION, actions,
+					   "Invalid action.");
 			return -rte_errno;
 		}
-		break;
-	case RTE_FLOW_ACTION_TYPE_DROP:
-		break;
-	default:
-		rte_flow_error_set(error, EINVAL,
-				   RTE_FLOW_ERROR_TYPE_ACTION, actions,
-				   "Invalid action.");
-		return -rte_errno;
 	}
-
 	return 0;
 }
 
Signature · 1 line
1.8.3.1
Reviewed-by on v1 2/3
#8 lore raw

Re: [dpdk-dev] [PATCH 2/3] net/ice: fix flow action validation

Quoted 69 lines · Wang Ying A

Action is a list. We should check each element of the action rather than the first one.
This patch fixes this issue.

Fixes d76116a4678f ("net/ice: add generic flow API")

---
drivers/net/ice/ice_generic_flow.c | 39 ++++++++++++++++++++------------------

1 file changed, 21 insertions(+), 18 deletions(-)
drivers/net/ice/ice_generic_flow.c +21 -18
index 464f6ec..2c57276 100644
@@ -517,28 +517,31 @@ static int ice_flow_valid_action(struct rte_eth_dev *dev,
 {
 	const struct rte_flow_action_queue *act_q;
 	uint16_t queue;
-
-	switch (actions->type) {
-	case RTE_FLOW_ACTION_TYPE_QUEUE:
-		act_q = actions->conf;
-		queue = act_q->index;
-		if (queue >= dev->data->nb_rx_queues) {
+	const struct rte_flow_action *action;
+	for (action = actions; action->type !=
+			RTE_FLOW_ACTION_TYPE_END; action++) {
+		switch (action->type) {
+		case RTE_FLOW_ACTION_TYPE_QUEUE:
+			act_q = action->conf;
+			queue = act_q->index;
+			if (queue >= dev->data->nb_rx_queues) {
+				rte_flow_error_set(error, EINVAL,
+						RTE_FLOW_ERROR_TYPE_ACTION,
+						actions, "Invalid queue ID for"
+						" switch filter.");
+				return -rte_errno;
+			}
+			break;
+		case RTE_FLOW_ACTION_TYPE_DROP:
+		case RTE_FLOW_ACTION_TYPE_VOID:
+			break;
+		default:
 			rte_flow_error_set(error, EINVAL,
-					   RTE_FLOW_ERROR_TYPE_ACTION,
-					   actions, "Invalid queue ID for"
-					   " switch filter.");
+					   RTE_FLOW_ERROR_TYPE_ACTION, actions,
+					   "Invalid action.");
 			return -rte_errno;
 		}
-		break;
-	case RTE_FLOW_ACTION_TYPE_DROP:
-		break;
-	default:
-		rte_flow_error_set(error, EINVAL,
-				   RTE_FLOW_ERROR_TYPE_ACTION, actions,
-				   "Invalid action.");
-		return -rte_errno;
 	}
-
 	return 0;
 }
 
Signature · 1 line
1.8.3.1
#9 lore raw

Re: [dpdk-dev] [PATCH 2/3] net/ice: fix flow action validation

In reply to Wang Ying A

Hi, Ying
For the action check reorganization, please according to Beilei's comments, use array to stand the action element list. And as we discussed before, it's better to change in the next release.

Qiming
-----Original Message-----
From: Wang, Ying A
Sent: Thursday, July 18, 2019 9:39 AM
To: Zhang, Qi Z <[email protected]>
Cc: Yang, Qiming <[email protected]>; [email protected]; Wang, Ying A <[email protected]>; [email protected]
Subject: [PATCH 2/3] net/ice: fix flow action validation

Action is a list. We should check each element of the action rather than the first one. This patch fixes this issue.

Fixes d76116a4678f ("net/ice: add generic flow API")
---
 drivers/net/ice/ice_generic_flow.c | 39 ++++++++++++++++++++------------------
 1 file changed, 21 insertions(+), 18 deletions(-)
drivers/net/ice/ice_generic_flow.c +21 -19
index 464f6ec..2c57276 100644
@@ -517,28 +517,31 @@ static int ice_flow_valid_action(struct rte_eth_dev *dev,  {
 	const struct rte_flow_action_queue *act_q;
 	uint16_t queue;
-
-	switch (actions->type) {
-	case RTE_FLOW_ACTION_TYPE_QUEUE:
-		act_q = actions->conf;
-		queue = act_q->index;
-		if (queue >= dev->data->nb_rx_queues) {
+	const struct rte_flow_action *action;
+	for (action = actions; action->type !=
+			RTE_FLOW_ACTION_TYPE_END; action++) {
+		switch (action->type) {
+		case RTE_FLOW_ACTION_TYPE_QUEUE:
+			act_q = action->conf;
+			queue = act_q->index;
+			if (queue >= dev->data->nb_rx_queues) {
+				rte_flow_error_set(error, EINVAL,
+						RTE_FLOW_ERROR_TYPE_ACTION,
+						actions, "Invalid queue ID for"
+						" switch filter.");
+				return -rte_errno;
+			}
+			break;
+		case RTE_FLOW_ACTION_TYPE_DROP:
+		case RTE_FLOW_ACTION_TYPE_VOID:
+			break;
+		default:
 			rte_flow_error_set(error, EINVAL,
-					   RTE_FLOW_ERROR_TYPE_ACTION,
-					   actions, "Invalid queue ID for"
-					   " switch filter.");
+					   RTE_FLOW_ERROR_TYPE_ACTION, actions,
+					   "Invalid action.");
 			return -rte_errno;
 		}
-		break;
-	case RTE_FLOW_ACTION_TYPE_DROP:
-		break;
-	default:
-		rte_flow_error_set(error, EINVAL,
-				   RTE_FLOW_ERROR_TYPE_ACTION, actions,
-				   "Invalid action.");
-		return -rte_errno;
 	}
-
 	return 0;
 }
 
--

1.8.3.1

Acked-by on v1 2/3
#10 lore raw

Re: [dpdk-dev] [PATCH 2/3] net/ice: fix flow action validation

In reply to Wang Ying A

-----Original Message-----
From: Wang, Ying A
Sent: Thursday, July 18, 2019 9:39 AM
To: Zhang, Qi Z <[email protected]>
Cc: Yang, Qiming <[email protected]>; [email protected]; Wang, Ying A <[email protected]>; [email protected]
Subject: [PATCH 2/3] net/ice: fix flow action validation

Action is a list. We should check each element of the action rather than the first one. This patch fixes this issue.

Fixes d76116a4678f ("net/ice: add generic flow API")
---
 drivers/net/ice/ice_generic_flow.c | 39 ++++++++++++++++++++------------------
 1 file changed, 21 insertions(+), 18 deletions(-)
drivers/net/ice/ice_generic_flow.c +21 -19
index 464f6ec..2c57276 100644
@@ -517,28 +517,31 @@ static int ice_flow_valid_action(struct rte_eth_dev *dev,  {
 	const struct rte_flow_action_queue *act_q;
 	uint16_t queue;
-
-	switch (actions->type) {
-	case RTE_FLOW_ACTION_TYPE_QUEUE:
-		act_q = actions->conf;
-		queue = act_q->index;
-		if (queue >= dev->data->nb_rx_queues) {
+	const struct rte_flow_action *action;
+	for (action = actions; action->type !=
+			RTE_FLOW_ACTION_TYPE_END; action++) {
+		switch (action->type) {
+		case RTE_FLOW_ACTION_TYPE_QUEUE:
+			act_q = action->conf;
+			queue = act_q->index;
+			if (queue >= dev->data->nb_rx_queues) {
+				rte_flow_error_set(error, EINVAL,
+						RTE_FLOW_ERROR_TYPE_ACTION,
+						actions, "Invalid queue ID for"
+						" switch filter.");
+				return -rte_errno;
+			}
+			break;
+		case RTE_FLOW_ACTION_TYPE_DROP:
+		case RTE_FLOW_ACTION_TYPE_VOID:
+			break;
+		default:
 			rte_flow_error_set(error, EINVAL,
-					   RTE_FLOW_ERROR_TYPE_ACTION,
-					   actions, "Invalid queue ID for"
-					   " switch filter.");
+					   RTE_FLOW_ERROR_TYPE_ACTION, actions,
+					   "Invalid action.");
 			return -rte_errno;
 		}
-		break;
-	case RTE_FLOW_ACTION_TYPE_DROP:
-		break;
-	default:
-		rte_flow_error_set(error, EINVAL,
-				   RTE_FLOW_ERROR_TYPE_ACTION, actions,
-				   "Invalid action.");
-		return -rte_errno;
 	}
-
 	return 0;
 }
 
--

1.8.3.1

Applied
#11 lore raw

Re: [dpdk-dev] [PATCH 2/3] net/ice: fix flow action validation

Quoted 24 lines

-----Original Message-----
From: Yang, Qiming
Sent: Thursday, July 18, 2019 11:07 AM
To: Wang, Ying A <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH 2/3] net/ice: fix flow action validation

-----Original Message-----
From: Wang, Ying A
Sent: Thursday, July 18, 2019 9:39 AM
To: Zhang, Qi Z <[email protected]>
Cc: Yang, Qiming <[email protected]>; [email protected]; Wang, Ying A <[email protected]>; [email protected]
Subject: [PATCH 2/3] net/ice: fix flow action validation

Action is a list. We should check each element of the action rather than the first one.
This patch fixes this issue.

Quoted 6 lines
Fixes d76116a4678f ("net/ice: add generic flow API")

---

Applied to dpdk-next-net-intel.

Thanks
Qi

#12 lore raw

PATCH 3/3 net/ice: add flow ipv6 tc support

In reply to Wang Ying A

When set flow ipv6 tc rule, ice_get_flow_field will set error. This patch fixes this issue.

Fixes d76116a4678f ("net/ice: add generic flow API")
---
 drivers/net/ice/ice_generic_flow.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ice/ice_generic_flow.c +7 -3
index 2c57276..5725bff 100644
@@ -282,8 +282,7 @@ static uint64_t ice_get_flow_field(const struct rte_flow_item pattern[],
 			if (!(ipv6_spec && ipv6_mask))
 				break;
 
-			if (ipv6_mask->hdr.payload_len ||
-			    ipv6_mask->hdr.vtc_flow) {
+			if (ipv6_mask->hdr.payload_len) {
 				rte_flow_error_set(error, EINVAL,
 					   RTE_FLOW_ERROR_TYPE_ITEM,
 					   item,
@@ -317,6 +316,11 @@ static uint64_t ice_get_flow_field(const struct rte_flow_item pattern[],
 					input_set |= ICE_INSET_IPV6_PROTO;
 				if (ipv6_mask->hdr.hop_limits == UINT8_MAX)
 					input_set |= ICE_INSET_IPV6_HOP_LIMIT;
+				if ((ipv6_mask->hdr.vtc_flow &
+					rte_cpu_to_be_32(RTE_IPV6_HDR_TC_MASK))
+						== rte_cpu_to_be_32
+						(RTE_IPV6_HDR_TC_MASK))
+					input_set |= ICE_INSET_IPV6_TOS;
 			}
 
 			break;
@@ -486,7 +490,7 @@ static uint64_t ice_get_flow_field(const struct rte_flow_item pattern[],
 			rte_flow_error_set(error, EINVAL,
 					   RTE_FLOW_ERROR_TYPE_ITEM,
 					   item,
-					   "Invalid mask no exist");
+					   "Invalid pattern");
 			break;
 		}
 	}
Signature · 1 line
1.8.3.1
#13 lore raw

Re: [dpdk-dev] [PATCH 3/3] net/ice: add flow ipv6 tc support

-----Original Message-----
From: Wang, Ying A
Sent: Thursday, July 18, 2019 9:39 AM
To: Zhang, Qi Z <[email protected]>
Cc: Yang, Qiming <[email protected]>; [email protected]; Wang, Ying A <[email protected]>; [email protected]
Subject: [PATCH 3/3] net/ice: add flow ipv6 tc support

When set flow ipv6 tc rule, ice_get_flow_field will set error. This patch fixes this issue.

Fixes d76116a4678f ("net/ice: add generic flow API")
---
 drivers/net/ice/ice_generic_flow.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ice/ice_generic_flow.c +7 -3
index 2c57276..5725bff 100644
@@ -282,8 +282,7 @@ static uint64_t ice_get_flow_field(const struct rte_flow_item pattern[],
 			if (!(ipv6_spec && ipv6_mask))
 				break;
 
-			if (ipv6_mask->hdr.payload_len ||
-			    ipv6_mask->hdr.vtc_flow) {
+			if (ipv6_mask->hdr.payload_len) {
 				rte_flow_error_set(error, EINVAL,
 					   RTE_FLOW_ERROR_TYPE_ITEM,
 					   item,
@@ -317,6 +316,11 @@ static uint64_t ice_get_flow_field(const struct rte_flow_item pattern[],
 					input_set |= ICE_INSET_IPV6_PROTO;
 				if (ipv6_mask->hdr.hop_limits == UINT8_MAX)
 					input_set |= ICE_INSET_IPV6_HOP_LIMIT;
+				if ((ipv6_mask->hdr.vtc_flow &
+					rte_cpu_to_be_32(RTE_IPV6_HDR_TC_MASK))
+						== rte_cpu_to_be_32
+						(RTE_IPV6_HDR_TC_MASK))
+					input_set |= ICE_INSET_IPV6_TOS;
 			}
 
 			break;
@@ -486,7 +490,7 @@ static uint64_t ice_get_flow_field(const struct rte_flow_item pattern[],
 			rte_flow_error_set(error, EINVAL,
 					   RTE_FLOW_ERROR_TYPE_ITEM,
 					   item,
-					   "Invalid mask no exist");
+					   "Invalid pattern");
 			break;
 		}
 	}
Signature · 3 lines
1.8.3.1

Acked-by: Qiming Yang <[email protected]>
Applied
#14 lore raw

Re: [dpdk-dev] [PATCH 3/3] net/ice: add flow ipv6 tc support

Quoted 23 lines

-----Original Message-----
From: Yang, Qiming
Sent: Thursday, July 18, 2019 11:06 AM
To: Wang, Ying A <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH 3/3] net/ice: add flow ipv6 tc support

-----Original Message-----
From: Wang, Ying A
Sent: Thursday, July 18, 2019 9:39 AM
To: Zhang, Qi Z <[email protected]>
Cc: Yang, Qiming <[email protected]>; [email protected]; Wang, Ying A <[email protected]>; [email protected]
Subject: [PATCH 3/3] net/ice: add flow ipv6 tc support

When set flow ipv6 tc rule, ice_get_flow_field will set error. This patch fixes this issue.

Quoted 7 lines
Fixes d76116a4678f ("net/ice: add generic flow API")

---

Applied to dpdk-next-net-intel.

Thanks
Qi