From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40052.outbound.protection.outlook.com [40.107.4.52]) by dpdk.org (Postfix) with ESMTP id E947C5F18 for ; Fri, 23 Mar 2018 12:50:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=0UsmiOybiNK8eIyHVIu01NAZ/g/KwDWTl2OB4W66dj8=; b=sFizEXGMIjf5fnSgm8TczPsSYeyutC0zAmS7u1cA9DSICaktFVyD6x6ha1ktjXWmdgfbhuhl9p4BhFoggcFcIiDqu8LgL7gnmkTUM+5p/eLIY1fP+0CM/V33JLw+Fyc6jltuRcDOKcaSuouRc1iyAhjfhNAZ7avoXWFmPCjjzdM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; Received: from localhost.localdomain (14.142.187.166) by HE1PR0402MB2778.eurprd04.prod.outlook.com (2603:10a6:3:d4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.588.14; Fri, 23 Mar 2018 11:50:36 +0000 From: Shreyansh Jain To: dev@dpdk.org Cc: ferruh.yigit@intel.com, hemant.agrawal@nxp.com, nipun.gupta@nxp.com, akhil.goyal@nxp.com, Shreyansh Jain Date: Fri, 23 Mar 2018 17:34:51 +0530 Message-Id: <20180323120456.16920-3-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180323120456.16920-1-shreyansh.jain@nxp.com> References: <20180313054431.19556-1-shreyansh.jain@nxp.com> <20180323120456.16920-1-shreyansh.jain@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: PN1PR0101CA0016.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:e::26) To HE1PR0402MB2778.eurprd04.prod.outlook.com (2603:10a6:3:d4::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c9cdb9eb-191f-4a25-5ed8-08d590b44bee X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:HE1PR0402MB2778; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0402MB2778; 3:hj8fogPi3Re9eDSkwVaMpZW5CZul87B/+hrZPDmR5QItnozUUB82MU0GC+MeT1HCmOxtlwf6Oit4R39OJ8pYFfo0c6EDBovDU2qVvv0mXclgwyuXZRyxsnIh7ewUNXZazEV6OubzYePyBGss19y+fSxIIZl+r8IUHG1+24nb3qo/9p3EaDSmdyB8m6wmHVJe3yDHh2sJh32v2tpAxdiSNVLpIJ8B2B0cgtMN575eLd1upshCQIr+2m57LHo8Y/gx; 25:3NSXblAjxmbumfCnq+79yghqExkmjiKZkmkJ9QAExMcpoKdAjsp3yHr3m+gBG5/Aam7+rJqiee/mHZIqydvZNK3IYb1u0xLS2AuTUoMiIbk3o9Q4cNW7bVxkdpLeju6gbzz0E7nkeKsrdsTVTZ80v1ISXYY8cpDfppRQBlRVgj99HZQvfBz2rnPVBk3iv1+4nimr+ppzXTclfGKIyxQ/TTQGlqEwmVwAl52o0QSrDaXQwtOsmvVqqX1FXuG86W6WwLeI2+F1UfKh3R3+irx9dFw5adzfVwmgWk7pcUL8wbW/ruT3GAVnEoVPNEpFAjLBV8s7sgj8SIXh6FlzDbEKuQ==; 31:jFoWFVy9S1jT5sFYzkd/Z3SDXL54QJsamXAqUtM7cS30EaHu8xjyyVbNNQKXEfMN5qST9gMr8HRKkBTbi9uQvQd9phwa351FpR2dpk4BHHLjBknuoc1RE9OPWSpT7e/0gXuv57CwZD3HNQrDuQXAgexm/bcCQFcTsfvSJPVFtms5yBB5qlzk1I1/jcRa/AQwMVEkT4kzgi8TAMkz2ufKk00IYKljl0rozKIWvCVtkmk= X-MS-TrafficTypeDiagnostic: HE1PR0402MB2778: X-Microsoft-Exchange-Diagnostics: 1; HE1PR0402MB2778; 20:kmWpfXIRYzs7zfV7xxGcCWsJmespJf/D5CabKBsTLaAwcRpqmJtAKVlumACSY75OdarQwRXlT5ufzzpHuSRXmSMHJ+Y1tZ39WMRFoYIcu873r9qxR/3NcWECsAKctQEWPRHdHb54RddaxLTwgMZ1fR6Ml5PQAsmqFyCc79MrTe4UJmnEh6BvFla0WymZB2MfDqscfB7LJFbjD6o1zHTlZ/STM1AVhjnHDGP51qYgDyX2Pv0mlxTTZUdMztsh/5Jj+9N6iNZ8s6+WHQxPBaeJAS4UWYEmK+MvU29HVKG2VML3z289FnxQ5tFosUUVGIOPTGiPks7sHgPEYW2OpDgCXjgiKszMRpL6KpnTxEjDV3FL0p91dk1nL/b9w9tXrp9CP7NwfG65s1rDa4Z4y2S3a9dPVhXOhRC1n+w58z9evRrPgtQbBDN7acOLXOVe3btYArRmB9dn/fbQKo5dHnjWJ6SZAC8EDHwOO7xCDGj4HBYMZE9HZW6F2b4JsxnUcozZ; 4:diVttg3wubSTvfNzCQ0aFkAtf13GPN0AUY22ZqxNGWsgHIAMQpx2X67ToWYVIp9IuheanDNjMEcBqZQxSzFxZ56+eub+BfJ+cIqYm6wtessFzekY40S7I9/eqcq4NK65ahLKGp2UcyaUa0EQpNKgcN+o1aUVRHywuSkOiKTMGriqPKFBr6szRZlRcgwWljCK1x6aXsGlASlfhW8Wl945bmKLNg2Z6dlDr0smN1Td7TGR57Z9DXO+A6qdbUgiRL/42LlnOlhTDd6Xd8AqUtCPjnjKP5hCB9qpiNajgJpelRE5oE1J/InadscLPONx7j1RDSKnjN+CiDhhBx/GdSB7MFw4tfWlhKJgWbc+FvIvMAc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501327)(52105095)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041310)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011); SRVR:HE1PR0402MB2778; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0402MB2778; X-Forefront-PRVS: 0620CADDF3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(346002)(396003)(376002)(39380400002)(39860400002)(366004)(189003)(199004)(6666003)(59450400001)(105586002)(50226002)(52116002)(25786009)(97736004)(316002)(2361001)(6512007)(575784001)(51416003)(2351001)(86362001)(6916009)(6486002)(2906002)(16586007)(26005)(3846002)(68736007)(11346002)(106356001)(4326008)(1076002)(5660300001)(6116002)(16526019)(6506007)(386003)(186003)(446003)(36756003)(7736002)(478600001)(305945005)(48376002)(66066001)(47776003)(5009440100003)(55236004)(8676002)(81166006)(53936002)(81156014)(50466002)(8936002)(76176011)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0402MB2778; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0402MB2778; 23:RNP2aGS3jAMKqugprJcLCGBqGW2gdKDMCK6skW9?= =?us-ascii?Q?+AmuF1WZ6rwed3dOwqXNanjpD3WzdjHuJDChMpXk3xhVPCebVo0YZW05B1BB?= =?us-ascii?Q?/FBXXXiV6c7YB0QwkOjpNvTYkM4rXjTf61EPciZin+Bx8uFQeeINnbEWGA6b?= =?us-ascii?Q?BNQ5hJ4nrFSQKrI49HoCegBUZaIuY3rW8XfjCZqcGDU5sUfhEaFZQbAKaZiV?= =?us-ascii?Q?fJBFvLIu8pyx2cmBpzGJSDZe6gYQ4Smo5xym+MSZdJQuNzax82vDON/pihju?= =?us-ascii?Q?rIFfj5S/5lj26wqbeSQLOjkXDMEcD0aqpDVFYTYXM4dcz6kMa643j62Jyo1N?= =?us-ascii?Q?P5xz/ky/egrX5W4dYHuUURRVfVINbibH1LwtJ0iB0WW0bfTSAjSLIaEnccRw?= =?us-ascii?Q?2fiIDQ/M3c8hzIk3Yqhe9lcco4YrZqGCsxA2UnRClQ6btMIQe0o0iB5T+BsL?= =?us-ascii?Q?wSAj/B0xHEYM05OCIAkiR3+93S7f2yEvNfCqtca+W/pPBRl6zlvHwRMnZ+Cr?= =?us-ascii?Q?xKr5R2rcAHTMyiaX7nFb9rd4AtEfsnJLaxf5yWBaJ5qbp+TOhfV7gDAUwJbk?= =?us-ascii?Q?RWhSxEp8b4RTu7BCYj48907RK0EXxp0zrq30qIHMUzhOEJ5EpEjXMcXyfTXJ?= =?us-ascii?Q?iDzQSRgS+qlcJkcKMzn91+sgJ+J9c1jDAxSM6ZIsUyC+eIsOkltqmH7ohHOu?= =?us-ascii?Q?d2kUDt5aymJA318K35EKDB4bCL/W/kpVoWZRF3VY5xL63CL7c/NoXgEuP3W4?= =?us-ascii?Q?39SwNMYiIUU+hJ1zx5fzBbwKxBGS+M6FX3KY5ymk/71wHBHEfVsIjy/ITTuE?= =?us-ascii?Q?Kb2zZp6v6P7MZWGBXaTLsnJ+qNpPtYF7BYth90Iiajc0OYeSd8rhQA1RWifQ?= =?us-ascii?Q?ee2xkek4X9IrKzFY7PD1cfFXMX8Vfninu1OU0I9vCDeWmYNhepXOUC8OluHr?= =?us-ascii?Q?docJCjpcnxzsU0RY/vdIDNTabzl7e8yxphIcxucvYQuoFRZIvT5Nhpch6EvR?= =?us-ascii?Q?OEzrqcy0qYDjvQgPGOnT+aa2Fi7XxQGaGgP21yVtnOjf8plaG7G3fNEFCSNd?= =?us-ascii?Q?BTBtDKV8XfmAs0419n8NXCwzNQ+lFjqK8ZovvUIPtBbPJSjHw76O0s7sbde6?= =?us-ascii?Q?8elFG+lwn/N7C2fKIeV2SDtrcBwGmR9FuHHjeA6K42Q6I4J7dTu5rG80ZB8o?= =?us-ascii?Q?Cr4xfh+f2bwbDJWtAj1WJcN7JpMdDXXLv70kqXQTWVFdDbj604cQj12naB+z?= =?us-ascii?Q?NjBRgk13oV+TkmHbr1C6tCXH89ehDE6FIurzhRtDjeIpvnbdFwuc0Jvv4gpi?= =?us-ascii?Q?ffYEPRohnF3kAvbn9ypk2n5c=3D?= X-Microsoft-Antispam-Message-Info: GjTCLrhnItot20HkjcTkFowR0OZBwZPWXOsUFUVwByllZHfhiW3qT6DVbr+bz+pidfhkIQoy36it5Lv9+YDBfNAIuh23hwEVFLsV4qDFjGXlMZhM0oZvF55klMLdMdyxSefN9T4UjsGzpt8wLHVT+Py6wscc56XU7DnVDMu5YSZ3+KxzvKrg93prwAdz8Tlk X-Microsoft-Exchange-Diagnostics: 1; HE1PR0402MB2778; 6:Qez6zYHPevQjGPKo+saa8Xj6xP31qCaMyCLKkBh9W7KXZdrATN55GqXJJox+DgeJl9z8v/rJTjbASdWJ4gpcj6BP5OwkkswMpZAeo64Jwak6ZewTa3XuE8LnAOLnEB5JSoylpbqv30fY9tdXPHsYWi1WPnbRxFnPwsj2FmXYPwjJppeupx0XwWxuLNFSQJjacLG+nwwK9x90En8SKNXX/EkT1A1jc+sGiTAkwsvhi9qbapXG/sveN623MjZlRmZgw/8G/8uVaLYUCgSGK2gn9binp6PL3fnpf3PzYkSOPh5wwyOlACacVsP0i4SeGIjMUJny/k3LpRoWRtvYY2pt9D/db1ATMWO707Lzc+89daU=; 5:K148fpYjkfrAYzgfzSW9AFg+uDi55LApauyQ53wYC2oqkIlVDhEEWrP7XyHdZHPOOXbFKLmsJbonp5BzPrquV9ZyjNrTZUwLe37LlBGn2z7RTEJSRJWLypB29XE7ebzTiCCOdejigjBAlBO0NWy02S67SfTQGsaJdr12ak8P/L8=; 24:0BZz+MvX8DM5vXiJXi7cwjccJkJBqdgueiC/zmA4Dc/2KBqcG98FqagWf97Xh1QocMfKqddtbgzcyxGT8hKD4v80N09aI7ucXTWdheTKblw=; 7:ZQ/VptGnTWmalSZQ4hkwqoEpbt+Rj9JVZt2KBEpEJavccrbAVVXkMNJ/UoeBU2JnRqkBXO7O22ChSQVRmgB5KscU9Xx5awDKJq8ja6aBwmll0s5wtSG38sgU8I2E+Gv93A47RnMgYMrVvta/EPemqG8gpmIwmrhbiMwO7biBi22+KIeV7gLPYljhidWc6N3gR0BLbZD4Nx/NNoXO0fgeO68PYtFQh59JaAl6PRh5Th3XsNI9GTDKXOQavy4k9eq4 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Mar 2018 11:50:36.9750 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c9cdb9eb-191f-4a25-5ed8-08d590b44bee X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0402MB2778 Subject: [dpdk-dev] [PATCH v3 2/7] mempool/dpaa2: change to dynamic logging 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: Fri, 23 Mar 2018 11:50:41 -0000 Signed-off-by: Shreyansh Jain --- drivers/mempool/dpaa2/Makefile | 6 --- drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 60 +++++++++++++++++---------- drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h | 38 +++++++++++++++++ 3 files changed, 75 insertions(+), 29 deletions(-) create mode 100644 drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h diff --git a/drivers/mempool/dpaa2/Makefile b/drivers/mempool/dpaa2/Makefile index efaac96e7..f0edb32ce 100644 --- a/drivers/mempool/dpaa2/Makefile +++ b/drivers/mempool/dpaa2/Makefile @@ -9,14 +9,8 @@ include $(RTE_SDK)/mk/rte.vars.mk # LIB = librte_mempool_dpaa2.a -ifeq ($(CONFIG_RTE_LIBRTE_DPAA2_DEBUG_INIT),y) -CFLAGS += -O0 -g -CFLAGS += "-Wno-error" -else CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) -endif - CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/qbman/include CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c index 1a618ae1b..ce7a4c577 100644 --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c @@ -27,10 +27,14 @@ #include #include #include "dpaa2_hw_mempool.h" +#include "dpaa2_hw_mempool_logs.h" struct dpaa2_bp_info rte_dpaa2_bpid_info[MAX_BPID]; static struct dpaa2_bp_list *h_bp_list; +/* Dynamic logging identified for mempool */ +int dpaa2_logtype_mempool; + static int rte_hw_mbuf_create_pool(struct rte_mempool *mp) { @@ -44,30 +48,30 @@ rte_hw_mbuf_create_pool(struct rte_mempool *mp) avail_dpbp = dpaa2_alloc_dpbp_dev(); if (!avail_dpbp) { - PMD_DRV_LOG(ERR, "DPAA2 resources not available"); + DPAA2_MEMPOOL_ERR("DPAA2 pool not available!"); return -ENOENT; } if (unlikely(!DPAA2_PER_LCORE_DPIO)) { ret = dpaa2_affine_qbman_swp(); if (ret) { - RTE_LOG(ERR, PMD, "Failure in affining portal\n"); + DPAA2_MEMPOOL_ERR("Failure in affining portal"); goto err1; } } ret = dpbp_enable(&avail_dpbp->dpbp, CMD_PRI_LOW, avail_dpbp->token); if (ret != 0) { - PMD_INIT_LOG(ERR, "Resource enable failure with" - " err code: %d\n", ret); + DPAA2_MEMPOOL_ERR("Resource enable failure with err code: %d", + ret); goto err1; } ret = dpbp_get_attributes(&avail_dpbp->dpbp, CMD_PRI_LOW, avail_dpbp->token, &dpbp_attr); if (ret != 0) { - PMD_INIT_LOG(ERR, "Resource read failure with" - " err code: %d\n", ret); + DPAA2_MEMPOOL_ERR("Resource read failure with err code: %d", + ret); goto err2; } @@ -75,7 +79,7 @@ rte_hw_mbuf_create_pool(struct rte_mempool *mp) sizeof(struct dpaa2_bp_info), RTE_CACHE_LINE_SIZE); if (!bp_info) { - PMD_INIT_LOG(ERR, "No heap memory available for bp_info"); + DPAA2_MEMPOOL_ERR("Unable to allocate buffer pool memory"); ret = -ENOMEM; goto err2; } @@ -84,7 +88,7 @@ rte_hw_mbuf_create_pool(struct rte_mempool *mp) bp_list = rte_malloc(NULL, sizeof(struct dpaa2_bp_list), RTE_CACHE_LINE_SIZE); if (!bp_list) { - PMD_INIT_LOG(ERR, "No heap memory available"); + DPAA2_MEMPOOL_ERR("Unable to allocate buffer pool memory"); ret = -ENOMEM; goto err3; } @@ -112,7 +116,7 @@ rte_hw_mbuf_create_pool(struct rte_mempool *mp) sizeof(struct dpaa2_bp_info)); mp->pool_data = (void *)bp_info; - PMD_INIT_LOG(DEBUG, "BP List created for bpid =%d", dpbp_attr.bpid); + DPAA2_MEMPOOL_DEBUG("BP List created for bpid =%d", dpbp_attr.bpid); h_bp_list = bp_list; return 0; @@ -134,7 +138,7 @@ rte_hw_mbuf_free_pool(struct rte_mempool *mp) struct dpaa2_dpbp_dev *dpbp_node; if (!mp->pool_data) { - PMD_DRV_LOG(ERR, "Not a valid dpaa22 pool"); + DPAA2_MEMPOOL_ERR("Not a valid dpaa2 buffer pool"); return; } @@ -180,7 +184,7 @@ rte_dpaa2_mbuf_release(struct rte_mempool *pool __rte_unused, if (unlikely(!DPAA2_PER_LCORE_DPIO)) { ret = dpaa2_affine_qbman_swp(); if (ret != 0) { - RTE_LOG(ERR, PMD, "Failed to allocate IO portal\n"); + DPAA2_MEMPOOL_ERR("Failed to allocate IO portal"); return; } } @@ -250,7 +254,7 @@ rte_dpaa2_mbuf_alloc_bulk(struct rte_mempool *pool, bp_info = mempool_to_bpinfo(pool); if (!(bp_info->bp_list)) { - RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured\n"); + DPAA2_MEMPOOL_ERR("DPAA2 buffer pool not configured"); return -ENOENT; } @@ -259,7 +263,7 @@ rte_dpaa2_mbuf_alloc_bulk(struct rte_mempool *pool, if (unlikely(!DPAA2_PER_LCORE_DPIO)) { ret = dpaa2_affine_qbman_swp(); if (ret != 0) { - RTE_LOG(ERR, PMD, "Failed to allocate IO portal\n"); + DPAA2_MEMPOOL_ERR("Failed to allocate IO portal"); return ret; } } @@ -280,8 +284,8 @@ rte_dpaa2_mbuf_alloc_bulk(struct rte_mempool *pool, * in pool, qbman_swp_acquire returns 0 */ if (ret <= 0) { - PMD_TX_LOG(ERR, "Buffer acquire failed with" - " err code: %d", ret); + DPAA2_MEMPOOL_ERR("Buffer acquire failed with" + " err code: %d", ret); /* The API expect the exact number of requested bufs */ /* Releasing all buffers allocated */ rte_dpaa2_mbuf_release(pool, obj_table, bpid, @@ -293,7 +297,8 @@ rte_dpaa2_mbuf_alloc_bulk(struct rte_mempool *pool, DPAA2_MODIFY_IOVA_TO_VADDR(bufs[i], size_t); obj_table[n] = (struct rte_mbuf *) (bufs[i] - bp_info->meta_data_size); - PMD_TX_LOG(DEBUG, "Acquired %p address %p from BMAN", + DPAA2_MEMPOOL_DP_DEBUG( + "Acquired %p address %p from BMAN\n", (void *)bufs[i], (void *)obj_table[n]); n++; } @@ -301,8 +306,8 @@ rte_dpaa2_mbuf_alloc_bulk(struct rte_mempool *pool, #ifdef RTE_LIBRTE_DPAA2_DEBUG_DRIVER alloc += n; - PMD_TX_LOG(DEBUG, "Total = %d , req = %d done = %d", - alloc, count, n); + DPAA2_MEMPOOL_DP_DEBUG("Total = %d , req = %d done = %d\n", + alloc, count, n); #endif return 0; } @@ -315,7 +320,7 @@ rte_hw_mbuf_free_bulk(struct rte_mempool *pool, bp_info = mempool_to_bpinfo(pool); if (!(bp_info->bp_list)) { - RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured\n"); + DPAA2_MEMPOOL_ERR("DPAA2 buffer pool not configured"); return -ENOENT; } rte_dpaa2_mbuf_release(pool, obj_table, bp_info->bpid, @@ -333,7 +338,7 @@ rte_hw_mbuf_get_count(const struct rte_mempool *mp) struct dpaa2_dpbp_dev *dpbp_node; if (!mp || !mp->pool_data) { - RTE_LOG(ERR, PMD, "Invalid mempool provided\n"); + DPAA2_MEMPOOL_ERR("Invalid mempool provided"); return 0; } @@ -343,12 +348,12 @@ rte_hw_mbuf_get_count(const struct rte_mempool *mp) ret = dpbp_get_num_free_bufs(&dpbp_node->dpbp, CMD_PRI_LOW, dpbp_node->token, &num_of_bufs); if (ret) { - RTE_LOG(ERR, PMD, "Unable to obtain free buf count (err=%d)\n", - ret); + DPAA2_MEMPOOL_ERR("Unable to obtain free buf count (err=%d)", + ret); return 0; } - RTE_LOG(DEBUG, PMD, "Free bufs = %u\n", num_of_bufs); + DPAA2_MEMPOOL_DP_DEBUG("Free bufs = %u\n", num_of_bufs); return num_of_bufs; } @@ -363,3 +368,12 @@ struct rte_mempool_ops dpaa2_mpool_ops = { }; MEMPOOL_REGISTER_OPS(dpaa2_mpool_ops); + +RTE_INIT(dpaa2_mempool_init_log); +static void +dpaa2_mempool_init_log(void) +{ + dpaa2_logtype_mempool = rte_log_register("mempool.dpaa2"); + if (dpaa2_logtype_mempool >= 0) + rte_log_set_level(dpaa2_logtype_mempool, RTE_LOG_NOTICE); +} diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h b/drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h new file mode 100644 index 000000000..c79b3d1cf --- /dev/null +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h @@ -0,0 +1,38 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * Copyright 2017 NXP + */ + +#ifndef _DPAA2_HW_MEMPOOL_LOGS_H_ +#define _DPAA2_HW_MEMPOOL_LOGS_H_ + +extern int dpaa2_logtype_mempool; + +#define DPAA2_MEMPOOL_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, dpaa2_logtype_mempool, \ + "mempool/dpaa2: " fmt "\n", ##args) + +/* Debug logs are with Function names */ +#define DPAA2_MEMPOOL_DEBUG(fmt, args...) \ + rte_log(RTE_LOG_DEBUG, dpaa2_logtype_mempool, \ + "mempool/dpaa2: %s(): " fmt "\n", __func__, ##args) + +#define DPAA2_MEMPOOL_INFO(fmt, args...) \ + DPAA2_MEMPOOL_LOG(INFO, fmt, ## args) +#define DPAA2_MEMPOOL_ERR(fmt, args...) \ + DPAA2_MEMPOOL_LOG(ERR, fmt, ## args) +#define DPAA2_MEMPOOL_WARN(fmt, args...) \ + DPAA2_MEMPOOL_LOG(WARNING, fmt, ## args) + +/* DP Logs, toggled out at compile time if level lower than current level */ +#define DPAA2_MEMPOOL_DP_LOG(level, fmt, args...) \ + RTE_LOG_DP(level, PMD, fmt, ## args) + +#define DPAA2_MEMPOOL_DP_DEBUG(fmt, args...) \ + DPAA2_MEMPOOL_DP_LOG(DEBUG, fmt, ## args) +#define DPAA2_MEMPOOL_DP_INFO(fmt, args...) \ + DPAA2_MEMPOOL_DP_LOG(INFO, fmt, ## args) +#define DPAA2_MEMPOOL_DP_WARN(fmt, args...) \ + DPAA2_MEMPOOL_DP_LOG(WARNING, fmt, ## args) + +#endif /* _DPAA2_HW_MEMPOOL_LOGS_H_ */ -- 2.14.1