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 478D1A0A0E; Tue, 11 May 2021 13:49:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AF73140140; Tue, 11 May 2021 13:49:19 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id C3FC84003E for ; Tue, 11 May 2021 13:49:17 +0200 (CEST) IronPort-SDR: YDESEs3qK2HzKCUDsJkFnszLtW/BsDxcYmldbcPEefNl9g8HSYG7Fmepubzi4GUN3G10jfB5kd 7iqA3VUroMGg== X-IronPort-AV: E=McAfee;i="6200,9189,9980"; a="186555608" X-IronPort-AV: E=Sophos;i="5.82,290,1613462400"; d="scan'208";a="186555608" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2021 04:49:16 -0700 IronPort-SDR: vVQ7wtar3IZVpLKbt1WdCswB1tMW2/g0vgm2bkyuSg0Z/PFgUv/fsfvDVHWUc/C6r/jU7PULGW mMOSoJhxnWCA== X-IronPort-AV: E=Sophos;i="5.82,290,1613462400"; d="scan'208";a="436618968" Received: from bricha3-mobl.ger.corp.intel.com ([10.252.2.198]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 11 May 2021 04:49:15 -0700 Date: Tue, 11 May 2021 12:49:11 +0100 From: Bruce Richardson To: Thomas Monjalon Cc: dev@dpdk.org, andrew.rybchenko@oktetlabs.ru, ferruh.yigit@intel.com, David Marchand Message-ID: References: <20210409124334.24479-1-david.marchand@redhat.com> <20210511100927.824319-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210511100927.824319-1-thomas@monjalon.net> Subject: Re: [dpdk-dev] [PATCH v3] log: register with standardized names 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 Sender: "dev" On Tue, May 11, 2021 at 12:09:27PM +0200, Thomas Monjalon wrote: > From: David Marchand > > Let's try to enforce the convention where most drivers use a pmd. logtype > with their class reflected in it, and libraries use a lib. logtype. > > Introduce two new macros: > - RTE_LOG_REGISTER_DEFAULT can be used when a single logtype is > used in a component. It is associated to the default name provided > by the build system, > - RTE_LOG_REGISTER_SUFFIX can be used when multiple logtypes are used, > and then the passed name is appended to the default name, > > RTE_LOG_REGISTER is left untouched for existing external users > and for components that do not comply with the convention. > > There is a new Meson variable log_prefix to adapt the default name > for baseband (pmd.bb.), bus (no pmd.) and mempool (no pmd.) classes. > > Note: achieved with below commands + reverted change on net/bonding + > edits on crypto/virtio, compress/mlx5, regex/mlx5, baseband, bus and > mempool drivers. > > $ git grep -l RTE_LOG_REGISTER drivers/ | > while read file; do > pattern=${file##drivers/}; > class=${pattern%%/*}; > pattern=${pattern#$class/}; > pattern=pmd.$class.${pattern%%/*}; > sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern',/RTE_LOG_REGISTER_DEFAULT(\1,/' $file; > sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern'\.\(.*\),/RTE_LOG_REGISTER_SUFFIX(\1, \2,/' $file; > done > > $ git grep -l RTE_LOG_REGISTER lib/ | > while read file; do > pattern=${file##lib/}; > pattern=lib.${pattern%%/*}; > sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern',/RTE_LOG_REGISTER_DEFAULT(\1,/' $file; > sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern'\.\(.*\),/RTE_LOG_REGISTER_SUFFIX(\1, \2,/' $file; > done > > Signed-off-by: David Marchand > Signed-off-by: Thomas Monjalon > --- > > Changes since v2: > - use RTE_LOG_REGISTER_DEFAULT in baseband, bus, mempool > by adding the variable log_prefix in drivers/meson.build > > Changes since v1: > - moved default logtype generation in the build system, > - rebased, > - reverted net/bonding change, > > diff --git a/doc/guides/contributing/coding_style.rst b/doc/guides/contributing/coding_style.rst > index 7601162c4f..f58ae948ff 100644 > --- a/doc/guides/contributing/coding_style.rst > +++ b/doc/guides/contributing/coding_style.rst > @@ -986,6 +986,12 @@ includes > > includes += include_directories('base') > > +log_prefix > + **Default Value = pmd.** > + Some driver classes have a customized log prefix. > + This prefix is combined with the driver name > + when registering a default log name for the driver. > + I don't think this should be added here. This section is for elements to be defined in the meson.build file of each individual driver. This value, though, is to be defined per class, rather than per-driver. We don't have a doc section for that, but perhaps one is needed. For now, I'd just omit documenting this value as it should only be of relevance for the couple of existing driver classes that use it. Nobody else contributing new code to DPDK should need it. /Bruce