patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [DPDK] net/ice: fix flow rule checking
@ 2021-01-27  9:42 yuanx.wang
  2021-01-28  8:13 ` Yang, Qiming
  0 siblings, 1 reply; 3+ messages in thread
From: yuanx.wang @ 2021-01-27  9:42 UTC (permalink / raw)
  To: qiming.yang, qi.z.zhang; +Cc: dev, yuanx.wang, stable

Currently, when the RSS rule set to l4-src-only and l4-dst-only,
the hash value is different while the ingress packets
have same L4 parameters.

This patch keeps the hash value consistent in above situation.

Fixes: 38d632cbdc88 ("net/ice: refactor PF RSS")
Fixes: 0b952714e9c1 ("net/ice: refactor PF hash flow")
Cc: stable@dpdk.org

Signed-off-by: yuanx.wang <yuanx.wang@intel.com>
---
 drivers/net/ice/ice_hash.c | 66 +++++++++++++++++++++-----------------
 1 file changed, 36 insertions(+), 30 deletions(-)

diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
index 2d23c8dd5..8092c1acc 100644
--- a/drivers/net/ice/ice_hash.c
+++ b/drivers/net/ice/ice_hash.c
@@ -712,14 +712,18 @@ ice_refine_hash_cfg_l234(struct ice_rss_hash_cfg *hash_cfg,
 		if (rss_type &
 		   (ETH_RSS_NONFRAG_IPV4_UDP |
 		    ETH_RSS_NONFRAG_IPV6_UDP)) {
-			if (rss_type & ETH_RSS_L4_SRC_ONLY)
-				*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_DST_PORT));
-			else if (rss_type & ETH_RSS_L4_DST_ONLY)
-				*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_SRC_PORT));
-			else if (rss_type &
-				(ETH_RSS_L3_SRC_ONLY |
-				  ETH_RSS_L3_DST_ONLY))
-				*hash_flds &= ~ICE_FLOW_HASH_UDP_PORT;
+			if ((rss_type &
+			     (ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY)) !=
+			    (ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY)) {
+				if (rss_type & ETH_RSS_L4_SRC_ONLY)
+					*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_DST_PORT));
+				else if (rss_type & ETH_RSS_L4_DST_ONLY)
+					*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_SRC_PORT));
+				else if (rss_type &
+					 (ETH_RSS_L3_SRC_ONLY |
+					  ETH_RSS_L3_DST_ONLY))
+					*hash_flds &= ~ICE_FLOW_HASH_UDP_PORT;
+			}
 		} else {
 			*hash_flds &= ~ICE_FLOW_HASH_UDP_PORT;
 		}
@@ -729,14 +733,18 @@ ice_refine_hash_cfg_l234(struct ice_rss_hash_cfg *hash_cfg,
 		if (rss_type &
 		   (ETH_RSS_NONFRAG_IPV4_TCP |
 		    ETH_RSS_NONFRAG_IPV6_TCP)) {
-			if (rss_type & ETH_RSS_L4_SRC_ONLY)
-				*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_DST_PORT));
-			else if (rss_type & ETH_RSS_L4_DST_ONLY)
-				*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_SRC_PORT));
-			else if (rss_type &
-				(ETH_RSS_L3_SRC_ONLY |
-				  ETH_RSS_L3_DST_ONLY))
-				*hash_flds &= ~ICE_FLOW_HASH_TCP_PORT;
+			if ((rss_type &
+			     (ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY)) !=
+			    (ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY)) {
+				if (rss_type & ETH_RSS_L4_SRC_ONLY)
+					*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_DST_PORT));
+				else if (rss_type & ETH_RSS_L4_DST_ONLY)
+					*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_SRC_PORT));
+				else if (rss_type &
+					 (ETH_RSS_L3_SRC_ONLY |
+					  ETH_RSS_L3_DST_ONLY))
+					*hash_flds &= ~ICE_FLOW_HASH_TCP_PORT;
+			}
 		} else {
 			*hash_flds &= ~ICE_FLOW_HASH_TCP_PORT;
 		}
@@ -746,14 +754,18 @@ ice_refine_hash_cfg_l234(struct ice_rss_hash_cfg *hash_cfg,
 		if (rss_type &
 		   (ETH_RSS_NONFRAG_IPV4_SCTP |
 		    ETH_RSS_NONFRAG_IPV6_SCTP)) {
-			if (rss_type & ETH_RSS_L4_SRC_ONLY)
-				*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_DST_PORT));
-			else if (rss_type & ETH_RSS_L4_DST_ONLY)
-				*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT));
-			else if (rss_type &
-				(ETH_RSS_L3_SRC_ONLY |
-				  ETH_RSS_L3_DST_ONLY))
-				*hash_flds &= ~ICE_FLOW_HASH_SCTP_PORT;
+			if ((rss_type &
+			     (ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY)) !=
+			    (ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY)) {
+				if (rss_type & ETH_RSS_L4_SRC_ONLY)
+					*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_DST_PORT));
+				else if (rss_type & ETH_RSS_L4_DST_ONLY)
+					*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT));
+				else if (rss_type &
+					 (ETH_RSS_L3_SRC_ONLY |
+					  ETH_RSS_L3_DST_ONLY))
+					*hash_flds &= ~ICE_FLOW_HASH_SCTP_PORT;
+			}
 		} else {
 			*hash_flds &= ~ICE_FLOW_HASH_SCTP_PORT;
 		}
@@ -946,12 +958,6 @@ ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item,
 					RTE_FLOW_ERROR_TYPE_ACTION, action,
 					"a non-NULL RSS queue is not supported");
 
-			/**
-			 * Check simultaneous use of SRC_ONLY and DST_ONLY
-			 * of the same level.
-			 */
-			rss_type = rte_eth_rss_hf_refine(rss_type);
-
 			if (ice_any_invalid_rss_type(rss->func, rss_type,
 					pattern_match_item->input_set_mask))
 				return rte_flow_error_set(error, ENOTSUP,
-- 
2.25.1


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

* Re: [dpdk-stable] [DPDK] net/ice: fix flow rule checking
  2021-01-27  9:42 [dpdk-stable] [DPDK] net/ice: fix flow rule checking yuanx.wang
@ 2021-01-28  8:13 ` Yang, Qiming
  0 siblings, 0 replies; 3+ messages in thread
