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 4CCA545CA6; Fri, 8 Nov 2024 13:11:44 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3AE7D43369; Fri, 8 Nov 2024 13:11:44 +0100 (CET) Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by mails.dpdk.org (Postfix) with ESMTP id 0ABCA43364 for ; Fri, 8 Nov 2024 13:11:42 +0100 (CET) X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 4A8CBeUuA1901407, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=realsil.com.cn; s=dkim; t=1731067901; bh=c0anAoBa9oMVHtCjyQ7A1upECKeZOhu1IITNFHQOhVw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type; b=tr4G8qTXnvYGwhwhDgaihYys4Zn4EP5EulTB5WTMY3EFcvDkggJjoLXOP9N9Gq0Xa ZNKIwpDte01vKbtiot4k3450C9pPFhOJXQueJN7+Cy6cpN1oXWULmBJLv3nq1WXkBV kgNrTM4qoXDi0dk5W3XIRbM852hC9aK3paJlgdI5YwTUhWzsqFzl13FExetKZ9N94I v+U5hvgsaLl/CmByEvWzyU1w6JHPtPCDhHYEroxtJv285hRYARQCrKhmlSXqqaKGJl UrlnKUP8+SbpTYJqJp1hqLDwuhSSJzAODJaAYym9kl3ReUNUTCRls/u3I6RfCvwEsj SKR3sID3dyW/g== 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 4A8CBeUuA1901407 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Fri, 8 Nov 2024 20:11:40 +0800 Received: from RSEXDAG02.realsil.com.cn (172.29.17.196) 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; Fri, 8 Nov 2024 20:11:40 +0800 Received: from RSEXH36502.realsil.com.cn (172.29.17.3) by RSEXDAG02.realsil.com.cn (172.29.17.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 8 Nov 2024 20:11:40 +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; Fri, 8 Nov 2024 20:11:40 +0800 From: Howard Wang To: CC: , Howard Wang Subject: [PATCH v6 02/17] net/r8169: add logging structure Date: Fri, 8 Nov 2024 20:11:08 +0800 Message-ID: <20241108121123.248797-3-howard_wang@realsil.com.cn> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241108121123.248797-1-howard_wang@realsil.com.cn> References: <20241108121123.248797-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