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 5214FA00C5 for ; Tue, 26 Jul 2022 06:22:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EB2E342685; Tue, 26 Jul 2022 06:22:17 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 8BA5E40695; Tue, 26 Jul 2022 06:22:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658809335; x=1690345335; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=4KH4owJypk86RhSdu1XBsywkghpnMcCa1OIlsTtJ1WQ=; b=QGHWlofHxMneMHJ/wF2F/v8ANBZ6MaLpfIov5hQRI2otPnupUXuNgbxd IosjeOfMrN0SG4YT4vxGKmDflJbLurWI40WO2xrQQgdduFOczSQcQFcWK Xl44tAE+5CCQCaDHPWIyoVKYyIefyxcUAj7BLoomcILXAK+TkEE3cYP8R QdF4d9IEMxOJIgXns9j6gLA8y5EaM3U1QE26MGuaWkKvMspEjqWrj+BBW WcGFpiwaJSpJI9d0HF46+6Pn8v/g7SJ3vzC4m0bDIxqE0SdMoPkNH6Ka6 /q47j7Pm6XAtDb9xz/Kii1Dv4ctnVk3MvXp4vrE2uma5sEgpps4M0IhdG Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10419"; a="270891791" X-IronPort-AV: E=Sophos;i="5.93,193,1654585200"; d="scan'208";a="270891791" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2022 21:22:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,193,1654585200"; d="scan'208";a="658497102" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by fmsmga008.fm.intel.com with ESMTP; 25 Jul 2022 21:22:14 -0700 From: Naga Harish K S V To: jay.jayatheerthan@intel.com, jerinj@marvell.com Cc: dev@dpdk.org, stable@dpdk.org Subject: [PATCH 1/2] eventdev/eth_tx: add spinlock for adapter start/stop Date: Mon, 25 Jul 2022 23:22:10 -0500 Message-Id: <20220726042211.1018326-1-s.v.naga.harish.k@intel.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 add spinlock protection for tx adapter stop and start APIs add null check for tx adapter service pointer in adapter start/stop apis. Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation") Cc: stable@dpdk.org Signed-off-by: Naga Harish K S V --- lib/eventdev/rte_event_eth_tx_adapter.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c index a237e8edba..3251dad61f 100644 --- a/lib/eventdev/rte_event_eth_tx_adapter.c +++ b/lib/eventdev/rte_event_eth_tx_adapter.c @@ -44,7 +44,7 @@ #define RTE_EVENT_ETH_TX_ADAPTER_ID_VALID_OR_ERR_RET(id, retval) \ do { \ if (!txa_valid_id(id)) { \ - RTE_EDEV_LOG_ERR("Invalid eth Rx adapter id = %d", id); \ + RTE_EDEV_LOG_ERR("Invalid eth Tx adapter id = %d", id); \ return retval; \ } \ } while (0) @@ -468,10 +468,13 @@ txa_service_ctrl(uint8_t id, int start) struct txa_service_data *txa; txa = txa_service_id_to_data(id); - if (txa->service_id == TXA_INVALID_SERVICE_ID) + if (txa == NULL || txa->service_id == TXA_INVALID_SERVICE_ID) return 0; + rte_spinlock_lock(&txa->tx_lock); ret = rte_service_runstate_set(txa->service_id, start); + rte_spinlock_unlock(&txa->tx_lock); + if (ret == 0 && !start) { while (rte_service_may_be_active(txa->service_id)) rte_pause(); -- 2.23.0