From: Yang, Qiming @ 2021-01-28  8:13 UTC (permalink / raw)
  To: Wang, YuanX, Zhang, Qi Z; +Cc: dev, Wang, YuanX, stable



> -----Original Message-----
> From: yuanx.wang <yuanx.wang@intel.com>
> Sent: Wednesday, January 27, 2021 17:43
> To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Wang, YuanX <yuanx.wang@intel.com>; stable@dpdk.org
> Subject: [DPDK] net/ice: fix flow rule checking
> 
> Currently, when the RSS rule set to l4-src-only and l4-dst-only, the hash value is
> different while the ingress packets have same L4 parameters.
> 
> This patch keeps the hash value consistent in above situation.
> 
> Fixes: 38d632cbdc88 ("net/ice: refactor PF RSS")
> Fixes: 0b952714e9c1 ("net/ice: refactor PF hash flow")
> Cc: stable@dpdk.org
> 
> Signed-off-by: yuanx.wang <yuanx.wang@intel.com>
> ---
>  drivers/net/ice/ice_hash.c | 66 +++++++++++++++++++++-----------------
>  1 file changed, 36 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c index
> 2d23c8dd5..8092c1acc 100644
> --- a/drivers/net/ice/ice_hash.c
> +++ b/drivers/net/ice/ice_hash.c
> @@ -712,14 +712,18 @@ ice_refine_hash_cfg_l234(struct ice_rss_hash_cfg
> *hash_cfg,
>  		if (rss_type &
>  		   (ETH_RSS_NONFRAG_IPV4_UDP |
>  		    ETH_RSS_NONFRAG_IPV6_UDP)) {
> -			if (rss_type & ETH_RSS_L4_SRC_ONLY)
> -				*hash_flds &=
> ~(BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_DST_PORT));
> -			else if (rss_type & ETH_RSS_L4_DST_ONLY)
> -				*hash_flds &=
> ~(BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_SRC_PORT));
> -			else if (rss_type &
> -				(ETH_RSS_L3_SRC_ONLY |
> -				  ETH_RSS_L3_DST_ONLY))
> -				*hash_flds &= ~ICE_FLOW_HASH_UDP_PORT;
> +			if ((rss_type &
> +			     (ETH_RSS_L4_SRC_ONLY |
> ETH_RSS_L4_DST_ONLY)) !=
> +			    (ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY))

