From patchwork Tue Jul 7 09:22:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 234959 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp736179ilg; Tue, 7 Jul 2020 02:28:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysUVY+ApK1PvJX9p0XHVjMQZj28ZUdj5fgh9fZkcEB6xuVYk1ZvN4mARTMsAjSwqVilesM X-Received: by 2002:a17:906:4e87:: with SMTP id v7mr34359492eju.242.1594114080206; Tue, 07 Jul 2020 02:28:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594114080; cv=none; d=google.com; s=arc-20160816; b=dHE9MNhgvkKfS3gjrmQaeEGZyro8QlI5YZs3G6oFJcB1TJtFSqZ1c8ASYneICUNLga 5C0ba1A2AjlRdEmTg9niS6S7zZndRzMwe0Ar+QtL37adGUqM/lc6olTD8Masta3kn2ZL Ekj1LVgIkeAhcLYb6CiSrXRQBdhNUrlLN7o5QrZrtMeYs8X2Qke5oOSLOoa1kPQ+dmo2 CaVXwriLmSf9tomE7iGuM9ix4ZxtFB8xrjSZ3zdc3UgafanN3NEHDLLiNqONBiIG86HM OK3WY4tr94t1dYANl/yYkfZkuH2fbOKPLeRL6Mb+00ADQsJq708fJu2azBoRHCTuSjUT 2oCg== 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=PVGuqKQ2lnWRtR0mVCl12o3+NDkkxPfqdqIJRLrivVs=; b=nQINbvdf+tBv29/UR1rGZQMUm/8U4SV9QbAfK/9dCWCz4V5pI6FLzfJ3toUIukQz8s 85r2TEWSRXXmMC9x4d1GUQnePGN6r5+K7R5ARI9Zdy8zBcROgRa21yXrvgdpkgQk0j3N ox7uqTaQL8Az82SXctixnqU+GyiREo84hRajJ0jQ2TY2uZ6Ec7a+f4Vwef0taybhaEMB yJdPLJLE7e7giRTIKuEDgYcIxg9KbrSpwznv2rH3TvHfN3CxqnPKvJNQGoJdtGtnAycS XiOhN1+HjhzoOPz7BLRgEyIfF4C1GqmtrwjMWzArG/dML8lBYTmjALMfbDalwJ3R/wDe D7zw== 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 gj5si15254690ejb.49.2020.07.07.02.28.00; Tue, 07 Jul 2020 02:28:00 -0700 (PDT) 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 25AB91DCFB; Tue, 7 Jul 2020 11:27:08 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 47F751DC61 for ; Tue, 7 Jul 2020 11:27:02 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 291151A0A4E; Tue, 7 Jul 2020 11:27:02 +0200 (CEST) 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 165221A0A56; Tue, 7 Jul 2020 11:27:00 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 02275402C8; Tue, 7 Jul 2020 17:26:56 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Nipun Gupta , Hemant Agrawal Date: Tue, 7 Jul 2020 14:52:21 +0530 Message-Id: <20200707092244.12791-7-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200707092244.12791-1-hemant.agrawal@nxp.com> References: <20200527132326.1382-1-hemant.agrawal@nxp.com> <20200707092244.12791-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v2 06/29] 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 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 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 47ae72749..5a12ff35d 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c @@ -284,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)); @@ -293,6 +295,7 @@ 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; } @@ -316,7 +319,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; @@ -338,7 +341,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;