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 15F664595D; Wed, 11 Sep 2024 09:40:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D8F4E402D1; Wed, 11 Sep 2024 09:40:39 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id BEFEC402CE for ; Wed, 11 Sep 2024 09:40:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726040438; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UpY/3yiOX6X2sIW1Il2e5mqv5/5fQlcZQz4xOTcNOWc=; b=gC+afmiZpmHNiX6qkbVI8InS+6BADlJUbULeGW7gNsmJNF+nliwiqMVbHT9wI+wv/o84O8 r86F0J8VAb8tX1wL7roK3pdLf6GZgtP0xBJ02oN5O7nwqkqGHrmHmT+XpltQpH3zQod7N2 uSo27soWZ086xevHvuxY6Fof0v90Cq0= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-217-e4_WPao0OkKlgN0oLk-vIQ-1; Wed, 11 Sep 2024 03:40:36 -0400 X-MC-Unique: e4_WPao0OkKlgN0oLk-vIQ-1 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-536589936d3so1436452e87.0 for ; Wed, 11 Sep 2024 00:40:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726040435; x=1726645235; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UpY/3yiOX6X2sIW1Il2e5mqv5/5fQlcZQz4xOTcNOWc=; b=DnjlGb/6m5X30QB6kyv4wxucrBBOYROZ82ITX13nk6Rs7ySARZ1E4cUgZGtvCHzQow hVkqW8hISfMibKQur+JjV85w3Ks/kQDg9KDF7Bs9lKH3cB53ufgPYMEBfQX8Z4CzlnUF Qkav/uxkFZ51TP7Fj9ojlVl4ngC9jC8+qJc1+Kdt3o5GS4/xPR8yd4imQ1pJBrjeipxc 7B04rYFQLXLSnDQBrqKmGebE1AzjKOvCi493iviq21EU6Dmz65kIa6JOcHxcDJ2SXhWF IWkRkGoE+SCbVwGfKhiB+cE5/j4sE+vwGetuRVEFfNVwl3wePQdVA4Eq0lDWU3dPG+OI ZDSw== X-Gm-Message-State: AOJu0YyWop9mN5Yar47ZhbtxHcUtigrfRtnXCUtCkIO+KEtKOkAr/wC9 ldFI65rL9tphSJ4fZ3HjJwfbF/nS1qoigzPqajrTkh1Mpawv0GAx0h7959dmTyy3zCyKNcYC0s3 LrqdKRSq+ScHH2LkY+ZBTsPSgyyBQRscyNfwTsKdMMrjv0GuaXPl/tRpQtgViKXQUI/IWutSPXf oSkqNjd9x405el4hI= X-Received: by 2002:a05:6512:2208:b0:536:545c:bbf6 with SMTP id 2adb3069b0e04-53673a633e9mr1040435e87.1.1726040435125; Wed, 11 Sep 2024 00:40:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFe0WHUDdffurAjQxvX93POaOzRvA94s+sJ8QpMsdm//4t5udquuc/GtaExJmL6cUd8OmZS1h6z6gwSXxGce2A= X-Received: by 2002:a05:6512:2208:b0:536:545c:bbf6 with SMTP id 2adb3069b0e04-53673a633e9mr1040416e87.1.1726040434511; Wed, 11 Sep 2024 00:40:34 -0700 (PDT) MIME-Version: 1.0 References: <20240911020740.3950704-3-wanry@yunsilicon.com> In-Reply-To: <20240911020740.3950704-3-wanry@yunsilicon.com> From: David Marchand Date: Wed, 11 Sep 2024 09:40:23 +0200 Message-ID: Subject: Re: [PATCH v2 02/19] net/xsc: add log macro To: WanRenyong Cc: dev@dpdk.org, ferruh.yigit@amd.com, thomas@monjalon.net X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Wed, Sep 11, 2024 at 4:08=E2=80=AFAM WanRenyong w= rote: > > Add log macro to print runtime messages and trace functions. > > Signed-off-by: WanRenyong > --- > drivers/net/xsc/xsc_ethdev.c | 11 +++++++++ > drivers/net/xsc/xsc_log.h | 44 ++++++++++++++++++++++++++++++++++++ > 2 files changed, 55 insertions(+) > create mode 100644 drivers/net/xsc/xsc_log.h > > diff --git a/drivers/net/xsc/xsc_ethdev.c b/drivers/net/xsc/xsc_ethdev.c > index 0e48cb76fa..58ceaa3940 100644 > --- a/drivers/net/xsc/xsc_ethdev.c > +++ b/drivers/net/xsc/xsc_ethdev.c > @@ -1,3 +1,14 @@ > /* SPDX-License-Identifier: BSD-3-Clause > * Copyright 2024 Yunsilicon Technology Co., Ltd. > */ > + > +#include "xsc_log.h" > + > +RTE_LOG_REGISTER_SUFFIX(xsc_logtype_init, init, NOTICE); > +RTE_LOG_REGISTER_SUFFIX(xsc_logtype_driver, driver, NOTICE); > +#ifdef RTE_ETHDEV_DEBUG_RX > +RTE_LOG_REGISTER_SUFFIX(xsc_logtype_rx, rx, DEBUG); > +#endif > +#ifdef RTE_ETHDEV_DEBUG_TX > +RTE_LOG_REGISTER_SUFFIX(xsc_logtype_tx, tx, DEBUG); > +#endif > diff --git a/drivers/net/xsc/xsc_log.h b/drivers/net/xsc/xsc_log.h > new file mode 100644 > index 0000000000..163145ff09 > --- /dev/null > +++ b/drivers/net/xsc/xsc_log.h > @@ -0,0 +1,44 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright 2024 Yunsilicon Technology Co., Ltd. > + */ > + > +#ifndef _XSC_LOG_H_ > +#define _XSC_LOG_H_ > + > +#include > + > +extern int xsc_logtype_init; > +extern int xsc_logtype_driver; > + > +#define PMD_INIT_LOG(level, fmt, ...) \ > + rte_log(RTE_LOG_ ## level, xsc_logtype_init, "%s(): " fmt "\n", \ > + __func__, ##__VA_ARGS__) > + > +#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") > + > +#ifdef RTE_ETHDEV_DEBUG_RX > +extern int xsc_logtype_rx; > +#define PMD_RX_LOG(level, fmt, ...) \ > + rte_log(RTE_LOG_ ## level, xsc_logtype_rx, \ > + "%s(): " fmt "\n", __func__, ##__VA_ARGS__) > +#else > +#define PMD_RX_LOG(level, fmt, ...) do { } while (0) > +#endif > + > +#ifdef RTE_ETHDEV_DEBUG_TX > +extern int xsc_logtype_tx; > +#define PMD_TX_LOG(level, fmt, ...) \ > + rte_log(RTE_LOG_ ## level, xsc_logtype_tx, \ > + "%s(): " fmt "\n", __func__, ##__VA_ARGS__) > +#else > +#define PMD_TX_LOG(level, fmt, ...) do { } while (0) > +#endif > + > +#define PMD_DRV_LOG_RAW(level, fmt, ...) \ > + rte_log(RTE_LOG_ ## level, xsc_logtype_driver, "%s(): " fmt, \ > + __func__, ##__VA_ARGS__) > + > +#define PMD_DRV_LOG(level, fmt, ...) \ > + PMD_DRV_LOG_RAW(level, fmt "\n", ##__VA_ARGS__) > + > +#endif /* _XSC_LOG_H_ */ Please use RTE_LOG_LINE_PREFIX in those macros. --=20 David Marchand