From patchwork Thu Jun 23 10:05:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Naga Harish K, S V" X-Patchwork-Id: 113335 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 58E0EA0093; Thu, 23 Jun 2022 12:39:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AAD7A4069D; Thu, 23 Jun 2022 12:39:14 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 679BF4003F; Thu, 23 Jun 2022 12:39:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655980753; x=1687516753; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=SPijsGEM+60uhXrW8GpuFi5KD0KyknaTzHeCI2ViAu4=; b=eYqxKoN/i7fKJqTQQtYsK7UhreK5HeyncYVvzPzemaGMj1SerGIeAT4E ueiEDh+NriKp+feMZJ2rcmEbfYaHTsiPNwB0JlpP/Hh+9kvPG76uuJx88 v5S1AhsO/LZQbfbGKjGenqXcxkvqWYdrkC4LnVoMgSw+VS5Rr9GcnOAWL x3OUgnBnj0QGy88omnmknrI9pHOJdLltWPHcwkOf/Ok60GzhfPBaKR0Hf OYMdyl2R0c7FdKIyJ6+wJRa+0zUp97iUyhqc6J8+MVgQjIYnpp0go/7/6 tri4V/aeq90Rqpn7I/O/XkkDGR0RTb6NWgsCJpap8Tbk5lEl9GrNlKqxU w==; X-IronPort-AV: E=McAfee;i="6400,9594,10386"; a="261115335" X-IronPort-AV: E=Sophos;i="5.92,215,1650956400"; d="scan'208";a="261115335" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2022 03:39:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,215,1650956400"; d="scan'208";a="690965584" Received: from unknown (HELO localhost.localdomain) ([10.190.210.133]) by fmsmga002.fm.intel.com with ESMTP; 23 Jun 2022 03:39:10 -0700 From: Naga Harish K S V To: jay.jayatheerthan@intel.com, jerinj@marvell.com Cc: dev@dpdk.org, stable@dpdk.org Subject: [PATCH] eventdev/eth_tx: fix queue delete Date: Thu, 23 Jun 2022 15:35:11 +0530 Message-Id: <20220623100511.2388739-1-s.v.naga.harish.k@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add spinlock protection in queue delete function. This protects the data path while the queue delete operation is in progress. Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation") Cc: stable@dpdk.org Signed-off-by: Naga Harish K S V Acked-by: Jay Jayatheerthan --- lib/eventdev/rte_event_eth_tx_adapter.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c index c700fb7b1f..b4b37f1cae 100644 --- a/lib/eventdev/rte_event_eth_tx_adapter.c +++ b/lib/eventdev/rte_event_eth_tx_adapter.c @@ -891,9 +891,10 @@ txa_service_queue_del(uint8_t id, txa = txa_service_id_to_data(id); + rte_spinlock_lock(&txa->tx_lock); tqi = txa_service_queue(txa, port_id, tx_queue_id); if (tqi == NULL || !tqi->added) - return 0; + goto ret_unlock; tb = tqi->tx_buf; tqi->added = 0; @@ -903,6 +904,9 @@ txa_service_queue_del(uint8_t id, txa->txa_ethdev[port_id].nb_queues--; txa_service_queue_array_free(txa, port_id); + +ret_unlock: + rte_spinlock_unlock(&txa->tx_lock); return 0; }