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 8CC7341CE5; Mon, 20 Feb 2023 11:12:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7CF4543008; Mon, 20 Feb 2023 11:12:05 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2080.outbound.protection.outlook.com [40.107.92.80]) by mails.dpdk.org (Postfix) with ESMTP id F42294300A for ; Mon, 20 Feb 2023 11:12:03 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hLI9WaLJfiWyBAcE6BdFkEDu23zaz40oFCuITvQJgyq+xZDEv/glc/+D/VdOy9skGg4BYpf2LZ73fwsXq0wqqz2BDwJqyEeEt0/HhL1hOMx1H2zyj/SwJ7JvV1jwyJCYjGTV4rQUzkHEgbYV0jmeErje1JOhOQzntLbiqSautfrWKsVS6hyppjY5B14IVwXRihDoczSdO7TfmgN5Ax9bPdnh8Cbx/ZLv2A6sIAvGAaaHgyI5nW4jJYewDOmMFxj56Ph5uV63Hv6vtp8+ghM7ANVy7HpQZihZQWVZKGyvxbXoCACmUab2dNC94JjP8DmxLpdmTnPdo7GSCnJEomxgeA== 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=hiQhc8e0N7AamRScIiLXiWfHP5hf8/dmGUKMeTzhFDY=; b=CGFdOq3gaGBlEaf/JQB0/c86VE6Ax3y6QVuCr4ntwuLeehthWfkMVwb9MGPOM55frPR3vQ/lhe7oVBn95GlEszKiXMI2fIfFSkcKwtfqh5lqjDtMdk5vm31wsaPs+4Pymx/vYnv6LddoAX4Sl5VzxSEkM3MoBDgY1nBINkWlboEhNIOKMELFTkAw/RWYhr6g/nq0PF/w99gKujCP3EKEYE8KpXasdcUHo/T642yxJrdJiE9ZMY0UuLPK9nL3hnfzGxuSwNrRviAeU+8ZbdX9lPrPUZLiqtWMIzuOOeAw7ijqX43q0+7mxkmX99pios/hoxeuOyIprwZETkZOVkWKrQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hiQhc8e0N7AamRScIiLXiWfHP5hf8/dmGUKMeTzhFDY=; b=EA+au7M5BnHuuT15rrPn6zKy++HVgxc7EjyskpI9UQv+mW642iHmdvyZXXyEnybfxXPsdvgbekDc2r2I4ukC53yiBY89ptzO7E6lyRrwDyyYSC4GqZCZg5qPQMxtPM2StjkNlk4Q6u6MfB0AItWYGTsJNR83kdBfuhIkQPM7s+A= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by BL3PR12MB6449.namprd12.prod.outlook.com (2603:10b6:208:3b8::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.17; Mon, 20 Feb 2023 10:12:01 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::3614:22ed:ed5:5b48]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::3614:22ed:ed5:5b48%8]) with mapi id 15.20.6111.020; Mon, 20 Feb 2023 10:12:01 +0000 Message-ID: <357ee243-d0d1-37fb-f7f3-ba4d99a001ed@amd.com> Date: Mon, 20 Feb 2023 10:09:51 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH 2/3] net/nfp: get rid of the usage of RTE log level type Content-Language: en-US To: Chaoyong He , "dev@dpdk.org" Cc: oss-drivers , Niklas Soderlund References: <20230217024539.16514-1-chaoyong.he@corigine.com> <20230217024539.16514-3-chaoyong.he@corigine.com> From: Ferruh Yigit In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO2P265CA0249.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8a::21) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|BL3PR12MB6449:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f0a253c-ee0e-48a7-fd8d-08db132ae814 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wMvmIe3OVMCDgrHelD6S8tW6rfPJ5lWjLMA33/iY+BihHlchgJlmkQNoB0guIVUujXZPzd9BNsbTrpE+QMb2OmWzF1O/hjVeY4jU5JwxGO8OAP/331kY6ie6W3EkMRArwrp1Srk0NYE3903StB57Moj+kdFZz0c8VhC6sFH2r15AImY0kt2K921ZpzwRpeljTVk4uzQjcrGHvJnbNpOfe6bc6PpiWlS49oI2HZNDjPWuzY+bM2fAwpEtEJIPSE17F86ulsc2cwH6xqmZ0szfOQKGPKfkqpeZVUDjixU74wgm0BKR21X0sJ+Ex/ygGjjTIzrADIiaS/qJDZf6hVOxt2D/5IuAdskBm/751dMzpa2wC3jnZU81CTl8KFxDUIAbtspR5Nrkueo7bjddrzsSH93gn1i6XjpgB4j9rj2gqvydW8RMqif5u4FKyBGXCCn0zj10y6tf+QytG+QlSavGQzPghiA0JERbOAFkGioNUrPnBhV79RbuYv1umz1LExf/yk7OqNP8F9TOAsno4/j38NYB4nE5WsKYidem8REz52nYFxMAJ/d5vkKZA0dSLpJ/EN3Qp/mdneezM+kU+obwJYdSEBkT0Ci43eApgFzBTqhHkdudV3AhXMlfafegFfhraPCW+370/jTL7sO/ku9KYvu4DnvDBKho/EW7Av1I42etqdpb7X5246tfI5GETDCkgM9NMNzCV1yeMNJ126qCsp6OiaGXuKB0EoXv49JhPcvlcFMH3Bv2DTcUqNNbXJHMUHaTIGYs3TvzdzLp7uo0iQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(39860400002)(346002)(366004)(376002)(396003)(136003)(451199018)(31686004)(44832011)(2906002)(5660300002)(66574015)(83380400001)(8936002)(36756003)(6486002)(6666004)(6506007)(6512007)(53546011)(26005)(186003)(2616005)(38100700002)(86362001)(31696002)(41300700001)(478600001)(4326008)(66476007)(66556008)(66946007)(8676002)(54906003)(316002)(110136005)(26583001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SEhiSko5cXJNYkVIVWxwbEQwVzZjT3ZPMUpFMW5wNmJWeXVyTlM4d2xJaElz?= =?utf-8?B?eWpLSUdQRklHNUo1RVN2SnIzWjFwUnlhVkRBUzZMT1ZyS1ZnTlAwU0YzcEJm?= =?utf-8?B?NGlYUHQ3WkRLSlVCelVoL3JxSlRKOXd6RW1jQzd5RFhZbmptYnhkcEFkcUFv?= =?utf-8?B?WkFmdVJKaWdLWG03dGo3NTBsZWFEaFZTU1pTTkRQRjl3ZnJDc2FUYm0ycWdk?= =?utf-8?B?aG5LaTE2cWdjMUVaTjRUNzBOVUZMZ0c2M0ZNcFpsTzNaKzJBVGx6NG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EhmbzZkdkJSTDhXVHNrWFZLdnRX?= =?utf-8?Q?Cly1Ay2vunYDYLCcUl70HInDx?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f0a253c-ee0e-48a7-fd8d-08db132ae814 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2023 10:12:00.8488 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8tCyTcZDB4zNGcnLOHFOk7pm7ACWqJl8DJ97SfXoIh3Hv56AKbgf/PAdCHVorCOn X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6449 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 On 2/20/2023 1:36 AM, Chaoyong He wrote: >> On 2/17/2023 2:45 AM, Chaoyong He wrote: >>> Register the own RX/TX debug log level type, and get rid of the usage >>> of RTE_LOGTYPE_*. Then we can control the log by a independent switch. >>> >>> Signed-off-by: Chaoyong He >>> Reviewed-by: Niklas Söderlund >>> --- >>> drivers/net/nfp/nfp_logs.c | 10 ++++++++++ >>> drivers/net/nfp/nfp_logs.h | 8 ++++++-- >>> 2 files changed, 16 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/net/nfp/nfp_logs.c b/drivers/net/nfp/nfp_logs.c >>> index 48c42fe53f..cd58bcee43 100644 >>> --- a/drivers/net/nfp/nfp_logs.c >>> +++ b/drivers/net/nfp/nfp_logs.c >>> @@ -5,6 +5,16 @@ >>> >>> #include "nfp_logs.h" >>> >>> +#include >>> + >>> RTE_LOG_REGISTER_SUFFIX(nfp_logtype_init, init, NOTICE); >>> RTE_LOG_REGISTER_SUFFIX(nfp_logtype_driver, driver, NOTICE); >>> RTE_LOG_REGISTER_SUFFIX(nfp_logtype_cpp, cpp, NOTICE); >>> + >>> +#ifdef RTE_ETHDEV_DEBUG_RX >>> +RTE_LOG_REGISTER_SUFFIX(nfp_logtype_rx, rx, DEBUG) #endif >>> + >>> +#ifdef RTE_ETHDEV_DEBUG_TX >>> +RTE_LOG_REGISTER_SUFFIX(nfp_logtype_tx, tx, DEBUG) #endif >>> diff --git a/drivers/net/nfp/nfp_logs.h b/drivers/net/nfp/nfp_logs.h >>> index b7632ee72c..315a57811c 100644 >>> --- a/drivers/net/nfp/nfp_logs.h >>> +++ b/drivers/net/nfp/nfp_logs.h >>> @@ -15,15 +15,19 @@ extern int nfp_logtype_init; #define >>> PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") >>> >>> #ifdef RTE_ETHDEV_DEBUG_RX >>> +extern int nfp_logtype_rx; >>> #define PMD_RX_LOG(level, fmt, args...) \ >>> - RTE_LOG(level, PMD, "%s() rx: " fmt "\n", __func__, ## args) >>> + rte_log(RTE_LOG_ ## level, nfp_logtype_rx, \ >>> + "%s(): " fmt "\n", __func__, ## args) >>> #else >>> #define PMD_RX_LOG(level, fmt, args...) do { } while (0) #endif >>> >>> #ifdef RTE_ETHDEV_DEBUG_TX >>> +extern int nfp_logtype_tx; >>> #define PMD_TX_LOG(level, fmt, args...) \ >>> - RTE_LOG(level, PMD, "%s() tx: " fmt "\n", __func__, ## args) >>> + rte_log(RTE_LOG_ ## level, nfp_logtype_tx, \ >>> + "%s(): " fmt "\n", __func__, ## args) >>> #else >>> #define PMD_TX_LOG(level, fmt, args...) do { } while (0) #endif >> >> Intention is to replace 'RTE_LOG_DP' with 'PMD_RX_LOG'/'PMD_TX_LOG', >> but these are not exactly same (although difference is minor). >> >> When 'RTE_ETHDEV_DEBUG_RX' is set, ethdev layer also adds some >> additional load, although I believe that will small comparing to logging in >> driver. >> If 'RTE_LOG_DP' used, the ethdev layer cost can be removed. >> >> With 'RTE_LOG_DP', log level more verbose than requested won't cause any >> performance impact. Like if ERR level requested, INFO, DEBUG etc logs will >> be compiled out and won't cause any performance impact. >> But with 'RTE_ETHDEV_DEBUG_RX', even log level only request ERR, all >> logging will add cost of at least an if branch (checking log level). >> >> >> For many cases I am not sure these differences matters, and already many >> drivers directly uses 'RTE_ETHDEV_DEBUG_RX' as done here. So you may >> prefer to keep as it is. >> >> But if there is a desire for this fine grain approach, it is possible to add a >> version of 'RTE_LOG_DP' macro that accepts dynamic log type (instead of >> static RTE_LOGTYPE_# type), what do you think? >> > > Thanks for the suggestion. > For now, we prefer to keep as it is. > If we does need the more refined design in the future, we would follow your advice here, thanks again. ack, I just wanted to double check. I will proceed as it is.