From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C6829A04F3; Thu, 19 Dec 2019 23:19:24 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5D8081BF81; Thu, 19 Dec 2019 23:19:04 +0100 (CET) Received: from mail.ntop.org (mail-digitalocean.ntop.org [167.99.215.164]) by dpdk.org (Postfix) with ESMTP id 41B551B9BF for ; Thu, 19 Dec 2019 23:18:54 +0100 (CET) Received: from devele.ntop.org (net-93-145-196-230.cust.vodafonedsl.it [93.145.196.230]) by mail.ntop.org (Postfix) with ESMTPSA id F2AF13FAB6; Thu, 19 Dec 2019 23:18:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ntop.org; s=mail; t=1576793934; bh=U+lUxmutKNWsIXT/fH1X1r0ksseoC+Sh0f214lbZoqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mptjgtJJC+EJJio/aoI9HOPeN4KwRkeSdoOSDniY7uXkVi4f9RC8B4KjyXFGbgqYv aFDOI2APZlYB3CL4eFYCaCGxmgmRQPhhoaaVyiuHoP865JgXp/yIPy8mfyVrr4Yy+C 4ta5XmYAokDSAjPhIwyEtR3qZ0bCl9S5dO4iUHcs= From: Alfredo Cardigliano To: Alfredo Cardigliano Cc: dev@dpdk.org Date: Thu, 19 Dec 2019 23:18:33 +0100 Message-Id: <20191219221847.29989-4-cardigliano@ntop.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191219221847.29989-1-cardigliano@ntop.org> References: <20191219221847.29989-1-cardigliano@ntop.org> Subject: [dpdk-dev] [PATCH v4 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 --- drivers/net/ionic/Makefile | 2 +- drivers/net/ionic/ionic_ethdev.c | 15 +++++++++++++++ drivers/net/ionic/ionic_logs.h | 26 ++++++++++++++++++++++++++ drivers/net/ionic/meson.build | 1 + 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ionic/ionic_ethdev.c create mode 100644 drivers/net/ionic/ionic_logs.h diff --git a/drivers/net/ionic/Makefile b/drivers/net/ionic/Makefile index 9c2f9cf2e..baa34b055 100644 --- a/drivers/net/ionic/Makefile +++ b/drivers/net/ionic/Makefile @@ -20,6 +20,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..f19de85a9 --- /dev/null +++ b/drivers/net/ionic/ionic_ethdev.c @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) + * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved. + */ + +#include "ionic_logs.h" + +int ionic_logtype; + +RTE_INIT(ionic_init_log) +{ + ionic_logtype = rte_log_register("pmd.net.ionic"); + + if (ionic_logtype >= 0) + rte_log_set_level(ionic_logtype, 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..bc10ad174 --- /dev/null +++ b/drivers/net/ionic/ionic_logs.h @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: (BSD-3-Clause OR 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; + +#define IONIC_PRINT(level, fmt, args...) rte_log(RTE_LOG_ ## level, \ + ionic_logtype, "%s(): " fmt "\n", __func__, ##args) + +#define IONIC_PRINT_CALL() IONIC_PRINT(DEBUG, " >>") + +#ifndef IONIC_WARN_ON +#define IONIC_WARN_ON(x) do { \ + int ret = !!(x); \ + if (unlikely(ret)) \ + IONIC_PRINT(WARNING, "WARN_ON: \"" #x "\" at %s:%d\n", \ + __func__, __LINE__); \ +} while (0) +#endif + +#endif /* _IONIC_LOGS_H_ */ diff --git a/drivers/net/ionic/meson.build b/drivers/net/ionic/meson.build index 5386e23ca..f5e3c36c9 100644 --- a/drivers/net/ionic/meson.build +++ b/drivers/net/ionic/meson.build @@ -2,5 +2,6 @@ # Copyright(c) 2019 Pensando sources = files( + 'ionic_ethdev.c' ) -- 2.17.1