All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>
Subject: [PATCH v3 1/2] ethdev: move log macro to header
Date: Mon, 14 May 2018 16:56:47 +0100	[thread overview]
Message-ID: <20180514155648.81149-1-ferruh.yigit@intel.com> (raw)
In-Reply-To: <20180509142412.294034-1-ferruh.yigit@intel.com>

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 <ferruh.yigit@intel.com>
---
v2:
* updated commit log
---
 lib/librte_ethdev/rte_ethdev.c | 25 +++++++++++--------------
 lib/librte_ethdev/rte_ethdev.h |  5 +++++
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index b3ed82105..5f19a7bd9 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -42,10 +42,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];
@@ -303,14 +300,14 @@ rte_eth_dev_allocate(const char *name)
 	rte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);
 
 	if (_rte_eth_dev_allocated(name) != NULL) {
-		ethdev_log(ERR, "Ethernet device with name %s already allocated",
+		RTE_ETHDEV_LOG(ERR, "Ethernet device with name %s already allocated",
 				name);
 		goto unlock;
 	}
 
 	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;
 	}
 
@@ -663,7 +660,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;
 	}
@@ -698,7 +695,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;
 	}
@@ -1164,7 +1161,7 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	/* Any requested offloading must be within its device capabilities */
 	if ((local_conf.rxmode.offloads & dev_info.rx_offload_capa) !=
 	     local_conf.rxmode.offloads) {
-		ethdev_log(ERR, "ethdev port_id=%d requested Rx offloads "
+		RTE_ETHDEV_LOG(ERR, "ethdev port_id=%d requested Rx offloads "
 				"0x%" PRIx64 " doesn't match Rx offloads "
 				"capabilities 0x%" PRIx64 " in %s()\n",
 				port_id,
@@ -1175,7 +1172,7 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	}
 	if ((local_conf.txmode.offloads & dev_info.tx_offload_capa) !=
 	     local_conf.txmode.offloads) {
-		ethdev_log(ERR, "ethdev port_id=%d requested Tx offloads "
+		RTE_ETHDEV_LOG(ERR, "ethdev port_id=%d requested Tx offloads "
 				"0x%" PRIx64 " doesn't match Tx offloads "
 				"capabilities 0x%" PRIx64 " in %s()\n",
 				port_id,
@@ -1571,7 +1568,7 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
 	 */
 	if ((local_conf.offloads & dev_info.rx_queue_offload_capa) !=
 	     local_conf.offloads) {
-		ethdev_log(ERR, "Ethdev port_id=%d rx_queue_id=%d, new "
+		RTE_ETHDEV_LOG(ERR, "Ethdev port_id=%d rx_queue_id=%d, new "
 				"added offloads 0x%" PRIx64 " must be "
 				"within pre-queue offload capabilities 0x%"
 				PRIx64 " in %s()\n",
@@ -1736,7 +1733,7 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
 	 */
 	if ((local_conf.offloads & dev_info.tx_queue_offload_capa) !=
 	     local_conf.offloads) {
-		ethdev_log(ERR, "Ethdev port_id=%d tx_queue_id=%d, new "
+		RTE_ETHDEV_LOG(ERR, "Ethdev port_id=%d tx_queue_id=%d, new "
 				"added offloads 0x%" PRIx64 " must be "
 				"within pre-queue offload capabilities 0x%"
 				PRIx64 " in %s()\n",
@@ -3341,7 +3338,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;
 	}
 
@@ -3404,7 +3401,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 f8815e994..ce305adea 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;
 
 /**
-- 
2.14.3

  parent reply	other threads:[~2018-05-14 15:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-01 17:28 [PATCH 1/2] ethdev: move log macro to header Ferruh Yigit
2018-05-01 17:28 ` [PATCH 2/2] ethdev: convert static logtype usage to dynamic Ferruh Yigit
2018-05-01 18:56 ` [PATCH 1/2] ethdev: move log macro to header Thomas Monjalon
2018-05-02  9:40   ` Ferruh Yigit
2018-05-02 14:45     ` Stephen Hemminger
2018-05-09 14:24 ` [PATCH v2 " Ferruh Yigit
2018-05-09 14:24   ` [PATCH v2 2/2] ethdev: convert static logtype usage to dynamic Ferruh Yigit
2018-05-14 15:56   ` Ferruh Yigit [this message]
2018-05-14 15:56     ` [PATCH v3 " Ferruh Yigit
2018-06-19  1:04     ` [PATCH v4 1/3] ethdev: move log macro to header Ferruh Yigit
2018-06-19  1:04       ` [PATCH v4 2/3] ethdev: convert static logtype usage to dynamic Ferruh Yigit
2018-06-19 13:11         ` Andrew Rybchenko
2018-06-19  1:04       ` [PATCH v4 3/3] eal: don't enable static log macro for ethdev Ferruh Yigit
2018-06-19 13:02       ` [PATCH v4 1/3] ethdev: move log macro to header Andrew Rybchenko
2018-06-26 11:41       ` Shahaf Shuler
2018-06-26 12:25         ` Thomas Monjalon
2018-06-26 15:52           ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180514155648.81149-1-ferruh.yigit@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.