DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
From: Shreyansh Jain <shreyansh.jain@nxp.com>
To: ferruh.yigit@intel.com
Cc: dev@dpdk.org, hemant.agrawal@nxp.com, akhil.goyal@nxp.com,
	nipun.gupta@nxp.com, Shreyansh Jain <shreyansh.jain@nxp.com>
Subject: [PATCH 4/7] event/dpaa2: change to dynamic logging
Date: Mon, 12 Mar 2018 14:55:44 +0530
Message-ID: <20180312092547.18472-5-shreyansh.jain@nxp.com> (raw)
In-Reply-To: <20180312092547.18472-1-shreyansh.jain@nxp.com>

Some changes had already been pushed via SHA:72654f090a11 patch. This
patch updates them.
Cc: nipun.gupta@nxp.com

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 doc/guides/eventdevs/dpaa2.rst            | 14 ++++++++-
 drivers/event/dpaa2/dpaa2_eventdev.c      | 49 +++++++++++++++++++------------
 drivers/event/dpaa2/dpaa2_eventdev_logs.h | 10 ++++---
 drivers/event/dpaa2/dpaa2_hw_dpcon.c      | 15 +++++-----
 4 files changed, 57 insertions(+), 31 deletions(-)

diff --git a/doc/guides/eventdevs/dpaa2.rst b/doc/guides/eventdevs/dpaa2.rst
index 5b8da95d7..e8089b532 100644
--- a/doc/guides/eventdevs/dpaa2.rst
+++ b/doc/guides/eventdevs/dpaa2.rst
@@ -129,7 +129,19 @@ Example:
 
 .. code-block:: console
 
-    ./your_eventdev_application --vdev="event_dpaa2"
+   ./your_eventdev_application --vdev="event_dpaa2"
+
+Enabling logs
+-------------
+
+For enabling logs, use the following EAL parameter:
+
+.. code-block:: console
+
+   ./your_eventdev_application <EAL args> --log-level=eventdev.dpaa2,<level>
+
+Using ``eventdev.dpaa2`` as log matching criteria, all Event PMD logs can be
+enabled which are lower than logging ``level``.
 
 Limitations
 -----------
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 8800b47f5..750aac9ef 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -72,7 +72,7 @@ dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[],
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
 		if (ret) {
-			DPAA2_EVENTDEV_ERR("Failure in affining portal\n");
+			DPAA2_EVENTDEV_ERR("Failure in affining portal");
 			return 0;
 		}
 	}
@@ -122,7 +122,8 @@ dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[],
 				if (!loop)
 					return num_tx;
 				frames_to_send = loop;
-				DPAA2_EVENTDEV_ERR("Unable to allocate memory");
+				DPAA2_EVENTDEV_ERR(
+					"Unable to allocate event object");
 				goto send_partial;
 			}
 			rte_memcpy(ev_temp, event, sizeof(struct rte_event));
@@ -167,9 +168,9 @@ static void dpaa2_eventdev_dequeue_wait(uint64_t timeout_ticks)
 		 * case to avoid the problem.
 		 */
 		if (errno == EINTR) {
-			DPAA2_EVENTDEV_DEBUG("epoll_wait fails\n");
+			DPAA2_EVENTDEV_DEBUG("epoll_wait fails");
 			if (i++ > 10)
-				DPAA2_EVENTDEV_DEBUG("Dequeue burst Failed\n");
+				DPAA2_EVENTDEV_DEBUG("Dequeue burst Failed");
 		goto RETRY;
 		}
 	}
@@ -227,7 +228,7 @@ dpaa2_eventdev_dequeue_burst(void *port, struct rte_event ev[],
 	if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
 		ret = dpaa2_affine_qbman_swp();
 		if (ret) {
-			DPAA2_EVENTDEV_ERR("Failure in affining portal\n");
+			DPAA2_EVENTDEV_ERR("Failure in affining portal");
 			return 0;
 		}
 	}
@@ -263,7 +264,7 @@ dpaa2_eventdev_dequeue_burst(void *port, struct rte_event ev[],
 			rxq->cb(swp, fd, dq, rxq, &ev[num_pkts]);
 		} else {
 			qbman_swp_dqrr_consume(swp, dq);
-			DPAA2_EVENTDEV_ERR("Null Return VQ received\n");
+			DPAA2_EVENTDEV_ERR("Null Return VQ received");
 			return 0;
 		}
 
@@ -335,7 +336,7 @@ dpaa2_eventdev_configure(const struct rte_eventdev *dev)
 	priv->event_dev_cfg = conf->event_dev_cfg;
 
 	DPAA2_EVENTDEV_DEBUG("Configured eventdev devid=%d",
-		dev->data->dev_id);
+			     dev->data->dev_id);
 	return 0;
 }
 
