DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ice: fix invalid RSS type
@ 2020-07-09  6:26 Simei Su
  2020-07-09  6:46 ` Zhang, Qi Z
  2020-07-09  7:50 ` [dpdk-dev] [PATCH v2] " Simei Su
  0 siblings, 2 replies; 10+ messages in thread
From: Simei Su @ 2020-07-09  6:26 UTC (permalink / raw)
  To: qi.z.zhang; +Cc: dev, jia.guo, Simei Su

When a RSS rule with only RSS type modifirer L2/L3/L4 SRC/DST_ONLY,
it should return failure. This patch adds invalid RSS type check.

Fixes: dfaedcf20170 ("net/ice: refactor PF hash flow")

Signed-off-by: Simei Su <simei.su@intel.com>
---
 drivers/net/ice/ice_hash.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
index cbd6116..777bd6d 100644
--- a/drivers/net/ice/ice_hash.c
+++ b/drivers/net/ice/ice_hash.c
@@ -721,6 +721,11 @@ struct ice_hash_match_type ice_hash_type_list[] = {
 			 * of the same level.
 			 */
 			rss_type = rte_eth_rss_hf_refine(rss_type);
+			/* Check if only L2/L3/L4 src/dst-only exists. */
+			if ((rss_type & 0xffffffff) == 0)
+				return rte_flow_error_set(error, ENOTSUP,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"rss type with only L2/L3/L4 src/dst only is invalid");
 
 			combine_type = ETH_RSS_L2_SRC_ONLY |
 					ETH_RSS_L2_DST_ONLY |
-- 
1.8.3.1


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

* Re: [dpdk-dev] [PATCH] net/ice: fix invalid RSS type
  2020-07-09  6:26 [dpdk-dev] [PATCH] net/ice: fix invalid RSS type Simei Su
@ 2020-07-09  6:46 ` Zhang, Qi Z
  2020-07-09  7:32   ` Su, Simei
  2020-07-09  7:50 ` [dpdk-dev] [PATCH v2] " Simei Su
  1 sibling, 1 reply; 10+ messages in thread
From: Zhang, Qi Z @ 2020-07-09  6:46 UTC (permalink / raw)
  To: Su, Simei; +Cc: dev, Guo, Jia



> -----Original Message-----
> From: Su, Simei <simei.su@intel.com>
> Sent: Thursday, July 9, 2020 2:27 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Guo, Jia <jia.guo@intel.com>; Su, Simei
> <simei.su@intel.com>
> Subject: [PATCH] net/ice: fix invalid RSS type
> 
> When a RSS rule with only RSS type modifirer L2/L3/L4 SRC/DST_ONLY, it
> should return failure. This patch adds invalid RSS type check.
> 
> Fixes: dfaedcf20170 ("net/ice: refactor PF hash flow")
> 
> Signed-off-by: Simei Su <simei.su@intel.com>
> ---
>  drivers/net/ice/ice_hash.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c index
> cbd6116..777bd6d 100644
> --- a/drivers/net/ice/ice_hash.c
> +++ b/drivers/net/ice/ice_hash.c
> @@ -721,6 +721,11 @@ struct ice_hash_match_type ice_hash_type_list[] = {
>  			 * of the same level.
>  			 */
>  			rss_type = rte_eth_rss_hf_refine(rss_type);
> +			/* Check if only L2/L3/L4 src/dst-only exists. */
> +			if ((rss_type & 0xffffffff) == 0)

Why 0xffffffff? We should not hard code.

> +				return rte_flow_error_set(error, ENOTSUP,
> +					RTE_FLOW_ERROR_TYPE_ACTION, action,
> +					"rss type with only L2/L3/L4 src/dst only is invalid");
> 
>  			combine_type = ETH_RSS_L2_SRC_ONLY |
>  					ETH_RSS_L2_DST_ONLY |
> --
> 1.8.3.1


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

* Re: [dpdk-dev] [PATCH] net/ice: fix invalid RSS type
  2020-07-09  6:46 ` Zhang, Qi Z
@ 2020-07-09  7:32   ` Su, Simei
  0 siblings, 0 replies; 10+ messages in thread
From: Su, Simei @ 2020-07-09  7:32 UTC (permalink / raw)
  To: Zhang, Qi Z; +Cc: dev, Guo, Jia



> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Thursday, July 9, 2020 2:47 PM
> To: Su, Simei <simei.su@intel.com>
> Cc: dev@dpdk.org; Guo, Jia <jia.guo@intel.com>
> Subject: RE: [PATCH] net/ice: fix invalid RSS type
> 
> 
> 
> > -----Original Message-----
> > From: Su, Simei <simei.su@intel.com>
> > Sent: Thursday, July 9, 2020 2:27 PM
> > To: Zhang, Qi Z <qi.z.zhang@intel.com>
> > Cc: dev@dpdk.org; Guo, Jia <jia.guo@intel.com>; Su, Simei
> > <simei.su@intel.com>
> > Subject: [PATCH] net/ice: fix invalid RSS type
> >
> > When a RSS rule with only RSS type modifirer L2/L3/L4 SRC/DST_ONLY, it
> > should return failure. This patch adds invalid RSS type check.
> >
> > Fixes: dfaedcf20170 ("net/ice: refactor PF hash flow")
> >
> > Signed-off-by: Simei Su <simei.su@intel.com>
> > ---
> >  drivers/net/ice/ice_hash.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
> > index cbd6116..777bd6d 100644
> > --- a/drivers/net/ice/ice_hash.c
> > +++ b/drivers/net/ice/ice_hash.c
> > @@ -721,6 +721,11 @@ struct ice_hash_match_type ice_hash_type_list[] =
> {
> >  			 * of the same level.
> >  			 */
> >  			rss_type = rte_eth_rss_hf_refine(rss_type);
> > +			/* Check if only L2/L3/L4 src/dst-only exists. */
> > +			if ((rss_type & 0xffffffff) == 0)
> 
> Why 0xffffffff? We should not hard code.

 Ok, got it. My purpose is to check if rss type is 0 except SRC/DST_ONLY bit to make sure there exist ipv4, ipv6, udp, tcp or sctp type, etc. I will modify it in v2. Thanks.

Br
Simei

> 
> > +				return rte_flow_error_set(error, ENOTSUP,
> > +					RTE_FLOW_ERROR_TYPE_ACTION, action,
> > +					"rss type with only L2/L3/L4 src/dst only is invalid");
> >
> >  			combine_type = ETH_RSS_L2_SRC_ONLY |
> >  					ETH_RSS_L2_DST_ONLY |
> > --
> > 1.8.3.1
> 


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

* [dpdk-dev] [PATCH v2] net/ice: fix invalid RSS type
  2020-07-09  6:26 [dpdk-dev] [PATCH] net/ice: fix invalid RSS type Simei Su
  2020-07-09  6:46 ` Zhang, Qi Z
@ 2020-07-09  7:50 ` Simei Su
  2020-07-11 14:01   ` [dpdk-dev] [PATCH v3] " Simei Su
  1 sibling, 1 reply; 10+ messages in thread
From: Simei Su @ 2020-07-09  7:50 UTC (permalink / raw)
  To: qi.z.zhang; +Cc: dev, jia.guo, Simei Su

When a RSS rule with only RSS type modifier L2/L3/L4 SRC/DST_ONLY,
it should return failure. This patch adds invalid RSS type check.

Fixes: dfaedcf20170 ("net/ice: refactor PF hash flow")

Signed-off-by: Simei Su <simei.su@intel.com>
---

v2:
* Add specific macro value in check rather than hard code.
---
 drivers/net/ice/ice_hash.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
index cbd6116..2c79458 100644
--- a/drivers/net/ice/ice_hash.c
+++ b/drivers/net/ice/ice_hash.c
@@ -722,6 +722,17 @@ struct ice_hash_match_type ice_hash_type_list[] = {
 			 */
 			rss_type = rte_eth_rss_hf_refine(rss_type);
 
+			/* Check if only L2/L3/L4 SRC/DST_ONLY exists. */
+			if ((rss_type & ~(ETH_RSS_L2_SRC_ONLY |
+					  ETH_RSS_L2_DST_ONLY |
+					  ETH_RSS_L3_SRC_ONLY |
+					  ETH_RSS_L3_DST_ONLY |
+					  ETH_RSS_L4_SRC_ONLY |
+					  ETH_RSS_L4_DST_ONLY)) == 0)
+				return rte_flow_error_set(error, ENOTSUP,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"rss type with only L2/L3/L4 src/dst only is invalid");
+
 			combine_type = ETH_RSS_L2_SRC_ONLY |
 					ETH_RSS_L2_DST_ONLY |
 					ETH_RSS_L3_SRC_ONLY |
-- 
1.8.3.1


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

* [dpdk-dev] [PATCH v3] net/ice: fix invalid RSS type
  2020-07-09  7:50 ` [dpdk-dev] [PATCH v2] " Simei Su
@ 2020-07-11 14:01   ` Simei Su
  2020-07-15 10:25     ` [dpdk-dev] [PATCH v4] " Simei Su
  0 siblings, 1 reply; 10+ messages in thread
From: Simei Su @ 2020-07-11 14:01 UTC (permalink / raw)
  To: qi.z.zhang; +Cc: dev, junfeng.guo, ting.xu, jia.guo, Simei Su

When a RSS rule with only SRC/DST_ONLY or IPV6 prefix RSS type,
it should return failure. Besides, when a RSS rule with symmetric
hash function, the RSS type shouldn't carry with SRC/DST_ONLY or
IPV6 prefix. This patch adds invalid RSS type check for the two
cases.

Fixes: dfdc589f6ee0 ("net/ice: refactor PF hash flow")

Signed-off-by: Simei Su <simei.su@intel.com>
---

v3:
* Add invalid RSS type check for symmetric case.
* Consider IPV6 prefix.
* Refine commit log.

v2:
* Add specific macro value in check rather than hard code.
---
 drivers/net/ice/ice_hash.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
index e57feff..01311b4 100644
--- a/drivers/net/ice/ice_hash.c
+++ b/drivers/net/ice/ice_hash.c
@@ -1049,13 +1049,36 @@ struct ice_hash_match_type ice_hash_type_list[] = {
 			combine_type = ETH_RSS_L2_SRC_ONLY |
 					ETH_RSS_L2_DST_ONLY |
 					RTE_ETH_RSS_L3_PRE32    |
+					RTE_ETH_RSS_L3_PRE40	|
 					RTE_ETH_RSS_L3_PRE48    |
+					RTE_ETH_RSS_L3_PRE56	|
 					RTE_ETH_RSS_L3_PRE64    |
+					RTE_ETH_RSS_L3_PRE96	|
 					ETH_RSS_L3_SRC_ONLY |
 					ETH_RSS_L3_DST_ONLY |
 					ETH_RSS_L4_SRC_ONLY |
 					ETH_RSS_L4_DST_ONLY;
 
+			/* Check if only SRC/DST_ONLY or ipv6 prefix exists. */
+			if ((rss_type & ~combine_type) == 0)
+				return rte_flow_error_set(error, ENOTSUP,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"invalid rss types");
+
+			/**
+			 * Check if SRC/DST_ONLY or ipv6 prefix is set for
+			 * SYMMETRIC_TOEPLITZ hash function.
+			 */
+			if (rss->func ==
+				RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
+				if (rss_type & combine_type)
+					return rte_flow_error_set(error,
+						ENOTSUP,
+						RTE_FLOW_ERROR_TYPE_ACTION,
+						action,
+						"invalid rss types");
+			}
+
 			/* Check if rss types match pattern. */
 			if (rss_type & ~combine_type & ~m->eth_rss_hint) {
 				return rte_flow_error_set(error,
-- 
1.8.3.1


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

* [dpdk-dev] [PATCH v4] net/ice: fix invalid RSS type
  2020-07-11 14:01   ` [dpdk-dev] [PATCH v3] " Simei Su
@ 2020-07-15 10:25     ` Simei Su
  2020-07-15 14:13       ` Zhang, Qi Z
  2020-07-16  3:24       ` [dpdk-dev] [PATCH v5] " Simei Su
  0 siblings, 2 replies; 10+ messages in thread
From: Simei Su @ 2020-07-15 10:25 UTC (permalink / raw)
  To: qi.z.zhang; +Cc: dev, junfeng.guo, jia.guo, ting.xu, Simei Su

When a RSS rule with only SRC/DST_ONLY or IPV6 prefix RSS type,
it should return failure. Besides, when a RSS rule with symmetric
hash function, the RSS type shouldn't carry with SRC/DST_ONLY.
This patch adds invalid RSS type check for the two cases.

Fixes: dfdc589f6ee0 ("net/ice: refactor PF hash flow")

Signed-off-by: Simei Su <simei.su@intel.com>
---

v4:
* Modify check logic for symmetric case.

v3:
* Add invalid RSS type check for symmetric case.
* Consider IPV6 prefix.
* Refine commit log.

v2:
* Add specific macro value in check rather than hard code.
---
 drivers/net/ice/ice_hash.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
index e57feff..009ea1f 100644
--- a/drivers/net/ice/ice_hash.c
+++ b/drivers/net/ice/ice_hash.c
@@ -1049,13 +1049,41 @@ struct ice_hash_match_type ice_hash_type_list[] = {
 			combine_type = ETH_RSS_L2_SRC_ONLY |
 					ETH_RSS_L2_DST_ONLY |
 					RTE_ETH_RSS_L3_PRE32    |
+					RTE_ETH_RSS_L3_PRE40	|
 					RTE_ETH_RSS_L3_PRE48    |
+					RTE_ETH_RSS_L3_PRE56	|
 					RTE_ETH_RSS_L3_PRE64    |
+					RTE_ETH_RSS_L3_PRE96	|
 					ETH_RSS_L3_SRC_ONLY |
 					ETH_RSS_L3_DST_ONLY |
 					ETH_RSS_L4_SRC_ONLY |
 					ETH_RSS_L4_DST_ONLY;
 
+			/* Check if only SRC/DST_ONLY or ipv6 prefix exists. */
+			if ((rss_type & ~combine_type) == 0)
+				return rte_flow_error_set(error, ENOTSUP,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"invalid rss types");
+
+			/**
+			 * Check if SRC/DST_ONLY is set for SYMMETRIC_TOEPLITZ
+			 * hash function.
+			 */
+			if (rss->func ==
+				RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
+				if (rss_type & (ETH_RSS_L2_SRC_ONLY |
+						ETH_RSS_L2_DST_ONLY |
+						ETH_RSS_L3_SRC_ONLY |
+						ETH_RSS_L3_DST_ONLY |
+						ETH_RSS_L4_SRC_ONLY |
+						ETH_RSS_L4_DST_ONLY))
+					return rte_flow_error_set(error,
+						ENOTSUP,
+						RTE_FLOW_ERROR_TYPE_ACTION,
+						action,
+						"invalid rss types");
+			}
+
 			/* Check if rss types match pattern. */
 			if (rss_type & ~combine_type & ~m->eth_rss_hint) {
 				return rte_flow_error_set(error,
-- 
1.8.3.1


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

* Re: [dpdk-dev] [PATCH v4] net/ice: fix invalid RSS type
  2020-07-15 10:25     ` [dpdk-dev] [PATCH v4] " Simei Su
@ 2020-07-15 14:13       ` Zhang, Qi Z
  2020-07-16  3:01         ` Su, Simei
  2020-07-16  3:24       ` [dpdk-dev] [PATCH v5] " Simei Su
  1 sibling, 1 reply; 10+ messages in thread
From: Zhang, Qi Z @ 2020-07-15 14:13 UTC (permalink / raw)
  To: Su, Simei; +Cc: dev, Guo, Junfeng, Guo, Jia, Xu, Ting



> -----Original Message-----
> From: Su, Simei <simei.su@intel.com>
> Sent: Wednesday, July 15, 2020 6:26 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Guo, Junfeng <junfeng.guo@intel.com>; Guo, Jia
> <jia.guo@intel.com>; Xu, Ting <ting.xu@intel.com>; Su, Simei
> <simei.su@intel.com>
> Subject: [PATCH v4] net/ice: fix invalid RSS type
> 
> When a RSS rule with only SRC/DST_ONLY or IPV6 prefix RSS type, it should
> return failure. Besides, when a RSS rule with symmetric hash function, the RSS
> type shouldn't carry with SRC/DST_ONLY.
> This patch adds invalid RSS type check for the two cases.
> 
> Fixes: dfdc589f6ee0 ("net/ice: refactor PF hash flow")
> 
> Signed-off-by: Simei Su <simei.su@intel.com>

> ---
> 
> v4:
> * Modify check logic for symmetric case.
> 
> v3:
> * Add invalid RSS type check for symmetric case.
> * Consider IPV6 prefix.
> * Refine commit log.
> 
> v2:
> * Add specific macro value in check rather than hard code.
> ---
>  drivers/net/ice/ice_hash.c | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c index
> e57feff..009ea1f 100644
> --- a/drivers/net/ice/ice_hash.c
> +++ b/drivers/net/ice/ice_hash.c
> @@ -1049,13 +1049,41 @@ struct ice_hash_match_type ice_hash_type_list[] =
> {
>  			combine_type = ETH_RSS_L2_SRC_ONLY |
>  					ETH_RSS_L2_DST_ONLY |
>  					RTE_ETH_RSS_L3_PRE32    |
> +					RTE_ETH_RSS_L3_PRE40	|
>  					RTE_ETH_RSS_L3_PRE48    |
> +					RTE_ETH_RSS_L3_PRE56	|
>  					RTE_ETH_RSS_L3_PRE64    |
> +					RTE_ETH_RSS_L3_PRE96	|
>  					ETH_RSS_L3_SRC_ONLY |
>  					ETH_RSS_L3_DST_ONLY |
>  					ETH_RSS_L4_SRC_ONLY |
>  					ETH_RSS_L4_DST_ONLY;

Do we support 48, 56 and 96?  Will they already be rejected during previous check?

Better to refactor the code to avoid duplicate, for example:

 rss_attr_src_dst = ETH_RSS_L2_DST_ONLY | ETH_RSS_L2_SRC_ONLY....

 rss_attr_l3_pre = ETH_RSS_L3_PRE32 | PRE_40 | ...

 rss_attr_all = rss_attr_v6_prefix | rss_attr_src_dst


> 
> +			/* Check if only SRC/DST_ONLY or ipv6 prefix exists. */
> +			if ((rss_type & ~combine_type) == 0)
> +				return rte_flow_error_set(error, ENOTSUP,
> +					RTE_FLOW_ERROR_TYPE_ACTION, action,
> +					"invalid rss types");
> +
> +			/**
> +			 * Check if SRC/DST_ONLY is set for SYMMETRIC_TOEPLITZ
> +			 * hash function.
> +			 */
> +			if (rss->func ==
> +				RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
> +				if (rss_type & (ETH_RSS_L2_SRC_ONLY |
> +						ETH_RSS_L2_DST_ONLY |
> +						ETH_RSS_L3_SRC_ONLY |
> +						ETH_RSS_L3_DST_ONLY |
> +						ETH_RSS_L4_SRC_ONLY |
> +						ETH_RSS_L4_DST_ONLY))
> +					return rte_flow_error_set(error,
> +						ENOTSUP,
> +						RTE_FLOW_ERROR_TYPE_ACTION,
> +						action,
> +						"invalid rss types");
> +			}
> +
>  			/* Check if rss types match pattern. */
>  			if (rss_type & ~combine_type & ~m->eth_rss_hint) {
>  				return rte_flow_error_set(error,
> --
> 1.8.3.1


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

* Re: [dpdk-dev] [PATCH v4] net/ice: fix invalid RSS type
  2020-07-15 14:13       ` Zhang, Qi Z
@ 2020-07-16  3:01         ` Su, Simei
  0 siblings, 0 replies; 10+ messages in thread
From: Su, Simei @ 2020-07-16  3:01 UTC (permalink / raw)
  To: Zhang, Qi Z; +Cc: dev, Guo, Junfeng, Guo, Jia, Xu, Ting

Hi, Qi

> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Wednesday, July 15, 2020 10:13 PM
> To: Su, Simei <simei.su@intel.com>
> Cc: dev@dpdk.org; Guo, Junfeng <junfeng.guo@intel.com>; Guo, Jia
> <jia.guo@intel.com>; Xu, Ting <ting.xu@intel.com>
> Subject: RE: [PATCH v4] net/ice: fix invalid RSS type
> 
> 
> 
> > -----Original Message-----
> > From: Su, Simei <simei.su@intel.com>
> > Sent: Wednesday, July 15, 2020 6:26 PM
> > To: Zhang, Qi Z <qi.z.zhang@intel.com>
> > Cc: dev@dpdk.org; Guo, Junfeng <junfeng.guo@intel.com>; Guo, Jia
> > <jia.guo@intel.com>; Xu, Ting <ting.xu@intel.com>; Su, Simei
> > <simei.su@intel.com>
> > Subject: [PATCH v4] net/ice: fix invalid RSS type
> >
> > When a RSS rule with only SRC/DST_ONLY or IPV6 prefix RSS type, it
> > should return failure. Besides, when a RSS rule with symmetric hash
> > function, the RSS type shouldn't carry with SRC/DST_ONLY.
> > This patch adds invalid RSS type check for the two cases.
> >
> > Fixes: dfdc589f6ee0 ("net/ice: refactor PF hash flow")
> >
> > Signed-off-by: Simei Su <simei.su@intel.com>
> 
> > ---
> >
> > v4:
> > * Modify check logic for symmetric case.
> >
> > v3:
> > * Add invalid RSS type check for symmetric case.
> > * Consider IPV6 prefix.
> > * Refine commit log.
> >
> > v2:
> > * Add specific macro value in check rather than hard code.
> > ---
> >  drivers/net/ice/ice_hash.c | 28 ++++++++++++++++++++++++++++
> >  1 file changed, 28 insertions(+)
> >
> > diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
> > index e57feff..009ea1f 100644
> > --- a/drivers/net/ice/ice_hash.c
> > +++ b/drivers/net/ice/ice_hash.c
> > @@ -1049,13 +1049,41 @@ struct ice_hash_match_type
> > ice_hash_type_list[] = {
> >  			combine_type = ETH_RSS_L2_SRC_ONLY |
> >  					ETH_RSS_L2_DST_ONLY |
> >  					RTE_ETH_RSS_L3_PRE32    |
> > +					RTE_ETH_RSS_L3_PRE40	|
> >  					RTE_ETH_RSS_L3_PRE48    |
> > +					RTE_ETH_RSS_L3_PRE56	|
> >  					RTE_ETH_RSS_L3_PRE64    |
> > +					RTE_ETH_RSS_L3_PRE96	|
> >  					ETH_RSS_L3_SRC_ONLY |
> >  					ETH_RSS_L3_DST_ONLY |
> >  					ETH_RSS_L4_SRC_ONLY |
> >  					ETH_RSS_L4_DST_ONLY;
> 
> Do we support 48, 56 and 96?  Will they already be rejected during previous
> check?

  We only support 32, 48 and 64 currently.

> 
> Better to refactor the code to avoid duplicate, for example:
> 
>  rss_attr_src_dst = ETH_RSS_L2_DST_ONLY | ETH_RSS_L2_SRC_ONLY....
> 
>  rss_attr_l3_pre = ETH_RSS_L3_PRE32 | PRE_40 | ...
> 
>  rss_attr_all = rss_attr_v6_prefix | rss_attr_src_dst
> 
   
   Ok, I will refine it. Thanks.

Br
Simei

> 
> >
> > +			/* Check if only SRC/DST_ONLY or ipv6 prefix exists. */
> > +			if ((rss_type & ~combine_type) == 0)
> > +				return rte_flow_error_set(error, ENOTSUP,
> > +					RTE_FLOW_ERROR_TYPE_ACTION, action,
> > +					"invalid rss types");
> > +
> > +			/**
> > +			 * Check if SRC/DST_ONLY is set for SYMMETRIC_TOEPLITZ
> > +			 * hash function.
> > +			 */
> > +			if (rss->func ==
> > +				RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
> > +				if (rss_type & (ETH_RSS_L2_SRC_ONLY |
> > +						ETH_RSS_L2_DST_ONLY |
> > +						ETH_RSS_L3_SRC_ONLY |
> > +						ETH_RSS_L3_DST_ONLY |
> > +						ETH_RSS_L4_SRC_ONLY |
> > +						ETH_RSS_L4_DST_ONLY))
> > +					return rte_flow_error_set(error,
> > +						ENOTSUP,
> > +						RTE_FLOW_ERROR_TYPE_ACTION,
> > +						action,
> > +						"invalid rss types");
> > +			}
> > +
> >  			/* Check if rss types match pattern. */
> >  			if (rss_type & ~combine_type & ~m->eth_rss_hint) {
> >  				return rte_flow_error_set(error,
> > --
> > 1.8.3.1
> 


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

* [dpdk-dev] [PATCH v5] net/ice: fix invalid RSS type
  2020-07-15 10:25     ` [dpdk-dev] [PATCH v4] " Simei Su
  2020-07-15 14:13       ` Zhang, Qi Z
@ 2020-07-16  3:24       ` Simei Su
  2020-07-16  3:33         ` Zhang, Qi Z
  1 sibling, 1 reply; 10+ messages in thread
From: Simei Su @ 2020-07-16  3:24 UTC (permalink / raw)
  To: qi.z.zhang; +Cc: dev, jia.guo, junfeng.guo, ting.xu, Simei Su

When a RSS rule with only SRC/DST_ONLY or IPV6 prefix RSS type,
it should return failure. Besides, when a RSS rule with symmetric
hash function, the RSS type shouldn't carry with SRC/DST_ONLY.
This patch adds invalid RSS type check for the two cases.

Fixes: 0b952714e9c1 ("net/ice: refactor PF hash flow")

Signed-off-by: Simei Su <simei.su@intel.com>
---

v5:
* Refactor code to avoid duplicate.

v4:
* Modify check logic for symmetric case.

v3:
* Add invalid RSS type check for symmetric case.
* Consider IPV6 prefix.
* Refine commit log.

v2:
* Add specific macro value in check rather than hard code.
---
 drivers/net/ice/ice_hash.c | 47 +++++++++++++++++++++++++++++++++++-----------
 1 file changed, 36 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
index e57feff..af29ab6 100644
--- a/drivers/net/ice/ice_hash.c
+++ b/drivers/net/ice/ice_hash.c
@@ -994,7 +994,9 @@ struct ice_hash_match_type ice_hash_type_list[] = {
 	enum rte_flow_action_type action_type;
 	const struct rte_flow_action_rss *rss;
 	const struct rte_flow_action *action;
-	uint64_t combine_type;
+	uint64_t rss_attr_src_dst;
+	uint64_t rss_attr_l3_pre;
+	uint64_t rss_attr_all;
 	uint64_t rss_type;
 	uint16_t i;
 
@@ -1046,18 +1048,41 @@ struct ice_hash_match_type ice_hash_type_list[] = {
 			 */
 			rss_type = rte_eth_rss_hf_refine(rss_type);
 
-			combine_type = ETH_RSS_L2_SRC_ONLY |
-					ETH_RSS_L2_DST_ONLY |
-					RTE_ETH_RSS_L3_PRE32    |
-					RTE_ETH_RSS_L3_PRE48    |
-					RTE_ETH_RSS_L3_PRE64    |
-					ETH_RSS_L3_SRC_ONLY |
-					ETH_RSS_L3_DST_ONLY |
-					ETH_RSS_L4_SRC_ONLY |
-					ETH_RSS_L4_DST_ONLY;
+			rss_attr_src_dst = ETH_RSS_L2_SRC_ONLY |
+					   ETH_RSS_L2_DST_ONLY |
+					   ETH_RSS_L3_SRC_ONLY |
+					   ETH_RSS_L3_DST_ONLY |
+					   ETH_RSS_L4_SRC_ONLY |
+					   ETH_RSS_L4_DST_ONLY;
+
+			rss_attr_l3_pre = RTE_ETH_RSS_L3_PRE32 |
+					  RTE_ETH_RSS_L3_PRE48 |
+					  RTE_ETH_RSS_L3_PRE64;
+
+			rss_attr_all = rss_attr_src_dst | rss_attr_l3_pre;
+
+			/* Check if only SRC/DST_ONLY or ipv6 prefix exists. */
+			if ((rss_type & ~rss_attr_all) == 0)
+				return rte_flow_error_set(error, ENOTSUP,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"invalid rss types");
+
+			/**
+			 * Check if SRC/DST_ONLY is set for SYMMETRIC_TOEPLITZ
+			 * hash function.
+			 */
+			if (rss->func ==
+				RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
+				if (rss_type & rss_attr_src_dst)
+					return rte_flow_error_set(error,
+						ENOTSUP,
+						RTE_FLOW_ERROR_TYPE_ACTION,
+						action,
+						"invalid rss types");
+			}
 
 			/* Check if rss types match pattern. */
-			if (rss_type & ~combine_type & ~m->eth_rss_hint) {
+			if (rss_type & ~rss_attr_all & ~m->eth_rss_hint) {
 				return rte_flow_error_set(error,
 				ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION,
 				action, "Not supported RSS types");
-- 
1.8.3.1


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

* Re: [dpdk-dev] [PATCH v5] net/ice: fix invalid RSS type
  2020-07-16  3:24       ` [dpdk-dev] [PATCH v5] " Simei Su
@ 2020-07-16  3:33         ` Zhang, Qi Z
  0 siblings, 0 replies; 10+ messages in thread
From: Zhang, Qi Z @ 2020-07-16  3:33 UTC (permalink / raw)
  To: Su, Simei; +Cc: dev, Guo, Jia, Guo, Junfeng, Xu, Ting



> -----Original Message-----
> From: Su, Simei <simei.su@intel.com>
> Sent: Thursday, July 16, 2020 11:25 AM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Guo, Jia <jia.guo@intel.com>; Guo, Junfeng
> <junfeng.guo@intel.com>; Xu, Ting <ting.xu@intel.com>; Su, Simei
> <simei.su@intel.com>
> Subject: [PATCH v5] net/ice: fix invalid RSS type
> 
> When a RSS rule with only SRC/DST_ONLY or IPV6 prefix RSS type, it should
> return failure. Besides, when a RSS rule with symmetric hash function, the RSS
> type shouldn't carry with SRC/DST_ONLY.
> This patch adds invalid RSS type check for the two cases.
> 
> Fixes: 0b952714e9c1 ("net/ice: refactor PF hash flow")
> 
> Signed-off-by: Simei Su <simei.su@intel.com>

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

Applied to dpdk-next-net-intel.

Thanks
Qi

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

end of thread, other threads:[~2020-07-16  3:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-09  6:26 [dpdk-dev] [PATCH] net/ice: fix invalid RSS type Simei Su
2020-07-09  6:46 ` Zhang, Qi Z
2020-07-09  7:32   ` Su, Simei
2020-07-09  7:50 ` [dpdk-dev] [PATCH v2] " Simei Su
2020-07-11 14:01   ` [dpdk-dev] [PATCH v3] " Simei Su
2020-07-15 10:25     ` [dpdk-dev] [PATCH v4] " Simei Su
2020-07-15 14:13       ` Zhang, Qi Z
2020-07-16  3:01         ` Su, Simei
2020-07-16  3:24       ` [dpdk-dev] [PATCH v5] " Simei Su
2020-07-16  3:33         ` Zhang, Qi Z

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