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

The RSS configuration in a policy action container was a pointer
inside an union, and the pointer area could be used as other fate
action. In the current implementation, the RSS of the green color
was prior to that of the yellow color. There was a high posibility
the pointer was considered as the RSS and result in a error flow
expansion when only the yellow color had the RSS action.

The check of the fate action type should also be done to get rid of
the misjudgment.

Fixes: b38a12272b3a ("net/mlx5: split meter color policy handling")
Cc: stable@dpdk.org

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 509ca01859..4f5211a90d 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -3594,6 +3594,8 @@ flow_get_rss_action(struct rte_eth_dev *dev,
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
 	const struct rte_flow_action_rss *rss = NULL;
+	struct mlx5_meter_policy_action_container *acg;
+	struct mlx5_meter_policy_action_container *acy;
 
 	for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {
 		switch (actions->type) {
@@ -3629,9 +3631,18 @@ flow_get_rss_action(struct rte_eth_dev *dev,
 					if (!policy)
 						return NULL;
 				}
-				if (policy->is_rss)
-					rss =
-				policy->act_cnt[RTE_COLOR_GREEN].rss->conf;
+				if (policy->is_rss) {
+					acg =
+					&policy->act_cnt[RTE_COLOR_GREEN];
+					acy =
+					&policy->act_cnt[RTE_COLOR_YELLOW];
+					if (acg->fate_action ==
+					    MLX5_FLOW_FATE_SHARED_RSS)
+						rss = acg->rss->conf;
+					else if (acy->fate_action ==
+						 MLX5_FLOW_FATE_SHARED_RSS)
+						rss = acy->rss->conf;
+				}
 			}
 			break;
 		}
-- 
2.27.0


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

* [dpdk-stable] [PATCH v2] net/mlx5: fix meter yellow policy with RSS action
  2021-10-18 13:18 [dpdk-stable] [PATCH] net/mlx5: fix meter yellow policy with RSS action Bing Zhao
@ 2021-10-18 13:53 ` Bing Zhao
  2021-10-20 19:34 ` [dpdk-stable] [PATCH] " Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Bing Zhao @ 2021-10-18 13:53 UTC (permalink / raw)
  To: viacheslavo, matan; +Cc: dev, rasland, stable

The RSS configuration in a policy action container was a pointer
inside a union, and the pointer area could be used as other fate
action. In the current implementation, the RSS of the green color
was prior to that of the yellow color. There was a high possibility
the pointer was considered as the RSS and result in a error flow
expansion when only the yellow color had the RSS action.

The check of the fate action type should also be done to get rid of
the misjudgment.

Fixes: b38a12272b3a ("net/mlx5: split meter color policy handling")
Cc: stable@dpdk.org

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
v2: fix the spelling typo in the commit log
---
 drivers/net/mlx5/mlx5_flow.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 509ca01859..4f5211a90d 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -3594,6 +3594,8 @@ flow_get_rss_action(struct rte_eth_dev *dev,
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
 	const struct rte_flow_action_rss *rss = NULL;
+	struct mlx5_meter_policy_action_container *acg;
+	struct mlx5_meter_policy_action_container *acy;
 
 	for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {
 		switch (actions->type) {
@@ -3629,9 +3631,18 @@ flow_get_rss_action(struct rte_eth_dev *dev,
 					if (!policy)
 						return NULL;
 				}
-				if (policy->is_rss)
-					rss =
-				policy->act_cnt[RTE_COLOR_GREEN].rss->conf;
+				if (policy->is_rss) {
+					acg =
+					&policy->act_cnt[RTE_COLOR_GREEN];
+					acy =
+					&policy->act_cnt[RTE_COLOR_YELLOW];
+					if (acg->fate_action ==
+					    MLX5_FLOW_FATE_SHARED_RSS)
+						rss = acg->rss->conf;
+					else if (acy->fate_action ==
+						 MLX5_FLOW_FATE_SHARED_RSS)
+						rss = acy->rss->conf;
+				}
 			}
 			break;
 		}
-- 
2.27.0


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

* Re: [dpdk-stable] [PATCH] net/mlx5: fix meter yellow policy with RSS action
  2021-10-18 13:18 [dpdk-stable] [PATCH] net/mlx5: fix meter yellow policy with RSS action Bing Zhao
  2021-10-18 13:53 ` [dpdk-stable] [PATCH v2] " Bing Zhao
@ 2021-10-20 19:34 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Raslan Darawsheh @ 2021-10-20 19:34 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:19 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 meter yellow policy with RSS action
> 
> The RSS configuration in a policy action container was a pointer inside an
> union, and the pointer area could be used as other fate action. In the current
> implementation, the RSS of the green color was prior to that of the yellow
> color. There was a high posibility the pointer was considered as the RSS and
> result in a error flow expansion when only the yellow color had the RSS
> action.
> 
> The check of the fate action type should also be done to get rid of the
> misjudgment.
> 
> Fixes: b38a12272b3a ("net/mlx5: split meter color policy handling")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bing Zhao <bingz@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-18 13:18 [dpdk-stable] [PATCH] net/mlx5: fix meter yellow policy with RSS action Bing Zhao
2021-10-18 13:53 ` [dpdk-stable] [PATCH v2] " Bing Zhao
2021-10-20 19:34 ` [dpdk-stable] [PATCH] " Raslan Darawsheh

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