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 C461FA034E; Wed, 9 Feb 2022 06:33:24 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 90076410FD; Wed, 9 Feb 2022 06:33:24 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 6A9EE410F3 for ; Wed, 9 Feb 2022 06:33:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644384803; x=1675920803; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zBTQt9FTSlgl34vrLTjTo/sW3y18jMwtBtjS9BrDf8M=; b=OP/zNlli9L+xD6bvHpuiw8+feDQ9VhSDyiztVoXcjKjldJ05CuZbKaqq Q/Q+Odzu7c/6U3AzBkngxBWhUqIcKQPfFDV6CGUy6O4K64a+v1/dsNM6w vfpOaGgK3Jhpn7oW/TIXufoHWYRAddjPRI3V7nlG5dM7FU+Yn/0G2bljj mz1/G7AmIHJryoQomgii3hCh3lLjhbmc61egeShPvubMqmNH4D/d5MNJY w+G9cySOnaaoA+6PFAYbTIQYSYkIrIhydFUkrggOyc94bn1ff0WPwF4hK ubOVx0FHKDyzV3wor21h5KXiMSIJfu/5hMIjWhrAK/6fCHJgn5fwJEBYq g==; X-IronPort-AV: E=McAfee;i="6200,9189,10252"; a="236530889" X-IronPort-AV: E=Sophos;i="5.88,354,1635231600"; d="scan'208";a="236530889" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2022 21:31:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,354,1635231600"; d="scan'208";a="540937806" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by orsmga008.jf.intel.com with ESMTP; 08 Feb 2022 21:31:54 -0800 From: Naga Harish K S V To: jay.jayatheerthan@intel.com, jerinj@marvell.com Cc: dev@dpdk.org Subject: [PATCH v2] eventdev/eth_tx: fix queue add logic Date: Tue, 8 Feb 2022 23:31:51 -0600 Message-Id: <20220209053151.1557961-1-s.v.naga.harish.k@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220209052313.1557377-1-s.v.naga.harish.k@intel.com> References: <20220209052313.1557377-1-s.v.naga.harish.k@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 The internal function txa_service_queue_add is returning 0 in case of error. correct this logic to return a negative value to indicate failure. Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation") Signed-off-by: Naga Harish K S V --- v2: * adjust commit message line size --- lib/eventdev/rte_event_eth_tx_adapter.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c index c17f33f098..1b304f0a73 100644 --- a/lib/eventdev/rte_event_eth_tx_adapter.c +++ b/lib/eventdev/rte_event_eth_tx_adapter.c @@ -806,10 +806,8 @@ txa_service_queue_add(uint8_t id, rte_spinlock_lock(&txa->tx_lock); - if (txa_service_is_queue_added(txa, eth_dev, tx_queue_id)) { - rte_spinlock_unlock(&txa->tx_lock); - return 0; - } + if (txa_service_is_queue_added(txa, eth_dev, tx_queue_id)) + goto ret_unlock; ret = txa_service_queue_array_alloc(txa, eth_dev->data->port_id); if (ret) @@ -821,6 +819,8 @@ txa_service_queue_add(uint8_t id, tdi = &txa->txa_ethdev[eth_dev->data->port_id]; tqi = txa_service_queue(txa, eth_dev->data->port_id, tx_queue_id); + if (tqi == NULL) + goto err_unlock; txa_retry = &tqi->txa_retry; txa_retry->id = txa->id; @@ -836,6 +836,10 @@ txa_service_queue_add(uint8_t id, tdi->nb_queues++; txa->nb_queues++; +ret_unlock: + rte_spinlock_unlock(&txa->tx_lock); + return 0; + err_unlock: if (txa->nb_queues == 0) { txa_service_queue_array_free(txa, @@ -844,7 +848,7 @@ txa_service_queue_add(uint8_t id, } rte_spinlock_unlock(&txa->tx_lock); - return 0; + return -1; } static int -- 2.23.0