patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/mlx5: fix the RSS consistency check of meter policy
@ 2021-10-18 13:16 Bing Zhao
  2021-10-18 14:43 ` [dpdk-stable] [PATCH v2] " Bing Zhao
  2021-10-20 19:35 ` [dpdk-stable] [PATCH] " Raslan Darawsheh
  0 siblings, 2 replies; 6+ messages in thread
From: Bing Zhao @ 2021-10-18 13:16 UTC (permalink / raw)
  To: viacheslavo, matan; +Cc: dev, rasland, stable

After yellow color actions in the metering policy were supported,
the RSS could be used for both green and yellow colors and only the
queues attribute could be different.

When specifying the attributes of a RSS, some fields can be ignored
and some default values will be used in PMD. For example, there is a
default RSS key in the PMD and it will be used to create the TIR if
nothing is provided by the application.

The default value cases were missed in the current implementation
and it would cause some false positives or crashes.

The comparison function should be adjusted to take all cases into
consideration when RSS is used for both green and yellow colors.

Fixes: 4b7bf3ffb473 ("net/mlx5: support yellow in meter policy validation")
Cc: stable@dpdk.org

Signed-off-by: Bing Zhao <bingz@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 609ab43fb6..828f290308 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -17412,12 +17412,22 @@ static inline int
 flow_dv_mtr_policy_rss_compare(const struct rte_flow_action_rss *r1,
 			       const struct rte_flow_action_rss *r2)
 {
-	if (!r1 || !r2)
+	if (r1 == NULL || r2 == NULL)
 		return 0;
-	if (r1->func != r2->func || r1->level != r2->level ||
-	    r1->types != r2->types || r1->key_len != r2->key_len ||
-	    memcmp(r1->key, r2->key, r1->key_len))
+	if (!(r1->level <= 1 && r2->level <= 1) &&
+	    !(r1->level > 1 && r2->level > 1))
 		return 1;
+	if ((r1->types != r2->types) &&
+	    !((r1->types == 0 || r1->types == ETH_RSS_IP) &&
+	      (r2->types == 0 || r2->types == ETH_RSS_IP)))
+		return 1;
+	if (r1->key || r2->key) {
+		const void *key1 = r1->key ? r1->key : rss_hash_default_key;
+		const void *key2 = r2->key ? r2->key : rss_hash_default_key;
+
+		if (memcmp(key1, key2, MLX5_RSS_HASH_KEY_LEN))
+			return 1;
+	}
 	return 0;
 }
 
-- 
2.27.0


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

* [dpdk-stable] [PATCH v2] net/mlx5: fix the RSS consistency check of meter policy
  2021-10-18 13:16 [dpdk-stable] [PATCH] net/mlx5: fix the RSS consistency check of meter policy Bing Zhao
@ 2021-10-18 14:43 ` Bing Zhao
  2021-11-04  8:56   ` Matan Azrad
                     ` (2 more replies)
  2021-10-20 19:35 ` [dpdk-stable] [PATCH] " Raslan Darawsheh
  1 sibling, 3 replies; 6+ messages in thread
From: Bing Zhao @ 2021-10-18 14:43 UTC (permalink / raw)
  To: viacheslavo, matan; +Cc: dev, rasland, stable

After yellow color actions in the metering policy were supported,
the RSS could be used for both green and yellow colors and only the
queues attribute could be different.

When specifying the attributes of a RSS, some fields can be ignored
and some default values will be used in PMD. For example, there is a
default RSS key in the PMD and it will be used to create the TIR if
nothing is provided by the application.

The default value cases were missed in the current implementation
and it would cause some false positives or crashes.

The comparison function should be adjusted to take all cases into
consideration when RSS is used for both green and yellow colors.

Fixes: 4b7bf3ffb473 ("net/mlx5: support yellow in meter policy validation")
Cc: stable@dpdk.org