@@ -502,8 +503,8 @@ dpaa2_eventdev_port_link(struct rte_eventdev *dev, void *port,
 			CMD_PRI_LOW, dpaa2_portal->dpio_dev->token,
 			evq_info->dpcon->dpcon_id, &channel_index);
 		if (ret < 0) {
-			DPAA2_EVENTDEV_ERR("Static dequeue cfg failed with ret: %d\n",
-				    ret);
+			DPAA2_EVENTDEV_ERR(
+				"Static dequeue config failed: err(%d)", ret);
 			goto err;
 		}
 
@@ -587,8 +588,8 @@ dpaa2_eventdev_eth_queue_add_all(const struct rte_eventdev *dev,
 		ret = dpaa2_eth_eventq_attach(eth_dev, i,
 				dpcon_id, queue_conf);
 		if (ret) {
-			DPAA2_EVENTDEV_ERR("dpaa2_eth_eventq_attach failed: ret %d\n",
-				    ret);
+			DPAA2_EVENTDEV_ERR(
+				"Event queue attach failed: err(%d)", ret);
 			goto fail;
 		}
 	}
@@ -620,7 +621,8 @@ dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
 	ret = dpaa2_eth_eventq_attach(eth_dev, rx_queue_id,
 			dpcon_id, queue_conf);
 	if (ret) {
-		DPAA2_EVENTDEV_ERR("dpaa2_eth_eventq_attach failed: ret: %d\n", ret);
+		DPAA2_EVENTDEV_ERR(
+			"Event queue attach failed: err(%d)", ret);
 		return ret;
 	}
 	return 0;
@@ -639,8 +641,8 @@ dpaa2_eventdev_eth_queue_del_all(const struct rte_eventdev *dev,
 	for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
 		ret = dpaa2_eth_eventq_detach(eth_dev, i);
 		if (ret) {
-			DPAA2_EVENTDEV_ERR("dpaa2_eth_eventq_detach failed: ret %d\n",
-				    ret);
+			DPAA2_EVENTDEV_ERR(
+				"Event queue detach failed: err(%d)", ret);
 			return ret;
 		}
 	}
@@ -662,7 +664,8 @@ dpaa2_eventdev_eth_queue_del(const struct rte_eventdev *dev,
 
 	ret = dpaa2_eth_eventq_detach(eth_dev, rx_queue_id);
 	if (ret) {
-		DPAA2_EVENTDEV_ERR("dpaa2_eth_eventq_detach failed: ret: %d\n", ret);
+		DPAA2_EVENTDEV_ERR(
+			"Event queue detach failed: err(%d)", ret);
 		return ret;
 	}
 
@@ -743,7 +746,8 @@ dpaa2_eventdev_setup_dpci(struct dpaa2_dpci_dev *dpci_dev,
 					&rx_queue_cfg);
 		if (ret) {
 			DPAA2_EVENTDEV_ERR(
-				    "set_rx_q failed with err code: %d", ret);
+				"DPCI Rx queue setup failed: err(%d)",
+				ret);
 			return ret;
 		}
 	}
@@ -763,7 +767,7 @@ dpaa2_eventdev_create(const char *name)
 					   sizeof(struct dpaa2_eventdev),
 					   rte_socket_id());
 	if (eventdev == NULL) {
-		DPAA2_EVENTDEV_ERR("Failed to create eventdev vdev %s", name);
+		DPAA2_EVENTDEV_ERR("Failed to create Event device %s", name);
 		goto fail;
 	}
 
@@ -798,7 +802,7 @@ dpaa2_eventdev_create(const char *name)
 		ret = dpaa2_eventdev_setup_dpci(dpci_dev, dpcon_dev);
 		if (ret) {
 			DPAA2_EVENTDEV_ERR(
-				    "dpci setup failed with err code: %d", ret);
+				    "DPCI setup failed: err(%d)", ret);
 			return ret;
 		}
 		priv->max_event_queues++;
@@ -836,3 +840,12 @@ static struct rte_vdev_driver vdev_eventdev_dpaa2_pmd = {
 };
 
 RTE_PMD_REGISTER_VDEV(EVENTDEV_NAME_DPAA2_PMD, vdev_eventdev_dpaa2_pmd);
+
+RTE_INIT(dpaa2_eventdev_init_log);
+static void
+dpaa2_eventdev_init_log(void)
+{
+	dpaa2_logtype_event = rte_log_register("eventdev.dpaa2");
+	if (dpaa2_logtype_event >= 0)
+		rte_log_set_level(dpaa2_logtype_event, RTE_LOG_NOTICE);
+}
diff --git a/drivers/event/dpaa2/dpaa2_eventdev_logs.h b/drivers/event/dpaa2/dpaa2_eventdev_logs.h
index 7d250c3f1..48f1abd1f 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev_logs.h
+++ b/drivers/event/dpaa2/dpaa2_eventdev_logs.h
@@ -9,13 +9,15 @@
 extern int dpaa2_logtype_event;
 
 #define DPAA2_EVENTDEV_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, dpaa2_logtype_event, "%s(): " fmt "\n", \
