From patchwork Wed May 9 14:24:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 39607 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9AEF15B20; Wed, 9 May 2018 16:24:26 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 107D1548B for ; Wed, 9 May 2018 16:24:23 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 May 2018 07:24:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,381,1520924400"; d="scan'208";a="39910578" Received: from silpixa00399777.ir.intel.com (HELO silpixa00399777.ger.corp.intel.com) ([10.237.222.236]) by orsmga008.jf.intel.com with ESMTP; 09 May 2018 07:24:21 -0700 From: Ferruh Yigit To: Thomas Monjalon Cc: dev@dpdk.org, Ferruh Yigit Date: Wed, 9 May 2018 15:24:10 +0100 Message-Id: <20180509142412.294034-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180501172815.214973-1-ferruh.yigit@intel.com> References: <20180501172815.214973-1-ferruh.yigit@intel.com> Subject: [dpdk-dev] [PATCH v2 1/2] ethdev: move log macro to header 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" Macro moved to header to be able to convert logging usage in header. And since it has been moved to public header changed naming and added RTE prefix, ethdev_log -> RTE_ETHDEV_LOG Signed-off-by: Ferruh Yigit --- v2: * updated commit log --- lib/librte_ethdev/rte_ethdev.c | 17 +++++++---------- lib/librte_ethdev/rte_ethdev.h | 5 +++++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index a357ee09f..f86b462cf 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -41,10 +41,7 @@ #include "rte_ethdev_driver.h" #include "ethdev_profile.h" -static int ethdev_logtype; - -#define ethdev_log(level, fmt, ...) \ - rte_log(RTE_LOG_ ## level, ethdev_logtype, fmt "\n", ## __VA_ARGS__) +int ethdev_logtype; static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data"; struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS]; @@ -282,12 +279,12 @@ rte_eth_dev_allocate(const char *name) port_id = rte_eth_dev_find_free_port(); if (port_id == RTE_MAX_ETHPORTS) { - ethdev_log(ERR, "Reached maximum number of Ethernet ports"); + RTE_ETHDEV_LOG(ERR, "Reached maximum number of Ethernet ports"); goto unlock; } if (rte_eth_dev_allocated(name) != NULL) { - ethdev_log(ERR, + RTE_ETHDEV_LOG(ERR, "Ethernet Device with name %s already allocated!", name); goto unlock; @@ -640,7 +637,7 @@ rte_eth_dev_attach(const char *devargs, uint16_t *port_id) /* no point looking at the port count if no port exists */ if (!rte_eth_dev_count_total()) { - ethdev_log(ERR, "No port found for device (%s)", da.name); + RTE_ETHDEV_LOG(ERR, "No port found for device (%s)", da.name); ret = -1; goto err; } @@ -675,7 +672,7 @@ rte_eth_dev_detach(uint16_t port_id, char *name __rte_unused) dev_flags = rte_eth_devices[port_id].data->dev_flags; if (dev_flags & RTE_ETH_DEV_BONDED_SLAVE) { - ethdev_log(ERR, + RTE_ETHDEV_LOG(ERR, "Port %" PRIu16 " is bonded, cannot detach", port_id); return -ENOTSUP; } @@ -3229,7 +3226,7 @@ rte_eth_dev_callback_register(uint16_t port_id, return -EINVAL; if (!rte_eth_dev_is_valid_port(port_id) && port_id != RTE_ETH_ALL) { - ethdev_log(ERR, "Invalid port_id=%d", port_id); + RTE_ETHDEV_LOG(ERR, "Invalid port_id=%d", port_id); return -EINVAL; } @@ -3292,7 +3289,7 @@ rte_eth_dev_callback_unregister(uint16_t port_id, return -EINVAL; if (!rte_eth_dev_is_valid_port(port_id) && port_id != RTE_ETH_ALL) { - ethdev_log(ERR, "Invalid port_id=%d", port_id); + RTE_ETHDEV_LOG(ERR, "Invalid port_id=%d", port_id); return -EINVAL; } diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index 7ccf4bae6..f05095c85 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -159,6 +159,11 @@ extern "C" { #include "rte_eth_ctrl.h" #include "rte_dev_info.h" +extern int ethdev_logtype; + +#define RTE_ETHDEV_LOG(level, fmt, ...) \ + rte_log(RTE_LOG_ ## level, ethdev_logtype, fmt "\n", ## __VA_ARGS__) + struct rte_mbuf; /**