From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier MATZ Subject: Re: [PATCH v4] eal: redefine logtype values Date: Wed, 19 Apr 2017 14:15:27 +0200 Message-ID: <20170419141527.26db741e@glumotte.dev.6wind.com> References: <1492090967-51332-1-git-send-email-pablo.de.lara.guarch@intel.com> <1492601044-27217-1-git-send-email-pablo.de.lara.guarch@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: thomas@monjalon.net, dev@dpdk.org To: Pablo de Lara Return-path: Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) by dpdk.org (Postfix) with ESMTP id 3A8B75587 for ; Wed, 19 Apr 2017 14:15:00 +0200 (CEST) Received: by mail-wm0-f47.google.com with SMTP id w64so78704732wma.0 for ; Wed, 19 Apr 2017 05:15:00 -0700 (PDT) In-Reply-To: <1492601044-27217-1-git-send-email-pablo.de.lara.guarch@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Pablo, On Wed, 19 Apr 2017 12:24:04 +0100, Pablo de Lara wrote: > After the changes in commit c1b5fa94a46f > ("eal: support dynamic log types"), logtype is not treated as a > bitmask, but a decimal value. Therefore, values have to be > converted. > > Fixes: c1b5fa94a46f ("eal: support dynamic log types") > > Signed-off-by: Pablo de Lara > --- > > Changes in v4: > - Moved log type strings to eal_common_log.c > > Changes in v3: > - Created array of structures containing logtype id and string > - Added left shift to convert new decimal values to bitmask for backward compatibility > > Changes in v2: > - Used new RTE_LOGTYPE values in rte_log_init() > > lib/librte_eal/common/eal_common_log.c | 73 ++++++++++++++++++++------------- > lib/librte_eal/common/include/rte_log.h | 58 +++++++++++++------------- > 2 files changed, 73 insertions(+), 58 deletions(-) > > diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c > index dd4d30c..fd76612 100644 > --- a/lib/librte_eal/common/eal_common_log.c > +++ b/lib/librte_eal/common/eal_common_log.c > @@ -118,9 +118,9 @@ rte_set_log_type(uint32_t type, int enable) > { > if (type < RTE_LOGTYPE_FIRST_EXT_ID) { > if (enable) > - rte_logs.type |= type; > + rte_logs.type |= 1 << type; > else > - rte_logs.type &= ~type; > + rte_logs.type &= ~(1 << type); > } > > if (enable) > @@ -240,42 +240,57 @@ rte_log_register(const char *name) > return ret; > } > > +struct logtype { > + uint32_t log_id; > + char logtype[32]; > +}; Sorry I missed it in the previous review, but what do you think of using "const char *" instead of "char[32]"?