Signed-off-by: Bing Zhao <bingz@nvidia.com>
---
v2: remove unnecessary parenthesis
---
 drivers/net/mlx5/mlx5_flow_dv.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 609ab43fb6..94b70bd10a 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -17412,12 +17412,22 @@ static inline int
 flow_dv_mtr_policy_rss_compare(const struct rte_flow_action_rss *r1,
 			       const struct rte_flow_action_rss *r2)
 {
-	if (!r1 || !r2)
+	if (r1 == NULL || r2 == NULL)
 		return 0;
-	if (r1->func != r2->func || r1->level != r2->level ||
-	    r1->types != r2->types || r1->key_len != r2->key_len ||
-	    memcmp(r1->key, r2->key, r1->key_len))
+	if (!(r1->level <= 1 && r2->level <= 1) &&
+	    !(r1->level > 1 && r2->level > 1))
 		return 1;
+	if (r1->types != r2->types &&
+	    !((r1->types == 0 || r1->types == ETH_RSS_IP) &&
+	      (r2->types == 0 || r2->types == ETH_RSS_IP)))
+		return 1;
+	if (r1->key || r2->key) {
+		const void *key1 = r1->key ? r1->key : rss_hash_default_key;
+		const void *key2 = r2->key ? r2->key : rss_hash_default_key;
+
+		if (memcmp(key1, key2, MLX5_RSS_HASH_KEY_LEN))
+			return 1;
+	}
 	return 0;
 }
 
-- 
2.27.0


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

* Re: [dpdk-stable] [PATCH] net/mlx5: fix the RSS consistency check of meter policy
  2021-10-18 13:16 [dpdk-stable] [PATCH] net/mlx5: fix the RSS consistency check of meter policy Bing Zhao
  2021-10-18 14:43 ` [dpdk-stable] [PATCH v2] " Bing Zhao
@ 2021-10-20 19:35 ` Raslan Darawsheh
  1 sibling, 0 replies; 6+ messages in thread
From: Raslan Darawsheh @ 2021-10-20 19:35 UTC (permalink / raw)
  To: Bing Zhao, Slava Ovsiienko, Matan Azrad; +Cc: dev, stable

Hi,
> -----Original Message-----
> From: Bing Zhao <bingz@nvidia.com>
> Sent: Monday, October 18, 2021 4:16 PM
> To: Slava Ovsiienko <viacheslavo@nvidia.com>; Matan Azrad
> <matan@nvidia.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>;
> stable@dpdk.org
> Subject: [PATCH] net/mlx5: fix the RSS consistency check of meter policy
> 
> After yellow color actions in the metering policy were supported,
> the RSS could be used for both green and yellow colors and only the
> queues attribute could be different.
> 
> When specifying the attributes of a RSS, some fields can be ignored
> and some default values will be used in PMD. For example, there is a
> default RSS key in the PMD and it will be used to create the TIR if
> nothing is provided by the application.
> 
> The default value cases were missed in the current implementation
> and it would cause some false positives or crashes.
> 
> The comparison function should be adjusted to take all cases into
> consideration when RSS is used for both green and yellow colors.
> 
> Fixes: 4b7bf3ffb473 ("net/mlx5: support yellow in meter policy validation")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bing Zhao <bingz@nvidia.com>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

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

* Re: [dpdk-stable] [PATCH v2] net/mlx5: fix the RSS consistency check of meter policy
  2021-10-18 14:43 ` [dpdk-stable] [PATCH v2] " Bing Zhao
@ 2021-11-04  8:56   ` Matan Azrad
  2021-11-09  9:57   ` Raslan Darawsheh
  2021-11-10 16:16   ` [dpdk-dev] " Ferruh Yigit
  2 siblings, 0 replies; 6+ messages in thread
From: Matan Azrad @ 2021-11-04  8:56 UTC (permalink / raw)
  To: Bing Zhao, Slava Ovsiienko; +Cc: dev, Raslan Darawsheh, stable



From: Bing Zhao
> After yellow color actions in the metering policy were supported, the RSS
> could be used for both green and yellow colors and only the queues attribute
> could be different.
> 
> When specifying the attributes of a RSS, some fields can be ignored and
> some default values will be used in PMD. For example, there is a default RSS
> key in the PMD and it will be used to create the TIR if nothing is provided by
> the application.
> 
> The default value cases were missed in the current implementation and it
> would cause some false positives or crashes.
> 
> The comparison function should be adjusted to take all cases into
> consideration when RSS is used for both green and yellow colors.
> 
> Fixes: 4b7bf3ffb473 ("net/mlx5: support yellow in meter policy validation")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>

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

* Re: [dpdk-stable] [PATCH v2] net/mlx5: fix the RSS consistency check of meter policy
  2021-10-18 14:43 ` [dpdk-stable] [PATCH v2] " Bing Zhao
  2021-11-04  8:56   ` Matan Azrad
@ 2021-11-09  9:57   ` Raslan Darawsheh
  2021-11-10 16:16   ` [dpdk-dev] " Ferruh Yigit
  2 siblings, 0 replies; 6+ messages in thread
