From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BE85141BE7; Mon, 6 Feb 2023 08:06:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D2D7E42D12; Mon, 6 Feb 2023 08:06:13 +0100 (CET) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2109.outbound.protection.outlook.com [40.107.100.109]) by mails.dpdk.org (Postfix) with ESMTP id A96B641156 for ; Mon, 6 Feb 2023 08:06:11 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D3xmzxBPrKr/uKIC3tlwfQBAmgYymfKvFumB6MnD6HVZvpq/I+IrYRlNMMP95YmLAY3olJXT9n0zCPO/ddO1FfGL7iFbyqjE8iOAQEKiozC8mfwJB7box2cri0Tf2gK/hV6QEQUJfx2S5onABgXAXCOxTn1thlIHcirFE2flCnnvwKPKrF1M1ND8APgyCJ+N0QXKRl4lFS8Dg3P5oiU76KwF5F+66tEk13dL+QHMSqg40mfiyk9Rh81OLc6xSb/YCNTjPzoyAsqGEY69r8Bjp+s1AuXizefcww2lRWbvVw/BK11YnjnML1P0raEyGFMCRR4fMvuUwEkQKQEuIcUk7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/avWhwPAiMZxjwMSp/CKPBzMia1M4nmdA4/thSEx+9g=; b=ToobaRyvL+bzudyj4hC+ebINBMtF/n/rnHLqL7uuHYpdx/JOgWnnoQrN7rQD2jIPluAyPwPaKwSPE5ayQDUGMi96i/BCS0bmqBP9mWHNa0er3KEQ5uwfiMhlNtTZpG3+yJ7MOwbomwLvpk/8KL2cQ8CH7nzBFikih1ZhQ1dL7YUoXhj07RSNC4H6fztHBRmBouK3D/K11UGUVrEHSgFek9lUyVQI296XUJ8GfEM0Of+zdm+aQQjIqXqZRKIoqS9yOj1Of3w5VTqbhkrsKjCtmuZ4ua4wJu7x762v854oxJRIn6+loR9nBdjdGDvA+gsZHzl/FXyrWDwYqTrqFswRkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/avWhwPAiMZxjwMSp/CKPBzMia1M4nmdA4/thSEx+9g=; b=vtY7dnkInHslfLq5Ui56iZZYJA4bP5GF27tuXvj8tST2r+vKPBS15xJWKzOjx2Us6j6fegUHmBxb4gieLomqfcExrg3CLTHNUpcrnUYVM4WkkBIRMpSsVZNVoZrwjBBnwSr+9x68KpXYY1nOgt9ZEH1wj/X2bidm32AWKvZG+k8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by SJ0PR13MB5302.namprd13.prod.outlook.com (2603:10b6:a03:3dc::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Mon, 6 Feb 2023 07:06:10 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7ea4:e421:5dd5:9f4d]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7ea4:e421:5dd5:9f4d%4]) with mapi id 15.20.6064.034; Mon, 6 Feb 2023 07:06:10 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, James Hershaw , Chaoyong He Subject: [PATCH 1/3] net/nfp: remove usage of print statements Date: Mon, 6 Feb 2023 15:05:47 +0800 Message-Id: <20230206070549.27265-2-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.29.3 In-Reply-To: <20230206070549.27265-1-chaoyong.he@corigine.com> References: <20230206070549.27265-1-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR01CA0120.apcprd01.prod.exchangelabs.com (2603:1096:4:40::24) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SJ0PR13MB5302:EE_ X-MS-Office365-Filtering-Correlation-Id: ec0ad689-080a-40c8-fe4f-08db08109ffc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aXZJjsLz6npJWQEwnJwF36TrPZrAA3UT3cPaQIVidI0YEDZkdOiYhD1bX48Yu/6at9fWcfipaR4bf/5tNVDx7JcYdFnwN8PkQcCUSJwzS8nSAnIyAVbxaNS7f/xo6pRA/FIhY35LqW7BFtHGHjzJYh61Cpy3J6pQXweHZo/3zM+GyBPelTw9XBeWf2NlaVXUlmn/ieD/dyUo0RgXZLKHEVBNPSlQI2owvXpyx/NdQ0hrdEAi63vlL9EbokvMJqjh4Q1phmUOWDcSCRthNUkLmfZBv32Np8Iwhp6XfP1c5Altjl9hD9DRwZZDeWn5XkXUHhoYuAdpqlx7r5wxkYWGgO9goPA0+2bZ02HQICIKDuhgITSF73Gl32+6GiWIn+pB3Soyu6GmArb4huwb0m+nVQxLBhdyUgYYFdenWUI8DAX12V2dQHgoP5NZC2JDGJ5LyK6X0h+2Fx4mhcvbOIRyTI011LuP4bhqYIglgvWmj5FQL6AqAHU7/BxwDfSs9p9V0Lx8dmsxPF6P4r14CCAFmaka3EefdmvdfIWh3E0A27MGF+TuCDq4LZ9vGmNNDwnXkWyM8hnj1B8Wr2SFPCCES+XWpHsoKDhbB6tpipINVcVMTk3hK8NxZsCrsziaBloKhWTRwl+cXT3THZPHEl35N4u4/D7+GrNu4vrRWGQrCXZX2pLibtncCP3e6WFMBvruTDEjQQkmhV6r2xe07ekX9w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(346002)(396003)(366004)(39840400004)(136003)(376002)(451199018)(52116002)(36756003)(316002)(107886003)(6666004)(54906003)(1076003)(6506007)(8676002)(6486002)(30864003)(5660300002)(8936002)(66476007)(66556008)(2906002)(6916009)(66946007)(4326008)(478600001)(44832011)(41300700001)(6512007)(26005)(38100700002)(86362001)(38350700002)(66574015)(83380400001)(186003)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aXltOWE4WTRIMG1SZFNocDNwTFBpQkNIbkFzdEtPdFJDYjYrWE5IRWgzcm96?= =?utf-8?B?WVFFMWNPMldvb1hEODhtWTR4LzV6SFBwc0t6OU5nYVRjQWVLL1ZrSkNIOXB2?= =?utf-8?B?ekNEQ0liRUJCTWJkY2JOQkdQcTN1elA3MmJSd3F1eURHS3dhbDRjSS9xMGFq?= =?utf-8?B?N1BtRCtwbkl6eklaQ3NGWXEveU9rYndGT2hYcXg4am51OHJtdnNWcU02ZnJD?= =?utf-8?B?YlZKQW9ZdnhaaTFwOEp4c2NIZEpNdUlneEt0UU9ZTG5JMG1QT3RJU1VHZFVp?= =?utf-8?B?S1I5VS9qZkxIZDVUaWxQYTl1a1BHcDdSUDhESU1zcWxpNWZJNXNEZVYwM0cw?=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=?utf-8?B?NUVZNW0yQ2tpQXg3YlNTTFBISWdjRkhPdjVqQ3hZL0Q1WXlKNDVFTHJtWkJu?= =?utf-8?B?NXc9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec0ad689-080a-40c8-fe4f-08db08109ffc X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2023 07:06:10.4087 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6j8SKHjAX/PWC6wJPTBNOQFK3SdSY9TYGJcw18hcYnY+O2RwfzQeHxhj0S5EFhYIoeTU6mC8W9ToNSTqfNKH7Pnv9d4F+Zv18huqvt0G9PE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR13MB5302 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: James Hershaw Removal of the usage of printf() statements from the nfp PMD in favour of appropriate RTE logging functions in compliance with the standard. Debug messages are now logged using the appropriate RTE_LOG functions so it is no longer necessary to print specific statements when compiled in with the DEBUG tag, rather log these messages using the appropriate functions regardless of whether the DEBUG tag is set or not. Signed-off-by: James Hershaw Reviewed-by: Chaoyong He Reviewed-by: Niklas Söderlund --- drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 71 +++++++++------------- drivers/net/nfp/nfpcore/nfp_cppcore.c | 3 +- drivers/net/nfp/nfpcore/nfp_hwinfo.c | 17 +++--- drivers/net/nfp/nfpcore/nfp_mip.c | 12 ++-- drivers/net/nfp/nfpcore/nfp_mutex.c | 10 ++- drivers/net/nfp/nfpcore/nfp_nsp.c | 30 +++++---- drivers/net/nfp/nfpcore/nfp_nsp_cmds.c | 4 +- drivers/net/nfp/nfpcore/nfp_nsp_eth.c | 16 ++--- drivers/net/nfp/nfpcore/nfp_resource.c | 5 +- drivers/net/nfp/nfpcore/nfp_rtsym.c | 28 +++------ 10 files changed, 87 insertions(+), 109 deletions(-) diff --git a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c index 22c8bc4b14..8d7eb96da1 100644 --- a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c +++ b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c @@ -34,6 +34,7 @@ #include #include "nfp_cpp.h" +#include "nfp_logs.h" #include "nfp_target.h" #include "nfp6000/nfp6000.h" @@ -173,23 +174,17 @@ nfp_compute_bar(const struct nfp_bar *bar, uint32_t *bar_config, newcfg |= NFP_PCIE_BAR_PCIE2CPP_TOKEN_BASEADDRESS(tok); if ((offset & mask) != ((offset + size - 1) & mask)) { - printf("BAR%d: Won't use for Fixed mapping\n", - bar->index); - printf("\t<%#llx,%#llx>, action=%d\n", - (unsigned long long)offset, - (unsigned long long)(offset + size), act); - printf("\tBAR too small (0x%llx).\n", - (unsigned long long)mask); + PMD_DRV_LOG(ERR, "BAR%d: Won't use for Fixed mapping <%#llx,%#llx>, action=%d BAR too small (0x%llx)", + bar->index, (unsigned long long)offset, + (unsigned long long)(offset + size), act, + (unsigned long long)mask); return -EINVAL; } offset &= mask; -#ifdef DEBUG - printf("BAR%d: Created Fixed mapping\n", bar->index); - printf("\t%d:%d:%d:0x%#llx-0x%#llx>\n", tgt, act, tok, - (unsigned long long)offset, - (unsigned long long)(offset + mask)); -#endif + PMD_DRV_LOG(DEBUG, "BAR%d: Created Fixed mapping %d:%d:%d:0x%#llx-0x%#llx>", + bar->index, tgt, act, tok, (unsigned long long)offset, + (unsigned long long)(offset + mask)); bitsize = 40 - 16; } else { @@ -204,33 +199,27 @@ nfp_compute_bar(const struct nfp_bar *bar, uint32_t *bar_config, newcfg |= NFP_PCIE_BAR_PCIE2CPP_TOKEN_BASEADDRESS(tok); if ((offset & mask) != ((offset + size - 1) & mask)) { - printf("BAR%d: Won't use for bulk mapping\n", - bar->index); - printf("\t<%#llx,%#llx>\n", (unsigned long long)offset, - (unsigned long long)(offset + size)); - printf("\ttarget=%d, token=%d\n", tgt, tok); - printf("\tBAR too small (%#llx) - (%#llx != %#llx).\n", - (unsigned long long)mask, - (unsigned long long)(offset & mask), - (unsigned long long)(offset + size - 1) & mask); - + PMD_DRV_LOG(ERR, "BAR%d: Won't use for bulk mapping <%#llx,%#llx> target=%d, token=%d BAR too small (%#llx) - (%#llx != %#llx).", + bar->index, (unsigned long long)offset, + (unsigned long long)(offset + size), + tgt, tok, (unsigned long long)mask, + (unsigned long long)(offset & mask), + (unsigned long long)(offset + size - 1) & mask); return -EINVAL; } offset &= mask; -#ifdef DEBUG - printf("BAR%d: Created bulk mapping %d:x:%d:%#llx-%#llx\n", - bar->index, tgt, tok, (unsigned long long)offset, - (unsigned long long)(offset + ~mask)); -#endif + PMD_DRV_LOG(DEBUG, "BAR%d: Created bulk mapping %d:x:%d:%#llx-%#llx", + bar->index, tgt, tok, (unsigned long long)offset, + (unsigned long long)(offset + ~mask)); bitsize = 40 - 21; } if (bar->bitsize < bitsize) { - printf("BAR%d: Too small for %d:%d:%d\n", bar->index, tgt, tok, - act); + PMD_DRV_LOG(ERR, "BAR%d: Too small for %d:%d:%d", bar->index, + tgt, tok, act); return -EINVAL; } @@ -263,9 +252,7 @@ nfp_bar_write(struct nfp_pcie_user *nfp, struct nfp_bar *bar, *(uint32_t *)(bar->csr) = newcfg; bar->barcfg = newcfg; -#ifdef DEBUG - printf("BAR%d: updated to 0x%08x\n", bar->index, newcfg); -#endif + PMD_DRV_LOG(DEBUG, "BAR%d: updated to 0x%08x", bar->index, newcfg); return 0; } @@ -535,7 +522,7 @@ nfp6000_area_read(struct nfp_cpp_area *area, void *kernel_vaddr, /* Unaligned? Translate to an explicit access */ if ((priv->offset + offset) & (width - 1)) { - printf("aread_read unaligned!!!\n"); + PMD_DRV_LOG(ERR, "aread_read unaligned!!!"); return -EINVAL; } @@ -702,7 +689,7 @@ nfp_acquire_secondary_process_lock(struct nfp_pcie_user *desc) desc->secondary_lock = open(lockfile, O_RDWR | O_CREAT | O_NONBLOCK, 0666); if (desc->secondary_lock < 0) { - RTE_LOG(ERR, PMD, "NFP lock for secondary process failed\n"); + PMD_DRV_LOG(ERR, "NFP lock for secondary process failed"); free(lockfile); return desc->secondary_lock; } @@ -711,7 +698,7 @@ nfp_acquire_secondary_process_lock(struct nfp_pcie_user *desc) lock.l_whence = SEEK_SET; rc = fcntl(desc->secondary_lock, F_SETLK, &lock); if (rc < 0) { - RTE_LOG(ERR, PMD, "NFP lock for secondary process failed\n"); + PMD_DRV_LOG(ERR, "NFP lock for secondary process failed"); close(desc->secondary_lock); } @@ -725,7 +712,7 @@ nfp6000_set_model(struct rte_pci_device *dev, struct nfp_cpp *cpp) uint32_t model; if (rte_pci_read_config(dev, &model, 4, 0x2e) < 0) { - printf("nfp set model failed\n"); + PMD_DRV_LOG(ERR, "nfp set model failed"); return -1; } @@ -741,7 +728,7 @@ nfp6000_set_interface(struct rte_pci_device *dev, struct nfp_cpp *cpp) uint16_t interface; if (rte_pci_read_config(dev, &interface, 2, 0x154) < 0) { - printf("nfp set interface failed\n"); + PMD_DRV_LOG(ERR, "nfp set interface failed"); return -1; } @@ -760,14 +747,14 @@ nfp6000_set_serial(struct rte_pci_device *dev, struct nfp_cpp *cpp) pos = rte_pci_find_ext_capability(dev, RTE_PCI_EXT_CAP_ID_DSN); if (pos <= 0) { - printf("PCI_EXT_CAP_ID_DSN not found. nfp set serial failed\n"); + PMD_DRV_LOG(ERR, "PCI_EXT_CAP_ID_DSN not found. nfp set serial failed"); return -1; } else { pos += 6; } if (rte_pci_read_config(dev, &tmp, 2, pos) < 0) { - printf("nfp set serial failed\n"); + PMD_DRV_LOG(ERR, "nfp set serial failed"); return -1; } @@ -776,7 +763,7 @@ nfp6000_set_serial(struct rte_pci_device *dev, struct nfp_cpp *cpp) pos += 2; if (rte_pci_read_config(dev, &tmp, 2, pos) < 0) { - printf("nfp set serial failed\n"); + PMD_DRV_LOG(ERR, "nfp set serial failed"); return -1; } @@ -785,7 +772,7 @@ nfp6000_set_serial(struct rte_pci_device *dev, struct nfp_cpp *cpp) pos += 2; if (rte_pci_read_config(dev, &tmp, 2, pos) < 0) { - printf("nfp set serial failed\n"); + PMD_DRV_LOG(ERR, "nfp set serial failed"); return -1; } diff --git a/drivers/net/nfp/nfpcore/nfp_cppcore.c b/drivers/net/nfp/nfpcore/nfp_cppcore.c index 37799af558..e1e0a143f9 100644 --- a/drivers/net/nfp/nfpcore/nfp_cppcore.c +++ b/drivers/net/nfp/nfpcore/nfp_cppcore.c @@ -15,6 +15,7 @@ #include #include "nfp_cpp.h" +#include "nfp_logs.h" #include "nfp_target.h" #include "nfp6000/nfp6000.h" #include "nfp6000/nfp_xpb.h" @@ -701,7 +702,7 @@ nfp_cpp_read(struct nfp_cpp *cpp, uint32_t destination, area = nfp_cpp_area_alloc_acquire(cpp, destination, address, length); if (!area) { - printf("Area allocation/acquire failed\n"); + PMD_DRV_LOG(ERR, "Area allocation/acquire failed"); return -1; } diff --git a/drivers/net/nfp/nfpcore/nfp_hwinfo.c b/drivers/net/nfp/nfpcore/nfp_hwinfo.c index 9f848bde79..9b66569953 100644 --- a/drivers/net/nfp/nfpcore/nfp_hwinfo.c +++ b/drivers/net/nfp/nfpcore/nfp_hwinfo.c @@ -20,6 +20,7 @@ #include #include "nfp_cpp.h" +#include "nfp_logs.h" #include "nfp6000/nfp6000.h" #include "nfp_resource.h" #include "nfp_hwinfo.h" @@ -40,12 +41,12 @@ nfp_hwinfo_db_walk(struct nfp_hwinfo *hwinfo, uint32_t size) key = val + strlen(val) + 1) { val = key + strlen(key) + 1; if (val >= end) { - printf("Bad HWINFO - overflowing key\n"); + PMD_DRV_LOG(ERR, "Bad HWINFO - overflowing value"); return -EINVAL; } if (val + strlen(val) + 1 > end) { - printf("Bad HWINFO - overflowing value\n"); + PMD_DRV_LOG(ERR, "Bad HWINFO - overflowing value"); return -EINVAL; } } @@ -59,7 +60,7 @@ nfp_hwinfo_db_validate(struct nfp_hwinfo *db, uint32_t len) size = db->size; if (size > len) { - printf("Unsupported hwinfo size %u > %u\n", size, len); + PMD_DRV_LOG(ERR, "Unsupported hwinfo size %u > %u", size, len); return -EINVAL; } @@ -67,8 +68,8 @@ nfp_hwinfo_db_validate(struct nfp_hwinfo *db, uint32_t len) new_crc = nfp_crc32_posix((char *)db, size); crc = (uint32_t *)(db->start + size); if (new_crc != *crc) { - printf("Corrupt hwinfo table (CRC mismatch)\n"); - printf("\tcalculated 0x%x, expected 0x%x\n", new_crc, *crc); + PMD_DRV_LOG(ERR, "Corrupt hwinfo table (CRC mismatch) calculated 0x%x, expected 0x%x", + new_crc, *crc); return -EINVAL; } @@ -108,12 +109,12 @@ nfp_hwinfo_try_fetch(struct nfp_cpp *cpp, size_t *cpp_size) goto exit_free; header = (void *)db; - printf("NFP HWINFO header: %#08x\n", *(uint32_t *)header); + PMD_DRV_LOG(DEBUG, "NFP HWINFO header: %#08x", *(uint32_t *)header); if (nfp_hwinfo_is_updating(header)) goto exit_free; if (header->version != NFP_HWINFO_VERSION_2) { - printf("Unknown HWInfo version: 0x%08x\n", + PMD_DRV_LOG(DEBUG, "Unknown HWInfo version: 0x%08x", header->version); goto exit_free; } @@ -145,7 +146,7 @@ nfp_hwinfo_fetch(struct nfp_cpp *cpp, size_t *hwdb_size) nanosleep(&wait, NULL); if (count++ > 200) { - printf("NFP access error\n"); + PMD_DRV_LOG(ERR, "NFP access error"); return NULL; } } diff --git a/drivers/net/nfp/nfpcore/nfp_mip.c b/drivers/net/nfp/nfpcore/nfp_mip.c index c86966df8b..d342bc4141 100644 --- a/drivers/net/nfp/nfpcore/nfp_mip.c +++ b/drivers/net/nfp/nfpcore/nfp_mip.c @@ -7,6 +7,7 @@ #include #include "nfp_cpp.h" +#include "nfp_logs.h" #include "nfp_mip.h" #include "nfp_nffw.h" @@ -43,18 +44,17 @@ nfp_mip_try_read(struct nfp_cpp *cpp, uint32_t cpp_id, uint64_t addr, ret = nfp_cpp_read(cpp, cpp_id, addr, mip, sizeof(*mip)); if (ret != sizeof(*mip)) { - printf("Failed to read MIP data (%d, %zu)\n", - ret, sizeof(*mip)); + PMD_DRV_LOG(ERR, "Failed to read MIP data (%d, %zu)", ret, sizeof(*mip)); return -EIO; } if (mip->signature != NFP_MIP_SIGNATURE) { - printf("Incorrect MIP signature (0x%08x)\n", - rte_le_to_cpu_32(mip->signature)); + PMD_DRV_LOG(ERR, "Incorrect MIP signature (0x%08x)", + rte_le_to_cpu_32(mip->signature)); return -EINVAL; } if (mip->mip_version != NFP_MIP_VERSION) { - printf("Unsupported MIP version (%d)\n", - rte_le_to_cpu_32(mip->mip_version)); + PMD_DRV_LOG(ERR, "Unsupported MIP version (%d)", + rte_le_to_cpu_32(mip->mip_version)); return -EINVAL; } diff --git a/drivers/net/nfp/nfpcore/nfp_mutex.c b/drivers/net/nfp/nfpcore/nfp_mutex.c index 318c5800d7..de9049c6a0 100644 --- a/drivers/net/nfp/nfpcore/nfp_mutex.c +++ b/drivers/net/nfp/nfpcore/nfp_mutex.c @@ -10,6 +10,7 @@ #include #include "nfp_cpp.h" +#include "nfp_logs.h" #include "nfp6000/nfp6000.h" #define MUTEX_LOCKED(interface) ((((uint32_t)(interface)) << 16) | 0x000f) @@ -265,12 +266,9 @@ nfp_cpp_mutex_lock(struct nfp_cpp_mutex *mutex) if (err < 0 && errno != EBUSY) return err; if (time(NULL) >= warn_at) { - printf("Warning: waiting for NFP mutex\n"); - printf("\tusage:%u\n", mutex->usage); - printf("\tdepth:%hd]\n", mutex->depth); - printf("\ttarget:%d\n", mutex->target); - printf("\taddr:%llx\n", mutex->address); - printf("\tkey:%08x]\n", mutex->key); + PMD_DRV_LOG(ERR, "Warning: waiting for NFP mutex usage:%u depth:%hd] target:%d addr:%llx key:%08x]", + mutex->usage, mutex->depth, mutex->target, + mutex->address, mutex->key); warn_at = time(NULL) + 60; } sched_yield(); diff --git a/drivers/net/nfp/nfpcore/nfp_nsp.c b/drivers/net/nfp/nfpcore/nfp_nsp.c index 876a4017c9..22fb3407c6 100644 --- a/drivers/net/nfp/nfpcore/nfp_nsp.c +++ b/drivers/net/nfp/nfpcore/nfp_nsp.c @@ -11,6 +11,7 @@ #include #include "nfp_cpp.h" +#include "nfp_logs.h" #include "nfp_nsp.h" #include "nfp_resource.h" @@ -62,7 +63,7 @@ nfp_nsp_print_extended_error(uint32_t ret_val) for (i = 0; i < (int)ARRAY_SIZE(nsp_errors); i++) if (ret_val == (uint32_t)nsp_errors[i].code) - printf("err msg: %s\n", nsp_errors[i].msg); + PMD_DRV_LOG(ERR, "err msg: %s", nsp_errors[i].msg); } static int @@ -81,7 +82,7 @@ nfp_nsp_check(struct nfp_nsp *state) return err; if (FIELD_GET(NSP_STATUS_MAGIC, reg) != NSP_MAGIC) { - printf("Cannot detect NFP Service Processor\n"); + PMD_DRV_LOG(ERR, "Cannot detect NFP Service Processor"); return -ENODEV; } @@ -89,13 +90,13 @@ nfp_nsp_check(struct nfp_nsp *state) state->ver.minor = FIELD_GET(NSP_STATUS_MINOR, reg); if (state->ver.major != NSP_MAJOR || state->ver.minor < NSP_MINOR) { - printf("Unsupported ABI %hu.%hu\n", state->ver.major, + PMD_DRV_LOG(ERR, "Unsupported ABI %hu.%hu", state->ver.major, state->ver.minor); return -EINVAL; } if (reg & NSP_STATUS_BUSY) { - printf("Service processor busy!\n"); + PMD_DRV_LOG(ERR, "Service processor busy!"); return -EBUSY; } @@ -223,7 +224,7 @@ nfp_nsp_command(struct nfp_nsp *state, uint16_t code, uint32_t option, if (!FIELD_FIT(NSP_BUFFER_CPP, buff_cpp >> 8) || !FIELD_FIT(NSP_BUFFER_ADDRESS, buff_addr)) { - printf("Host buffer out of reach %08x %" PRIx64 "\n", + PMD_DRV_LOG(ERR, "Host buffer out of reach %08x %" PRIx64, buff_cpp, buff_addr); return -EINVAL; } @@ -245,7 +246,7 @@ nfp_nsp_command(struct nfp_nsp *state, uint16_t code, uint32_t option, err = nfp_nsp_wait_reg(cpp, ®, nsp_cpp, nsp_command, NSP_COMMAND_START, 0); if (err) { - printf("Error %d waiting for code 0x%04x to start\n", + PMD_DRV_LOG(ERR, "Error %d waiting for code 0x%04x to start", err, code); return err; } @@ -254,7 +255,7 @@ nfp_nsp_command(struct nfp_nsp *state, uint16_t code, uint32_t option, err = nfp_nsp_wait_reg(cpp, ®, nsp_cpp, nsp_status, NSP_STATUS_BUSY, 0); if (err) { - printf("Error %d waiting for code 0x%04x to complete\n", + PMD_DRV_LOG(ERR, "Error %d waiting for code 0x%04x to start", err, code); return err; } @@ -266,7 +267,7 @@ nfp_nsp_command(struct nfp_nsp *state, uint16_t code, uint32_t option, err = FIELD_GET(NSP_STATUS_RESULT, reg); if (err) { - printf("Result (error) code set: %d (%d) command: %d\n", + PMD_DRV_LOG(ERR, "Result (error) code set: %d (%d) command: %d", -err, (int)ret_val, code); nfp_nsp_print_extended_error(ret_val); return -err; @@ -289,8 +290,8 @@ nfp_nsp_command_buf(struct nfp_nsp *nsp, uint16_t code, uint32_t option, uint32_t cpp_id; if (nsp->ver.minor < 13) { - printf("NSP: Code 0x%04x with buffer not supported\n", code); - printf("\t(ABI %hu.%hu)\n", nsp->ver.major, nsp->ver.minor); + PMD_DRV_LOG(ERR, "NSP: Code 0x%04x with buffer not supported ABI %hu.%hu)", + code, nsp->ver.major, nsp->ver.minor); return -EOPNOTSUPP; } @@ -303,11 +304,8 @@ nfp_nsp_command_buf(struct nfp_nsp *nsp, uint16_t code, uint32_t option, max_size = RTE_MAX(in_size, out_size); if (FIELD_GET(NSP_DFLT_BUFFER_SIZE_MB, reg) * SZ_1M < max_size) { - printf("NSP: default buffer too small for command 0x%04x\n", - code); - printf("\t(%llu < %u)\n", - FIELD_GET(NSP_DFLT_BUFFER_SIZE_MB, reg) * SZ_1M, - max_size); + PMD_DRV_LOG(ERR, "NSP: default buffer too small for command 0x%04x (%llu < %u)", + code, FIELD_GET(NSP_DFLT_BUFFER_SIZE_MB, reg) * SZ_1M, max_size); return -EINVAL; } @@ -372,7 +370,7 @@ nfp_nsp_wait(struct nfp_nsp *state) } } if (err) - printf("NSP failed to respond %d\n", err); + PMD_DRV_LOG(ERR, "NSP failed to respond %d", err); return err; } diff --git a/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c b/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c index bfd1eddb3e..1de3d1b00f 100644 --- a/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c +++ b/drivers/net/nfp/nfpcore/nfp_nsp_cmds.c @@ -6,6 +6,7 @@ #include #include #include "nfp_cpp.h" +#include "nfp_logs.h" #include "nfp_nsp.h" #include "nfp_nffw.h" @@ -39,8 +40,7 @@ __nfp_nsp_identify(struct nfp_nsp *nsp) memset(ni, 0, sizeof(*ni)); ret = nfp_nsp_read_identify(nsp, ni, sizeof(*ni)); if (ret < 0) { - printf("reading bsp version failed %d\n", - ret); + PMD_DRV_LOG(ERR, "reading bsp version failed %d", ret); goto exit_free; } diff --git a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c index f8f3c372ac..eb532e5f3a 100644 --- a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c +++ b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c @@ -7,6 +7,7 @@ #include #include #include "nfp_cpp.h" +#include "nfp_logs.h" #include "nfp_nsp.h" #include "nfp6000/nfp6000.h" @@ -236,7 +237,7 @@ nfp_eth_calc_port_geometry(struct nfp_eth_table *table) continue; if (table->ports[i].label_subport == table->ports[j].label_subport) - printf("Port %d subport %d is a duplicate\n", + PMD_DRV_LOG(DEBUG, "Port %d subport %d is a duplicate", table->ports[i].label_port, table->ports[i].label_subport); @@ -275,7 +276,7 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp) memset(entries, 0, NSP_ETH_TABLE_SIZE); ret = nfp_nsp_read_eth_table(nsp, entries, NSP_ETH_TABLE_SIZE); if (ret < 0) { - printf("reading port table failed %d\n", ret); + PMD_DRV_LOG(ERR, "reading port table failed %d", ret); goto err; } @@ -294,7 +295,7 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp) * above. */ if (ret && ret != cnt) { - printf("table entry count (%d) unmatch entries present (%d)\n", + PMD_DRV_LOG(ERR, "table entry count (%d) unmatch entries present (%d)", ret, cnt); goto err; } @@ -372,12 +373,12 @@ nfp_eth_config_start(struct nfp_cpp *cpp, unsigned int idx) ret = nfp_nsp_read_eth_table(nsp, entries, NSP_ETH_TABLE_SIZE); if (ret < 0) { - printf("reading port table failed %d\n", ret); + PMD_DRV_LOG(ERR, "reading port table failed %d", ret); goto err; } if (!(entries[idx].port & NSP_ETH_PORT_LANES_MASK)) { - printf("trying to set port state on disabled port %d\n", idx); + PMD_DRV_LOG(ERR, "trying to set port state on disabled port %d", idx); goto err; } @@ -535,7 +536,7 @@ nfp_eth_set_bit_config(struct nfp_nsp *nsp, unsigned int raw_idx, * codes were initially not populated correctly. */ if (nfp_nsp_get_abi_ver_minor(nsp) < 17) { - printf("set operations not supported, please update flash\n"); + PMD_DRV_LOG(ERR, "set operations not supported, please update flash"); return -EOPNOTSUPP; } @@ -647,8 +648,7 @@ __nfp_eth_set_speed(struct nfp_nsp *nsp, unsigned int speed) rate = nfp_eth_speed2rate(speed); if (rate == RATE_INVALID) { - printf("could not find matching lane rate for speed %u\n", - speed); + PMD_DRV_LOG(ERR, "could not find matching lane rate for speed %u", speed); return -EINVAL; } diff --git a/drivers/net/nfp/nfpcore/nfp_resource.c b/drivers/net/nfp/nfpcore/nfp_resource.c index 7b5630fd86..6a10c9b0a7 100644 --- a/drivers/net/nfp/nfpcore/nfp_resource.c +++ b/drivers/net/nfp/nfpcore/nfp_resource.c @@ -10,6 +10,7 @@ #include #include "nfp_cpp.h" +#include "nfp_logs.h" #include "nfp6000/nfp6000.h" #include "nfp_resource.h" #include "nfp_crc.h" @@ -79,7 +80,7 @@ nfp_cpp_resource_find(struct nfp_cpp *cpp, struct nfp_resource *res) /* Search for a matching entry */ if (!memcmp(name_pad, NFP_RESOURCE_TBL_NAME "\0\0\0\0\0\0\0\0", 8)) { - printf("Grabbing device lock not supported\n"); + PMD_DRV_LOG(ERR, "Grabbing device lock not supported"); return -EOPNOTSUPP; } key = nfp_crc32_posix(name_pad, NFP_RESOURCE_ENTRY_NAME_SZ); @@ -185,7 +186,7 @@ nfp_resource_acquire(struct nfp_cpp *cpp, const char *name) goto err_free; if (count++ > 1000) { - printf("Error: resource %s timed out\n", name); + PMD_DRV_LOG(ERR, "Error: resource %s timed out", name); err = -EBUSY; goto err_free; } diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.c b/drivers/net/nfp/nfpcore/nfp_rtsym.c index 56bbf05cd8..288a37da60 100644 --- a/drivers/net/nfp/nfpcore/nfp_rtsym.c +++ b/drivers/net/nfp/nfpcore/nfp_rtsym.c @@ -11,6 +11,7 @@ #include #include #include "nfp_cpp.h" +#include "nfp_logs.h" #include "nfp_mip.h" #include "nfp_rtsym.h" #include "nfp6000/nfp6000.h" @@ -56,11 +57,8 @@ nfp_rtsym_sw_entry_init(struct nfp_rtsym_table *cache, uint32_t strtab_size, sw->size = ((uint64_t)fw->size_hi << 32) | rte_le_to_cpu_32(fw->size_lo); -#ifdef DEBUG - printf("rtsym_entry_init\n"); - printf("\tname=%s, addr=%" PRIx64 ", size=%" PRIu64 ",target=%d\n", - sw->name, sw->addr, sw->size, sw->target); -#endif + PMD_INIT_LOG(DEBUG, "rtsym_entry_init name=%s, addr=%" PRIx64 ", size=%" PRIu64 ", target=%d", + sw->name, sw->addr, sw->size, sw->target); switch (fw->target) { case SYM_TGT_LMEM: sw->target = NFP_RTSYM_TARGET_LMEM; @@ -241,10 +239,8 @@ nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name, int *error) id = NFP_CPP_ISLAND_ID(sym->target, NFP_CPP_ACTION_RW, 0, sym->domain); -#ifdef DEBUG - printf("Reading symbol %s with size %" PRIu64 " at %" PRIx64 "\n", + PMD_DRV_LOG(DEBUG, "Reading symbol %s with size %" PRIu64 " at %" PRIx64 "", name, sym->size, sym->addr); -#endif switch (sym->size) { case 4: err = nfp_cpp_readl(rtbl->cpp, id, sym->addr, &val32); @@ -254,7 +250,7 @@ nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name, int *error) err = nfp_cpp_readq(rtbl->cpp, id, sym->addr, &val); break; default: - printf("rtsym '%s' unsupported size: %" PRId64 "\n", + PMD_DRV_LOG(ERR, "rtsym '%s' unsupported size: %" PRId64, name, sym->size); err = -EINVAL; break; @@ -279,17 +275,15 @@ nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name, const struct nfp_rtsym *sym; uint8_t *mem; -#ifdef DEBUG - printf("mapping symbol %s\n", name); -#endif + PMD_DRV_LOG(DEBUG, "mapping symbol %s", name); sym = nfp_rtsym_lookup(rtbl, name); if (!sym) { - printf("symbol lookup fails for %s\n", name); + PMD_DRV_LOG(ERR, "symbol lookup fails for %s", name); return NULL; } if (sym->size < min_size) { - printf("Symbol %s too small (%" PRIu64 " < %u)\n", name, + PMD_DRV_LOG(ERR, "Symbol %s too small (%" PRIu64 " < %u)", name, sym->size, min_size); return NULL; } @@ -297,12 +291,10 @@ nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name, mem = nfp_cpp_map_area(rtbl->cpp, sym->domain, sym->target, sym->addr, sym->size, area); if (!mem) { - printf("Failed to map symbol %s\n", name); + PMD_DRV_LOG(ERR, "Failed to map symbol %s", name); return NULL; } -#ifdef DEBUG - printf("symbol %s with address %p\n", name, mem); -#endif + PMD_DRV_LOG(DEBUG, "symbol %s with address %p", name, mem); return mem; } -- 2.29.3