-		__func__, ##args)
+	rte_log(RTE_LOG_ ## level, dpaa2_logtype_event, "dpaa2_event: " \
+		fmt "\n", ##args)
+
+#define DPAA2_EVENTDEV_DEBUG(fmt, args...) \
+	rte_log(RTE_LOG_DEBUG, dpaa2_logtype_event, "dpaa2_event: %s(): " \
+		fmt "\n", __func__, ##args)
 
 #define EVENTDEV_INIT_FUNC_TRACE() DPAA2_EVENTDEV_LOG(DEBUG, " >>")
 
-#define DPAA2_EVENTDEV_DEBUG(fmt, args...) \
-	DPAA2_EVENTDEV_LOG(DEBUG, fmt, ## args)
 #define DPAA2_EVENTDEV_INFO(fmt, args...) \
 	DPAA2_EVENTDEV_LOG(INFO, fmt, ## args)
 #define DPAA2_EVENTDEV_ERR(fmt, args...) \
diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
index f2377b983..d64e588aa 100644
--- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c
+++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
@@ -20,11 +20,11 @@
 #include <rte_dev.h>
 #include <rte_ethdev_driver.h>
 
-#include <fslmc_logs.h>
 #include <rte_fslmc.h>
 #include <mc/fsl_dpcon.h>
 #include <portal/dpaa2_hw_pvt.h>
 #include "dpaa2_eventdev.h"
+#include "dpaa2_eventdev_logs.h"
 
 TAILQ_HEAD(dpcon_dev_list, dpaa2_dpcon_dev);
 static struct dpcon_dev_list dpcon_dev_list
@@ -42,7 +42,8 @@ rte_dpaa2_create_dpcon_device(int dev_fd __rte_unused,
 	/* Allocate DPAA2 dpcon handle */
 	dpcon_node = rte_malloc(NULL, sizeof(struct dpaa2_dpcon_dev), 0);
 	if (!dpcon_node) {
-		PMD_DRV_LOG(ERR, "Memory allocation failed for DPCON Device");
+		DPAA2_EVENTDEV_ERR(
+				"Memory allocation failed for dpcon device");
 		return -1;
 	}
 
@@ -51,8 +52,8 @@ rte_dpaa2_create_dpcon_device(int dev_fd __rte_unused,
 	ret = dpcon_open(&dpcon_node->dpcon,
 			 CMD_PRI_LOW, dpcon_id, &dpcon_node->token);
 	if (ret) {
-		PMD_DRV_LOG(ERR, "Resource alloc failure with err code: %d",
-			    ret);
+		DPAA2_EVENTDEV_ERR("Unable to open dpcon device: err(%d)",
+				   ret);
 		rte_free(dpcon_node);
 		return -1;
 	}
@@ -61,8 +62,8 @@ rte_dpaa2_create_dpcon_device(int dev_fd __rte_unused,
 	ret = dpcon_get_attributes(&dpcon_node->dpcon,
 				   CMD_PRI_LOW, dpcon_node->token, &attr);
 	if (ret != 0) {
-		PMD_DRV_LOG(ERR, "Reading device failed with err code: %d",
-			    ret);
+		DPAA2_EVENTDEV_ERR("dpcon attribute fetch failed: err(%d)",
+				   ret);
 		rte_free(dpcon_node);
 		return -1;
 	}
@@ -75,8 +76,6 @@ rte_dpaa2_create_dpcon_device(int dev_fd __rte_unused,
 
 	TAILQ_INSERT_TAIL(&dpcon_dev_list, dpcon_node, next);
 
-	RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpcon.%d]\n", dpcon_id);
-
 	return 0;
 }
 
-- 
2.14.1

  parent reply index

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-12  9:25 [PATCH 0/7] Change DPAA2 " Shreyansh Jain
2018-03-12  9:25 ` [PATCH 1/7] bus/fslmc: change " Shreyansh Jain
2018-03-12  9:25 ` [PATCH 2/7] mempool/dpaa2: " Shreyansh Jain
2018-03-12  9:25 ` [PATCH 3/7] net/dpaa2: change into " Shreyansh Jain
2018-03-12 11:04   ` Ferruh Yigit
2018-03-12 12:01     ` Shreyansh Jain
2018-03-12  9:25 ` Shreyansh Jain [this message]
2018-03-12  9:25 ` [PATCH 5/7] bus/fslmc: remove unused debug macros Shreyansh Jain
2018-03-12  9:25 ` [PATCH 6/7] crypto/dpaa2_sec: fix incorrect debugging prints Shreyansh Jain
2018-03-12  9:25 ` [PATCH 7/7] crypto/dpaa2_sec: change to dynamic logging Shreyansh Jain
2018-03-12 12:10 ` [PATCH 0/7] Change DPAA2 " Hemant Agrawal
2018-03-12 12:37 ` Shreyansh Jain
2018-03-13  5:44 ` [RESEND v2 " Shreyansh Jain
2018-03-13  5:44   ` [RESEND v2 1/7] bus/fslmc: change " Shreyansh Jain
2018-03-21  6:24     ` Hemant Agrawal
2018-03-13  5:44   ` [RESEND v2 2/7] mempool/dpaa2: " Shreyansh Jain
2018-03-21  6:27     ` Hemant Agrawal
2018-03-13  5:44   ` [RESEND v2 3/7] net/dpaa2: change into " Shreyansh Jain
2018-03-21  6:31     ` Hemant Agrawal
2018-03-23  7:19       ` Shreyansh Jain
2018-03-13  5:44   ` [RESEND v2 4/7] event/dpaa2: change to " Shreyansh Jain
2018-03-14  4:01     ` Nipun Gupta
2018-03-13  5:44   ` [RESEND v2 5/7] bus/fslmc: remove unused debug macros Shreyansh Jain
2018-03-21  6:13     ` Hemant Agrawal
2018-03-13  5:44   ` [RESEND v2 6/7] crypto/dpaa2_sec: fix incorrect debugging prints Shreyansh Jain
2018-03-21  6:12     ` Hemant Agrawal
2018-03-13  5:44   ` [RESEND v2 7/7] crypto/dpaa2_sec: change to dynamic logging Shreyansh Jain
2018-03-21  6:18     ` Hemant Agrawal
2018-03-23 12:04   ` [PATCH v3 0/7] Change DPAA2 " Shreyansh Jain
2018-03-23 12:04     ` [PATCH v3 1/7] bus/fslmc: change " Shreyansh Jain
2018-03-23 12:04     ` [PATCH v3 2/7] mempool/dpaa2: " Shreyansh Jain
2018-03-26  8:48       ` Hemant Agrawal
2018-03-23 12:04     ` [PATCH v3 3/7] net/dpaa2: change into " Shreyansh Jain
2018-03-26  8:48       ` Hemant Agrawal
2018-03-29 15:26       ` Thomas Monjalon
2018-03-29 18:01         ` Shreyansh Jain
2018-03-23 12:04     ` [PATCH v3 4/7] event/dpaa2: change to " Shreyansh Jain
2018-03-23 12:04     ` [PATCH v3 5/7] bus/fslmc: remove unused debug macros Shreyansh Jain
2018-03-23 12:04     ` [PATCH v3 6/7] crypto/dpaa2_sec: fix incorrect debugging prints Shreyansh Jain
2018-03-23 12:04     ` [PATCH v3 7/7] crypto/dpaa2_sec: change to dynamic logging Shreyansh Jain
2018-04-02 14:05     ` [PATCH v4 0/7] Change DPAA2 " Shreyansh Jain
2018-04-02 14:05       ` [PATCH v4 1/7] bus/fslmc: change " Shreyansh Jain
2019-12-03 15:35         ` [dpdk-dev] " Ferruh Yigit
2018-04-02 14:05       ` [PATCH v4 2/7] mempool/dpaa2: " Shreyansh Jain
2018-04-02 14:05       ` [PATCH v4 3/7] net/dpaa2: change into " Shreyansh Jain
2018-04-02 14:05       ` [PATCH v4 4/7] event/dpaa2: change to " Shreyansh Jain
2018-04-02 14:05       ` [PATCH v4 5/7] bus/fslmc: remove unused debug macros Shreyansh Jain
2018-04-02 14:06       ` [PATCH v4 6/7] crypto/dpaa2_sec: fix incorrect debugging prints Shreyansh Jain
2018-04-02 14:06       ` [PATCH v4 7/7] crypto/dpaa2_sec: change to dynamic logging Shreyansh Jain
2018-04-02 22:03       ` [PATCH v4 0/7] Change DPAA2 " Thomas Monjalon

Reply instructions:

You may reply publically 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=20180312092547.18472-5-shreyansh.jain@nxp.com \
    --to=shreyansh.jain@nxp.com \
    --cc=akhil.goyal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=nipun.gupta@nxp.com \
    /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

DPDK-dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \
		dev@dpdk.org
	public-inbox-index dpdk-dev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git