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 D428F45923; Thu, 12 Sep 2024 03:22:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 621A84027D; Thu, 12 Sep 2024 03:22:45 +0200 (CEST) Received: from lf-1-13.ptr.blmpb.com (lf-1-13.ptr.blmpb.com [103.149.242.13]) by mails.dpdk.org (Postfix) with ESMTP id 52B0340267 for ; Thu, 12 Sep 2024 03:22:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=feishu2403070942; d=yunsilicon.com; t=1726104157; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=2iCFRJSjsiAWPLNJ8vmYuNU41NMwgE9XZi/P+gr1MNo=; b=OkeI8TqN8JadKOcUc98PE0oodw2Zw+17SmTIUzrR02GWB65HdgdublFaYKKTBYn0jzSCDA +2uU732YaNwJ1aMG1RgJ3p/OjkjBGfb5yc5bpz2Q6Cbe3CE9YY6IDFwXEYZIrVa7vrciUi lVkTAeMyjcYmMmzQWoTywnNRFNlhA+EcDf8oNgvm0apI2CMsyVFFU0JZ0rXJju5Wn2tYVB RHsaui8EuyAfDVHZ7QqyMVMg+3ohTaPVJ2KbM+aJu+tJk8EWBIXzQxxpTAm76kQ/rkG9YU AnpX6OE0dMpY2YknCxP5b+i2M/4aSnw8H7EEqp3Dhs2twYbFpLCmF9mEQFHhjw== Date: Thu, 12 Sep 2024 09:22:34 +0800 Message-Id: Mime-Version: 1.0 In-Reply-To: To: "David Marchand" References: <20240911020740.3950704-3-wanry@yunsilicon.com> Cc: , , From: "WanRenyong" Content-Type: text/plain; charset=UTF-8 X-Original-From: WanRenyong Subject: Re: [PATCH v2 02/19] net/xsc: add log macro Content-Transfer-Encoding: quoted-printable X-Lms-Return-Path: User-Agent: Mozilla Thunderbird Received: from [127.0.0.1] ([222.64.242.227]) by smtp.feishu.cn with ESMTPS; Thu, 12 Sep 2024 09:22:35 +0800 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 2024/9/11 15:40, David Marchand wrote: > On Wed, Sep 11, 2024 at 4:08=E2=80=AFAM WanRenyong = wrote: >> 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. > > OK, will fix it in next version. --=20 Thanks, WanRenyong