From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0050.outbound.protection.outlook.com [104.47.1.50]) by dpdk.org (Postfix) with ESMTP id 932B5AAD4 for ; Mon, 2 Apr 2018 15:51:49 +0200 (CEST) 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=6ZqqUwCuQRtDI4qZQfd3HyqNNn3/LScCWRtJ7QFKgjw=; b=gp5cP0LATpTZqhueX2hV7uYwfugVb/bl619nGeuKTZuhBfL9ChKZNzRyhGTZEcP87oDlgty5FT7nl0UP702NJntkiYLx80HXN8QnMoXGCE/MlcQCy9ElbDPF5Txc+Y2qGARR5c6KQ7c2lbRWmNBjJumdOVwcZZm8gEcisj2xA8s= 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.631.10; Mon, 2 Apr 2018 13:51:43 +0000 From: Shreyansh Jain To: dev@dpdk.org Cc: thomas@monjalon.net, ferruh.yigit@intel.com, hemant.agrawal@nxp.com, nipun.gupta@nxp.com, akhil.goyal@nxp.com, Shreyansh Jain Date: Mon, 2 Apr 2018 19:35:56 +0530 Message-Id: <20180402140601.21078-3-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180402140601.21078-1-shreyansh.jain@nxp.com> References: <20180323120456.16920-1-shreyansh.jain@nxp.com> <20180402140601.21078-1-shreyansh.jain@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: KAWPR01CA0081.jpnprd01.prod.outlook.com (2603:1096:402:c::17) 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: 12261bfc-897f-4b21-fa9c-08d598a0e0ee 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:q9YNqt0WQ+v/TmN8itRhqQ2XjSrq2JqcUyZ0atLv4RPM9LuwryZPy4LbTNA2PH/FJnAp3FnW+4roszy5D9ZDiTOdwtclHDimSrd1uN8zYjEeX5sASkwhlPuVCx7UbazzWCw0gmBwCst03u3H4oYvPp+bcPEYZS860g8m+upV2Qe9kP8VwxUAyQRUXiVL5QVlpj435HJ0sVD0VIBh3RZjai91NVacewntQklnEws3Zq2aWe0Qx3EvxZ6HVwd0tY9y; 25:2OXdQ/4LkXIJKxFcjw7HsqJ4QLmdvBsenoiMagvq5yg2SZUwKqN0qMsysK+VlF31mvNbn7e1ONKedfVpzAqFZXbpI9uz2sqXV0EiR3YuIceuWmW7C3U8KdNDHwH1WPS6gKd6Ive7sg33p7+LjJEgtBEvdds14Sug/xPqmwglPPA/wZco1nH9iYKFVJ8mme5qiGDMMXlzIUBR0avOQDANh/7PYyhIUZxzmilnf2KEyyWs+beuZCdqUUPs9FNVaP+fzLlkivV4hOLrEyrtq59QEUWvQZbCTe4Ylc18wfR5l6AsJjrcGdtXbxw0vRk9A6F5XaKgOybkaCMbNM7KBlxwcA==; 31:5K6X1prgBvO8/igiUzXTUFipytf1Z3v/n3GL+oyunO3d52qwF1ZY7c6jkBIq5DVBZ9mODJHXxGyXLmtwUEajOWV2B2YDEAmQh6Rl1ViSfJuyiCwbTKaRQ6OhSBRlsE1FaIXDabuwHCV9l3NeONhyflLgiMwslbbT+vSzCQxe2IlIz6Uic2Spm1gjkLcF0XV/w9q+m1zQ0mMVH/ce/TFIOWh4rTN55tpCnlg26SAPCVM= X-MS-TrafficTypeDiagnostic: HE1PR0402MB2778: X-Microsoft-Exchange-Diagnostics: 1; HE1PR0402MB2778; 20:RAbjaY2Mc0500naydFlKkVsroE9SWtN5AtZtXXKl35R5IvocRSUNz8FzO9MMo4NF/Gb1L11yjSlXYKhEVZzq3jg/Mor1AIPeXuAbsLLjxw5HBtRsOLXPoisy4PyyIfzVHH8Wl2kLm/f6dMteRQrGtU3Vpa7M9L+89xUTjpmWy+Xq7EGSjtQPGZS8TJMuqT6fJb0vj8QDFsJfgMQirwZ77SGZafuocjY4wUqOSdh90SWtvfaBebhNb/vPOYDSw7r9Wo65yrBJjDd0KX4AemJorw5QJKcUCBMycicj8RYouFeKfrNz/A3l0itKOjVmpeqwkrvF7jQpk0Y5xhjhHnEaHWLKPHhjk1nAZF2oo5O02j4O9oEWAwG1UVz/IO2xWoPuFMfCyZlfnQTHcY6avXb3Q0/mR9EP/ymegxnc0+Q/eDHodiJzaK9vOF/VUPNGFg4yyfbQcR8YAqVpppaO95wqZsSsuE/v/RwrPBbfEFH6JXgktkSIc4OW9QdIEzOK7XA9; 4:7WnKyF7kfILdkI/vI+Ki1q9HETnSLLIO6LRaTEr95ffqpETwKynk3HZwn6sKirsvu5e90G9LIpW0hpd3K0BMzqj/EEIw31lFwLi2KQA5wXTySmWORFL5zp7OF2KxdNSNViP38lhaQ2v1Qn56Oc/yjldm+9o2PSCBfIq2Oql67mUhbLjvu2RbSQ0HqDBvz9e8UusU6AF7bWIIEaLq7VIDmdNAnERgPWVUSuGrRSqvAVAxlUNZqjoSiP1l42PPWc44xdXPQ7U4n+LGHfFfBWKrLOA04tUECFAtTXQZ5fm2/va0x5b+tIuwpJkikdgqPSE3CRno1NsAiOgqk0cogLTmN2kZxCglrrBLPlhw5nVuh6A= 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)(10201501046)(93006095)(93001095)(3002001)(3231221)(944501327)(52105095)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:HE1PR0402MB2778; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0402MB2778; X-Forefront-PRVS: 0630013541 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(39860400002)(366004)(376002)(39380400002)(396003)(346002)(199004)(189003)(6486002)(8936002)(6666003)(11346002)(2906002)(8676002)(52116002)(6506007)(106356001)(2351001)(36756003)(5009440100003)(16586007)(105586002)(66066001)(575784001)(86362001)(386003)(81156014)(81166006)(446003)(50226002)(2361001)(4326008)(6916009)(59450400001)(2616005)(305945005)(68736007)(486005)(5660300001)(6512007)(6116002)(55236004)(97736004)(3846002)(47776003)(50466002)(51416003)(25786009)(476003)(486005)(478600001)(76176011)(16526019)(26005)(956004)(48376002)(7736002)(1076002)(316002)(186003)(53936002)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0402MB2778; H:localhost.localdomain; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0402MB2778; 23:ai/APpFWFbO29KNHstAoshbh4IwbCifXDCz//II?= =?us-ascii?Q?EhQ57IsBLogQ6ONloBg64VNE+mshjs3rx0DPb64okVG76YhEUp+DOXakN4VM?= =?us-ascii?Q?SDohA654FSRfLGZ2z4wv8a2vDc4Xz5d+/F5J1BUdbXWBbyHZQkWLD7CDgNMS?= =?us-ascii?Q?+IomAwTnB/IV2nu5nmu6uBZ4QZ+Srd9op6whQYqAP5Uh1LEG+0oMRJ2yuC6p?= =?us-ascii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zGGne1jXLXa7x8g==; 5:55BpMeP6IFeC5nB0Au51qmYf6scC08TBsiZTlvmTFZbYwcx+SGmUj6DpY5sNLS/rhUKPi3ubJmzMgxfr1xujrXbMeC+pX+MJHCpm3qdE3FIAi7A7gF3pSEFW3BBR3pszKFpj1tRrXN9QdTpDxFixgW08AVXm6oTG3KXSLVggnnE=; 24:Et07L2Lk5sDoIT/JemW3awRLYd8GzNlslSf8Qd4ekQ36CRcB9yd5caiWuh/U+XzWuRw+2/AYmmG0Hwf6UwDsftXBDOPHG7d6Br24MOqBv30= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0402MB2778; 7:ew4izl65JdgjReHCU4Ur47xmZiFQo5+0eVBVsrZlO6YyBqYDQ4ieryOApUaVwH7TfD7K9gUZ9s1GYuYqqkJhzC4CDDZpqMKC5SNPGOiIwgkLABhbldhr9XpYuaPS5YFHkBwM1v63oOF1pg4K/+UZVmaxkgwEl6xUQcSiw565vvXXpdJxh9iHpQFZzcekCkEOEh/O3DpCzu8pMjYPQ82uc+0/51FMHiIjFW4VrbCxggZgBJ6nMz6hUvA2oXfFcBI8 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2018 13:51:43.7021 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 12261bfc-897f-4b21-fa9c-08d598a0e0ee 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 v4 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, 02 Apr 2018 13:51:49 -0000 Signed-off-by: Shreyansh Jain Acked-by: Hemant Agrawal --- 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