Do you want to avoid set ETH_RSS_L4_SRC_ONLY and ETH_RSS_L4_DST_ONLY at the same time?

> {
> +				if (rss_type & ETH_RSS_L4_SRC_ONLY)
> +					*hash_flds &=
> ~(BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_DST_PORT));
> +				else if (rss_type & ETH_RSS_L4_DST_ONLY)
> +					*hash_flds &=
> ~(BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_SRC_PORT));
> +				else if (rss_type &
> +					 (ETH_RSS_L3_SRC_ONLY |
> +					  ETH_RSS_L3_DST_ONLY))
> +					*hash_flds &=
> ~ICE_FLOW_HASH_UDP_PORT;
> +			}
>  		} else {
>  			*hash_flds &= ~ICE_FLOW_HASH_UDP_PORT;
>  		}
> @@ -729,14 +733,18 @@ ice_refine_hash_cfg_l234(struct ice_rss_hash_cfg
> *hash_cfg,
>  		if (rss_type &
>  		   (ETH_RSS_NONFRAG_IPV4_TCP |
>  		    ETH_RSS_NONFRAG_IPV6_TCP)) {
> -			if (rss_type & ETH_RSS_L4_SRC_ONLY)
> -				*hash_flds &=
> ~(BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_DST_PORT));
> -			else if (rss_type & ETH_RSS_L4_DST_ONLY)
> -				*hash_flds &=
> ~(BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_SRC_PORT));
> -			else if (rss_type &
> -				(ETH_RSS_L3_SRC_ONLY |
> -				  ETH_RSS_L3_DST_ONLY))
> -				*hash_flds &= ~ICE_FLOW_HASH_TCP_PORT;
> +			if ((rss_type &
> +			     (ETH_RSS_L4_SRC_ONLY |
> ETH_RSS_L4_DST_ONLY)) !=
> +			    (ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY))
> {
> +				if (rss_type & ETH_RSS_L4_SRC_ONLY)
> +					*hash_flds &=
> ~(BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_DST_PORT));
> +				else if (rss_type & ETH_RSS_L4_DST_ONLY)
> +					*hash_flds &=
> ~(BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_SRC_PORT));
> +				else if (rss_type &
> +					 (ETH_RSS_L3_SRC_ONLY |
> +					  ETH_RSS_L3_DST_ONLY))
> +					*hash_flds &=
> ~ICE_FLOW_HASH_TCP_PORT;
> +			}
>  		} else {
>  			*hash_flds &= ~ICE_FLOW_HASH_TCP_PORT;
>  		}
> @@ -746,14 +754,18 @@ ice_refine_hash_cfg_l234(struct ice_rss_hash_cfg
> *hash_cfg,
>  		if (rss_type &
>  		   (ETH_RSS_NONFRAG_IPV4_SCTP |
>  		    ETH_RSS_NONFRAG_IPV6_SCTP)) {
> -			if (rss_type & ETH_RSS_L4_SRC_ONLY)
> -				*hash_flds &=
> ~(BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_DST_PORT));
> -			else if (rss_type & ETH_RSS_L4_DST_ONLY)
> -				*hash_flds &=
> ~(BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT));
> -			else if (rss_type &
> -				(ETH_RSS_L3_SRC_ONLY |
> -				  ETH_RSS_L3_DST_ONLY))
> -				*hash_flds &= ~ICE_FLOW_HASH_SCTP_PORT;
> +			if ((rss_type &
> +			     (ETH_RSS_L4_SRC_ONLY |
> ETH_RSS_L4_DST_ONLY)) !=
> +			    (ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY))
> {
> +				if (rss_type & ETH_RSS_L4_SRC_ONLY)
> +					*hash_flds &=
> ~(BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_DST_PORT));
> +				else if (rss_type & ETH_RSS_L4_DST_ONLY)
> +					*hash_flds &=
> ~(BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT));
> +				else if (rss_type &
> +					 (ETH_RSS_L3_SRC_ONLY |
> +					  ETH_RSS_L3_DST_ONLY))
> +					*hash_flds &=
> ~ICE_FLOW_HASH_SCTP_PORT;
> +			}
>  		} else {
>  			*hash_flds &= ~ICE_FLOW_HASH_SCTP_PORT;
>  		}
> @@ -946,12 +958,6 @@ ice_hash_parse_action(struct
> ice_pattern_match_item *pattern_match_item,
>  					RTE_FLOW_ERROR_TYPE_ACTION,
> action,
>  					"a non-NULL RSS queue is not
> supported");
> 
> -			/**
> -			 * Check simultaneous use of SRC_ONLY and
> DST_ONLY
> -			 * of the same level.
> -			 */
> -			rss_type = rte_eth_rss_hf_refine(rss_type);
> -
>  			if (ice_any_invalid_rss_type(rss->func, rss_type,
>  					pattern_match_item-
> >input_set_mask))
>  				return rte_flow_error_set(error, ENOTSUP,
> --
> 2.25.1


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

* [dpdk-stable] [DPDK] net/ice: fix flow rule checking
@ 2021-01-27  7:42 yuanx.wang
  0 siblings, 0 replies; 3+ messages in thread
From: yuanx.wang @ 2021-01-27  7:42 UTC (permalink / raw)
  To: build_sh; +Cc: yuanx.wang, stable

Currently, when the RSS rule set to l4-src-only and l4-dst-only,
the hash value is different while the ingress packets
have same L4 parameters.

This patch keeps the hash value consistent in above situation.

Fixes: 38d632cbdc88 ("net/ice: refactor PF RSS")
Fixes: 0b952714e9c1 ("net/ice: refactor PF hash flow")
Cc: stable@dpdk.org

Signed-off-by: yuanx.wang <yuanx.wang@intel.com>
---
 drivers/net/ice/ice_hash.c | 66 +++++++++++++++++++++-----------------
 1 file changed, 36 insertions(+), 30 deletions(-)

diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
index 2d23c8dd5..8092c1acc 100644
--- a/drivers/net/ice/ice_hash.c
+++ b/drivers/net/ice/ice_hash.c
@@ -712,14 +712,18 @@ ice_refine_hash_cfg_l234(struct ice_rss_hash_cfg *hash_cfg,
 		if (rss_type &
 		   (ETH_RSS_NONFRAG_IPV4_UDP |
 		    ETH_RSS_NONFRAG_IPV6_UDP)) {
-			if (rss_type & ETH_RSS_L4_SRC_ONLY)
-				*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_DST_PORT));
-			else if (rss_type & ETH_RSS_L4_DST_ONLY)
-				*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_SRC_PORT));
-			else if (rss_type &
-				(ETH_RSS_L3_SRC_ONLY |
-				  ETH_RSS_L3_DST_ONLY))
-				*hash_flds &= ~ICE_FLOW_HASH_UDP_PORT;
+			if ((rss_type &
+			     (ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY)) !=
+			    (ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY)) {
+				if (rss_type & ETH_RSS_L4_SRC_ONLY)
+					*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_DST_PORT));
+				else if (rss_type & ETH_RSS_L4_DST_ONLY)
+					*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_SRC_PORT));
+				else if (rss_type &
+					 (ETH_RSS_L3_SRC_ONLY |
+					  ETH_RSS_L3_DST_ONLY))
+					*hash_flds &= ~ICE_FLOW_HASH_UDP_PORT;
+			}
 		} else {
 			*hash_flds &= ~ICE_FLOW_HASH_UDP_PORT;
 		}
