event/dpaa2: replace static with dynamic logging
authorNipun Gupta <nipun.gupta@nxp.com>
Wed, 17 Jan 2018 11:39:09 +0000 (17:09 +0530)
committerJerin Jacob <jerin.jacob@caviumnetworks.com>
Fri, 19 Jan 2018 15:09:56 +0000 (16:09 +0100)
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
config/common_base
config/defconfig_arm64-dpaa2-linuxapp-gcc
doc/guides/eventdevs/dpaa2.rst
drivers/event/dpaa2/dpaa2_eventdev.c
drivers/event/dpaa2/dpaa2_eventdev.h
drivers/event/dpaa2/dpaa2_eventdev_logs.h [new file with mode: 0644]
drivers/event/dpaa2/dpaa2_hw_dpcon.c

index 8d1715a..571746e 100644 (file)
@@ -594,6 +594,11 @@ CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF=y
 #
 CONFIG_RTE_LIBRTE_PMD_OPDL_EVENTDEV=y
 
+#
+# Compile PMD for NXP DPAA2 event device
+#
+CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV=n
+
 #
 # Compile librte_ring
 #
index cd3396b..d38d696 100644 (file)
@@ -62,4 +62,3 @@ CONFIG_RTE_DPAA2_SEC_PMD_MAX_NB_SESSIONS=2048
 # Compile schedule-oriented NXP DPAA2 EVENTDEV driver
 #
 CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV=y
-CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV_DEBUG=n
index bbffd5e..5b8da95 100644 (file)
@@ -102,10 +102,6 @@ Please note that enabling debugging options may affect system performance.
 
   Toggle compilation of the ``lrte_pmd_dpaa2_event`` driver.
 
-- ``CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV_DEBUG`` (default ``n``)
-
-  Toggle display of generic debugging messages
-
 Driver Compilation
 ~~~~~~~~~~~~~~~~~~
 
index 498d049..542bccc 100644 (file)
@@ -35,6 +35,7 @@
 #include <dpaa2_hw_dpio.h>
 #include <dpaa2_ethdev.h>
 #include "dpaa2_eventdev.h"
+#include "dpaa2_eventdev_logs.h"
 #include <portal/dpaa2_hw_pvt.h>
 #include <mc/fsl_dpci.h>
 
@@ -46,6 +47,9 @@
  * Soft Event Flow is DPCI Instance
  */
 
+/* Dynamic logging identified for mempool */
+int dpaa2_logtype_event;
+
 static uint16_t
 dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[],
                             uint16_t nb_events)
@@ -68,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) {
-                       PMD_DRV_LOG(ERR, "Failure in affining portal\n");
+                       DPAA2_EVENTDEV_ERR("Failure in affining portal\n");
                        return 0;
                }
        }
@@ -118,7 +122,7 @@ dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[],
                                if (!loop)
                                        return num_tx;
                                frames_to_send = loop;
-                               PMD_DRV_LOG(ERR, "Unable to allocate memory");
+                               DPAA2_EVENTDEV_ERR("Unable to allocate memory");
                                goto send_partial;
                        }
                        rte_memcpy(ev_temp, event, sizeof(struct rte_event));
@@ -163,9 +167,9 @@ RETRY:
                 * case to avoid the problem.
                 */
                if (errno == EINTR) {
-                       PMD_DRV_LOG(DEBUG, "epoll_wait fails\n");
+                       DPAA2_EVENTDEV_DEBUG("epoll_wait fails\n");
                        if (i++ > 10)
-                               PMD_DRV_LOG(DEBUG, "Dequeue burst Failed\n");
+                               DPAA2_EVENTDEV_DEBUG("Dequeue burst Failed\n");
                goto RETRY;
                }
        }
@@ -223,7 +227,7 @@ dpaa2_eventdev_dequeue_burst(void *port, struct rte_event ev[],
        if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
                ret = dpaa2_affine_qbman_swp();
                if (ret) {
-                       PMD_DRV_LOG(ERR, "Failure in affining portal\n");
+                       DPAA2_EVENTDEV_ERR("Failure in affining portal\n");
                        return 0;
                }
        }
@@ -259,7 +263,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);
-                       PMD_DRV_LOG(ERR, "Null Return VQ received\n");
+                       DPAA2_EVENTDEV_ERR("Null Return VQ received\n");
                        return 0;
                }
 
