From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0043.outbound.protection.outlook.com [104.47.38.43]) by dpdk.org (Postfix) with ESMTP id 10E651B260 for ; Tue, 10 Oct 2017 16:12:41 +0200 (CEST) Received: from BN3PR03CA0106.namprd03.prod.outlook.com (10.174.66.24) by BN6PR03MB2690.namprd03.prod.outlook.com (10.173.144.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Tue, 10 Oct 2017 14:12:39 +0000 Received: from BN1BFFO11FD024.protection.gbl (2a01:111:f400:7c10::1:147) by BN3PR03CA0106.outlook.office365.com (2603:10b6:400:4::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7 via Frontend Transport; Tue, 10 Oct 2017 14:12:40 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11FD024.mail.protection.outlook.com (10.58.144.87) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.77.10 via Frontend Transport; Tue, 10 Oct 2017 14:12:40 +0000 Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.134.28]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id v9AECaDl004024; Tue, 10 Oct 2017 07:12:37 -0700 From: Hemant Agrawal To: CC: Date: Tue, 10 Oct 2017 19:42:03 +0530 Message-ID: <1507644723-21398-1-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131521183602714026; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(7966004)(39380400002)(39860400002)(376002)(346002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(104016004)(16586007)(69596002)(5660300001)(33646002)(356003)(36756003)(498600001)(105606002)(97736004)(316002)(2351001)(106466001)(81156014)(81166006)(5003940100001)(305945005)(50466002)(50986999)(8676002)(86362001)(53936002)(2906002)(68736007)(8936002)(189998001)(48376002)(4326008)(77096006)(50226002)(47776003)(6916009)(85426001)(6666003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2690; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD024; 1:XGTbIMgxs96Ooq/p5S6eB05g7D2oXLSbO7MFeBflzKL4qU3jK/d1rC/xWdH0/hb0sTVPX1DGYL87BI7mHaON+4tSP4QvFciipZE37djT5SVVabBmVITyzDPDg/pVS48r MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 761a324f-0e02-4df0-c449-08d50fe8f788 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017052603199)(201703131430075)(201703131517081); SRVR:BN6PR03MB2690; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2690; 3:Du0Q1I069jU77GVMgxxTaHcPDn6BNEzdXZJkiMh61/6kuZA8Z7GNlSmLj6uQXdkI1CzWmLxecUVqm1wv2a8zKoHNN27x9eN77vCGKWqGamaEb+Rwe4xaJrDULqGDapO+wPllU6uSMS0X24fKI1CzyO9Y50B9Wi38vNTEdWAYH+4WZnP/xt4CUdgPKIbIp11a7VC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z+RRHpvYNkyfePuIpQUj8yE25KRoTFFPFfIkTsRN86sSXkq8Uqcr5ayE44Sy2xofL25U1mzVBzBokvkGCRhj0HZOEQKxAtiYOUag== X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(8121501046)(5005006)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6096035)(20161123565025)(20161123559100)(20161123561025)(20161123563025)(20161123556025)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR03MB2690; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR03MB2690; X-Forefront-PRVS: 04569283F9 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR03MB2690; 23:a2lU3w2fM7jjMTjTxqRdRGCwx+meaNo96c++5R6dE?= =?us-ascii?Q?J/lW7Pf2aERy8WDspQyYeLjUb0T5RUEHTr/u/Ut5SEP/jUlSOvUBt6uGQp+i?= =?us-ascii?Q?4HqdmXP0uDjwVuP+o7iwI8A9ipgQTrFpLU9kGYsh7FcITzJwWZcxsBz5wH3r?= =?us-ascii?Q?pxAi9WIcWZ9G0raj4TXS97nP6jpdkc8IXFZXABl7iCkZnKhIOtAvV7Q/WqON?= =?us-ascii?Q?FacFb5bTkxiXxFbAAm4vY5zwEaBMlwyE6sOhCnJXSFb86JO/cYpk0KAK028K?= =?us-ascii?Q?tZxBjPki95k/QhUqM/k7ijN7VGk4sQGWIftXa/KfbywFzD8AAGGy237OjaJm?= =?us-ascii?Q?rVmLh7e7mOGYZ6djrm+4th6tKMtN//KeYza+XI5rUSF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41zFi21L5dyfIy/ejEmb6B6aL8QrovlGEyE1M9LrWuOVSeLiiIEBZMeM6y/eSwTmcaqWO6/q31RuK7j1RQTp/yBFVLg/LMZdTx7Fxioyz6qkHf9WWfzcKufKx+LxRuVzAUmaZhNhvLc1Av2uGkkn04YudX8HydrgCAyxsj/ZzK8LPLguZm0U9Zvzc1IyECk7oAhJolDH6sieydtq/trwZyBEFhu1hP/vd6oNUA4a4wiJ8wgNRcCWOw==; 5:O5QZ5jhfWgv0w5E0hukrjS3xGK+vfFLGQ8ier5LJEX9YivsJCEGMYAXKk5FKHv1NuoMyhvFWU57zIzbeZfuQTrgf9DGquFlIPDob6Qezal0zG2by22icD2nezq6U1G9gdwrC56jdXlX562RjFyPoZ15j9OeRaH39WZ0T3sZV4Tg=; 24:88RbsSEfFFdXPCiQ/0WnJ3lR8f8NLCULJ8QkpeV72ImeE3QtEc3JeHzUrTl80VwEMxn7k8VO9Gp4Nieoqdg1+V7gCCeBJKZV/nj72sYDtBM=; 7:ISoqJ9yrBjXy6/AAwv05jiGOFRwJD/EQXhkSofW4o9J5BiBGSeDBWw3edNbTWFys4Tr3bLVfERmTIcrljnx/XCXzY5gu7GgAWnm99kd2FTK5elqx7ZkAdHetQrELwK/A39ETUZCcaZNWJRquv/N+yXUFfU9HVUHZVyigDubdX/oca7K6SUPgC/dxkyGhJZcB7Yw7v+Rzdef/ptUuvapyM/1rCSmdTg7igNJ/p0/zRZE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2017 14:12:40.0374 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR03MB2690 Subject: [dpdk-dev] [PATCH] mempool/dpaa2: improve error handling 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: , X-List-Received-Date: Tue, 10 Oct 2017 14:12:42 -0000 Reverting the config on encountering errors. Signed-off-by: Hemant Agrawal --- drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 34 +++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c index 6df203f..d664929 100644 --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c @@ -65,7 +65,7 @@ rte_hw_mbuf_create_pool(struct rte_mempool *mp) struct dpaa2_bp_info *bp_info; struct dpbp_attr dpbp_attr; uint32_t bpid; - int ret, p_ret; + int ret; avail_dpbp = dpaa2_alloc_dpbp_dev(); @@ -78,7 +78,7 @@ rte_hw_mbuf_create_pool(struct rte_mempool *mp) ret = dpaa2_affine_qbman_swp(); if (ret) { RTE_LOG(ERR, PMD, "Failure in affining portal\n"); - return ret; + goto err1; } } @@ -86,7 +86,7 @@ rte_hw_mbuf_create_pool(struct rte_mempool *mp) if (ret != 0) { PMD_INIT_LOG(ERR, "Resource enable failure with" " err code: %d\n", ret); - return ret; + goto err1; } ret = dpbp_get_attributes(&avail_dpbp->dpbp, CMD_PRI_LOW, @@ -94,10 +94,16 @@ rte_hw_mbuf_create_pool(struct rte_mempool *mp) if (ret != 0) { PMD_INIT_LOG(ERR, "Resource read failure with" " err code: %d\n", ret); - p_ret = ret; - ret = dpbp_disable(&avail_dpbp->dpbp, CMD_PRI_LOW, - avail_dpbp->token); - return p_ret; + goto err2; + } + + bp_info = rte_malloc(NULL, + sizeof(struct dpaa2_bp_info), + RTE_CACHE_LINE_SIZE); + if (!bp_info) { + PMD_INIT_LOG(ERR, "No heap memory available for bp_info"); + ret = -ENOMEM; + goto err2; } /* Allocate the bp_list which will be added into global_bp_list */ @@ -105,7 +111,8 @@ rte_hw_mbuf_create_pool(struct rte_mempool *mp) RTE_CACHE_LINE_SIZE); if (!bp_list) { PMD_INIT_LOG(ERR, "No heap memory available"); - return -ENOMEM; + ret = -ENOMEM; + goto err3; } /* Set parameters of buffer pool list */ @@ -127,9 +134,6 @@ rte_hw_mbuf_create_pool(struct rte_mempool *mp) rte_dpaa2_bpid_info[bpid].bp_list = bp_list; rte_dpaa2_bpid_info[bpid].bpid = bpid; - bp_info = rte_malloc(NULL, - sizeof(struct dpaa2_bp_info), - RTE_CACHE_LINE_SIZE); rte_memcpy(bp_info, (void *)&rte_dpaa2_bpid_info[bpid], sizeof(struct dpaa2_bp_info)); mp->pool_data = (void *)bp_info; @@ -138,6 +142,14 @@ rte_hw_mbuf_create_pool(struct rte_mempool *mp) h_bp_list = bp_list; return 0; +err3: + rte_free(bp_info); +err2: + dpbp_disable(&avail_dpbp->dpbp, CMD_PRI_LOW, avail_dpbp->token); +err1: + dpaa2_free_dpbp_dev(avail_dpbp); + + return ret; } static void -- 2.7.4