@@ -729,14 +733,18 @@ ice_refine_hash_cfg_l234(struct ice_rss_hash_cfg *hash_cfg,
 		if (rss_type &
 		   (ETH_RSS_NONFRAG_IPV4_TCP |
 		    ETH_RSS_NONFRAG_IPV6_TCP)) {
-			if (rss_type & ETH_RSS_L4_SRC_ONLY)
-				*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_DST_PORT));
-			else if (rss_type & ETH_RSS_L4_DST_ONLY)
-				*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_SRC_PORT));
-			else if (rss_type &
-				(ETH_RSS_L3_SRC_ONLY |
-				  ETH_RSS_L3_DST_ONLY))
-				*hash_flds &= ~ICE_FLOW_HASH_TCP_PORT;
+			if ((rss_type &
+			     (ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY)) !=
+			    (ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY)) {
+				if (rss_type & ETH_RSS_L4_SRC_ONLY)
+					*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_DST_PORT));
+				else if (rss_type & ETH_RSS_L4_DST_ONLY)
+					*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_SRC_PORT));
+				else if (rss_type &
+					 (ETH_RSS_L3_SRC_ONLY |
+					  ETH_RSS_L3_DST_ONLY))
+					*hash_flds &= ~ICE_FLOW_HASH_TCP_PORT;
+			}
 		} else {
 			*hash_flds &= ~ICE_FLOW_HASH_TCP_PORT;
 		}
