From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0071.outbound.protection.outlook.com [104.47.0.71]) by dpdk.org (Postfix) with ESMTP id C63855F25 for ; Tue, 13 Mar 2018 06:30:32 +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=ozChgTXjKeZxkR6i+uFCmwH8E3Sv1Hz53ZiiFjvKT5xM64WGN3jSiI4SAt9k0VG+J8z7gsGWAGSyxp92jE3Mxwtuk9PB2LwA0powjHLVeHDMAKjb8ilm3Wc06/L3LxCpG97ZuqNt8TtUedzWFO0TlqhgW+j7UsAf7FpSIf7B0+o= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; Received: from localhost.localdomain (14.142.187.166) by AM5PR0402MB2770.eurprd04.prod.outlook.com (2603:10a6:203:98::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.14; Tue, 13 Mar 2018 05:30:28 +0000 From: Shreyansh Jain To: ferruh.yigit@intel.com Cc: dev@dpdk.org, hemant.agrawal@nxp.com, nipun.gupta@nxp.com, akhil.goyal@nxp.com, Shreyansh Jain Date: Tue, 13 Mar 2018 11:14:26 +0530 Message-Id: <20180313054431.19556-3-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180313054431.19556-1-shreyansh.jain@nxp.com> References: <20180312092547.18472-1-shreyansh.jain@nxp.com> <20180313054431.19556-1-shreyansh.jain@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: SG2PR0401CA0018.apcprd04.prod.outlook.com (2603:1096:3:1::28) To AM5PR0402MB2770.eurprd04.prod.outlook.com (2603:10a6:203:98::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 23b2e696-840b-475c-347e-08d588a38989 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM5PR0402MB2770; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0402MB2770; 3:rls5956AiawIV1DHRWj+xZ0Sg8VP+9PYQjeGKfxb/h6dorDW1Ypj0abvUg2OvmiWYbrZTto4OV9JCjfbWtni4E8iwrDzCOdx6wL12xvvrRDpv13watKChmPNZPPaqyYTSPjphnSBESL20V670W7YyDO2hFpKOFCGlrtqok0vKx6vHDqEIpEKc2XQdZ1BR36B52XjMJtQATrP/UYzzi7y3Dz2m/2hzkxhkBNAYa4uezuZiLHGuCUczq//TtdIzAO3; 25:ZfIoudB+MpuiNcSwCKoXZrRXPqltOD9VuwqX9Xo1ZpJGkoH6XeuKth6wl+TIL/HfTe2tJoF0zbYG74zKq2ewitocXgSTTteNwYRwyjx78GjfQimeoM25LM3hkiIIEBy+uD+GYicIPJ7odN8bH+nftMz59H3cV2DWM5I+0vBGJm/61Dula3RcxSBju26vEjDBw2sk8ufN6wGb0YY46FeWt1e2L2BtECUsvuW8/9U9lJe7bKxlJPCy/pvmIKmHRdajrpJObHPX+2sE4Tad0Eb9zOcwkXHJRgUhGdJAEUx05VihSJMsPi2I5ohLaYz+5XvVjmpNEIfWsqAuJRuca0M2wA==; 31:ZPO2cF0CWITAjGVMh6wq8E52u/X5qcus3gE2JntYPcS+jTnV3CY8VlTAFHDnpJmOt1dyIfW7rpQM/SCHBAs5jdlzSt/c848xFw2NOyq1z2kGV/hMTDO8ondvAtd6OXMinKBgrxFGCzTfVbCh8Qvsma+aEjj6PvjUMNqX98bwxgteOWUVDClc40zAXij+0RQdkzNBxS53eQ9fQ7TAGSaDqGfymap+j06WPzUwLqAP9Fk= X-MS-TrafficTypeDiagnostic: AM5PR0402MB2770: X-Microsoft-Exchange-Diagnostics: 1; AM5PR0402MB2770; 20:oqPBnUCGu0JoKiBe54Q0ZqPrpyxQ3kqaOXW2A164skiTuKf9dW1viIMgAMwlS0CHJYmw/Osog40xtpjR2WjMph3VtgotwIdxFng3c+6qZ0gNpn8pl4Ruwwnh0MsuUMePLlZe8ld0CVUa/jLPGyl5yZ2V709QZbJZ4qtsfzDlfxos1pEMKIsFIoZ0/PkV1ZoAzK2Z8LgWsaw1sq3iBklqW2slPVfZPrHUS+bl9q200ICcPMgn1vLt8qLBFqXZKTW/2dBFFlbPYrjbJCjWa3mbvbsQlJQGGi+BBCgqBr4xenxIhRRkKTp3bvVSN+cvO8u29wpHwEZGvr/UlnpvWc4Fj1BV3usCiWoC9VJPM4qqrp2hDY0ibi8LmrCkYg7XAiEYX8MqVn0q/CosWnmcSJY1dyjxMMwhFpLmoKzHNOVwS7+QV0YkEsSOi3URYSw+F7JWHQ/Ee4J8M69ex8kUanDt4vIVigT/Ld0j6ozSabA75UqsC4bLZSpod4HTBihEU53w; 4:EJnwG7ldUP1OZ8vYre/1riAQ9HWKH1r9eIVoCqrnSTy7cNm97PkbNzpcfmn5kc4VLS5rzXjcrJle4jCGWGBOhzf84bK4UlBaSWPiru0siv2eHuFlbrcjF2RKQGfzDI7IT51Ye5YDNFTRZLlFqwpvguxze4Vtf2O1SSV2kS3e/c0Tq1D0zqCS1ES2MRufLgBCBda9fdYv1xtLzsMMRJEgQVW4J/v5jB9CqOQ3zljiVyje74guZGzFXTLfHFrNvYHVLoMlqMx5Syaik5KSEHCNVHmGU7ME5efZ6w43RQQ6w01Ds8xKwnsGd2Dm+UZ0+43MexfSfQb6OPffY3YY9/eRtVQ2KNxOaBI2avdqxxqpsj4= 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)(944501244)(52105095)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041310)(20161123562045)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:AM5PR0402MB2770; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0402MB2770; X-Forefront-PRVS: 0610D16BBE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(366004)(376002)(39380400002)(396003)(39860400002)(346002)(189003)(199004)(6512007)(68736007)(55236004)(2351001)(386003)(6506007)(66066001)(6486002)(97736004)(48376002)(7736002)(25786009)(26005)(5660300001)(4326008)(50226002)(8936002)(16586007)(47776003)(106356001)(50466002)(2361001)(575784001)(8676002)(316002)(305945005)(81166006)(5009440100003)(81156014)(3846002)(6116002)(16526019)(53936002)(86362001)(105586002)(36756003)(1076002)(6916009)(186003)(2950100002)(59450400001)(2906002)(51416003)(52116002)(478600001)(76176011)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0402MB2770; 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; AM5PR0402MB2770; 23:MB/7FjfFm+rnBxYkmXcWl5myjm5Lm3oRjUEnMVg?= =?us-ascii?Q?ycxyV5d7qQOKGwIpuPnV66PKvHD7UD+F4L3gOdZmJQau7HgWs3GrFz4rS3ug?= =?us-ascii?Q?dkksJr6GwxMci5YVq8Pu8ytFFSj4w2UXRAH4sg3V0+oh19EdN6XyVPWyRKO3?= =?us-ascii?Q?qrCHMyktcbOjZMcRPniTw7wlDM3j93qcxaA0yn6Oj7lMbIbRnnstrHD5aIAP?= =?us-ascii?Q?K5yantifgpZOcZyOO1M5WCxUAgVKCVVZFT2WX4l6KG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NEeLrKYfRkWtFnxfcJKah6BQrN1WoC7E=; 7:b5t5T5f9FC6UQVq7JpY4f5AHPPaFaKQ9B00aiEZtyM6/8iMgKWqQ5eM99uyAq5TsS8u9uxVA0uKToM7eOreHXFDFxq6FaVAAxkPNNrgEzQCvU71ZrreuV9jumsFxQbH6TSmOcOM21wg/naDCXHUZaZX7SIh6hsCT7fgI7wca4mXWfs7H47chlkQ64jFFGoiNyUOlqNOT/85HtqpT3/1mN/O0BvloO8ZYIm8afnBJQExVJmJi1mgFmOjdOscNpk3k SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2018 05:30:28.9591 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 23b2e696-840b-475c-347e-08d588a38989 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0402MB2770 Subject: [dpdk-dev] [RESEND v2 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: Tue, 13 Mar 2018 05:30:33 -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