@@ -282,7 +286,7 @@ dpaa2_eventdev_info_get(struct rte_eventdev *dev,
 {
        struct dpaa2_eventdev *priv = dev->data->dev_private;
 
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        RTE_SET_USED(dev);
 
@@ -320,7 +324,7 @@ dpaa2_eventdev_configure(const struct rte_eventdev *dev)
        struct dpaa2_eventdev *priv = dev->data->dev_private;
        struct rte_event_dev_config *conf = &dev->data->dev_conf;
 
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        priv->dequeue_timeout_ns = conf->dequeue_timeout_ns;
        priv->nb_event_queues = conf->nb_event_queues;
@@ -330,14 +334,15 @@ dpaa2_eventdev_configure(const struct rte_eventdev *dev)
        priv->nb_event_port_enqueue_depth = conf->nb_event_port_enqueue_depth;
        priv->event_dev_cfg = conf->event_dev_cfg;
 
-       PMD_DRV_LOG(DEBUG, "Configured eventdev devid=%d", dev->data->dev_id);
+       DPAA2_EVENTDEV_DEBUG("Configured eventdev devid=%d",
+               dev->data->dev_id);
        return 0;
 }
 
 static int
 dpaa2_eventdev_start(struct rte_eventdev *dev)
 {
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        RTE_SET_USED(dev);
 
@@ -347,7 +352,7 @@ dpaa2_eventdev_start(struct rte_eventdev *dev)
 static void
 dpaa2_eventdev_stop(struct rte_eventdev *dev)
 {
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        RTE_SET_USED(dev);
 }
@@ -355,7 +360,7 @@ dpaa2_eventdev_stop(struct rte_eventdev *dev)
 static int
 dpaa2_eventdev_close(struct rte_eventdev *dev)
 {
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        RTE_SET_USED(dev);
 
@@ -366,7 +371,7 @@ static void
 dpaa2_eventdev_queue_def_conf(struct rte_eventdev *dev, uint8_t queue_id,
                              struct rte_event_queue_conf *queue_conf)
 {
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        RTE_SET_USED(dev);
        RTE_SET_USED(queue_id);
@@ -381,7 +386,7 @@ dpaa2_eventdev_queue_def_conf(struct rte_eventdev *dev, uint8_t queue_id,
 static void
 dpaa2_eventdev_queue_release(struct rte_eventdev *dev, uint8_t queue_id)
 {
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        RTE_SET_USED(dev);
        RTE_SET_USED(queue_id);
@@ -395,7 +400,7 @@ dpaa2_eventdev_queue_setup(struct rte_eventdev *dev, uint8_t queue_id,
        struct evq_info_t *evq_info =
                &priv->evq_info[queue_id];
 
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        evq_info->event_queue_cfg = queue_conf->event_queue_cfg;
 
@@ -406,7 +411,7 @@ static void
 dpaa2_eventdev_port_def_conf(struct rte_eventdev *dev, uint8_t port_id,
                             struct rte_event_port_conf *port_conf)
 {
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        RTE_SET_USED(dev);
        RTE_SET_USED(port_id);
@@ -424,7 +429,7 @@ dpaa2_eventdev_port_def_conf(struct rte_eventdev *dev, uint8_t port_id,
 static void
 dpaa2_eventdev_port_release(void *port)
 {
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        RTE_SET_USED(port);
 }
@@ -433,7 +438,7 @@ static int
 dpaa2_eventdev_port_setup(struct rte_eventdev *dev, uint8_t port_id,
                          const struct rte_event_port_conf *port_conf)
 {
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        RTE_SET_USED(port_conf);
 
@@ -459,7 +464,7 @@ dpaa2_eventdev_port_unlink(struct rte_eventdev *dev, void *port,
        struct evq_info_t *evq_info;
        int i;
 
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        for (i = 0; i < nb_unlinks; i++) {
                evq_info = &priv->evq_info[queues[i]];
@@ -485,7 +490,7 @@ dpaa2_eventdev_port_link(struct rte_eventdev *dev, void *port,
        uint8_t channel_index;
        int ret, i, n;
 
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        for (i = 0; i < nb_links; i++) {
                evq_info = &priv->evq_info[queues[i]];
@@ -497,7 +502,7 @@ 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) {
-                       PMD_DRV_ERR("Static dequeue cfg failed with ret: %d\n",
+                       DPAA2_EVENTDEV_ERR("Static dequeue cfg failed with ret: %d\n",
                                    ret);
                        goto err;
                }
@@ -530,7 +535,7 @@ dpaa2_eventdev_timeout_ticks(struct rte_eventdev *dev, uint64_t ns,
 {
        uint32_t scale = 1;
 
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        RTE_SET_USED(dev);
        *timeout_ticks = ns * scale;
@@ -541,7 +546,7 @@ dpaa2_eventdev_timeout_ticks(struct rte_eventdev *dev, uint64_t ns,
 static void
 dpaa2_eventdev_dump(struct rte_eventdev *dev, FILE *f)
 {
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        RTE_SET_USED(dev);
        RTE_SET_USED(f);
@@ -554,7 +559,7 @@ dpaa2_eventdev_eth_caps_get(const struct rte_eventdev *dev,
 {
        const char *ethdev_driver = eth_dev->device->driver->name;
 
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        RTE_SET_USED(dev);
 
@@ -576,13 +581,13 @@ dpaa2_eventdev_eth_queue_add_all(const struct rte_eventdev *dev,
        uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
        int i, ret;
 
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
                ret = dpaa2_eth_eventq_attach(eth_dev, i,
                                dpcon_id, queue_conf);
                if (ret) {
-                       PMD_DRV_ERR("dpaa2_eth_eventq_attach failed: ret %d\n",
+                       DPAA2_EVENTDEV_ERR("dpaa2_eth_eventq_attach failed: ret %d\n",
                                    ret);
                        goto fail;
                }
@@ -606,7 +611,7 @@ dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
        uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
        int ret;
 
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        if (rx_queue_id == -1)
                return dpaa2_eventdev_eth_queue_add_all(dev,
@@ -615,7 +620,7 @@ 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) {
-               PMD_DRV_ERR("dpaa2_eth_eventq_attach failed: ret: %d\n", ret);
+               DPAA2_EVENTDEV_ERR("dpaa2_eth_eventq_attach failed: ret: %d\n", ret);
                return ret;
        }
        return 0;
@@ -627,14 +632,14 @@ dpaa2_eventdev_eth_queue_del_all(const struct rte_eventdev *dev,
 {
        int i, ret;
 
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        RTE_SET_USED(dev);
 
        for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
                ret = dpaa2_eth_eventq_detach(eth_dev, i);
                if (ret) {
-                       PMD_DRV_ERR("dpaa2_eth_eventq_detach failed: ret %d\n",
+                       DPAA2_EVENTDEV_ERR("dpaa2_eth_eventq_detach failed: ret %d\n",
                                    ret);
                        return ret;
                }
@@ -650,14 +655,14 @@ dpaa2_eventdev_eth_queue_del(const struct rte_eventdev *dev,
 {
        int ret;
 
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        if (rx_queue_id == -1)
                return dpaa2_eventdev_eth_queue_del_all(dev, eth_dev);
 
        ret = dpaa2_eth_eventq_detach(eth_dev, rx_queue_id);
        if (ret) {
-               PMD_DRV_ERR("dpaa2_eth_eventq_detach failed: ret: %d\n", ret);
+               DPAA2_EVENTDEV_ERR("dpaa2_eth_eventq_detach failed: ret: %d\n", ret);
                return ret;
        }
 
@@ -668,7 +673,7 @@ static int
 dpaa2_eventdev_eth_start(const struct rte_eventdev *dev,
                         const struct rte_eth_dev *eth_dev)
 {
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        RTE_SET_USED(dev);
        RTE_SET_USED(eth_dev);
@@ -680,7 +685,7 @@ static int
 dpaa2_eventdev_eth_stop(const struct rte_eventdev *dev,
                        const struct rte_eth_dev *eth_dev)
 {
-       PMD_DRV_FUNC_TRACE();
+       EVENTDEV_INIT_FUNC_TRACE();
 
        RTE_SET_USED(dev);
        RTE_SET_USED(eth_dev);
@@ -737,7 +742,7 @@ dpaa2_eventdev_setup_dpci(struct dpaa2_dpci_dev *dpci_dev,
                                        dpci_dev->token, i,
                                        &rx_queue_cfg);
                if (ret) {
-                       PMD_DRV_LOG(ERR,
+                       DPAA2_EVENTDEV_ERR(
                                    "set_rx_q failed with err code: %d", ret);
                        return ret;
                }
@@ -758,7 +763,7 @@ dpaa2_eventdev_create(const char *name)
                                           sizeof(struct dpaa2_eventdev),
                                           rte_socket_id());
        if (eventdev == NULL) {
-               PMD_DRV_ERR("Failed to create eventdev vdev %s", name);
+               DPAA2_EVENTDEV_ERR("Failed to create eventdev vdev %s", name);
                goto fail;
        }
 
@@ -792,7 +797,7 @@ dpaa2_eventdev_create(const char *name)
 
                ret = dpaa2_eventdev_setup_dpci(dpci_dev, dpcon_dev);
                if (ret) {
-                       PMD_DRV_LOG(ERR,
+                       DPAA2_EVENTDEV_ERR(
                                    "dpci setup failed with err code: %d", ret);
                        return ret;
                }
@@ -810,7 +815,7 @@ dpaa2_eventdev_probe(struct rte_vdev_device *vdev)
        const char *name;
 
        name = rte_vdev_device_name(vdev);
-       PMD_DRV_LOG(INFO, "Initializing %s", name);
+       DPAA2_EVENTDEV_INFO("Initializing %s", name);
        return dpaa2_eventdev_create(name);
 }
 
@@ -820,7 +825,7 @@ dpaa2_eventdev_remove(struct rte_vdev_device *vdev)
        const char *name;
 
        name = rte_vdev_device_name(vdev);
-       PMD_DRV_LOG(INFO, "Closing %s", name);
+       DPAA2_EVENTDEV_INFO("Closing %s", name);
 
        return rte_event_pmd_vdev_uninit(name);
 }
index 96524fa..91c8f2a 100644 (file)
 
 #define EVENTDEV_NAME_DPAA2_PMD                event_dpaa2
 
-#ifdef RTE_LIBRTE_PMD_DPAA2_EVENTDEV_DEBUG
-#define PMD_DRV_LOG(level, fmt, args...) \
-       RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
-#define PMD_DRV_FUNC_TRACE() PMD_DRV_LOG(DEBUG, ">>")
-#else
-#define PMD_DRV_LOG(level, fmt, args...) do { } while (0)
-#define PMD_DRV_FUNC_TRACE() do { } while (0)
-#endif
-
-#define PMD_DRV_ERR(fmt, args...) \
-       RTE_LOG(ERR, PMD, "%s(): " fmt "\n", __func__, ## args)
-
 #define DPAA2_EVENT_DEFAULT_DPCI_PRIO 0
 
 #define DPAA2_EVENT_MAX_QUEUES                 16
diff --git a/drivers/event/dpaa2/dpaa2_eventdev_logs.h b/drivers/event/dpaa2/dpaa2_eventdev_logs.h
new file mode 100644 (file)
index 0000000..7d250c3
--- /dev/null
@@ -0,0 +1,37 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2018 NXP
+ */
+
+#ifndef _DPAA2_EVENTDEV_LOGS_H_
+#define _DPAA2_EVENTDEV_LOGS_H_
+
+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)
+
+#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...) \
+       DPAA2_EVENTDEV_LOG(ERR, fmt, ## args)
+#define DPAA2_EVENTDEV_WARN(fmt, args...) \
+       DPAA2_EVENTDEV_LOG(WARNING, fmt, ## args)
+
+/* DP Logs, toggled out at compile time if level lower than current level */
+#define DPAA2_EVENTDEV_DP_LOG(level, fmt, args...) \
+       RTE_LOG_DP(level, PMD, fmt, ## args)
+
+#define DPAA2_EVENTDEV_DP_DEBUG(fmt, args...) \
+       DPAA2_EVENTDEV_DP_LOG(DEBUG, fmt, ## args)
+#define DPAA2_EVENTDEV_DP_INFO(fmt, args...) \
+       DPAA2_EVENTDEV_DP_LOG(INFO, fmt, ## args)
+#define DPAA2_EVENTDEV_DP_WARN(fmt, args...) \
+       DPAA2_EVENTDEV_DP_LOG(WARNING, fmt, ## args)
+
+#endif /* _DPAA2_EVENTDEV_LOGS_H_ */
index cdb3f86..c949b2d 100644 (file)
@@ -20,6 +20,7 @@
 #include <rte_dev.h>
 #include <rte_ethdev.h>
 
+#include <fslmc_logs.h>
 #include <rte_fslmc.h>
 #include <mc/fsl_dpcon.h>
 #include <portal/dpaa2_hw_pvt.h>