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 68AD0A034E; Wed, 9 Feb 2022 06:23:19 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 56CEB41101; Wed, 9 Feb 2022 06:23:19 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id B2E92410F3 for ; Wed, 9 Feb 2022 06:23:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644384197; x=1675920197; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=zn+mh39YJFwHS4LXLTviWKtEmA9/lFJ7dM6FkcaAF7Q=; b=gw+KnsdR5rQo+iMBEzG8sBlt0afb5W+tPK6geBDLSMORBofY+JITI8cw ZFXR6K5cJxJVAZmhC1J5QbFq4dt3YqPzXlhDzC55rLfcJvpZhTS3lH4py I0Oiu6OisnroHetWoiWR6WJxdHhBfa+wxFE+jYoGSXxj1RL92k1pOsXPd 25Nk4K+YYpCav6cr4wIbIxmqyYYNkqmCmijK4VGZ9QhuhywmA3PUyJy5F mMcadGDLdjtf8BTaZQlRaf3Mms1bJJLX+mTPedJ7uCx22H0MjBYzgNxCL u87FDhTc/JzjGo3MQbDHEaORf/WYLUqwTQzIsBZexgk1XvgEZk8OFxqor w==; X-IronPort-AV: E=McAfee;i="6200,9189,10252"; a="249329204" X-IronPort-AV: E=Sophos;i="5.88,354,1635231600"; d="scan'208";a="249329204" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2022 21:23:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,354,1635231600"; d="scan'208";a="540935289" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by orsmga008.jf.intel.com with ESMTP; 08 Feb 2022 21:23:16 -0800 From: Naga Harish K S V To: jay.jayatheerthan@intel.com, jerinj@marvell.com Cc: dev@dpdk.org Subject: [PATCH] eventdev/eth_tx: fix queue add logic Date: Tue, 8 Feb 2022 23:23:13 -0600 Message-Id: <20220209052313.1557377-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: 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 negative value to indicate failure. Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation") Signed-off-by: Naga Harish K S V --- lib/eventdev/rte_event_eth_tx_adapter.c | 13 ++++++++----- 1 file changed, 8 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..49053e6bea 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,9 @@ 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 +847,7 @@ txa_service_queue_add(uint8_t id, } rte_spinlock_unlock(&txa->tx_lock); - return 0; + return -1; } static int -- 2.23.0