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 72A3B45CF3; Wed, 13 Nov 2024 10:29:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5D17340E4B; Wed, 13 Nov 2024 10:29:32 +0100 (CET) Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by mails.dpdk.org (Postfix) with ESMTP id 838C940E4B for ; Wed, 13 Nov 2024 10:29:30 +0100 (CET) X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 4AD9TSLN01088001, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=realsil.com.cn; s=dkim; t=1731490168; bh=zhRZIiWL5H8+JRlEVrtNzmHJuCgJ+5GspNf+fbxl8EI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type; b=BhmFXaZaTTvAHy9IYzTaj5pG2GUcDMrflbrGTAr1exLRNVYjvZ6YMNshsYaFBjqXV QMQrz+n0NM8sM2MkGqWecyfo6wpGas6G4NRmZlGu+cfcWtQNl1T9HJ/glLajkhdmhN tyPe/0J4g1zHEA74IPTC+Irz3iKNT/9700RR+DevOiBkM3+cDgsQYkNzjHVHkneUGr qOaK5z6KyzAVgQxQSW8cDyO24T7s+TF6PlGH3RbCifBgYc9O9nSgHZre+Pymgx9G/D 7rIp5Y0rZPNHywkDadNz5WEr/VY4UAT3XqfKDSwtuBvy875PGiePVD9K+Ti1F+hmlA I1qjZ29fA2vcg== 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 4AD9TSLN01088001 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Wed, 13 Nov 2024 17:29:28 +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; Wed, 13 Nov 2024 17:29:28 +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; Wed, 13 Nov 2024 17:29:28 +0800 From: Howard Wang To: CC: , Howard Wang Subject: [PATCH v8 02/17] net/r8169: add logging structure Date: Wed, 13 Nov 2024 17:28:39 +0800 Message-ID: <20241113092854.91445-3-howard_wang@realsil.com.cn> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241113092854.91445-1-howard_wang@realsil.com.cn> References: <20241113092854.91445-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..ed8aa05f65 --- /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, ...) 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, ...) 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