[3/3] net/ice: add flow ipv6 tc support

Message ID 1563413923-404004-4-git-send-email-ying.a.wang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series [1/3] net/ice: fix flow get inputset check |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Ying Wang July 18, 2019, 1:38 a.m. UTC
  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")
Cc: stable@dpdk.org

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

Comments

Qiming Yang July 18, 2019, 3:06 a.m. UTC | #1
-----Original Message-----
From: Wang, Ying A 
Sent: Thursday, July 18, 2019 9:39 AM
To: Zhang, Qi Z <qi.z.zhang@intel.com>
Cc: Yang, Qiming <qiming.yang@intel.com>; dev@dpdk.org; Wang, Ying A <ying.a.wang@intel.com>; stable@dpdk.org
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")
Cc: stable@dpdk.org

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

diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c
index 2c57276..5725bff 100644
--- a/drivers/net/ice/ice_generic_flow.c
+++ b/drivers/net/ice/ice_generic_flow.c
@@ -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;
 		}
 	}
  
Qi Zhang July 19, 2019, 12:48 a.m. UTC | #2
> -----Original Message-----
> From: Yang, Qiming
> Sent: Thursday, July 18, 2019 11:06 AM
> To: Wang, Ying A <ying.a.wang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> 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 <qi.z.zhang@intel.com>
> Cc: Yang, Qiming <qiming.yang@intel.com>; dev@dpdk.org; Wang, Ying A
> <ying.a.wang@intel.com>; stable@dpdk.org
> 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")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wang Ying A <ying.a.wang@intel.com>
> ---
> 
> Acked-by: Qiming Yang <qiming.yang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
  

Patch

diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c
index 2c57276..5725bff 100644
--- a/drivers/net/ice/ice_generic_flow.c
+++ b/drivers/net/ice/ice_generic_flow.c
@@ -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;
 		}
 	}