@@ -746,14 +754,18 @@ ice_refine_hash_cfg_l234(struct ice_rss_hash_cfg *hash_cfg,
 		if (rss_type &
 		   (ETH_RSS_NONFRAG_IPV4_SCTP |
 		    ETH_RSS_NONFRAG_IPV6_SCTP)) {
-			if (rss_type & ETH_RSS_L4_SRC_ONLY)
-				*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_DST_PORT));
-			else if (rss_type & ETH_RSS_L4_DST_ONLY)
-				*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT));
-			else if (rss_type &
-				(ETH_RSS_L3_SRC_ONLY |
-				  ETH_RSS_L3_DST_ONLY))
-				*hash_flds &= ~ICE_FLOW_HASH_SCTP_PORT;
+			if ((rss_type &
+			     (ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY)) !=
+			    (ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY)) {
+				if (rss_type & ETH_RSS_L4_SRC_ONLY)
+					*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_DST_PORT));
+				else if (rss_type & ETH_RSS_L4_DST_ONLY)
+					*hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT));
+				else if (rss_type &
+					 (ETH_RSS_L3_SRC_ONLY |
+					  ETH_RSS_L3_DST_ONLY))
+					*hash_flds &= ~ICE_FLOW_HASH_SCTP_PORT;
+			}
 		} else {
 			*hash_flds &= ~ICE_FLOW_HASH_SCTP_PORT;
 		}
@@ -946,12 +958,6 @@ ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item,
 					RTE_FLOW_ERROR_TYPE_ACTION, action,
 					"a non-NULL RSS queue is not supported");
 
-			/**
-			 * Check simultaneous use of SRC_ONLY and DST_ONLY
-			 * of the same level.
-			 */
-			rss_type = rte_eth_rss_hf_refine(rss_type);
-
 			if (ice_any_invalid_rss_type(rss->func, rss_type,
 					pattern_match_item->input_set_mask))
 				return rte_flow_error_set(error, ENOTSUP,
-- 
2.25.1


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

end of thread, other threads:[~2021-01-28  8:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-27  9:42 [dpdk-stable] [DPDK] net/ice: fix flow rule checking yuanx.wang
2021-01-28  8:13 ` Yang, Qiming
  -- strict thread matches above, loose matches on Subject: below --
2021-01-27  7:42 yuanx.wang

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