From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AC9F3A055D for ; Mon, 1 Mar 2021 11:41:44 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9BC751CC57B; Mon, 1 Mar 2021 11:41:44 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by mails.dpdk.org (Postfix) with ESMTP id C35E81CC55F for ; Mon, 1 Mar 2021 11:41:41 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from matan@nvidia.com) with SMTP; 1 Mar 2021 12:41:38 +0200 Received: from pegasus25.mtr.labs.mlnx. (pegasus25.mtr.labs.mlnx [10.210.16.10]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 121Afc2H015685; Mon, 1 Mar 2021 12:41:38 +0200 From: Matan Azrad To: dev@dpdk.org Cc: Maxime Coquelin , stable@dpdk.org Date: Mon, 1 Mar 2021 10:41:31 +0000 Message-Id: <1614595291-112120-1-git-send-email-matan@nvidia.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-stable] [PATCH] vdpa/mlx5: fix virtq cleaning X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" The HW virtq object can be destroyed ether when the device is closed or when the state of the virtq becomes disabled. Some parameters of the virtq should continue to be managed when the virtq state is changed but all of them must be initialized when the device is closed. Wrongly, the enable parameter stayed on when the device is closed what might cause creation of invalid virtq in the next time a device is assigned to the driver. Clean all the virtqs memory when the device is closed. Fixes: c47d6e83334e ("vdpa/mlx5: support queue update") Cc: stable@dpdk.org Signed-off-by: Matan Azrad Acked-by: Xueming Li --- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c index ef2642a..024c5c4 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c @@ -103,13 +103,8 @@ for (i = 0; i < priv->nr_virtqs; i++) { virtq = &priv->virtqs[i]; mlx5_vdpa_virtq_unset(virtq); - if (virtq->counters) { + if (virtq->counters) claim_zero(mlx5_devx_cmd_destroy(virtq->counters)); - virtq->counters = NULL; - memset(&virtq->reset, 0, sizeof(virtq->reset)); - } - memset(virtq->err_time, 0, sizeof(virtq->err_time)); - virtq->n_retry = 0; } for (i = 0; i < priv->num_lag_ports; i++) { if (priv->tiss[i]) { @@ -126,6 +121,7 @@ priv->virtq_db_addr = NULL; } priv->features = 0; + memset(priv->virtqs, 0, sizeof(*virtq) * priv->nr_virtqs); priv->nr_virtqs = 0; } -- 1.8.3.1