DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix resource release issue for mirror flow
@ 2021-04-09 12:33 Jiawei Wang
  2021-04-12  6:36 ` Slava Ovsiienko
  2021-04-12 12:57 ` Raslan Darawsheh
  0 siblings, 2 replies; 3+ messages in thread
From: Jiawei Wang @ 2021-04-09 12:33 UTC (permalink / raw)
  To: Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko, Jiawei Wang; +Cc: dev, stable

The mlx5 PMD allocated the resources of the sample actions, and then
moved these ones to the destination actions array. The original indices
were not cleared and the resources were referenced twice in the
flow object - as the fate actions and in the destination actions array.

This causes the failure on flow destroy because PMD tried to release the
same objects twice.

The patch clears the original indices, add the missed checking for zero
and eliminates multiple object releasing.

Fixes: 00c10c22118a ("net/mlx5: update translate function for mirroring")
Cc: stable@dpdk.org

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Reviewed-by: Suanming Mou <suanmingm@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 1818895..883fe2e 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -10148,24 +10148,8 @@ struct mlx5_cache_entry *
 	return &cache_resource->entry;
 error:
 	for (idx = 0; idx < resource->num_of_dest; idx++) {
-		struct mlx5_flow_sub_actions_idx *act_res =
-					&cache_resource->sample_idx[idx];
-		if (act_res->rix_hrxq &&
-		    !mlx5_hrxq_release(dev,
-				act_res->rix_hrxq))
-			act_res->rix_hrxq = 0;
-		if (act_res->rix_encap_decap &&
-			!flow_dv_encap_decap_resource_release(dev,
-				act_res->rix_encap_decap))
-			act_res->rix_encap_decap = 0;
-		if (act_res->rix_port_id_action &&
-			!flow_dv_port_id_action_resource_release(dev,
-				act_res->rix_port_id_action))
-			act_res->rix_port_id_action = 0;
-		if (act_res->rix_jump &&
-			!flow_dv_jump_tbl_resource_release(dev,
-				act_res->rix_jump))
-			act_res->rix_jump = 0;
+		flow_dv_sample_sub_actions_release(dev,
+				&cache_resource->sample_idx[idx]);
 		if (dest_attr[idx])
 			mlx5_free(dest_attr[idx]);
 	}
@@ -10533,6 +10517,7 @@ struct mlx5_cache_entry *
 				dev_flow->handle->dvh.rix_encap_decap;
 			sample_act->dr_encap_action =
 				dev_flow->dv.encap_decap->action;
+			dev_flow->handle->dvh.rix_encap_decap = 0;
 		}
 		if (sample_act->action_flags & MLX5_FLOW_ACTION_PORT_ID) {
 			normal_idx++;
@@ -10540,6 +10525,7 @@ struct mlx5_cache_entry *
 				dev_flow->handle->rix_port_id_action;
 			sample_act->dr_port_id_action =
 				dev_flow->dv.port_id_action->action;
+			dev_flow->handle->rix_port_id_action = 0;
 		}
 		if (sample_act->action_flags & MLX5_FLOW_ACTION_JUMP) {
 			normal_idx++;
@@ -12406,7 +12392,8 @@ struct mlx5_cache_entry *
 		return;
 	switch (handle->fate_action) {
 	case MLX5_FLOW_FATE_QUEUE:
-		mlx5_hrxq_release(dev, handle->rix_hrxq);
+		if (!handle->dvh.rix_sample && !handle->dvh.rix_dest_array)
+			mlx5_hrxq_release(dev, handle->rix_hrxq);
 		break;
 	case MLX5_FLOW_FATE_JUMP:
 		flow_dv_jump_tbl_resource_release(dev, handle->rix_jump);
-- 
1.8.3.1


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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix resource release issue for mirror flow
  2021-04-09 12:33 [dpdk-dev] [PATCH] net/mlx5: fix resource release issue for mirror flow Jiawei Wang
@ 2021-04-12  6:36 ` Slava Ovsiienko
  2021-04-12 12:57 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Slava Ovsiienko @ 2021-04-12  6:36 UTC (permalink / raw)
  To: Jiawei(Jonny) Wang, Matan Azrad, Shahaf Shuler, Jiawei(Jonny) Wang
  Cc: dev, stable

> -----Original Message-----
> From: Jiawei Wang <jiaweiw@nvidia.com>
> Sent: Friday, April 9, 2021 15:33
> To: Matan Azrad <matan@nvidia.com>; Shahaf Shuler
> <shahafs@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>;
> Jiawei(Jonny) Wang <jiaweiw@nvidia.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [PATCH] net/mlx5: fix resource release issue for mirror flow
> 
> The mlx5 PMD allocated the resources of the sample actions, and then
> moved these ones to the destination actions array. The original indices were
> not cleared and the resources were referenced twice in the flow object - as
> the fate actions and in the destination actions array.
> 
> This causes the failure on flow destroy because PMD tried to release the
> same objects twice.
> 
> The patch clears the original indices, add the missed checking for zero and
> eliminates multiple object releasing.
> 
> Fixes: 00c10c22118a ("net/mlx5: update translate function for mirroring")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
> Reviewed-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix resource release issue for mirror flow
  2021-04-09 12:33 [dpdk-dev] [PATCH] net/mlx5: fix resource release issue for mirror flow Jiawei Wang
  2021-04-12  6:36 ` Slava Ovsiienko
@ 2021-04-12 12:57 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Raslan Darawsheh @ 2021-04-12 12:57 UTC (permalink / raw)
  To: Jiawei(Jonny) Wang, Matan Azrad, Shahaf Shuler, Slava Ovsiienko,
	Jiawei(Jonny) Wang
  Cc: dev, stable

Hi,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Jiawei Wang
> Sent: Friday, April 9, 2021 3:33 PM
> To: Matan Azrad <matan@nvidia.com>; Shahaf Shuler
> <shahafs@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>;
> Jiawei(Jonny) Wang <jiaweiw@nvidia.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix resource release issue for mirror
> flow
> 
> The mlx5 PMD allocated the resources of the sample actions, and then
> moved these ones to the destination actions array. The original indices
> were not cleared and the resources were referenced twice in the
> flow object - as the fate actions and in the destination actions array.
> 
> This causes the failure on flow destroy because PMD tried to release the
> same objects twice.
> 
> The patch clears the original indices, add the missed checking for zero
> and eliminates multiple object releasing.
> 
> Fixes: 00c10c22118a ("net/mlx5: update translate function for mirroring")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
> Reviewed-by: Suanming Mou <suanmingm@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-04-12 12:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09 12:33 [dpdk-dev] [PATCH] net/mlx5: fix resource release issue for mirror flow Jiawei Wang
2021-04-12  6:36 ` Slava Ovsiienko
2021-04-12 12:57 ` Raslan Darawsheh

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/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 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git