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 CB99A459C3; Wed, 18 Sep 2024 08:09:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AB1A440EF0; Wed, 18 Sep 2024 08:09:49 +0200 (CEST) Received: from lf-1-37.ptr.blmpb.com (lf-1-37.ptr.blmpb.com [103.149.242.37]) by mails.dpdk.org (Postfix) with ESMTP id 7C7BE40EF0 for ; Wed, 18 Sep 2024 08:09:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=feishu2403070942; d=yunsilicon.com; t=1726639782; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=ea2D+NcY7M1manAFgRTsOLtt7PAPSpxVZR3S8/oVqIk=; b=hnwEmPwnDTVMf1cxZ12QochRzyDNiY37BIScdrS3OLk+1MBrunl45tzNwVELc8ghq65AwC cFLT2ZwzMxfNPEO3Kv9bt2BvOAgYgzWcqvxYGmHnCM55cFIEL6WUE6tYgfw+d88JbPve5Y d23B41Qob27p0qAenQ/smvhdAxI7mJ58vavCRqCELGmLNIbl9a0pv5DATkjxzSNozTWY82 Z2fBrKtrJvpE0a8i/q8+sPMqkU7a5EuTVuj+qRYcFH5NrwGlW0y3OF8nvCusVIvW3O75qq pYQZJhSgIFZr8sLc2vWKOKeCG4rN8LWqIoJG/VR8WiiXTXiedDYKobO/dOp2NA== Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Received: from ubuntu-liun.yunsilicon.com ([58.34.192.114]) by smtp.feishu.cn with ESMTPS; Wed, 18 Sep 2024 14:09:40 +0800 Content-Type: text/plain; charset=UTF-8 Message-Id: <20240918060936.1231758-3-wanry@yunsilicon.com> From: "WanRenyong" X-Mailer: git-send-email 2.25.1 X-Lms-Return-Path: To: Subject: [PATCH v3 02/19] net/xsc: add log macro X-Original-From: WanRenyong Cc: , "WanRenyong" Date: Wed, 18 Sep 2024 14:09:19 +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 Add log macro to print runtime messages and trace functions. Signed-off-by: WanRenyong --- v3: * use RTE_LOG_LINE_PREFIX instead of rte_log --- drivers/net/xsc/xsc_ethdev.c | 11 +++++++++ drivers/net/xsc/xsc_log.h | 46 ++++++++++++++++++++++++++++++++++++ 2 files changed, 57 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..99a88fcd1b --- /dev/null +++ b/drivers/net/xsc/xsc_log.h @@ -0,0 +1,46 @@ +/* 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 RTE_LOGTYPE_XSC_INIT xsc_logtype_init +#define RTE_LOGTYPE_XSC_DRV xsc_logtype_driver + + +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, XSC_INIT, "%s(): ", __func__, __VA_ARGS__) + + +#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") + +#ifdef RTE_ETHDEV_DEBUG_RX +extern int xsc_logtype_rx; +#define RTE_LOGTYPE_XSC_RX xsc_logtype_rx +#define PMD_RX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, XSC_RX, "%s(): ", __func__, __VA_ARGS__) +#else +#define PMD_RX_LOG(level, ...) do { } while (0) +#endif + +#ifdef RTE_ETHDEV_DEBUG_TX +extern int xsc_logtype_tx; +#define RTE_LOGTYPE_XSC_TX xsc_logtype_tx +#define PMD_TX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, XSC_TX, "%s(): ", __func__, __VA_ARGS__) +#else +#define PMD_TX_LOG(level, ...) do { } while (0) +#endif + +#define PMD_DRV_LOG_RAW(level, ...) \ + RTE_LOG_LINE_PREFIX(level, XSC_DRV, "%s(): ", __func__, __VA_ARGS__) + +#define PMD_DRV_LOG(level, ...) \ + PMD_DRV_LOG_RAW(level, __VA_ARGS__) + +#endif /* _XSC_LOG_H_ */ -- 2.25.1