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 CAE4C45CF3; Tue, 12 Nov 2024 10:58:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B2E0942E0C; Tue, 12 Nov 2024 10:58:38 +0100 (CET) Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by mails.dpdk.org (Postfix) with ESMTP id 9BD3342DDE for ; Tue, 12 Nov 2024 10:58:36 +0100 (CET) X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 4AC9wYtX53637474, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=realsil.com.cn; s=dkim; t=1731405514; bh=c0anAoBa9oMVHtCjyQ7A1upECKeZOhu1IITNFHQOhVw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type; b=PyOp5TQC4esaSJeC+8YyLLDCf18jq3gzZTEXr0ei6E4FGDwCPF2dfpn6S264IswC/ NGkuDjbaIQnl/zKbd21Cm3rKqadJULA82U/FBOwmtgi0j1EgpeBi4/mzu/7adRICGd a2ONjStfaNk1KsjTwkjy3mF3VPvIcmoyOZH8A0EkTBgSgOKCJP1KXMvDVgMo2g36Hq FVu3HLbXfgP5KxksNLN1RRXvfhHYEUhQ4siuoKsf83QXcBG9ZL/+UxrkiuOjCOJPy1 vDPYlNg6YxfAYQW32rAoIsww7fwQxJP9bqnlvHjNNOOhUVC9BKCxZMJhwYqkpFUuPR nH3VFZ6Zw37Og== Received: from RSEXMBS01.realsil.com.cn ([172.29.17.195]) by rtits2.realtek.com.tw (8.15.2/3.06/5.92) with ESMTPS id 4AC9wYtX53637474 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 12 Nov 2024 17:58:34 +0800 Received: from RSEXH36502.realsil.com.cn (172.29.17.3) by RSEXMBS01.realsil.com.cn (172.29.17.195) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 12 Nov 2024 17:58:34 +0800 Received: from 172.29.32.27 (172.29.32.27) by RSEXH36502.realsil.com.cn (172.29.17.3) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Tue, 12 Nov 2024 17:58:34 +0800 From: Howard Wang To: CC: , Howard Wang Subject: [PATCH v7 02/17] net/r8169: add logging structure Date: Tue, 12 Nov 2024 17:57:49 +0800 Message-ID: <20241112095804.42091-3-howard_wang@realsil.com.cn> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112095804.42091-1-howard_wang@realsil.com.cn> References: <20241112095804.42091-1-howard_wang@realsil.com.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 Implement logging macros for debug purposes. Signed-off-by: Howard Wang --- drivers/net/r8169/r8169_ethdev.c | 9 +++++++ drivers/net/r8169/r8169_logs.h | 46 ++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 drivers/net/r8169/r8169_logs.h diff --git a/drivers/net/r8169/r8169_ethdev.c b/drivers/net/r8169/r8169_ethdev.c index 740f7957be..8208a54a00 100644 --- a/drivers/net/r8169/r8169_ethdev.c +++ b/drivers/net/r8169/r8169_ethdev.c @@ -145,3 +145,12 @@ static struct rte_pci_driver rte_r8169_pmd = { RTE_PMD_REGISTER_PCI(net_r8169, rte_r8169_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_r8169, pci_id_r8169_map); RTE_PMD_REGISTER_KMOD_DEP(net_r8169, "* igb_uio | uio_pci_generic | vfio-pci"); + +RTE_LOG_REGISTER_SUFFIX(r8169_logtype_init, init, NOTICE) +RTE_LOG_REGISTER_SUFFIX(r8169_logtype_driver, driver, NOTICE) +#ifdef RTE_ETHDEV_DEBUG_RX +RTE_LOG_REGISTER_SUFFIX(r8169_logtype_rx, rx, DEBUG) +#endif +#ifdef RTE_ETHDEV_DEBUG_TX +RTE_LOG_REGISTER_SUFFIX(r8169_logtype_tx, tx, DEBUG) +#endif diff --git a/drivers/net/r8169/r8169_logs.h b/drivers/net/r8169/r8169_logs.h new file mode 100644 index 0000000000..09e78c191b --- /dev/null +++ b/drivers/net/r8169/r8169_logs.h @@ -0,0 +1,46 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Realtek Corporation. All rights reserved + */ + +#ifndef _R8169_LOGS_H_ +#define _R8169_LOGS_H_ + +#include + +extern int r8169_logtype_init; +extern int r8169_logtype_driver; +#ifdef RTE_ETHDEV_DEBUG_RX +extern int r8169_logtype_rx; +#endif +#ifdef RTE_ETHDEV_DEBUG_TX +extern int r8169_logtype_tx; +#endif + +#define RTE_LOGTYPE_R8169_INIT r8169_logtype_init +#define RTE_LOGTYPE_R8169_RX r8169_logtype_rx +#define RTE_LOGTYPE_R8169_TX r8169_logtype_tx +#define RTE_LOGTYPE_R8169_DRIVER r8169_logtype_driver + +#define PMD_INIT_LOG(level, fmt, ...) \ + RTE_LOG_LINE(level, R8169_INIT, "%s(): " fmt, __func__, ##__VA_ARGS__) + +#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") + +#ifdef RTE_ETHDEV_DEBUG_RX +#define PMD_RX_LOG(level, fmt, ...) \ + RTE_LOG_DP_LINE(level, R8169_RX, "%s(): " fmt, __func__, ##__VA_ARGS__) +#else +#define PMD_RX_LOG(level, fmt, args...) do { } while (0) +#endif + +#ifdef RTE_ETHDEV_DEBUG_TX +#define PMD_TX_LOG(level, fmt, ...) \ + RTE_LOG_DP_LINE(level, R8169_TX, "%s(): " fmt, __func__, ##__VA_ARGS__) +#else +#define PMD_TX_LOG(level, fmt, args...) do { } while (0) +#endif + +#define PMD_DRV_LOG(level, fmt, ...) \ + RTE_LOG_LINE(level, R8169_DRIVER, "%s(): " fmt, __func__, ##__VA_ARGS__) + +#endif /* _R8169_LOGS_H_ */ -- 2.34.1