From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 54AE2A0093; Wed, 27 May 2020 18:05:23 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B06AF1DA97; Wed, 27 May 2020 18:05:22 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id D8C991D9D1 for ; Wed, 27 May 2020 18:05:21 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 04RFxvxO021069; Wed, 27 May 2020 09:05:20 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=IFStTMcPh/HuDGd5Ew38qe8yJtP5q5LYe6MKs1uniIQ=; b=RBjzV4qW81XMHUjGKcx7R11l3Kmim3Ll78zE8kEhCRjKzv0THmFvszPKc2ONAAavhC46 naYLZMqq/uG080xQRlVm1eXXSYKdJLICCCxvIkl9u0hmsyIULaqxzcYzRkwzV3lp8wgQ HtsOYhYHFiKBieqz0NZAbS/UXRMA/MtYWev8JzaqCd2p1hKKjMhszqOK1hc6n44T9vGd iLkydC13H2XZFOUAJaFazeb0dafn/JUdYHVmXc77+ZC5eXeeAT4X3YLPekT6RWwqax1s ti12u+DNuqnBoHMqbVp4R2UHnSzU3uHW7dtACEDiztaSQnnVuwZlZHSCS/1gUXyt8Qhp CQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 31716qxs96-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 27 May 2020 09:05:17 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 27 May 2020 09:05:16 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.173) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Wed, 27 May 2020 09:05:16 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DHZHXDnGEzezm1xkQn6A4vEX8mwWgbP8C76mPSh40AEW6IsXhqf3YHwg3bbyaj+yF2yQDkkbt1iLDflz+jRwZQ5oPnqSx1DahoxQvmOQ4GFRHPLwGcPg/K0+obWWhPib8vN7gjj8ULunvieTPzlyX0i9T55D+d5kOq8fUO8ZW2jfSyvKz/6zjp9B+EgBsSE711Vt08cnRmYxXAqGw3NzChU+PEwEsjZU7rDEyBoSGe7770RnoEDza4EGTRaAlvoh7FcNDy7YgVyqZ6uNqISIH9v6SjhiATu2IwUobjNY6HUvaR51aPoSWYSTxvGOBy39XA861joXEElKuHlhwwjMHw== 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-SenderADCheck; bh=IFStTMcPh/HuDGd5Ew38qe8yJtP5q5LYe6MKs1uniIQ=; b=Va80sDd76dMGoJGEefnfUBuEmTBKVIPKgZpeH/3YV5hOvAKfbWBq8glDfwiypgJYuVvSBP7yS+Y33rMj58fXWHdBHwbaDA47An5T54u3J+kQO8fHkCkUhaStgrRdCSfu3HgAZn0lZi1lP3xv/g9FUSzUMKABjhPidXIOcjY9H8ZhQjTUfFehvDn3oqsRWDeLQJydowMchiOz3O5JGoQla5G6LNL9WU3Ai04M0OJXqwiwbNZpDDoms2bWLnNoRpgoXZp28DBRIUi/0FVBeW2hbO5JDRWKJMP0HGhaWmTsSqWw3+Sev26UthTaq0uEFWQDC3KsVG/El5kc0ydtMddylw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IFStTMcPh/HuDGd5Ew38qe8yJtP5q5LYe6MKs1uniIQ=; b=p7yZPgvE7nbA1KtFJ7be/xJfitSXHq6Bj8nKYlFbLSmBmX69WIqGZpv8ehr2frOMCgCJwTKOV1i/EjDwLjP4jQ327Xp4WFUPcSj4V9+CZW56DP+DdywaJNgghxKll61yN9lpasovJTi86PJphvIv0b511/ZVudkeEFk9VYIDfdE= Received: from BYAPR18MB2424.namprd18.prod.outlook.com (2603:10b6:a03:130::21) by BYAPR18MB3015.namprd18.prod.outlook.com (2603:10b6:a03:13c::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.27; Wed, 27 May 2020 16:05:15 +0000 Received: from BYAPR18MB2424.namprd18.prod.outlook.com ([fe80::659e:abff:6625:aafe]) by BYAPR18MB2424.namprd18.prod.outlook.com ([fe80::659e:abff:6625:aafe%3]) with mapi id 15.20.3021.030; Wed, 27 May 2020 16:05:15 +0000 From: Jerin Kollanukkaran To: Olivier Matz , "david.marchand@redhat.com" , dpdk-dev Thread-Topic: rte_log simplification using constructor scheme Thread-Index: AdY0QBnteAt9aFXHQhWTRThWMDOgLg== Date: Wed, 27 May 2020 16:05:14 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: 6wind.com; dkim=none (message not signed) header.d=none;6wind.com; dmarc=none action=none header.from=marvell.com; x-originating-ip: [171.61.103.174] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ee8c968f-c655-47e8-faa6-08d80257be4d x-ms-traffictypediagnostic: BYAPR18MB3015: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 04163EF38A x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: GJ5Kg9cfIf+09yHr3dgbQyG33iFF5mw2oCiR3XfoZIsPodAFYV88gl6ZhQbCeKR41LRCqAOrgdYZk4mcHZydCk3Sna4RQrgKV5V9ftOapK2jVkvQ+XfkGUxkAmdEkRD++Qy16vOd+nUGzriMsPZmKTu6k10drEDiUNVGp9Gt5ROGffPyciyRuXH589E80I1f9l4upAk1bf0ZsKYrzDzdAzEeoOq6flOowA00EDaZZgT6JjCgJ4hjpSTlN2DfVssSgijm6rbIEfr/IXWymMgD4WbEfDNH+72F9q3o3S7iWhLpCeQ222Z6sbv/j+fnu+BL6BIH0aEz7wO0J97/d51gYzj4jSyO5FfxfQ8ObdGyqYLS+d87iFW9KpbKwl8TwXRhxDqUm55HSqrEmlXh+8Zayw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR18MB2424.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(346002)(376002)(366004)(136003)(396003)(39860400002)(26005)(33656002)(110136005)(5660300002)(86362001)(8936002)(52536014)(4743002)(966005)(8676002)(66446008)(9686003)(316002)(55016002)(186003)(6506007)(66946007)(64756008)(71200400001)(2906002)(66476007)(76116006)(66556008)(7696005)(83380400001)(478600001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: xpht0gkly1wQ4I11JDxvLeJ66of1qIKTqFE9FROJFTfmLeoxY2HtfyFuxSmLhKDRve2oREwqxzlvpnRSnrMUeCHbBzqyPoZDQ4oCRzwpo6UkCgToB+6F/fIGaf9JNySV3Umf2vFs+k5rU/flA0ZMyJiS1oysq5pjwus27TlU5j+rCRBx72XxD9yxehcfPd6I7XS+xQYfiNz7MZiEXJUhXKUH5oO0+WoktgMuoKm2r8piUrv6y0zXFv8J9birJ4BHec19Sn4frsLJ3usZtgNbEeiHst5zx1EIyjx9vF6mpZ8c967RVtGA/gIfKnG5jm4mtBCsBOIgztniPvrrbTBAE2UbVo5UNJN43Tf/6dNm//XFG9k4p8WnzOpr2Hg2rVzeYpsDZp49+GUY20caUFOqjvdQJyNvq3i6s/tMRWK3U3WTV0dkNucFgulF/gczYF/uXccR/cED/T6Y5BwZsVorrtyewh8LOhYkTQlyOQVN+0lCNurn62MV4Qk6k12ADMvG x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: ee8c968f-c655-47e8-faa6-08d80257be4d X-MS-Exchange-CrossTenant-originalarrivaltime: 27 May 2020 16:05:14.9857 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: hAs2ui70PKXDssHQX6pRbvnHyS+/ZYTt1/SXamMUklHW0poqCIRNUTYv+vadaMEDlQL1cdmt15j7+bWWcfK2Cg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR18MB3015 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-05-27_03:2020-05-27, 2020-05-27 signatures=0 Subject: [dpdk-dev] rte_log simplification using constructor scheme 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Based on the discussion happed on http://patches.dpdk.org/patch/69681/, I would like simply the rte_log to use constructor scheme and submit patch = to update existing consumer of rte_log to use new scheme for v20.08. RTE_LOG_REGISTER will an optional symbol to use the rte_log registration me= chanism. Let me know if there any overlap on someone's else work on the same area or= any objections? Example cleanup for octeontx2 driver. diff --git a/drivers/common/octeontx2/otx2_common.c b/drivers/common/octeontx2/otx2_common.c index 1a257cf07..4d391a7e0 100644 --- a/drivers/common/octeontx2/otx2_common.c +++ b/drivers/common/octeontx2/otx2_common.c @@ -169,89 +169,13 @@ int otx2_npa_lf_obj_ref(void) return cnt ? 0 : -EINVAL; } -/** - * @internal - */ -int otx2_logtype_base; -/** - * @internal - */ -int otx2_logtype_mbox; -/** - * @internal - */ -int otx2_logtype_npa; -/** - * @internal - */ -int otx2_logtype_nix; -/** - * @internal - */ -int otx2_logtype_npc; -/** - * @internal - */ -int otx2_logtype_tm; -/** - * @internal - */ -int otx2_logtype_sso; -/** - * @internal - */ -int otx2_logtype_tim; -/** - * @internal - */ -int otx2_logtype_dpi; -/** - * @internal - */ -int otx2_logtype_ep; - -RTE_INIT(otx2_log_init); -static void -otx2_log_init(void) -{ - otx2_logtype_base =3D rte_log_register("pmd.octeontx2.base"); - if (otx2_logtype_base >=3D 0) - rte_log_set_level(otx2_logtype_base, RTE_LOG_NOTICE); - - otx2_logtype_mbox =3D rte_log_register("pmd.octeontx2.mbox"); - if (otx2_logtype_mbox >=3D 0) - rte_log_set_level(otx2_logtype_mbox, RTE_LOG_NOTICE); - - otx2_logtype_npa =3D rte_log_register("pmd.mempool.octeontx2"); - if (otx2_logtype_npa >=3D 0) - rte_log_set_level(otx2_logtype_npa, RTE_LOG_NOTICE); - - otx2_logtype_nix =3D rte_log_register("pmd.net.octeontx2"); - if (otx2_logtype_nix >=3D 0) - rte_log_set_level(otx2_logtype_nix, RTE_LOG_NOTICE); - - otx2_logtype_npc =3D rte_log_register("pmd.net.octeontx2.flow"); - if (otx2_logtype_npc >=3D 0) - rte_log_set_level(otx2_logtype_npc, RTE_LOG_NOTICE); - - otx2_logtype_tm =3D rte_log_register("pmd.net.octeontx2.tm"); - if (otx2_logtype_tm >=3D 0) - rte_log_set_level(otx2_logtype_tm, RTE_LOG_NOTICE); - - otx2_logtype_sso =3D rte_log_register("pmd.event.octeontx2"); - if (otx2_logtype_sso >=3D 0) - rte_log_set_level(otx2_logtype_sso, RTE_LOG_NOTICE); - - otx2_logtype_tim =3D rte_log_register("pmd.event.octeontx2.timer"); - if (otx2_logtype_tim >=3D 0) - rte_log_set_level(otx2_logtype_tim, RTE_LOG_NOTICE); - - otx2_logtype_dpi =3D rte_log_register("pmd.raw.octeontx2.dpi"); - if (otx2_logtype_dpi >=3D 0) - rte_log_set_level(otx2_logtype_dpi, RTE_LOG_NOTICE); - - otx2_logtype_ep =3D rte_log_register("pmd.raw.octeontx2.ep"); - if (otx2_logtype_ep >=3D 0) - rte_log_set_level(otx2_logtype_ep, RTE_LOG_NOTICE); - -} +RTE_LOG_REGISTER(otx2_logtype_base, pmd.octeontx2.base, NOTICE); +RTE_LOG_REGISTER(otx2_logtype_mbox, pmd.octeontx2.mbox, NOTICE); +RTE_LOG_REGISTER(otx2_logtype_npa, pmd.mempool.octeontx2, NOTICE); +RTE_LOG_REGISTER(otx2_logtype_nix, pmd.net.octeontx2, NOTICE); +RTE_LOG_REGISTER(otx2_logtype_npc, pmd.net.octeontx2.flow, NOTICE); +RTE_LOG_REGISTER(otx2_logtype_tm, pmd.net.octeontx2.tm, NOTICE); +RTE_LOG_REGISTER(otx2_logtype_sso, pmd.event.octeontx2, NOTICE); +RTE_LOG_REGISTER(otx2_logtype_tim, pmd.event.octeontx2.timer, NOTICE); +RTE_LOG_REGISTER(otx2_logtype_dpi, pmd.raw.octeontx2.dpi, NOTICE); +RTE_LOG_REGISTER(otx2_logtype_ep, pmd.raw.octeontx2.ep, NOTICE); diff --git a/lib/librte_eal/include/rte_log.h b/lib/librte_eal/include/rte_= log.h index 1789ede56..22fc3802f 100644 --- a/lib/librte_eal/include/rte_log.h +++ b/lib/librte_eal/include/rte_log.h @@ -376,6 +376,15 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap) RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__) : \ 0) +#define RTE_LOG_REGISTER(type, name, level) \ +int type; \ +RTE_INIT(__##type) \ +{ \ + type =3D rte_log_register(RTE_STR(name)); \ + if (type >=3D 0) \ + rte_log_set_level(type, RTE_LOG_##level); \ +} + #ifdef __cplusplus } #endif