From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30065.outbound.protection.outlook.com [40.107.3.65]) by dpdk.org (Postfix) with ESMTP id 2C0282BCD for ; Mon, 12 Mar 2018 10:11:10 +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=zo70b443lQ1p6NTMRd8GRlWDYApbmRb0s6MU1ghmiIA=; b=PA/wSk018onODo7G4iaghlxuitmKpHnQRvNehdUqbs7gksbGOTdL4fAo6yN8q8mbxMHh9md6b4KwAgvPmyfW+hgOSO7Loz2Mwfj1DAU0SQ0uUMdrqwo4x+z+ylFFxNruP7zBzz4kx/vVTtE8+I0DHQtyzDQo0ko5hS7x0Lt2nqQ= 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:06 +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:41 +0530 Message-Id: <20180312092547.18472-2-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: 9a2d80f2-d1fb-4f7a-65db-08d587f930ba 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:9qQOJ/dxdZpQOkGWui72OKs8D6ZQKRjP6xz8B5fl/AxaUnUnE6pvUMwqekSF2tRplW0SRcpKtaUJK+AszEsQC5AUN68IDyx7o009Al/wzIwm7T/0+E31h7QFPOqFDrQ3e1ENeTD+B8sm+ZSNwJB8heVcytQGSXk29G9PZV3jDvaAIpm17LtXOQEtaMaytUYxVf6UBZQD26ha5zdGCV03DhTxfjpLwcON7M2slLo3MstykBbfr2+PJpCB2Dbr4CQh; 25:QqMPOVmY+2/jz0lWbm6XgE36lvDGuTOrzFfb/TO2iCXgZ2BI2+a4LMyYBHYj9Ey2y0Qd/xAfBPBE8+KP4OU3gadWZ/MuvTdqBidn9A4iBKsiC5xpsICUJ6Gs6OfGX8BTABZjA0jpjj9zo4Rf3jGoJYgjjYzYN8K+iaJ8o7RaETyUllU40jIoseASh8IdPwXAngzwkAiYDxe5DftRXbNFgRttc/1dNi5QH8TOy9UE5+hfdkFbDof90UfclYaSKJWq7miScdcPpjRw5XQP6cIxirFtpsFNLxmaXQaMq0GMnr82zSjDI5ec+w8QhVef6ee6rYclAZd/grvW7N//0yVH3g==; 31:B820904imXgy7SKv99nPdykBEuwgyw6pBlYqfraFrZFTyUuL9/q1iToND2QGW++0C2EUinJY6UDSzS+HbEWdU6UhVL2Nt4RjJZpRw3QoNdzg1QmI3p6e+xdoKZLZmMoQA5odAG+urz4CRh14g9xgztZAzyYau8D6Rd5bnLnjT1jNqBtJgtZxx60LGpTVBL26HJOT8KBjYjLQbmbJyf5aI0UcosFAP3JF5CGtmZPFAG8= X-MS-TrafficTypeDiagnostic: DB6PR0402MB2773: X-Microsoft-Exchange-Diagnostics: 1; DB6PR0402MB2773; 20:WfKkz5ePhXucX21I1MHtbknRcuDuET7WlIVLhutaTqkGd0HuZ8ROrBUI+VEmhzc7hQ8kJEz2ldbSEvRUaA3u0+HZEMVELDHnUvktMOHP2f+2c6ZnvjeSN/9LFW0nW4AIiW3Nhv6+lSE2dPSbxEDp95sWNkg4q2MbhcphvGPduINksfz57KCiWQqmNDJk74TYzAK9f7p41loyDrD2ZpavsnDtrNFVVS2LLd4CGPYlFyyn7UKHIDdsqsM/JJAEJEslbpc8dVUm78arHN4zVbie32PwnOhs9it9UBjVkwY3ZGwmSDsTq0KI8ypY6Vu053L6bArVHPx4EQC5ePKueq3O21hTN+s+WIbcoHEPxpt7CjUj3OmUGAEUabsVsdc4eIpzazOTfJWfHV7nSN9gH2ye1Fa2hW+fEtsBH6fA1v4zABWuricWwWWasmDRuQlJ8Ze7J/rke397ZjPNT3ReRXIJgc9f9MrF+zz8TBk/3Poh0v0K27pxNXePdTBgAq1WCXxp; 4:LmH2astxwRHM9LU6YjpGHZm4bkMrj+AYF99p2mUa36x2ZsTpQnFiQHcz7eeawSwDsFVrrjhwMTXdljg61VYfX7zvl8vpooX3tZXUHHm57g1qhGePPWktu2nzrqtuRwjA9/pvYjtbbJZ1ovyw/qP1xBQ55voQ77blFG44BWAFbY7cpQvUieovycrZCYWfnsLl42sTL4jl1O7YbR+5EFOxiljh7vtYjte9gR4CGM4K0j3lNDQzdrWdkBgZ6IJjLy/ffGtguLWwyqXeqt5dyQBrtJU+F7WB4kaGsGYgHqaMPf7gz4MY0eApdMK/dfjUNGe1p70TP3C8bteV/oMWcsJQGRnHQuqHMUn9TiC0zGd9K6chLazs+J/H3XZMNBwQjTAO X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684)(21532816269658); 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)(53946003)(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:1ST6XvuVXhNtA8KHUGvzPRmhAoSHA/3Sb60RiwC?= =?us-ascii?Q?Epo3hOPSolIaQHO6NXaVZZRM9BzRv8prgUEq2ZHh2LGfMj1H8t9ojJ0AU3nx?= =?us-ascii?Q?DTpfafcUWfaicamRy/4S9Nm6vnPc/V6UMCZnME9Gs0m0hfiDw49MdQEpimP5?= =?us-ascii?Q?5Ix69ljL/FT0rKUZ1aeLq3xsC6XA0F4RRjad+mFvyrw7v3ETu5DaAGBwH0u0?= =?us-ascii?Q?7vJ1a7NZw/z6YFg2ZWQ5k0e6Ft7aupEBNVDLXKMviTXIfPd3xQlozNQOgP7h?= =?us-ascii?Q?bH0wy3IQ0fbHuLw7dBwA/LKfiNS9H1Jfr7C/Bba+29bVW9+MFRZPzPZzvnG/?= =?us-ascii?Q?6zEitpekG51MtKB4p/hHIgu0TdNN/hehctENb2QCbtoF88fSWaX6RgoY+jOm?= =?us-ascii?Q?YmW4qb2tHyH2KDWlMG2XLrQf0XYTxQ09VzhFaGMV//+Ozdhtxdbc/yogAwvy?= =?us-ascii?Q?k8IwCthQ/527JR3aohB5AH7O+dFX8r/AnOBB6WDO1+FqGk6D2wApuYHQ+vBq?= =?us-ascii?Q?1vbBOxvSR0OkqUOOHnkI3oWDoIZUpG1LvBQFIgd2b2CCEY//hmCnXoDDdtvx?= =?us-ascii?Q?nDTaWSQCD8axxr2IAYIlLnKbXCmPpXaNBmXnRq5zhmAucBqHWLIPmH8UwpLy?= =?us-ascii?Q?jlLPHMFR8F3YQl6VoxSGr1br565DGro2CQxLLDbbaDSfYyyDqPDsmMY4Kn6P?= =?us-ascii?Q?q/wmiF4VZei2KSQsfpXrmixm0FaG9Ib0E4ZZgz5N2BoWfiI5CBRIKq7WdsJ6?= =?us-ascii?Q?d8mV+u6MYPjVclG3w8Ad8ipYJI471L+qheD7vSPq1mFwUvpHVVcdDBM95OUW?= =?us-ascii?Q?90kLIPW5o2NzERir9QO2M+isgT+PPQ0J2UCWZ/c3JHb1KsdCNZOs5SW+fa87?= =?us-ascii?Q?KhA1IdPf9O3G5daG7SlIpH0FA0pTT6qcCEBSE4iFCvKsl1ai/exkVtzqpSUh?= =?us-ascii?Q?onPdodTCrBtGEhaHdh2reIsRo2c1EcQTyCeJLjaZnTntJjzyy1IH7EAC+sAl?= =?us-ascii?Q?cEn/9d3/7FwzXDRs+gx7URS3gXq3K3vjNK6yr3t7DvX0A6qNCRw9tm23wiIC?= =?us-ascii?Q?/7NFfTYezwRX7paVkYKTxYfS7MJeskQdF0ADNW9nyc7l1kkLwU9Xt0Dx59yi?= =?us-ascii?Q?v5Q778R3GAcZ8Z5Ve7CMXtpe2mEeZs1jd7BxQM7S+Bju5aIyuCDl7QACfXi5?= =?us-ascii?Q?ZjUXQsCEsn+r42z2bKZdGRTOdHO5dPd3gvd/3ErUCNAeHeroW2sKrwEgLVY6?= =?us-ascii?Q?dSAhdXe910ji+8XDaQuVU7cu9Nh1ePS7CRZ/nt8cjYQYbhaxhHLzTWPBh1Wi?= =?us-ascii?Q?fizILSQg7AlCFtwzMfe8ernMrOQ8jjZb++X+9uFYB1Vcv?= X-Microsoft-Antispam-Message-Info: 63PgSFr29axQs32ME1UmRm4sZxuCePZ+3Oxd8HBaBMyutz6/sWGlcSi+o3lKVf+EhRmIyMBm5x2o/I860F9Pfev3ZOBbHt4U6CxGe3nbVrjKoh7QAQQo05uZF15QphAS0MQ1oiQ1XVNJHcjEUimysSH193eyrgkYHe8n//32hXznUhkjJMC4AtC6quL/Wpbv X-Microsoft-Exchange-Diagnostics: 1; DB6PR0402MB2773; 6:cmiMsWcD/ifUX3DseB44KVUPJ6IgTuhr1Lo6qWhpw+Qp0BDkMvKg1hfddOJ4Qf9MvMnsnhhV3IG6ZaDZQDu41PyohTmkPAUWZadb//j8nZp98YSM/wv7K2qWAG5TJNVIO6QE/bEw6KEcoUCtffjA7lrK+N6uwcJiHCy6f/clYaUlk6O8UZpkqDnV7ZHx+XrSfesFeVddjBztUYU8sEXbxyvQNYC8hRVBMLEvhGhGAvdzUafau04l3UAN5AoAp8HsObAp8Gaq9hIwU2XGt3GxLKkEoXu0BZTCYIBh5hXbyd9gDpWKvY00v2bq7fsaqUGwdYiE+wgveyfV3gdrFJjclbGplu0PThtgI12WnlFwA6g=; 5:zHRsuOi47lqhzLcm3k1iThFlZEoQgcVw3bfMmMbsyif0uGfVTq3oRpfmBcqf8aemGhVgOwvSnVMpuupH8BCtDJMNnPQGARsxO/uIRU0AWJxPKvFRlGzro3IbzRVKivStJAPSDakQ+G4LRHUsFVGGbzaRLUezQmaz+yC8/x0Qs3E=; 24:ai95/p8BJsO80Q1L2FFDN7HzK5Pp2K1VHJk0+mV8PyHqhnhMn12krRTj1a+uKcaqmB1R9FtCDMyzb3M+g6YU4t9FmdO8vz704fowRhvF0hA=; 7:XanRwtc7BdzfDh185h6y/RzVSjrUEuK6F/jrORjLA4dLlX7OamsexycUNgWc2ooW+ZaFrKAKLfVzq2Mq1pajWHFpwQG860bcBxbAW+povHGyiOfkhcDm1EBpik3/4HI9V8BhOTQ0Nw0RlyEqRNlZqErJM+fn6XQ6VeoqWJ9dPEKeHQ0NCe4RXm0bUvWOe5bD1dwElqmMrbDBvHkaKaidlkDY7FanhAoKSuFviERxIZ5XDDmog18KgcpxukyRlqEd SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2018 09:11:06.2546 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9a2d80f2-d1fb-4f7a-65db-08d587f930ba 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 1/7] bus/fslmc: 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:10 -0000 Signed-off-by: Shreyansh Jain --- drivers/bus/fslmc/Makefile | 5 - drivers/bus/fslmc/fslmc_bus.c | 64 +++++++++---- drivers/bus/fslmc/fslmc_logs.h | 31 +++++++ drivers/bus/fslmc/fslmc_vfio.c | 151 +++++++++++++++---------------- drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c | 12 +-- drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 22 ++--- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 101 ++++++++++----------- 7 files changed, 213 insertions(+), 173 deletions(-) diff --git a/drivers/bus/fslmc/Makefile b/drivers/bus/fslmc/Makefile index de237f0f7..07583145c 100644 --- a/drivers/bus/fslmc/Makefile +++ b/drivers/bus/fslmc/Makefile @@ -14,13 +14,8 @@ CONFIG_RTE_LIBRTE_FSLMC_BUS = $(CONFIG_RTE_LIBRTE_DPAA2_PMD) endif CFLAGS += -DALLOW_EXPERIMENTAL_API -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/mc diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c index 5ee0beb85..4d29b53b1 100644 --- a/drivers/bus/fslmc/fslmc_bus.c +++ b/drivers/bus/fslmc/fslmc_bus.c @@ -18,9 +18,9 @@ #include #include +#include "fslmc_logs.h" -#define FSLMC_BUS_LOG(level, fmt, args...) \ - RTE_LOG(level, EAL, fmt "\n", ##args) +int dpaa2_logtype_bus; #define VFIO_IOMMU_GROUP_PATH "/sys/kernel/iommu_groups" @@ -93,6 +93,25 @@ insert_in_device_list(struct rte_dpaa2_device *newdev) TAILQ_INSERT_TAIL(&rte_fslmc_bus.device_list, newdev, next); } +static void +dump_device_list(void) +{ + struct rte_dpaa2_device *dev; + uint32_t global_log_level; + int local_log_level; + + /* Only if the log level has been set to Debugging, print list */ + global_log_level = rte_log_get_global_level(); + local_log_level = rte_log_get_level(dpaa2_logtype_bus); + if (global_log_level == RTE_LOG_DEBUG || + local_log_level == RTE_LOG_DEBUG) { + DPAA2_BUS_DEBUG("List of devices scanned on bus:"); + TAILQ_FOREACH(dev, &rte_fslmc_bus.device_list, next) { + DPAA2_BUS_DEBUG("%s", dev->device.name); + } + } +} + static int scan_one_fslmc_device(char *dev_name) { @@ -109,7 +128,7 @@ scan_one_fslmc_device(char *dev_name) /* Creating a temporary copy to perform cut-parse over string */ dup_dev_name = strdup(dev_name); if (!dup_dev_name) { - FSLMC_BUS_LOG(ERR, "Out of memory."); + DPAA2_BUS_ERR("Unable to allocate device name memory"); return -ENOMEM; } @@ -120,7 +139,7 @@ scan_one_fslmc_device(char *dev_name) */ dev = calloc(1, sizeof(struct rte_dpaa2_device)); if (!dev) { - FSLMC_BUS_LOG(ERR, "Out of memory."); + DPAA2_BUS_ERR("Unable to allocate device object"); free(dup_dev_name); return -ENOMEM; } @@ -128,7 +147,7 @@ scan_one_fslmc_device(char *dev_name) /* Parse the device name and ID */ t_ptr = strtok(dup_dev_name, "."); if (!t_ptr) { - FSLMC_BUS_LOG(ERR, "Incorrect device string observed."); + DPAA2_BUS_ERR("Incorrect device name observed"); goto cleanup; } if (!strncmp("dpni", t_ptr, 4)) @@ -153,15 +172,14 @@ scan_one_fslmc_device(char *dev_name) t_ptr = strtok(NULL, "."); if (!t_ptr) { - FSLMC_BUS_LOG(ERR, "Incorrect device string observed (%s).", - t_ptr); + DPAA2_BUS_ERR("Incorrect device string observed (%s)", t_ptr); goto cleanup; } sscanf(t_ptr, "%hu", &dev->object_id); dev->device.name = strdup(dev_name); if (!dev->device.name) { - FSLMC_BUS_LOG(ERR, "Out of memory."); + DPAA2_BUS_ERR("Unable to clone device name. Out of memory"); goto cleanup; } @@ -193,8 +211,7 @@ rte_fslmc_scan(void) int groupid; if (process_once) { - FSLMC_BUS_LOG(DEBUG, - "Fslmc bus already scanned. Not rescanning"); + DPAA2_BUS_DEBUG("Fslmc bus already scanned. Not rescanning"); return 0; } process_once = 1; @@ -208,7 +225,7 @@ rte_fslmc_scan(void) groupid); dir = opendir(fslmc_dirpath); if (!dir) { - FSLMC_BUS_LOG(ERR, "Unable to open VFIO group dir."); + DPAA2_BUS_ERR("Unable to open VFIO group directory"); goto scan_fail; } @@ -224,9 +241,12 @@ rte_fslmc_scan(void) device_count += 1; } - FSLMC_BUS_LOG(INFO, "fslmc: Bus scan completed"); - closedir(dir); + + DPAA2_BUS_INFO("FSLMC Bus scan completed"); + /* If debugging is enabled, device list is dumped to log output */ + dump_device_list(); + return 0; scan_fail_cleanup: @@ -235,7 +255,7 @@ rte_fslmc_scan(void) /* Remove all devices in the list */ cleanup_fslmc_device_list(); scan_fail: - FSLMC_BUS_LOG(DEBUG, "FSLMC Bus Not Available. Skipping."); + DPAA2_BUS_INFO("FSLMC Bus Not Available. Skipping"); /* Irrespective of failure, scan only return success */ return 0; } @@ -262,13 +282,13 @@ rte_fslmc_probe(void) ret = fslmc_vfio_setup_group(); if (ret) { - FSLMC_BUS_LOG(ERR, "Unable to setup VFIO %d", ret); + DPAA2_BUS_ERR("Unable to setup VFIO %d", ret); return 0; } ret = fslmc_vfio_process_group(); if (ret) { - FSLMC_BUS_LOG(ERR, "Unable to setup devices %d", ret); + DPAA2_BUS_ERR("Unable to setup devices %d", ret); return 0; } @@ -283,7 +303,7 @@ rte_fslmc_probe(void) ret = drv->probe(drv, dev); if (ret) - FSLMC_BUS_LOG(ERR, "Unable to probe.\n"); + DPAA2_BUS_ERR("Unable to probe"); break; } } @@ -399,3 +419,13 @@ struct rte_fslmc_bus rte_fslmc_bus = { }; RTE_REGISTER_BUS(fslmc, rte_fslmc_bus.bus); + +RTE_INIT(fslmc_init_log); +static void +fslmc_init_log(void) +{ + /* Bus level logs */ + dpaa2_logtype_bus = rte_log_register("bus.fslmc"); + if (dpaa2_logtype_bus >= 0) + rte_log_set_level(dpaa2_logtype_bus, RTE_LOG_NOTICE); +} diff --git a/drivers/bus/fslmc/fslmc_logs.h b/drivers/bus/fslmc/fslmc_logs.h index d87b6386d..1f3fe8e66 100644 --- a/drivers/bus/fslmc/fslmc_logs.h +++ b/drivers/bus/fslmc/fslmc_logs.h @@ -7,6 +7,37 @@ #ifndef _FSLMC_LOGS_H_ #define _FSLMC_LOGS_H_ +extern int dpaa2_logtype_bus; + +#define DPAA2_BUS_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, dpaa2_logtype_bus, "fslmc: " fmt "\n", \ + ##args) + +/* Debug logs are with Function names */ +#define DPAA2_BUS_DEBUG(fmt, args...) \ + rte_log(RTE_LOG_DEBUG, dpaa2_logtype_bus, "fslmc: %s(): " fmt "\n", \ + __func__, ##args) + +#define BUS_INIT_FUNC_TRACE() DPAA2_BUS_LOG(DEBUG, " >>") + +#define DPAA2_BUS_INFO(fmt, args...) \ + DPAA2_BUS_LOG(INFO, fmt, ## args) +#define DPAA2_BUS_ERR(fmt, args...) \ + DPAA2_BUS_LOG(ERR, fmt, ## args) +#define DPAA2_BUS_WARN(fmt, args...) \ + DPAA2_BUS_LOG(WARNING, fmt, ## args) + +/* DP Logs, toggled out at compile time if level lower than current level */ +#define DPAA2_BUS_DP_LOG(level, fmt, args...) \ + RTE_LOG_DP(level, PMD, fmt, ## args) + +#define DPAA2_BUS_DP_DEBUG(fmt, args...) \ + DPAA2_BUS_DP_LOG(DEBUG, fmt, ## args) +#define DPAA2_BUS_DP_INFO(fmt, args...) \ + DPAA2_BUS_DP_LOG(INFO, fmt, ## args) +#define DPAA2_BUS_DP_WARN(fmt, args...) \ + DPAA2_BUS_DP_LOG(WARNING, fmt, ## args) + #define PMD_INIT_LOG(level, fmt, args...) \ RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ##args) diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c index e840ad6ef..3b992bfef 100644 --- a/drivers/bus/fslmc/fslmc_vfio.c +++ b/drivers/bus/fslmc/fslmc_vfio.c @@ -33,14 +33,12 @@ #include "rte_fslmc.h" #include "fslmc_vfio.h" +#include "fslmc_logs.h" #include #include "portal/dpaa2_hw_pvt.h" #include "portal/dpaa2_hw_dpio.h" -#define FSLMC_VFIO_LOG(level, fmt, args...) \ - RTE_LOG(level, EAL, fmt "\n", ##args) - /** Pathname of FSL-MC devices directory. */ #define SYSFS_FSL_MC_DEVICES "/sys/bus/fsl-mc/devices" @@ -76,19 +74,18 @@ fslmc_get_container_group(int *groupid) if (!g_container) { container = getenv("DPRC"); if (container == NULL) { - RTE_LOG(DEBUG, EAL, "DPAA2: DPRC not available\n"); + DPAA2_BUS_INFO("DPAA2: DPRC not available"); return -EINVAL; } if (strlen(container) >= FSLMC_CONTAINER_MAX_LEN) { - FSLMC_VFIO_LOG(ERR, "Invalid container name: %s\n", - container); + DPAA2_BUS_ERR("Invalid container name: %s", container); return -1; } g_container = strdup(container); if (!g_container) { - FSLMC_VFIO_LOG(ERR, "Out of memory."); + DPAA2_BUS_ERR("Mem alloc failure; Container name"); return -ENOMEM; } } @@ -96,13 +93,12 @@ fslmc_get_container_group(int *groupid) /* get group number */ ret = vfio_get_group_no(SYSFS_FSL_MC_DEVICES, g_container, groupid); if (ret <= 0) { - FSLMC_VFIO_LOG(ERR, "Unable to find %s IOMMU group", - g_container); + DPAA2_BUS_ERR("Unable to find %s IOMMU group", g_container); return -1; } - FSLMC_VFIO_LOG(DEBUG, "Container: %s has VFIO iommu group id = %d", - g_container, *groupid); + DPAA2_BUS_DEBUG("Container: %s has VFIO iommu group id = %d", + g_container, *groupid); return 0; } @@ -113,14 +109,14 @@ vfio_connect_container(void) int fd, ret; if (vfio_container.used) { - FSLMC_VFIO_LOG(DEBUG, "No container available."); + DPAA2_BUS_DEBUG("No container available"); return -1; } /* Try connecting to vfio container if already created */ if (!ioctl(vfio_group.fd, VFIO_GROUP_SET_CONTAINER, &vfio_container.fd)) { - FSLMC_VFIO_LOG(INFO, + DPAA2_BUS_DEBUG( "Container pre-exists with FD[0x%x] for this group", vfio_container.fd); vfio_group.container = &vfio_container; @@ -130,7 +126,7 @@ vfio_connect_container(void) /* Opens main vfio file descriptor which represents the "container" */ fd = vfio_get_container_fd(); if (fd < 0) { - FSLMC_VFIO_LOG(ERR, "Failed to open VFIO container"); + DPAA2_BUS_ERR("Failed to open VFIO container"); return -errno; } @@ -139,19 +135,19 @@ vfio_connect_container(void) /* Connect group to container */ ret = ioctl(vfio_group.fd, VFIO_GROUP_SET_CONTAINER, &fd); if (ret) { - FSLMC_VFIO_LOG(ERR, "Failed to setup group container"); + DPAA2_BUS_ERR("Failed to setup group container"); close(fd); return -errno; } ret = ioctl(fd, VFIO_SET_IOMMU, VFIO_TYPE1_IOMMU); if (ret) { - FSLMC_VFIO_LOG(ERR, "Failed to setup VFIO iommu"); + DPAA2_BUS_ERR("Failed to setup VFIO iommu"); close(fd); return -errno; } } else { - FSLMC_VFIO_LOG(ERR, "No supported IOMMU available"); + DPAA2_BUS_ERR("No supported IOMMU available"); close(fd); return -EINVAL; } @@ -179,7 +175,7 @@ static int vfio_map_irq_region(struct fslmc_vfio_group *group) vaddr = (unsigned long *)mmap(NULL, 0x1000, PROT_WRITE | PROT_READ, MAP_SHARED, container_device_fd, 0x6030000); if (vaddr == MAP_FAILED) { - FSLMC_VFIO_LOG(ERR, "Unable to map region (errno = %d)", errno); + DPAA2_BUS_ERR("Unable to map region (errno = %d)", errno); return -errno; } @@ -189,7 +185,7 @@ static int vfio_map_irq_region(struct fslmc_vfio_group *group) if (ret == 0) return 0; - FSLMC_VFIO_LOG(ERR, "VFIO_IOMMU_MAP_DMA fails (errno = %d)", errno); + DPAA2_BUS_ERR("Unable to map DMA address (errno = %d)", errno); return -errno; } @@ -210,13 +206,13 @@ int rte_fslmc_vfio_dmamap(void) memseg = rte_eal_get_physmem_layout(); if (memseg == NULL) { - FSLMC_VFIO_LOG(ERR, "Cannot get physical layout."); + DPAA2_BUS_ERR("Cannot get physical layout"); return -ENODEV; } for (i = 0; i < RTE_MAX_MEMSEG; i++) { if (memseg[i].addr == NULL && memseg[i].len == 0) { - FSLMC_VFIO_LOG(DEBUG, "Total %d segments found.", i); + DPAA2_BUS_DEBUG("Total %d segments found", i); break; } @@ -235,25 +231,25 @@ int rte_fslmc_vfio_dmamap(void) group = &vfio_group; if (!group->container) { - FSLMC_VFIO_LOG(ERR, "Container is not connected "); + DPAA2_BUS_ERR("Container is not connected"); return -1; } - FSLMC_VFIO_LOG(DEBUG, "-->Initial SHM Virtual ADDR %llX", - dma_map.vaddr); - FSLMC_VFIO_LOG(DEBUG, "-----> DMA size 0x%llX", dma_map.size); + DPAA2_BUS_DEBUG("-->Initial SHM Virtual ADDR %llX", + dma_map.vaddr); + DPAA2_BUS_DEBUG("-----> DMA size 0x%llX", dma_map.size); ret = ioctl(group->container->fd, VFIO_IOMMU_MAP_DMA, &dma_map); if (ret) { - FSLMC_VFIO_LOG(ERR, "VFIO_IOMMU_MAP_DMA API(errno = %d)", - errno); + DPAA2_BUS_ERR("Unable to map DMA address (errno = %d)", + errno); return ret; } } /* Verifying that at least single segment is available */ if (i <= 0) { - FSLMC_VFIO_LOG(ERR, "No Segments found for VFIO Mapping"); + DPAA2_BUS_ERR("No Segments found for VFIO Mapping"); return -1; } @@ -279,27 +275,27 @@ static int64_t vfio_map_mcp_obj(struct fslmc_vfio_group *group, char *mcp_obj) /* getting the mcp object's fd*/ mc_fd = ioctl(group->fd, VFIO_GROUP_GET_DEVICE_FD, mcp_obj); if (mc_fd < 0) { - FSLMC_VFIO_LOG(ERR, "error in VFIO get dev %s fd from group %d", - mcp_obj, group->fd); + DPAA2_BUS_ERR("Error in VFIO get dev %s fd from group %d", + mcp_obj, group->fd); return v_addr; } /* getting device info*/ ret = ioctl(mc_fd, VFIO_DEVICE_GET_INFO, &d_info); if (ret < 0) { - FSLMC_VFIO_LOG(ERR, "error in VFIO getting DEVICE_INFO"); + DPAA2_BUS_ERR("Error in VFIO getting DEVICE_INFO"); goto MC_FAILURE; } /* getting device region info*/ ret = ioctl(mc_fd, VFIO_DEVICE_GET_REGION_INFO, ®_info); if (ret < 0) { - FSLMC_VFIO_LOG(ERR, "error in VFIO getting REGION_INFO"); + DPAA2_BUS_ERR("Error in VFIO getting REGION_INFO"); goto MC_FAILURE; } - FSLMC_VFIO_LOG(DEBUG, "region offset = %llx , region size = %llx", - reg_info.offset, reg_info.size); + DPAA2_BUS_DEBUG("Region offset = %llx , region size = %llx", + reg_info.offset, reg_info.size); v_addr = (size_t)mmap(NULL, reg_info.size, PROT_WRITE | PROT_READ, MAP_SHARED, @@ -334,8 +330,8 @@ int rte_dpaa2_intr_enable(struct rte_intr_handle *intr_handle, int index) ret = ioctl(intr_handle->vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set); if (ret) { - RTE_LOG(ERR, EAL, "Error:dpaa2 SET IRQs fd=%d, err = %d(%s)\n", - intr_handle->fd, errno, strerror(errno)); + DPAA2_BUS_ERR("Error:dpaa2 SET IRQs fd=%d, err = %d(%s)", + intr_handle->fd, errno, strerror(errno)); return ret; } @@ -359,8 +355,8 @@ int rte_dpaa2_intr_disable(struct rte_intr_handle *intr_handle, int index) ret = ioctl(intr_handle->vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set); if (ret) - RTE_LOG(ERR, EAL, - "Error disabling dpaa2 interrupts for fd %d\n", + DPAA2_BUS_ERR( + "Error disabling dpaa2 interrupts for fd %d", intr_handle->fd); return ret; @@ -383,9 +379,8 @@ rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle, ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_IRQ_INFO, &irq_info); if (ret < 0) { - FSLMC_VFIO_LOG(ERR, - "cannot get IRQ(%d) info, error %i (%s)", - i, errno, strerror(errno)); + DPAA2_BUS_ERR("Cannot get IRQ(%d) info, error %i (%s)", + i, errno, strerror(errno)); return -1; } @@ -399,9 +394,8 @@ rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle, /* set up an eventfd for interrupts */ fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (fd < 0) { - FSLMC_VFIO_LOG(ERR, - "cannot set up eventfd, error %i (%s)\n", - errno, strerror(errno)); + DPAA2_BUS_ERR("Cannot set up eventfd, error %i (%s)", + errno, strerror(errno)); return -1; } @@ -430,13 +424,14 @@ fslmc_process_iodevices(struct rte_dpaa2_device *dev) dev_fd = ioctl(vfio_group.fd, VFIO_GROUP_GET_DEVICE_FD, dev->device.name); if (dev_fd <= 0) { - FSLMC_VFIO_LOG(ERR, "Unable to obtain device FD for device:%s", - dev->device.name); + DPAA2_BUS_ERR("Unable to obtain device FD for device:%s", + dev->device.name); return -1; } if (ioctl(dev_fd, VFIO_DEVICE_GET_INFO, &device_info)) { - FSLMC_VFIO_LOG(ERR, "DPAA2 VFIO_DEVICE_GET_INFO fail"); + DPAA2_BUS_ERR("Unable to obtain information for device:%s", + dev->device.name); return -1; } @@ -461,8 +456,8 @@ fslmc_process_iodevices(struct rte_dpaa2_device *dev) break; } - FSLMC_VFIO_LOG(DEBUG, "Device (%s) abstracted from VFIO", - dev->device.name); + DPAA2_BUS_DEBUG("Device (%s) abstracted from VFIO", + dev->device.name); return 0; } @@ -476,13 +471,13 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev) rte_mcp_ptr_list = malloc(sizeof(void *) * 1); if (!rte_mcp_ptr_list) { - FSLMC_VFIO_LOG(ERR, "Out of memory"); + DPAA2_BUS_ERR("Unable to allocate MC portal memory"); return -ENOMEM; } dev_name = strdup(dev->device.name); if (!dev_name) { - FSLMC_VFIO_LOG(ERR, "Out of memory."); + DPAA2_BUS_ERR("Unable to allocate MC device name memory"); free(rte_mcp_ptr_list); rte_mcp_ptr_list = NULL; return -ENOMEM; @@ -490,8 +485,7 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev) v_addr = vfio_map_mcp_obj(&vfio_group, dev_name); if (v_addr == (intptr_t)MAP_FAILED) { - FSLMC_VFIO_LOG(ERR, "Error mapping region (errno = %d)", - errno); + DPAA2_BUS_ERR("Error mapping region (errno = %d)", errno); free(rte_mcp_ptr_list); rte_mcp_ptr_list = NULL; return -1; @@ -499,16 +493,18 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev) /* check the MC version compatibility */ dpmng.regs = (void *)v_addr; - if (mc_get_version(&dpmng, CMD_PRI_LOW, &mc_ver_info)) - RTE_LOG(WARNING, PMD, "\tmc_get_version failed\n"); + if(mc_get_version(&dpmng, CMD_PRI_LOW, &mc_ver_info)) { + DPAA2_BUS_ERR("Unable to obtain MC version"); + return -1; + } if ((mc_ver_info.major != MC_VER_MAJOR) || (mc_ver_info.minor < MC_VER_MINOR)) { - RTE_LOG(ERR, PMD, "DPAA2 MC version not compatible!" - " Expected %d.%d.x, Detected %d.%d.%d\n", - MC_VER_MAJOR, MC_VER_MINOR, - mc_ver_info.major, mc_ver_info.minor, - mc_ver_info.revision); + DPAA2_BUS_ERR("DPAA2 MC version not compatible!" + " Expected %d.%d.x, Detected %d.%d.%d", + MC_VER_MAJOR, MC_VER_MINOR, + mc_ver_info.major, mc_ver_info.minor, + mc_ver_info.revision); free(rte_mcp_ptr_list); rte_mcp_ptr_list = NULL; return -1; @@ -530,7 +526,7 @@ fslmc_vfio_process_group(void) if (dev->dev_type == DPAA2_MPORTAL) { ret = fslmc_process_mcp(dev); if (ret) { - FSLMC_VFIO_LOG(DEBUG, "Unable to map Portal."); + DPAA2_BUS_ERR("Unable to map MC Portal"); return -1; } if (!found_mportal) @@ -547,8 +543,7 @@ fslmc_vfio_process_group(void) /* Cannot continue if there is not even a single mportal */ if (!found_mportal) { - FSLMC_VFIO_LOG(DEBUG, - "No MC Portal device found. Not continuing."); + DPAA2_BUS_ERR("No MC Portal device found. Not continuing"); return -1; } @@ -561,9 +556,8 @@ fslmc_vfio_process_group(void) case DPAA2_CRYPTO: ret = fslmc_process_iodevices(dev); if (ret) { - FSLMC_VFIO_LOG(DEBUG, - "Dev (%s) init failed.", - dev->device.name); + DPAA2_BUS_DEBUG("Dev (%s) init failed", + dev->device.name); return ret; } break; @@ -576,9 +570,8 @@ fslmc_vfio_process_group(void) */ ret = fslmc_process_iodevices(dev); if (ret) { - FSLMC_VFIO_LOG(DEBUG, - "Dev (%s) init failed.", - dev->device.name); + DPAA2_BUS_DEBUG("Dev (%s) init failed", + dev->device.name); return -1; } @@ -592,8 +585,8 @@ fslmc_vfio_process_group(void) case DPAA2_UNKNOWN: default: /* Unknown - ignore */ - FSLMC_VFIO_LOG(DEBUG, "Found unknown device (%s).", - dev->device.name); + DPAA2_BUS_DEBUG("Found unknown device (%s)", + dev->device.name); TAILQ_REMOVE(&rte_fslmc_bus.device_list, dev, next); free(dev); dev = NULL; @@ -622,7 +615,7 @@ fslmc_vfio_setup_group(void) * processing. */ if (vfio_group.groupid == groupid) { - FSLMC_VFIO_LOG(ERR, "groupid already exists %d", groupid); + DPAA2_BUS_ERR("groupid already exists %d", groupid); return 0; } @@ -635,14 +628,14 @@ fslmc_vfio_setup_group(void) /* Check group viability */ ret = ioctl(vfio_group.fd, VFIO_GROUP_GET_STATUS, &status); if (ret) { - FSLMC_VFIO_LOG(ERR, "VFIO error getting group status"); + DPAA2_BUS_ERR("VFIO error getting group status"); close(vfio_group.fd); rte_vfio_clear_group(vfio_group.fd); return ret; } if (!(status.flags & VFIO_GROUP_FLAGS_VIABLE)) { - FSLMC_VFIO_LOG(ERR, "VFIO group not viable"); + DPAA2_BUS_ERR("VFIO group not viable"); close(vfio_group.fd); rte_vfio_clear_group(vfio_group.fd); return -EPERM; @@ -655,7 +648,7 @@ fslmc_vfio_setup_group(void) /* Now connect this IOMMU group to given container */ ret = vfio_connect_container(); if (ret) { - FSLMC_VFIO_LOG(ERR, + DPAA2_BUS_ERR( "Error connecting container with groupid %d", groupid); close(vfio_group.fd); @@ -667,15 +660,15 @@ fslmc_vfio_setup_group(void) /* Get Device information */ ret = ioctl(vfio_group.fd, VFIO_GROUP_GET_DEVICE_FD, g_container); if (ret < 0) { - FSLMC_VFIO_LOG(ERR, "Error getting device %s fd from group %d", - g_container, vfio_group.groupid); + DPAA2_BUS_ERR("Error getting device %s fd from group %d", + g_container, vfio_group.groupid); close(vfio_group.fd); rte_vfio_clear_group(vfio_group.fd); return ret; } container_device_fd = ret; - FSLMC_VFIO_LOG(DEBUG, "VFIO Container FD is [0x%X]", - container_device_fd); + DPAA2_BUS_DEBUG("VFIO Container FD is [0x%X]", + container_device_fd); return 0; } diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c index f1f14e294..39c5adf90 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c @@ -44,7 +44,7 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused, /* Allocate DPAA2 dpbp handle */ dpbp_node = rte_malloc(NULL, sizeof(struct dpaa2_dpbp_dev), 0); if (!dpbp_node) { - PMD_INIT_LOG(ERR, "Memory allocation failed for DPBP Device"); + DPAA2_BUS_ERR("Memory allocation failed for DPBP Device"); return -1; } @@ -53,8 +53,8 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused, ret = dpbp_open(&dpbp_node->dpbp, CMD_PRI_LOW, dpbp_id, &dpbp_node->token); if (ret) { - PMD_INIT_LOG(ERR, "Resource alloc failure with err code: %d", - ret); + DPAA2_BUS_ERR("Unable to open buffer pool object: err(%d)", + ret); rte_free(dpbp_node); return -1; } @@ -62,8 +62,8 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused, /* Clean the device first */ ret = dpbp_reset(&dpbp_node->dpbp, CMD_PRI_LOW, dpbp_node->token); if (ret) { - PMD_INIT_LOG(ERR, "Failure cleaning dpbp device with" - " error code %d\n", ret); + DPAA2_BUS_ERR("Unable to reset buffer pool device. err(%d)", + ret); dpbp_close(&dpbp_node->dpbp, CMD_PRI_LOW, dpbp_node->token); rte_free(dpbp_node); return -1; @@ -74,8 +74,6 @@ dpaa2_create_dpbp_device(int vdev_fd __rte_unused, TAILQ_INSERT_TAIL(&dpbp_dev_list, dpbp_node, next); - RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpbp.%d]\n", dpbp_id); - if (!register_once) { rte_mbuf_set_platform_mempool_ops(DPAA2_MEMPOOL_OPS_NAME); register_once = 1; diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c index fb28e4970..aee870a56 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c @@ -44,7 +44,7 @@ rte_dpaa2_create_dpci_device(int vdev_fd __rte_unused, /* Allocate DPAA2 dpci handle */ dpci_node = rte_malloc(NULL, sizeof(struct dpaa2_dpci_dev), 0); if (!dpci_node) { - PMD_INIT_LOG(ERR, "Memory allocation failed for DPCI Device"); + DPAA2_BUS_ERR("Memory allocation failed for DPCI Device"); return -1; } @@ -53,8 +53,7 @@ rte_dpaa2_create_dpci_device(int vdev_fd __rte_unused, ret = dpci_open(&dpci_node->dpci, CMD_PRI_LOW, dpci_id, &dpci_node->token); if (ret) { - PMD_INIT_LOG(ERR, "Resource alloc failure with err code: %d", - ret); + DPAA2_BUS_ERR("Resource alloc failure with err code: %d", ret); rte_free(dpci_node); return -1; } @@ -63,8 +62,7 @@ rte_dpaa2_create_dpci_device(int vdev_fd __rte_unused, ret = dpci_get_attributes(&dpci_node->dpci, CMD_PRI_LOW, dpci_node->token, &attr); if (ret != 0) { - PMD_INIT_LOG(ERR, "Reading device failed with err code: %d", - ret); + DPAA2_BUS_ERR("Reading device failed with err code: %d", ret); rte_free(dpci_node); return -1; } @@ -76,8 +74,8 @@ rte_dpaa2_create_dpci_device(int vdev_fd __rte_unused, dpci_node->token, 0, &rx_queue_cfg); if (ret) { - PMD_INIT_LOG(ERR, "Setting Rx queue failed with err code: %d", - ret); + DPAA2_BUS_ERR("Setting Rx queue failed with err code: %d", + ret); rte_free(dpci_node); return -1; } @@ -86,8 +84,7 @@ rte_dpaa2_create_dpci_device(int vdev_fd __rte_unused, ret = dpci_enable(&dpci_node->dpci, CMD_PRI_LOW, dpci_node->token); if (ret != 0) { - PMD_INIT_LOG(ERR, "Enabling device failed with err code: %d", - ret); + DPAA2_BUS_ERR("Enabling device failed with err code: %d", ret); rte_free(dpci_node); return -1; } @@ -99,9 +96,8 @@ rte_dpaa2_create_dpci_device(int vdev_fd __rte_unused, dpci_node->token, i, &rx_attr); if (ret != 0) { - PMD_INIT_LOG(ERR, - "Reading device failed with err code: %d", - ret); + DPAA2_BUS_ERR("Rx queue fetch failed with err code:" + " %d", ret); rte_free(dpci_node); return -1; } @@ -114,8 +110,6 @@ rte_dpaa2_create_dpci_device(int vdev_fd __rte_unused, TAILQ_INSERT_TAIL(&dpci_dev_list, dpci_node, next); - RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpci.%d]\n", dpci_id); - return 0; } diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c index 7b671efd5..881dd5f1d 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c @@ -101,7 +101,7 @@ static void dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id) snprintf(string, STRING_LEN, "dpio.%d", dpio_id); file = fopen("/proc/interrupts", "r"); if (!file) { - PMD_DRV_LOG(WARNING, "Failed to open /proc/interrupts file\n"); + DPAA2_BUS_WARN("Failed to open /proc/interrupts file"); return; } while (getline(&temp, &len, file) != -1) { @@ -112,8 +112,8 @@ static void dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id) } if (!token) { - PMD_DRV_LOG(WARNING, "Failed to get interrupt id for dpio.%d\n", - dpio_id); + DPAA2_BUS_WARN("Failed to get interrupt id for dpio.%d", + dpio_id); if (temp) free(temp); fclose(file); @@ -125,10 +125,10 @@ static void dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id) cpu_mask, token); ret = system(command); if (ret < 0) - PMD_DRV_LOG(WARNING, - "Failed to affine interrupts on respective core\n"); + DPAA2_BUS_WARN( + "Failed to affine interrupts on respective core"); else - PMD_DRV_LOG(WARNING, " %s command is executed\n", command); + DPAA2_BUS_DEBUG(" %s command is executed", command); free(temp); fclose(file); @@ -143,7 +143,7 @@ static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev) dpio_epoll_fd = epoll_create(1); ret = rte_dpaa2_intr_enable(&dpio_dev->intr_handle, 0); if (ret) { - PMD_DRV_LOG(ERR, "Interrupt registeration failed\n"); + DPAA2_BUS_ERR("Interrupt registeration failed"); return -1; } @@ -166,7 +166,7 @@ static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev) ret = epoll_ctl(dpio_epoll_fd, EPOLL_CTL_ADD, eventfd, &epoll_ev); if (ret < 0) { - PMD_DRV_LOG(ERR, "epoll_ctl failed\n"); + DPAA2_BUS_ERR("epoll_ctl failed"); return -1; } dpio_dev->epoll_fd = dpio_epoll_fd; @@ -185,28 +185,28 @@ configure_dpio_qbman_swp(struct dpaa2_dpio_dev *dpio_dev) dpio_dev->dpio = malloc(sizeof(struct fsl_mc_io)); if (!dpio_dev->dpio) { - PMD_INIT_LOG(ERR, "Memory allocation failure\n"); + DPAA2_BUS_ERR("Memory allocation failure"); return -1; } - PMD_DRV_LOG(DEBUG, "Allocated DPIO Portal[%p]", dpio_dev->dpio); + DPAA2_BUS_DEBUG("Allocated DPIO Portal[%p]", dpio_dev->dpio); dpio_dev->dpio->regs = dpio_dev->mc_portal; if (dpio_open(dpio_dev->dpio, CMD_PRI_LOW, dpio_dev->hw_id, &dpio_dev->token)) { - PMD_INIT_LOG(ERR, "Failed to allocate IO space\n"); + DPAA2_BUS_ERR("Failed to allocate IO space"); free(dpio_dev->dpio); return -1; } if (dpio_reset(dpio_dev->dpio, CMD_PRI_LOW, dpio_dev->token)) { - PMD_INIT_LOG(ERR, "Failed to reset dpio\n"); + DPAA2_BUS_ERR("Failed to reset dpio"); dpio_close(dpio_dev->dpio, CMD_PRI_LOW, dpio_dev->token); free(dpio_dev->dpio); return -1; } if (dpio_enable(dpio_dev->dpio, CMD_PRI_LOW, dpio_dev->token)) { - PMD_INIT_LOG(ERR, "Failed to Enable dpio\n"); + DPAA2_BUS_ERR("Failed to Enable dpio"); dpio_close(dpio_dev->dpio, CMD_PRI_LOW, dpio_dev->token); free(dpio_dev->dpio); return -1; @@ -214,7 +214,7 @@ configure_dpio_qbman_swp(struct dpaa2_dpio_dev *dpio_dev) if (dpio_get_attributes(dpio_dev->dpio, CMD_PRI_LOW, dpio_dev->token, &attr)) { - PMD_INIT_LOG(ERR, "DPIO Get attribute failed\n"); + DPAA2_BUS_ERR("DPIO Get attribute failed"); dpio_disable(dpio_dev->dpio, CMD_PRI_LOW, dpio_dev->token); dpio_close(dpio_dev->dpio, CMD_PRI_LOW, dpio_dev->token); free(dpio_dev->dpio); @@ -231,7 +231,7 @@ configure_dpio_qbman_swp(struct dpaa2_dpio_dev *dpio_dev) dpio_dev->sw_portal = qbman_swp_init(&p_des); if (dpio_dev->sw_portal == NULL) { - PMD_DRV_LOG(ERR, " QBMan SW Portal Init failed\n"); + DPAA2_BUS_ERR("QBMan SW Portal Init failed"); dpio_close(dpio_dev->dpio, CMD_PRI_LOW, dpio_dev->token); free(dpio_dev->dpio); return -1; @@ -249,7 +249,7 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id) if (cpu_id < 0) { cpu_id = rte_get_master_lcore(); if (cpu_id < 0) { - RTE_LOG(ERR, PMD, "\tGetting CPU Index failed\n"); + DPAA2_BUS_ERR("Getting CPU Index failed"); return -1; } } @@ -258,19 +258,19 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id) */ sdest = dpaa2_core_cluster_sdest(cpu_id); - PMD_DRV_LOG(DEBUG, "Portal= %d CPU= %u SDEST= %d", - dpio_dev->index, cpu_id, sdest); + DPAA2_BUS_DEBUG("Portal= %d CPU= %u SDEST= %d", + dpio_dev->index, cpu_id, sdest); ret = dpio_set_stashing_destination(dpio_dev->dpio, CMD_PRI_LOW, dpio_dev->token, sdest); if (ret) { - PMD_DRV_LOG(ERR, "%d ERROR in SDEST\n", ret); + DPAA2_BUS_ERR("%d ERROR in SDEST", ret); return -1; } #ifdef RTE_LIBRTE_PMD_DPAA2_EVENTDEV if (dpaa2_dpio_intr_init(dpio_dev)) { - PMD_DRV_LOG(ERR, "Interrupt registration failed for dpio\n"); + DPAA2_BUS_ERR("Interrupt registration failed for dpio"); return -1; } #endif @@ -291,12 +291,12 @@ struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int cpu_id) if (!dpio_dev) return NULL; - PMD_DRV_LOG(DEBUG, "New Portal %p (%d) affined thread - %lu", - dpio_dev, dpio_dev->index, syscall(SYS_gettid)); + DPAA2_BUS_DEBUG("New Portal %p (%d) affined thread - %lu", + dpio_dev, dpio_dev->index, syscall(SYS_gettid)); ret = dpaa2_configure_stashing(dpio_dev, cpu_id); if (ret) - PMD_DRV_LOG(ERR, "dpaa2_configure_stashing failed"); + DPAA2_BUS_ERR("dpaa2_configure_stashing failed"); return dpio_dev; } @@ -314,7 +314,7 @@ dpaa2_affine_qbman_swp(void) return -1; if (dpaa2_io_portal[lcore_id].dpio_dev) { - PMD_DRV_LOG(INFO, "DPAAPortal=%p (%d) is being shared" + DPAA2_BUS_DP_INFO("DPAA Portal=%p (%d) is being shared" " between thread %" PRIu64 " and current " "%" PRIu64 "\n", dpaa2_io_portal[lcore_id].dpio_dev, @@ -327,8 +327,8 @@ dpaa2_affine_qbman_swp(void) [lcore_id].dpio_dev->ref_count); dpaa2_io_portal[lcore_id].net_tid = tid; - PMD_DRV_LOG(DEBUG, "Old Portal=%p (%d)" - "affined thread - %" PRIu64 "\n", + DPAA2_BUS_DP_DEBUG("Old Portal=%p (%d) affined thread - " + "%" PRIu64 "\n", dpaa2_io_portal[lcore_id].dpio_dev, dpaa2_io_portal[lcore_id].dpio_dev->index, tid); @@ -362,24 +362,25 @@ dpaa2_affine_qbman_swp_sec(void) return -1; if (dpaa2_io_portal[lcore_id].sec_dpio_dev) { - PMD_DRV_LOG(INFO, "DPAAPortal=%p (%d) is being shared" - " between thread %" PRIu64 " and current " - "%" PRIu64 "\n", - dpaa2_io_portal[lcore_id].sec_dpio_dev, - dpaa2_io_portal[lcore_id].sec_dpio_dev->index, - dpaa2_io_portal[lcore_id].sec_tid, - tid); + DPAA2_BUS_DP_INFO( + "DPAA Portal=%p (%d) is being shared between thread" + " %" PRIu64 " and current %" PRIu64 "\n", + dpaa2_io_portal[lcore_id].sec_dpio_dev, + dpaa2_io_portal[lcore_id].sec_dpio_dev->index, + dpaa2_io_portal[lcore_id].sec_tid, + tid); RTE_PER_LCORE(_dpaa2_io).sec_dpio_dev = dpaa2_io_portal[lcore_id].sec_dpio_dev; rte_atomic16_inc(&dpaa2_io_portal [lcore_id].sec_dpio_dev->ref_count); dpaa2_io_portal[lcore_id].sec_tid = tid; - PMD_DRV_LOG(DEBUG, "Old Portal=%p (%d) " - "affined thread - %" PRIu64 "\n", - dpaa2_io_portal[lcore_id].sec_dpio_dev, - dpaa2_io_portal[lcore_id].sec_dpio_dev->index, - tid); + DPAA2_BUS_DP_DEBUG( + "Old Portal=%p (%d) affined thread" + " - %" PRIu64 "\n", + dpaa2_io_portal[lcore_id].sec_dpio_dev, + dpaa2_io_portal[lcore_id].sec_dpio_dev->index, + tid); return 0; } @@ -405,15 +406,14 @@ dpaa2_create_dpio_device(int vdev_fd, struct vfio_region_info reg_info = { .argsz = sizeof(reg_info)}; if (obj_info->num_regions < NUM_DPIO_REGIONS) { - PMD_INIT_LOG(ERR, "ERROR, Not sufficient number " - "of DPIO regions.\n"); + DPAA2_BUS_ERR("Not sufficient number of DPIO regions"); return -1; } dpio_dev = rte_malloc(NULL, sizeof(struct dpaa2_dpio_dev), RTE_CACHE_LINE_SIZE); if (!dpio_dev) { - PMD_INIT_LOG(ERR, "Memory allocation failed for DPIO Device\n"); + DPAA2_BUS_ERR("Memory allocation failed for DPIO Device"); return -1; } @@ -425,7 +425,7 @@ dpaa2_create_dpio_device(int vdev_fd, reg_info.index = 0; if (ioctl(vdev_fd, VFIO_DEVICE_GET_REGION_INFO, ®_info)) { - PMD_INIT_LOG(ERR, "vfio: error getting region info\n"); + DPAA2_BUS_ERR("vfio: error getting region info"); rte_free(dpio_dev); return -1; } @@ -437,7 +437,7 @@ dpaa2_create_dpio_device(int vdev_fd, reg_info.index = 1; if (ioctl(vdev_fd, VFIO_DEVICE_GET_REGION_INFO, ®_info)) { - PMD_INIT_LOG(ERR, "vfio: error getting region info\n"); + DPAA2_BUS_ERR("vfio: error getting region info"); rte_free(dpio_dev); return -1; } @@ -448,8 +448,8 @@ dpaa2_create_dpio_device(int vdev_fd, vdev_fd, reg_info.offset); if (configure_dpio_qbman_swp(dpio_dev)) { - PMD_INIT_LOG(ERR, - "Fail to configure the dpio qbman portal for %d\n", + DPAA2_BUS_ERR( + "Fail to configure the dpio qbman portal for %d", dpio_dev->hw_id); rte_free(dpio_dev); return -1; @@ -459,8 +459,8 @@ dpaa2_create_dpio_device(int vdev_fd, dpio_dev->index = io_space_count; if (rte_dpaa2_vfio_setup_intr(&dpio_dev->intr_handle, vdev_fd, 1)) { - PMD_INIT_LOG(ERR, "Fail to setup interrupt for %d\n", - dpio_dev->hw_id); + DPAA2_BUS_ERR("Fail to setup interrupt for %d", + dpio_dev->hw_id); rte_free(dpio_dev); } @@ -470,21 +470,20 @@ dpaa2_create_dpio_device(int vdev_fd, if (mc_get_soc_version(dpio_dev->dpio, CMD_PRI_LOW, &mc_plat_info)) { - PMD_INIT_LOG(ERR, "\tmc_get_soc_version failed\n"); + DPAA2_BUS_ERR("Unable to get SoC version information"); } else if ((mc_plat_info.svr & 0xffff0000) == SVR_LS1080A) { dpaa2_core_cluster_base = 0x02; dpaa2_cluster_sz = 4; - PMD_INIT_LOG(DEBUG, "\tLS108x (A53) Platform Detected"); + DPAA2_BUS_DEBUG("LS108x (A53) Platform Detected"); } else if ((mc_plat_info.svr & 0xffff0000) == SVR_LX2160A) { dpaa2_core_cluster_base = 0x00; dpaa2_cluster_sz = 2; - PMD_INIT_LOG(DEBUG, "\tLX2160 Platform Detected"); + DPAA2_BUS_DEBUG("LX2160 Platform Detected"); } dpaa2_svr_family = (mc_plat_info.svr & 0xffff0000); } TAILQ_INSERT_TAIL(&dpio_dev_list, dpio_dev, next); - RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpio.%d]\n", object_id); return 0; } -- 2.14.1