From patchwork Tue Jul 26 04:22:10 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: 114207 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 4CF51A00C4; 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 1DB2C40DDD; 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 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 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 Acked-by: Jay Jayatheerthan --- 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(); From patchwork Tue Jul 26 04:22: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: 114208 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 A0CDBA00C4; Tue, 26 Jul 2022 06:23:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 91C2E40DDD; Tue, 26 Jul 2022 06:23:11 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id E922C40695; Tue, 26 Jul 2022 06:23:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658809390; x=1690345390; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aLukRttMFz7rkbJ9Nt0phvBIodR9cu2TATcEYhG8lqc=; b=E/2/loWAS5mT2ZqON3B6Z6Zcc+mCSpWjdsF4n0eMmY5C/LUOnZuZfB2x XOSa/KN96Se6yrHLEHbUJkhuLj8hXMMhlgt1vr2saLcSlWdVj2SC1NhKJ 2ijSVwonmpuo7jdP+nAGjTxvYkQsUAhhazf2PTFaJNYFwyMKdJwoz8uu4 6B6NIUcRtNvyjygvAAczIsHDeiCZaL08NmPo/Hc+Ehy0tQw+ojXGkhdiw sZb8uPf0rbiLiaYsUoVEFmHUW83WuvIBCM8TmzA1djbCDeWopayLR+l0E CTW3AMRrVZ0TNhWSJSQPZJ8ziMD6fEHq7pURefS0k5mEaNVUpB37liGxY A==; X-IronPort-AV: E=McAfee;i="6400,9594,10419"; a="270891852" X-IronPort-AV: E=Sophos;i="5.93,193,1654585200"; d="scan'208";a="270891852" 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:23:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,193,1654585200"; d="scan'208";a="658497378" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by fmsmga008.fm.intel.com with ESMTP; 25 Jul 2022 21:23:08 -0700 From: Naga Harish K S V To: jay.jayatheerthan@intel.com, jerinj@marvell.com Cc: dev@dpdk.org, stable@dpdk.org Subject: [PATCH 2/2] eventdev/eth_tx: fix adapter stop Date: Mon, 25 Jul 2022 23:22:11 -0500 Message-Id: <20220726042211.1018326-2-s.v.naga.harish.k@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220726042211.1018326-1-s.v.naga.harish.k@intel.com> References: <20220726042211.1018326-1-s.v.naga.harish.k@intel.com> 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 adapter_stop function is stopping the adapter service using rte_service_runstate_set() api and waiting until rte_service_may_be_active() api returns stopped state in an infinite loop. This results in hang issues if application calls rte_service_lcore_stop() before adapter stop. remove the state check after setting the service state which avoids running into hang issues. This also makes tx adapter stop inline with remaining adapters. 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 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c index 3251dad61f..41509ba750 100644 --- a/lib/eventdev/rte_event_eth_tx_adapter.c +++ b/lib/eventdev/rte_event_eth_tx_adapter.c @@ -475,10 +475,6 @@ txa_service_ctrl(uint8_t id, int start) 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(); - } return ret; }