From: Raslan Darawsheh @ 2021-11-09  9:57 UTC (permalink / raw)
  To: Bing Zhao, Slava Ovsiienko, Matan Azrad; +Cc: dev, stable

Hi,

> -----Original Message-----
> From: Bing Zhao <bingz@nvidia.com>
> Sent: Monday, October 18, 2021 5:43 PM
> To: Slava Ovsiienko <viacheslavo@nvidia.com>; Matan Azrad
> <matan@nvidia.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>;
> stable@dpdk.org
> Subject: [PATCH v2] net/mlx5: fix the RSS consistency check of meter policy
> 
> After yellow color actions in the metering policy were supported, the RSS
> could be used for both green and yellow colors and only the queues attribute
> could be different.
> 
> When specifying the attributes of a RSS, some fields can be ignored and
> some default values will be used in PMD. For example, there is a default RSS
> key in the PMD and it will be used to create the TIR if nothing is provided by
> the application.
> 
> The default value cases were missed in the current implementation and it
> would cause some false positives or crashes.
> 
> The comparison function should be adjusted to take all cases into
> consideration when RSS is used for both green and yellow colors.
> 
> Fixes: 4b7bf3ffb473 ("net/mlx5: support yellow in meter policy validation")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bing Zhao <bingz@nvidia.com>
> ---
> v2: remove unnecessary parenthesis
> ---

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

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

* Re: [dpdk-dev] [PATCH v2] net/mlx5: fix the RSS consistency check of meter policy
  2021-10-18 14:43 ` [dpdk-stable] [PATCH v2] " Bing Zhao
  2021-11-04  8:56   ` Matan Azrad
  2021-11-09  9:57   ` Raslan Darawsheh
@ 2021-11-10 16:16   ` Ferruh Yigit
  2 siblings, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2021-11-10 16:16 UTC (permalink / raw)
  To: Bing Zhao, viacheslavo, matan; +Cc: dev, rasland, stable

On 10/18/2021 3:43 PM, Bing Zhao wrote:
> After yellow color actions in the metering policy were supported,
> the RSS could be used for both green and yellow colors and only the
> queues attribute could be different.
> 
> When specifying the attributes of a RSS, some fields can be ignored
> and some default values will be used in PMD. For example, there is a
> default RSS key in the PMD and it will be used to create the TIR if
> nothing is provided by the application.
> 
> The default value cases were missed in the current implementation
> and it would cause some false positives or crashes.
> 
> The comparison function should be adjusted to take all cases into
> consideration when RSS is used for both green and yellow colors.
> 
> Fixes: 4b7bf3ffb473 ("net/mlx5: support yellow in meter policy validation")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bing Zhao <bingz@nvidia.com>
> ---
> v2: remove unnecessary parenthesis
> ---
>   drivers/net/mlx5/mlx5_flow_dv.c | 18 ++++++++++++++----
>   1 file changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
> index 609ab43fb6..94b70bd10a 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -17412,12 +17412,22 @@ static inline int
>   flow_dv_mtr_policy_rss_compare(const struct rte_flow_action_rss *r1,
>   			       const struct rte_flow_action_rss *r2)
>   {
> -	if (!r1 || !r2)
> +	if (r1 == NULL || r2 == NULL)
>   		return 0;
> -	if (r1->func != r2->func || r1->level != r2->level ||
> -	    r1->types != r2->types || r1->key_len != r2->key_len ||
> -	    memcmp(r1->key, r2->key, r1->key_len))
> +	if (!(r1->level <= 1 && r2->level <= 1) &&
> +	    !(r1->level > 1 && r2->level > 1))
>   		return 1;
> +	if (r1->types != r2->types &&
> +	    !((r1->types == 0 || r1->types == ETH_RSS_IP) &&
> +	      (r2->types == 0 || r2->types == ETH_RSS_IP)))

Need to use renamed macro: RTE_ETH_RSS_IP

Will update in the next-net.

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

end of thread, other threads:[~2021-11-10 16:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-18 13:16 [dpdk-stable] [PATCH] net/mlx5: fix the RSS consistency check of meter policy Bing Zhao
2021-10-18 14:43 ` [dpdk-stable] [PATCH v2] " Bing Zhao
2021-11-04  8:56   ` Matan Azrad
2021-11-09  9:57   ` Raslan Darawsheh
2021-11-10 16:16   ` [dpdk-dev] " Ferruh Yigit
2021-10-20 19:35 ` [dpdk-stable] [PATCH] " Raslan Darawsheh

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