From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FF20C47404 for ; Sat, 12 Oct 2019 00:27:02 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id E94B62084C for ; Sat, 12 Oct 2019 00:27:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E94B62084C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ntop.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D283E1EB49; Sat, 12 Oct 2019 02:26:43 +0200 (CEST) Received: from devele.ntop.org (net-93-145-196-230.cust.vodafonedsl.it [93.145.196.230]) by dpdk.org (Postfix) with ESMTP id 2323E1EB79 for ; Sat, 12 Oct 2019 02:26:42 +0200 (CEST) Received: from [192.168.2.134] (localhost6.localdomain6 [IPv6:::1]) by devele.ntop.org (Postfix) with ESMTP id F17B96C003C for ; Sat, 12 Oct 2019 02:26:41 +0200 (CEST) From: Alfredo Cardigliano To: dev@dpdk.org Date: Sat, 12 Oct 2019 02:26:41 +0200 Message-ID: <157084000193.11524.4069198856747684178.stgit@devele> In-Reply-To: <157083994018.11524.11276616720287263690.stgit@devele> References: <157083994018.11524.11276616720287263690.stgit@devele> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [dpdk-dev] [PATCH 03/17] net/ionic: add log X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add debug options to the config file. Define macros used for logs and make use of config file options to enable them. Signed-off-by: Alfredo Cardigliano Reviewed-by: Shannon Nelson --- config/common_base | 2 ++ drivers/net/ionic/Makefile | 2 +- drivers/net/ionic/ionic_ethdev.c | 21 +++++++++++++++++ drivers/net/ionic/ionic_logs.h | 46 ++++++++++++++++++++++++++++++++++++++ drivers/net/ionic/meson.build | 1 + 5 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ionic/ionic_ethdev.c create mode 100644 drivers/net/ionic/ionic_logs.h diff --git a/config/common_base b/config/common_base index 1c11fcae6..c1b556fc1 100644 --- a/config/common_base +++ b/config/common_base @@ -274,6 +274,8 @@ CONFIG_RTE_LIBRTE_E1000_PF_DISABLE_STRIP_CRC=n # Compile Pensando IONIC PMD driver # CONFIG_RTE_LIBRTE_IONIC_PMD=y +CONFIG_RTE_LIBRTE_IONIC_DEBUG_RX=n +CONFIG_RTE_LIBRTE_IONIC_DEBUG_TX=n # # Compile burst-oriented HINIC PMD driver diff --git a/drivers/net/ionic/Makefile b/drivers/net/ionic/Makefile index 3add24087..2f3296a15 100644 --- a/drivers/net/ionic/Makefile +++ b/drivers/net/ionic/Makefile @@ -52,6 +52,6 @@ LDLIBS += -lrte_bus_pci # # all source are stored in SRCS-y # -SRCS-$(CONFIG_RTE_LIBRTE_IONIC_PMD) += +SRCS-$(CONFIG_RTE_LIBRTE_IONIC_PMD) += ionic_ethdev.c include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c new file mode 100644 index 000000000..863d20d19 --- /dev/null +++ b/drivers/net/ionic/ionic_ethdev.c @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 + * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved. + */ + +#include "ionic_logs.h" + +int ionic_logtype_init; +int ionic_logtype_driver; + +RTE_INIT(ionic_init_log) +{ + ionic_logtype_init = rte_log_register("pmd.net.ionic.init"); + + if (ionic_logtype_init >= 0) + rte_log_set_level(ionic_logtype_init, RTE_LOG_NOTICE); + + ionic_logtype_driver = rte_log_register("pmd.net.ionic.driver"); + + if (ionic_logtype_driver >= 0) + rte_log_set_level(ionic_logtype_driver, RTE_LOG_NOTICE); +} diff --git a/drivers/net/ionic/ionic_logs.h b/drivers/net/ionic/ionic_logs.h new file mode 100644 index 000000000..a4a9af888 --- /dev/null +++ b/drivers/net/ionic/ionic_logs.h @@ -0,0 +1,46 @@ +/* SPDX-License-Identifier: GPL-2.0 + * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved. + */ + +#ifndef _IONIC_LOGS_H_ +#define _IONIC_LOGS_H_ + +#include + +extern int ionic_logtype_init; +extern int ionic_logtype_driver; + +#define ionic_init_print(level, fmt, args...) rte_log(RTE_LOG_ ## level, \ + ionic_logtype_init, "%s(): " fmt "\n", __func__, ##args) + +#define ionic_init_print_call() ionic_init_print(DEBUG, " >>") + +#ifndef IONIC_WARN_ON +#define IONIC_WARN_ON(x) do { \ + int ret = !!(x); \ + if (unlikely(ret)) \ + ionic_init_print(WARNING, "WARN_ON: \"" #x "\" at %s:%d\n", \ + __func__, __LINE__); \ +} while (0) +#endif + +#ifdef RTE_LIBRTE_IONIC_DEBUG_RX +#define ionic_rx_print(level, fmt, args...) RTE_LOG(level, PMD, \ + "%s(): " fmt "\n", __func__, ## args) +#else +#define ionic_rx_print(level, fmt, args...) do { } while (0) +#endif + +#ifdef RTE_LIBRTE_IONIC_DEBUG_TX +#define ionic_tx_print(level, fmt, args...) RTE_LOG(level, PMD, \ + "%s(): " fmt "\n", __func__, ## args) +#else +#define ionic_tx_print(level, fmt, args...) do { } while (0) +#endif + +#define ionic_drv_print(level, fmt, args...) rte_log(RTE_LOG_ ## level, \ + ionic_logtype_driver, "%s(): " fmt "\n", __func__, ## args) + +#define ionic_drv_print_call() ionic_drv_print(DEBUG, " >>") + +#endif /* _IONIC_LOGS_H_ */ diff --git a/drivers/net/ionic/meson.build b/drivers/net/ionic/meson.build index 502076e3c..5534ad6c3 100644 --- a/drivers/net/ionic/meson.build +++ b/drivers/net/ionic/meson.build @@ -4,5 +4,6 @@ version = 1 sources = files( + 'ionic_ethdev.c' )