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 A3E815F1A 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=xcQBOXOdSIUgiHx+o7cuZFpTH1jkJQPzl2PMduca5jc=; b=bVmybK2v1JUcpqwW3CN8Z/o/I7PzoOAGecsNPAajJHJOTEAEV0EK9GjSY7JezWoIDJ/9N4ZRJvgtv5eYRfSxcjN8Grw8SaTwqnggzBlfU9VUhqLhDgFBhLPViwsULAM0dm0pj5A6zeo27PIhGfbCByUsErXsOEa8p6pHQ59+T1o= 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:34 +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:50 +0530 Message-Id: <20180323120456.16920-2-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: f3dde669-75a1-46dc-0a35-08d590b44ab6 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://UD7woffVJpESbb9H2oWK7hyQ+CfDDYi4TRs2JDblijy8NV2K8lPmwtVbTA9H41UM8X1uZSZ4Lv25PA0S99DdE/5UE9VzJurTptnLG7jx97tz5Pb6AokY42X0Zo5iA7oK4bGcUUVzHDlOqpQ4idEFgofvSuFYcF2QjbHUmt+XljFtSQK81riDYENjyldTzFDfefVXFKGtCtIebsUMia6aPUBCZlGSX7ux4UtDrFgRhbKgTzTSZ44/tLwK+/JIP8; 25:6FM1oZfaCtPxuUQsHurqQvmgc9YnjXiKMNUv6E5M5EfSBdL0WRJQGUXijG5kaWG6eg1OZyZAcUJerAOQHlx4Cs0+s4NdAr3x7/+2DYtEnaspvY/y5GrRfJilfP/Wd8H/N2FB9ZgapYKoSdD7Rg35JzHKCNmnYgrNR5sG1Yk+NrTbH8cLHwLej6pRJn5wAKXYyTV9cTIWq0OdjfzgAXD5v9uIyafI1L+jmOlnLNnFO0Bu+lGGPnH4ihDp9fq5C8IHMGj+iTw+OkRA//AHk940+9xE9WLrGtlpnw5LEetQhNTNkwqKjVshluxoD9mEg10LQHFtCH8mqIjFbQRrR2fOwA==; 31:iVubPoEGhI1ouzt3Nn4r3H+Ur0N2ss0rNoSo7Kchu05KMFDpXrOokzUH5iE4o7jeZ1M8zmz9LBQvQpumHCfa/exeQCMRdOoun0iv3qqvRworpVnYzvAfZC92SjiFJC52+eWd5oj23/5CYxksLWf5e9SudylzcQL+MH5KHsOVK5F13l2ATkF26PvIEoG3/uWEoiqlH0mGCEsHMbct/KlRgXEDNx3/Dx7yi7ZKLNqC4aA= X-MS-TrafficTypeDiagnostic: HE1PR0402MB2778: X-Microsoft-Exchange-Diagnostics: 1; HE1PR0402MB2778; 20:N2w6Z82Is6MBiQsAHlojCaFt6jWMPpVjZw5GKrugdCHzVOjxtz3a8bkSV5dE2CtMyPChcwE2wbxARAugcjl9sckFgAZjLafX6DAWCBFJfF0JF/kxg3fSKeN9eXSZtv5u04G9GWn4sF70+kLVZlYyCfTOrhengIpm1Tih7dCDNaOOohWWfbaT6FZGxiOVpzWEo6w2WtRSRhsmIvM4fJ6MqUqOjdkFrxkZjq6qYx+4/FKGKYT95h8rdCzTLt0/UgWdhLa0Ua9EsvLyUScQm1fmhfzdL1JAVhPHHcxoXT/z3WnPtLa2Zo8qua427vu4/1AfBCHJJQZRQaUZcsf9qcUngJyBUD07xiO7NvlEOQR3BhtZHPLs2T0ptS0fCY9RCEZWvqX2nh8COnTNQ0B3OVyny40puvNy4rwRmNTMpTZWEn5iyFJ0ZGl/f7vhK2fQPAHqxA6vxKpQokZWWB3VtREET0Fjpq3P48KH10w/UbFeqUEFxirqzTVxVYoABoMF8TY6; 4:qS1Lovz74J0KXxRJ5sZK7ih8asZK3ILmLbc/iEnj6Dg+gNPvONxzYeDDuQnEt1pJ8/OzLx04cu9apRMMQTD8PrrD3BBOpwBCT/tQnU7hnPVNJkGaoFBFDSUDtRxROh/TnhP0GIqyOgYGV/taOkVyv8f9zu7b1Cn4asjMI5tdNy+n74cf6pHkQ9zptrC7fb3s1dWcOT2MWlDnwWlGtxv2l+0bdChKXfyFIRuIrXj3C+SrNizkTYMu/xw9NN+NOf57imuJq/HM8RWwNiiMPj5vajR/FlN8nDTR7wyOv8IIqynKmB0jJrn3VLaXg/bnkM5ObwPrsGk20g40hgWVjE5pye8rK1i9X1KFzGYcuL0B4pOJ4BIkms+nm655MAQ769B2 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)(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)(53946003)(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:5NDwtg1lk/+uF9TUHUs6i3IeEzW+VwCePpKwFN6?= =?us-ascii?Q?6UW2KL9ZACL0+owwslknLuUQC8heZywdsW3zXGCjXvToxsLYqaUM2ZoFz/6j?= =?us-ascii?Q?p1RhjMxIXrrczVAvwjYuYaJDdAtwc6lpwOuYPQpapaR+oXsrmkNvH6NahwXt?= =?us-ascii?Q?MNYBaIdj/8/UQFdPY8wOqqqQpuAEbbD72xEeoCHB1hgcTjVNaxNU4/z45zig?= =?us-ascii?Q?W9NJBzqartcBK7QAND9rY6A852Lq8UW2jKLTKMYYWwjRIVEhoqaUUkDAwnzZ?= =?us-ascii?Q?YW9d2Ey6q6nYQMJ3K3WjYPMhN3ecUSquH//B3HQUnH2tx1f4MfGHJ5oZgHK4?= =?us-ascii?Q?x5Lc1Ki5eyb7gIgrIBi3B1C55xsL2k6e15eD274/tabPBa/BDq18Htrhrcc9?= =?us-ascii?Q?TXOSUr0NhQxDSyJ6DSxwpumhEKm9q47EFnS++hRIygAk046x9j2oDjkwGLT5?= =?us-ascii?Q?xD2SoY/OvMiwzvJLmTXjABYz4mnd1UR9+B19pB16M7DEVZfXb0RXRoR09wa1?= =?us-ascii?Q?7Uh7NNLQQ27/NiXoNM2a+kR9uL3ePo8btew/YGomFb4xAd8lx7yxcvXdY7GU?= =?us-ascii?Q?2QeY/3i2LvxOvHofRZvDfRPP5fmgEef/WdubmfN0o2E5SOX/7aF7mfZaCy/r?= =?us-ascii?Q?AObNz3whYsZ5MNNDLfRhOf+2G0Hk5McDdlYmxCLeQAX+d03zVSs26v0wAEZ5?= =?us-ascii?Q?z0e0mafBV204uhvrlPMfFLbBbqlO9RtYf2nITn7AHLbWrASQ+p/1NLQ+GrAb?= =?us-ascii?Q?0TftYvcz0gVFaPmtmULX4d9NzpcqzZd9BTiP9czIfYhPtfsNODnSx8zuF6nu?= =?us-ascii?Q?ddC1KFCWOTMHB/83nnmLivOJ8aFeUBIsCpVOhjgr9uO69KwWbNAuUmFTilbn?= =?us-ascii?Q?0rQVIBSo7VYzvhX2iRe5qxchtuZNWv7Blbzo0Sbfd27wGKs1EfqIhFHZgTQe?= =?us-ascii?Q?OqBRCeE5kLJNw7s8cnVtOEZwuuyb9d1gAWbhr6n3FdPro2gplscoFGXM4Zc4?= =?us-ascii?Q?Q7boswZRnLOzs0ypsLe4zFJMXIGOQNZHFVL66u/Es0L2s7UlapZviVqOxC1z?= =?us-ascii?Q?stuS4g0deBj9R2mT78AeD3SexUaw//En90Krx92kmCK2D0umhLIc25YG0Lou?= =?us-ascii?Q?nu+KwkOiPgWFEP4WyZnwcMRdaCBwRofTZb7bCugVKU88yg/aMJVv8et6Dguz?= =?us-ascii?Q?B/IIqeViqUv6w+KNE5CEiPRKKF1bIXH/qHN39Uwc/OUbuHrmLPMgOrN3Vqlw?= =?us-ascii?Q?WLa3BHeIqFSmakxYLXgiby/xGC1xGsK1S6BGhv8MNBiyKiaZmuHU4pfiXHx/?= =?us-ascii?Q?vWhmc/wmDb8duIWOqfNi5BIUoqqFKmL/D+7alKZNXopW6?= X-Microsoft-Antispam-Message-Info: +TEig7v3zL3UO5Y6FcdZ2MUgxlRzraJCgBOqPbsnsMJLwwHdevYpW3VA16XK5/sLY0aEVGJFTZhChvZI/mMmIJhEXItal7TExOWtKXpNJVxcQXFK6fsXfv80IrZYd0Z3QVilMZedrgo7+/QMGGtGr0nh01MaOaooDRkKL3tvQzv906dCmS49FkKijozC9toR X-Microsoft-Exchange-Diagnostics: 1; HE1PR0402MB2778; 6:936E9+PzrHN/vcRzcM698yJYOURIeB1s+vbniyBY+VI1Hz5vvie3UcE26ImsJBiX4POXhqplgj0Bw/eZ0InaVmVH/OvCBKDtwdU2P49KFiy90rAHLRiEKlzEUGBSLLQOJ3b7XBrtT1x9KOko/0PvNjsUUfjusuiNCeCWikWc8/N5Lr3ITqUX6dIi/r/JX1jtYdutT9W1tsPXVwGEkKSaF4y+wj5KElJSaDp/RhnD95Wk2xnX8irYYrcTo2WHl3TqqoHtL6laFyThtp1JRoNz9wBuwkjFRgcEubn+jn6GOa6QzouaNyf/0IvcIlEu1iD+9RIsikWkqfRqfNGdilWbMyHm3dJ3BG+34Waw7coZNH0=; 5:lR6MqBJS0BVOG2eALwCjhfprywh4EaHs1gz3KVkse1139cgQrNnobtvHjcdmQo441HEg1vrbVteAnlHn5rSVaaQ5w3rbthkBGsdLMhNtrBkBLkpjrIvUg8hl0vmaOm/wdaIq2GVEch0fOw9b37RUiU+CuFtcUf1bxgUuVaBc8X8=; 24:99To4KpizM7xnHsmgucY204MQwlFwyC7fao5pdLXGXH0meLX1bfnFrMVeKc/cLlMjVagU4dGi7e63B2EZ1cOta3E2KHJNyeEj7FCfTLIeZ4=; 7:X2vBt0NVvd6XLP2dOJ3hVd0xOVR5KVDGTpgHciIO2I2azdGYx9x3RNyYP99T2EDnW5FGmlA9Pr4BkGCKpcTVvH0XLfYRYBapsF+ezTzOdETc6OW7wWIYxmddKBF2VvBtqSddg1HxTHBi+CWcmmMcTC78BMM4PF/wQS9gdB7OiONPF9bs5G+Ft9Y+Bu0vrVYCb+poZT2P0tJHhgllFu8dUi2keaHYY0YVkoQyH32KysZUEZ2GeE20+bJpsxsn4QRl SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Mar 2018 11:50:34.9125 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f3dde669-75a1-46dc-0a35-08d590b44ab6 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 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: Fri, 23 Mar 2018 11:50:41 -0000 Signed-off-by: Shreyansh Jain Acked-by: Hemant Agrawal --- 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 952b4c02b..93870bae3 100644 --- a/drivers/bus/fslmc/Makefile +++ b/drivers/bus/fslmc/Makefile @@ -10,13 +10,8 @@ include $(RTE_SDK)/mk/rte.vars.mk LIB = librte_bus_fslmc.a 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..62499de05 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