From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30089.outbound.protection.outlook.com [40.107.3.89]) by dpdk.org (Postfix) with ESMTP id 6C42B2C58 for ; Mon, 12 Mar 2018 10:11:11 +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=r0XVA94AJaGDqz6nmOiIgIYEH/MZYFc7VvSkG/JfpSs=; b=Ez1QzHCAiNuY1e7DWxI0dCVg9lQsVbG7dweg7tMdVEM7KZmJpwLsqhhYAA6sAg605uhUQvPSRSB4zInm7lZD/jbAsKtTauuc1ziCI5jufbI2Nn41P82ZRm8v3hDxeNSTQl+W1eI+6jMJLJxUyElNx2/4FqwsieKSspkx8e4lQeI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; Received: from localhost.localdomain (14.142.187.166) by DB6PR0402MB2773.eurprd04.prod.outlook.com (2603:10a6:4:96::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.13; Mon, 12 Mar 2018 09:11:08 +0000 From: Shreyansh Jain To: ferruh.yigit@intel.com Cc: dev@dpdk.org, hemant.agrawal@nxp.com, akhil.goyal@nxp.com, nipun.gupta@nxp.com, Shreyansh Jain Date: Mon, 12 Mar 2018 14:55:42 +0530 Message-Id: <20180312092547.18472-3-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180312092547.18472-1-shreyansh.jain@nxp.com> References: <20180312092547.18472-1-shreyansh.jain@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: BM1PR01CA0098.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00::14) To DB6PR0402MB2773.eurprd04.prod.outlook.com (2603:10a6:4:96::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a2cf081b-f51a-460f-6bff-08d587f931e4 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0402MB2773; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0402MB2773; 3:nQblmzF/gvtFEjMUjsFv7wcIf6jk9d8NeGiWCP4Kuos0YNYCO3e8Vz4/tf9k01Hdj5zvj8KtedJgELOhRzrRpXKUfSxwN0TE75E0m9zL56OS67Z/Y4uA83BRQSYRdELCLSgBRbSZ72mRvGb6HZ6E+EIsrY77NC/XIBycwB2kbxQ1gZuxm+/zSVuaWKEolLaWZq63jHINoYPpRbW0eUSHyfvBZ57iB0u/rBaoy5uCYimVtK9wAf+rAMG6fdGxTt+c; 25:gjMH0ceqxkpBRft2nToKsbLLaJZwopnnTBvfsw/AO0jAYsWBmMteAcQqUhgZSyjlU3ezsa8isTmeYiHJrwO+QUTQQS3B8MlfCcz7wisnPv4MRDxv7urxqY0eCzPghGEfMP3H/2PoA+UF723bCOUyZX8FAQcjxUNosP728dLyM08qJWV52Nhh1Ugz1fcJDimG2U9qqHHrwqKSaU4+2cOCHH6ndAr0ZmWu4ADWb1QBlQMB13dp43QUEhRbwkG4lJc0ryuo+L2OLV5yp9VWqAb2AaSeWVcaPA37IJdrpqlP6axyOO9pKwN4j3jZNHz4/WF+h9U7muirE4G6jA3fMsYcMQ==; 31:F+aMDGByS5OHKy2a4Ixl/pu2SwvGAC8ggxCiYOPjHJxsXBl41K77swihaPAm3SL9ioAo/zC025hC9VTEGsLRJeEaZSzYZnVtVIEW/lX1xMf/j0co4Vi/b+/J1A6WO815yMSJyfqV7d9EPjARnd+W4izVvp+kYwVaL2UeYaMK1vL6FcSgcKwDBjfZbFujLOMvNjj6yXxOt1eaac2VLewibIoVd503zPOHyS0l2OYkb3o= X-MS-TrafficTypeDiagnostic: DB6PR0402MB2773: X-Microsoft-Exchange-Diagnostics: 1; DB6PR0402MB2773; 20:DSU00TAnp6BSF6ScHeYnnqA1e7qnxnlVf0tMqqAY5PTdOBmyQCUDsP0VRbsd8dz+WYc1Lnh0LR6dAj8/oY2S0tSHLJpVpfaRM6/dTsZGbH07ZjNN+8lHl4xtSWJZ0adgrbe7lv9Z8eP8fFkbSufGkLXmVFOW4oHrIIF9+KFZicVZbVa8nSZlwdHGzMLW9gCrwPF6J94OctDXiDRI96pL/wWBirPeWBGE2RuFFXTphevblA2zgQ60Z/AqAxLUtpLaWwNvvyCE7Sm4HtIuGrRfw8mMYBVfj2xs27OXCUK9rTaoxo4wq8nL2ZZETVRrLBUy4jUZ1Lx6r2w+xMcSSSLwktMgZPgD6VIQny9soNcqyX/LjszKl8TWxW1/hs69VxmBAhWX+tcK4CZJqON0E21IAwwbLFJVE72Re2nqpJ8drgJYr04b8wbkVJyCZQDS5SU7WRdL7zBPo7d0N99VCT+BIqV7oe63U93aIhqJIxqPC9QQOtSl/5VTcySszgV/8JDC; 4:C1jBB1zYECCOIiuDFWvVW5LlpOy968Ab94ACH0Viahzna4IOt4n3tB+Gn3vV71NPdGfjm1gNZmcIbyeIe3rd8zVyCi7FW4Wz6ukV/FgKlmmLKDpS5awlIDa4eKNd1C7Q+QTPqeKml5bEK0/gBsVhnVCrddc68b14PaONlBxHpPIsagngUUKxe/8GvKKzEZSF8OwciGWkUem5CV5+A1yJawEx2JddLq1o44f8qoETg+TTe6dQuGiupJal9/wpghnYuzOotKh9PMCkdrmZN2V0rs9/5o3MWgQJYIN8TWbZ4aEUiNX2HOF3D+WY7aFb0pjKmA6sZWMo6/3KjS2qJBJ21Odic/3pImntHnMImhTsDSI= 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)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(3231220)(944501244)(52105095)(6055026)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:DB6PR0402MB2773; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0402MB2773; X-Forefront-PRVS: 06098A2863 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(396003)(39380400002)(39860400002)(376002)(366004)(346002)(189003)(199004)(5660300001)(186003)(16526019)(26005)(47776003)(8676002)(66066001)(8936002)(81156014)(81166006)(6916009)(2950100002)(2906002)(36756003)(2361001)(2351001)(575784001)(86362001)(6512007)(50226002)(52116002)(51416003)(76176011)(97736004)(6486002)(25786009)(6116002)(68736007)(4326008)(7736002)(6506007)(386003)(478600001)(305945005)(106356001)(53936002)(50466002)(1076002)(59450400001)(16586007)(3846002)(316002)(105586002)(5009440100003)(48376002)(6666003)(55236004)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0402MB2773; 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; DB6PR0402MB2773; 23:eO1KluCsKIR7lMirpdFLxDgbPuPJXSeiOCxAYSi?= =?us-ascii?Q?fzEo00Y7V7+fiy6b5TkqUhIyYFsZ8wqfbTvhtHjyL+MjXsTlkXph2EvniR95?= =?us-ascii?Q?TLEKMs870g0lQZ7a5+omRFqW+kfXMc58ImFjeujQXiu4ZLT/lKb7U2WeNIfa?= =?us-ascii?Q?4GFVvj7RVEFwy4LN6Rhk+5i9v3Ee3lGGKvNvGgFHPYEXQ1HquHvNLiR/zZ2E?= =?us-ascii?Q?SfkU0bs2DAMxacQRxuF552pZKP+KxMuFWSRN8WinTq1AmMdrGONegknnTn8T?= =?us-ascii?Q?j8TMB6oMCXNoiEZvTRkdXULr9OFqF4v0f4TjDWxfhroE7iU4P9ihBXuFcxDy?= =?us-ascii?Q?8ohssT2Qf5750vt/PmrQsKC8t+9b2W+29A728ntcHpFiA6N/zpGOmZKIByhg?= =?us-ascii?Q?RgoN5eEhYGZuu+vF+pTI0BktsVuw28de/iE881phKGTEZM3uK/Ez++c5EAni?= =?us-ascii?Q?1Si0uH0K/Trk47UPyY5DgV9XvwFKXJBWI7Ec5cN78LH2DQ4HN0Hlu1/rf/tu?= =?us-ascii?Q?qSmiqsHX2BoT7L/UbTSHlivUo3al1CBsIzlbx2JIzErFOVW7rup6tx/OYS5n?= =?us-ascii?Q?h+q5id1qbkzE5DIKjYdegS475uJjUdH9Rs2pvbswblMNfWcHWPZ1S6TN6DnZ?= =?us-ascii?Q?d86unowZ5647kCDKOc/JqStz1H0tY9HlJMBFtqWQgeGZaLagugHP6DyKMKqN?= =?us-ascii?Q?zfmDO+LFjCgKk+JZASwXkEcOlX/cLsG20h4n1vwpEE7PAzblphN0nDz1+LRQ?= =?us-ascii?Q?OuvCoTvvMlbKNxH00lGma4Ik3omF0SxLccAsGJfan71n/LuFPQDCSZjpPrAq?= =?us-ascii?Q?WKFVqPLJBkzEhHL+ThNXCkLFgqdC9I8g7Svjwi99ZtmhOcTkOWmWEZmnS/TY?= =?us-ascii?Q?9zbI9mpYm86mtR3JGwNMCVmynBOm296k9nedjQFtypgWu6knt50qfj13sZ/p?= =?us-ascii?Q?qOBl6GQprNNFmUp1fzHX6HT0+5aLkR3KX281q3U58Bz5C50MnimcbYDRC0fH?= =?us-ascii?Q?otP/NpW9TwMjZVX49E19YLe1LxyCYhl9UUAKHFZMncvt8tGRaw3u8MMACAe8?= =?us-ascii?Q?48waqPEC1K/G+p9r1iJ5mHzlqhpcVke7kv+E5YAwZHfdQ1CzUPdojK3gJV/b?= =?us-ascii?Q?apewlAfT6tmjzx4hK4cRFyRcPt77oMHFV5wE8YjTz4kYV/2xyWdEcmFyyPYt?= =?us-ascii?Q?0The9nxkVZuwsVb7mrl+nISQbty5zSra3gWf43ZeXdQTIAqe+8CXMijsxqj+?= =?us-ascii?Q?Pn4KEchBAViAMRSNCIGOqh9V8W6unbJ6hErxpVQnYj8CdgNxmW2hh5BCTrED?= =?us-ascii?Q?s+Qvy3gQCwdHk0yivZ0i/iqg=3D?= X-Microsoft-Antispam-Message-Info: Iz0m7DzI43+VCpngKuzdjKQjEeTM/R6aaXS4B8WjFi9U5YoWPBaB3BGgZKOetyS1s7IzPSouxKTa85eCtCMFHjBWNonOr5DzEUWOYy0CHGgv/0i4ZRiPTXVKfnxQdVaVQsP7LBPjsy7V9tfKUR4mJXPWPCw3sHk7G0dfu+j5MyX3a3LDq6fp+ezKLmL8Vfg7 X-Microsoft-Exchange-Diagnostics: 1; DB6PR0402MB2773; 6:rh1X/+/hPsMOuhVMLa2RnkuptjQQktNA62x2uBZpVkamGexV6pSjCHDl5Nfl8BF6mk98XtNoX/hDcjDq0Nbnj+wXbllEGijukpUUWv8v9H00Pxf4ZZiMb+RzJJT26ijlgWQr8xlLNLpOB+s9qo7nMnFyynU7OALT074c75rwKRwSBajV8gsX3RsI4ekAqX61EELKpdEPkCnwt1+P7zZB1sgPUDHz/I/zoc5Feh+vDDSePuNZzR5ifqi3lYYskMcOImeKEn46/uUZxT8KoH9+pRjCteAItlsy4OHTERx4m+PD4wOB/+9O29ucvADNTkCjm3vF196c5X6v2CeHeelVORsKsorns5C3o/jgFx9kJrQ=; 5:evxHdsVCtYFtbzVnVbQnxsUIubNERwQx58czlQWdczl53YkyUSqlF2806//0Ws/x9/TtxuJipNZnmgZTSQAMt+hTQT/K72g/PgLAkYxpst3IBBvagkH4bGXkggd+v+Ns4K48sIEHzSJQPZILuVnOr0ggmDq3pFdjy38DiO+aTOw=; 24:U6zJW7DxqD5rQnUAz4IBaTw3/51PkKfVFELXhiBhgfOuRjX9WsOcb3tRxFLgFqKYtPA9RpalJTnizYFdsPTrcZfOe9VzXSccFwpDQItTAXQ=; 7:uOlxB1TgK4zMBaGhiypmJ17fRaQKAOgPFSYO3Idn+6J5e9O40kD1KxlhhQUx4RF5tWApGcLBn5RTEqnaP6MU1+1dNQMw6XT+VFcRuB1ecozY8OatxxSP2IVlsf9oKK+n68KUyfgdOQ8zlH5FL7NHqYjbgEUreXlUKMkbsIKo00G0W4ggy40uDCozwgZdAWC2QwFreDuZQzqMOQW5tD9qqjP2X0TpE9G4IKenTiskY4+olZZU83qsfgOwO89annDs SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2018 09:11:08.2078 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a2cf081b-f51a-460f-6bff-08d587f931e4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0402MB2773 Subject: [dpdk-dev] [PATCH 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: Mon, 12 Mar 2018 09:11:11 -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..6e8b7068e 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 resources 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