net/mlx5: fix the RSS consistency check of meter policy
PATCH 1/1 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.
--- drivers/net/mlx5/mlx5_flow_dv.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/net/mlx5/mlx5_flow_dv.c +14 -4
@@ -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 ; }
Signature · 1 line
2.27.0
PATCH v2 1/1 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.
---
v2: remove unnecessary parenthesis
--- drivers/net/mlx5/mlx5_flow_dv.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/net/mlx5/mlx5_flow_dv.c +14 -4
@@ -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 ; }
Signature · 1 line
2.27.0
From: Bing Zhao
Quoted 12 lines
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.
Quoted 7 lines
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")Signed-off-by Bing Zhao <[email protected]>
Hi,
Quoted 24 lines
-----Original Message-----
From: Bing Zhao <[email protected]>
Sent: Monday, October 18, 2021 5:43 PM
To: Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>; [email protected]
Subject: [PATCH v2] net/mlx5: fix the RSS consistency check of meter policyAfter 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.
Quoted 7 lines
Fixes 4b7bf3ffb473 ("net/mlx5: support yellow in meter policy validation")Signed-off-by Bing Zhao <[email protected]>---
v2: remove unnecessary parenthesis
---
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh
Quoted 35 lines · 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")Signed-off-by Bing Zhao <[email protected]>---
v2: remove unnecessary parenthesis--- drivers/net/mlx5/mlx5_flow_dv.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)drivers/net/mlx5/mlx5_flow_dv.c +1
-1@@ -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)
drivers/net/mlx5/mlx5_flow_dv.c static inline int · line 17422
Quoted 10 lines
drivers/net/mlx5/mlx5_flow_dv.c +5
-3return 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.
Hi,
Quoted 21 lines
-----Original Message-----
From: Bing Zhao <[email protected]>
Sent: Monday, October 18, 2021 4:16 PM
To: Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>; [email protected]
Subject: [PATCH] net/mlx5: fix the RSS consistency check of meter policyAfter 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.
Quoted 7 lines
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")Signed-off-by Bing Zhao <[email protected]>
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh