From patchwork Fri Mar 6 09:57:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 184241 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp7231922ile; Fri, 6 Mar 2020 02:00:31 -0800 (PST) X-Google-Smtp-Source: ADFU+vud4rHuyUUh2X8opNBmpMGONAxtFX9tibDNSI2OJ9+7kQSxF5FwleES9EVtJTrb/8xGdAU/ X-Received: by 2002:a17:906:b30f:: with SMTP id n15mr2204610ejz.236.1583488831308; Fri, 06 Mar 2020 02:00:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583488831; cv=none; d=google.com; s=arc-20160816; b=Ou1w7AVXR141fDpcFNnTD90AJwZRbUf15nfuSc146WHpQ2F6sGAMhrPoLNWj0vovPc 2u+QtDR7X1m5RalSsj8s6WXoe1NYHpFhV/kr1rU4lVZMSUyXPflTW7TEVJMBKlX9P4SQ gUTQHJWs3Y04EGm8RKCcmZ7mj4BeSSlpHgeTdnJaYmolT+jDTXPwLPXr2NCwzdYZcOg+ aF20XyKiutdMvyZUUYuybj319drh4afmhWIRRDSedkymziD7NhzkwSZuXZ+sZZxZWkKz Ku6HEli7HK+IwBO74R5Y7PMsl07rctjxL58mRhM65OWGquzmRAWtUberB75ubqzPj+Mv tYhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=Zzun9V5RN15MMkqrRrwz00rFsKuKWipu9MHL6XMxTwY=; b=Dimcc19jQ+cfEhIjuNyxJlIVl80emplk0hWltxY/EyDD+hORLt9se7ihYyaBa+sfHP QGl+g9QN56A+1t0tupc8iZMBLnPKc8r8qWWTVpnDmxfzbKJ/1pe+kDmSDFGIiC4GDzkt OmzrTV4BFH579oNpyNLOP3EzFM5Q+PMeE/Dkk2ERHTVNQgZG3xuHWlLtQQZUCXjRJTvZ Bcb59TaRLNa8TVYjMZLTsjT1sM+m6xpIvpx/LNSGK9+h/yi1JbXNYQp5JTFPH2g49/sL /nHRIvIokd8C/zyczgiY0tdH4o01LRHGhZ7M8a+U38XHufNO6sxSJMICJWZ+qPHrUe9k 9gqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id y9si1339853edp.421.2020.03.06.02.00.31; Fri, 06 Mar 2020 02:00:31 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B57FE1C029; Fri, 6 Mar 2020 10:59:53 +0100 (CET) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id AB6691BFD6 for ; Fri, 6 Mar 2020 10:59:48 +0100 (CET) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 89ECA1A0AA9; Fri, 6 Mar 2020 10:59:48 +0100 (CET) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 057C81A0A62; Fri, 6 Mar 2020 10:59:46 +0100 (CET) Received: from bf-netperf1.ap.com (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 32E5540294; Fri, 6 Mar 2020 17:59:42 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Nipun Gupta , Hemant Agrawal Date: Fri, 6 Mar 2020 15:27:31 +0530 Message-Id: <20200306095742.18080-6-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200306095742.18080-1-hemant.agrawal@nxp.com> References: <20200302145829.27808-1-hemant.agrawal@nxp.com> <20200306095742.18080-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v2 05/16] bus/fslmc: support handle portal alloc failure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add the error handling on failure. Signed-off-by: Nipun Gupta Signed-off-by: Hemant Agrawal --- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 28 ++++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c index e765a382f..1a1453ea3 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c @@ -264,6 +264,16 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev) return 0; } +static void dpaa2_put_qbman_swp(struct dpaa2_dpio_dev *dpio_dev) +{ + if (dpio_dev) { +#ifdef RTE_LIBRTE_PMD_DPAA2_EVENTDEV + dpaa2_dpio_intr_deinit(dpio_dev); +#endif + rte_atomic16_clear(&dpio_dev->ref_count); + } +} + static struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(void) { struct dpaa2_dpio_dev *dpio_dev = NULL; @@ -274,8 +284,10 @@ static struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(void) if (dpio_dev && rte_atomic16_test_and_set(&dpio_dev->ref_count)) break; } - if (!dpio_dev) + if (!dpio_dev) { + DPAA2_BUS_ERR("No software portal resource left"); return NULL; + } DPAA2_BUS_DEBUG("New Portal %p (%d) affined thread - %lu", dpio_dev, dpio_dev->index, syscall(SYS_gettid)); @@ -283,21 +295,13 @@ static struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(void) ret = dpaa2_configure_stashing(dpio_dev); if (ret) { DPAA2_BUS_ERR("dpaa2_configure_stashing failed"); + rte_atomic16_clear(&dpio_dev->ref_count); return NULL; } return dpio_dev; } -static void dpaa2_put_qbman_swp(struct dpaa2_dpio_dev *dpio_dev) -{ -#ifdef RTE_LIBRTE_PMD_DPAA2_EVENTDEV - dpaa2_dpio_intr_deinit(dpio_dev); -#endif - if (dpio_dev) - rte_atomic16_clear(&dpio_dev->ref_count); -} - int dpaa2_affine_qbman_swp(void) { @@ -308,7 +312,7 @@ dpaa2_affine_qbman_swp(void) if (!RTE_PER_LCORE(_dpaa2_io).dpio_dev) { dpio_dev = dpaa2_get_qbman_swp(); if (!dpio_dev) { - DPAA2_BUS_ERR("No software portal resource left"); + DPAA2_BUS_ERR("Error in software portal allocation"); return -1; } RTE_PER_LCORE(_dpaa2_io).dpio_dev = dpio_dev; @@ -330,7 +334,7 @@ dpaa2_affine_qbman_ethrx_swp(void) if (!RTE_PER_LCORE(_dpaa2_io).ethrx_dpio_dev) { dpio_dev = dpaa2_get_qbman_swp(); if (!dpio_dev) { - DPAA2_BUS_ERR("No software portal resource left"); + DPAA2_BUS_ERR("Error in software portal allocation"); return -1; } RTE_PER_LCORE(_dpaa2_io).ethrx_dpio_dev = dpio_dev;