DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/4] drivers: add queue parameter in event processing callback
@ 2017-10-10 17:51 Nipun Gupta
  2017-10-10 17:51 ` [dpdk-dev] [PATCH 2/4] net/dpaa2: add API's to support event eth adapter Nipun Gupta
                   ` (6 more replies)
  0 siblings, 7 replies; 37+ messages in thread
From: Nipun Gupta @ 2017-10-10 17:51 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

For event dequeues for ethernet queues, a dpaa2_queue structure is
required to get the configuration for that ethernet queue. Based on
this configuration the rte_event is to be filled at the ingress side.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
These patches are based on the below patch series:
http://dpdk.org/dev/patchwork/patch/29806/

 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 4 ++++
 drivers/event/dpaa2/dpaa2_eventdev.c    | 8 +++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 5d7a828..0d5be29 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -124,9 +124,12 @@ struct queue_storage_info_t {
 	int toggle;
 };
 
+struct dpaa2_queue;
+
 typedef void (dpaa2_queue_cb_dqrr_t)(struct qbman_swp *swp,
 		const struct qbman_fd *fd,
 		const struct qbman_result *dq,
+		struct dpaa2_queue *rxq,
 		struct rte_event *ev);
 
 struct dpaa2_queue {
@@ -143,6 +146,7 @@ struct dpaa2_queue {
 		struct queue_storage_info_t *q_storage;
 		struct qbman_result *cscn;
 	};
+	struct rte_event ev;
 	dpaa2_queue_cb_dqrr_t *cb;
 };
 
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index cf2d274..6967741 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -189,10 +189,14 @@ static void dpaa2_eventdev_dequeue_wait(uint64_t timeout_ticks)
 static void dpaa2_eventdev_process_parallel(struct qbman_swp *swp,
 					    const struct qbman_fd *fd,
 					    const struct qbman_result *dq,
+					    struct dpaa2_queue *rxq,
 					    struct rte_event *ev)
 {
 	struct rte_event *ev_temp =
 		(struct rte_event *)DPAA2_GET_FD_ADDR(fd);
+
+	RTE_SET_USED(rxq);
+
 	rte_memcpy(ev, ev_temp, sizeof(struct rte_event));
 	rte_free(ev_temp);
 
@@ -202,6 +206,7 @@ static void dpaa2_eventdev_process_parallel(struct qbman_swp *swp,
 static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 					  const struct qbman_fd *fd,
 					  const struct qbman_result *dq,
+					  struct dpaa2_queue *rxq,
 					  struct rte_event *ev)
 {
 	struct rte_event *ev_temp =
@@ -209,6 +214,7 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 	uint8_t dqrr_index = qbman_get_dqrr_idx(dq);
 
 	RTE_SET_USED(swp);
+	RTE_SET_USED(rxq);
 
 	rte_memcpy(ev, ev_temp, sizeof(struct rte_event));
 	rte_free(ev_temp);
@@ -265,7 +271,7 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 
 		rxq = (struct dpaa2_queue *)qbman_result_DQ_fqd_ctx(dq);
 		if (rxq) {
-			rxq->cb(swp, fd, dq, &ev[num_pkts]);
+			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");
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-dev] [PATCH 2/4] net/dpaa2: add API's to support event eth adapter
  2017-10-10 17:51 [dpdk-dev] [PATCH 1/4] drivers: add queue parameter in event processing callback Nipun Gupta
@ 2017-10-10 17:51 ` Nipun Gupta
  2017-10-10 17:51 ` [dpdk-dev] [PATCH 3/4] event/dpaa2: " Nipun Gupta
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 37+ messages in thread
From: Nipun Gupta @ 2017-10-10 17:51 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/net/dpaa2/dpaa2_ethdev.c            | 67 +++++++++++++++++++++++++++++
 drivers/net/dpaa2/dpaa2_ethdev.h            | 15 +++++++
 drivers/net/dpaa2/dpaa2_rxtx.c              | 20 +++++++++
 drivers/net/dpaa2/rte_pmd_dpaa2_version.map |  7 +++
 4 files changed, 109 insertions(+)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 429b3a0..73b139d 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1299,6 +1299,73 @@ void dpaa2_dev_stats_reset(struct rte_eth_dev *dev)
 	return ret;
 }
 
+int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
+		int eth_rx_queue_id,
+		uint16_t dpcon_id,
+		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
+{
+	struct dpaa2_dev_priv *eth_priv = dev->data->dev_private;
+	struct fsl_mc_io *dpni = (struct fsl_mc_io *)eth_priv->hw;
+	struct dpaa2_queue *dpaa2_ethq = eth_priv->rx_vq[eth_rx_queue_id];
+	uint8_t flow_id = dpaa2_ethq->flow_id;
+
+	struct dpni_queue cfg;
+	uint8_t options;
+	int ret;
+
+	memset(&cfg, 0, sizeof(struct dpni_queue));
+	options = DPNI_QUEUE_OPT_DEST;
+	cfg.destination.type = DPNI_DEST_DPCON;
+	cfg.destination.id = dpcon_id;
+	cfg.destination.priority = queue_conf->ev.priority;
+
+	options |= DPNI_QUEUE_OPT_USER_CTX;
+	cfg.user_context = (uint64_t)(dpaa2_ethq);
+
+	ret = dpni_set_queue(dpni, CMD_PRI_LOW,
+		eth_priv->token, DPNI_QUEUE_RX,
+		dpaa2_ethq->tc_index, flow_id, options, &cfg);
+	if (ret) {
+		RTE_LOG(ERR, PMD, "Error in dpni_set_queue: ret: %d\n", ret);
+		return ret;
+	}
+
+	if (queue_conf->ev.sched_type == RTE_SCHED_TYPE_PARALLEL)
+		dpaa2_ethq->cb = dpaa2_dev_process_parallel_event;
+	else
+		return -1;
+
+	memcpy(&dpaa2_ethq->ev, &queue_conf->ev, sizeof(struct rte_event));
+
+	return 0;
+}
+
+int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
+		int eth_rx_queue_id)
+{
+	struct dpaa2_dev_priv *eth_priv = dev->data->dev_private;
+	struct fsl_mc_io *dpni = (struct fsl_mc_io *)eth_priv->hw;
+	struct dpaa2_queue *dpaa2_ethq = eth_priv->rx_vq[eth_rx_queue_id];
+	uint8_t flow_id = dpaa2_ethq->flow_id;
+	struct dpni_queue cfg;
+	uint8_t options;
+	int ret;
+
+	memset(&cfg, 0, sizeof(struct dpni_queue));
+	options = DPNI_QUEUE_OPT_DEST;
+	cfg.destination.type = DPNI_DEST_NONE;
+
+	ret = dpni_set_queue(dpni, CMD_PRI_LOW,
+		eth_priv->token, DPNI_QUEUE_RX,
+		dpaa2_ethq->tc_index, flow_id, options, &cfg);
+	if (ret) {
+		RTE_LOG(ERR, PMD, "Error in dpni_set_queue: ret: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
 static struct eth_dev_ops dpaa2_ethdev_ops = {
 	.dev_configure	  = dpaa2_eth_dev_configure,
 	.dev_start	      = dpaa2_dev_start,
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
index a2902da..03258fd 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.h
+++ b/drivers/net/dpaa2/dpaa2_ethdev.h
@@ -34,6 +34,8 @@
 #ifndef _DPAA2_ETHDEV_H
 #define _DPAA2_ETHDEV_H
 
+#include <rte_event_eth_rx_adapter.h>
+
 #include <mc/fsl_dpni.h>
 #include <mc/fsl_mc_sys.h>
 
@@ -99,8 +101,21 @@ int dpaa2_remove_flow_dist(struct rte_eth_dev *eth_dev,
 
 int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, void *blist);
 
+int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
+		int eth_rx_queue_id,
+		uint16_t dpcon_id,
+		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
+
+int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
+		int eth_rx_queue_id);
+
 uint16_t dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs,
 			       uint16_t nb_pkts);
+void dpaa2_dev_process_parallel_event(struct qbman_swp *swp,
+				    const struct qbman_fd *fd,
+				    const struct qbman_result *dq,
+				    struct dpaa2_queue *rxq,
+				    struct rte_event *ev);
 uint16_t dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
 uint16_t dummy_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
 #endif /* _DPAA2_ETHDEV_H */
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 3c057a3..bcdc1c3 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -517,6 +517,26 @@ static inline int __attribute__((hot))
 	return num_rx;
 }
 
+void __attribute__((hot))
+dpaa2_dev_process_parallel_event(struct qbman_swp *swp,
+				  const struct qbman_fd *fd,
+				  const struct qbman_result *dq,
+				  struct dpaa2_queue *rxq,
+				  struct rte_event *ev)
+{
+	ev->mbuf = eth_fd_to_mbuf(fd);
+
+	ev->flow_id = rxq->ev.flow_id;
+	ev->sub_event_type = rxq->ev.sub_event_type;
+	ev->event_type = RTE_EVENT_TYPE_ETHDEV;
+	ev->op = RTE_EVENT_OP_NEW;
+	ev->sched_type = rxq->ev.sched_type;
+	ev->queue_id = rxq->ev.queue_id;
+	ev->priority = rxq->ev.priority;
+
+	qbman_swp_dqrr_consume(swp, dq);
+}
+
 /*
  * Callback to handle sending packets through WRIOP based interface
  */
diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
index 8591cc0..b741bc0 100644
--- a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
+++ b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
@@ -2,3 +2,10 @@ DPDK_17.05 {
 
 	local: *;
 };
+
+DPDK_17.11 {
+	global:
+
+	dpaa2_eth_eventq_attach;
+	dpaa2_eth_eventq_detach;
+};
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-dev] [PATCH 3/4] event/dpaa2: support event eth adapter
  2017-10-10 17:51 [dpdk-dev] [PATCH 1/4] drivers: add queue parameter in event processing callback Nipun Gupta
  2017-10-10 17:51 ` [dpdk-dev] [PATCH 2/4] net/dpaa2: add API's to support event eth adapter Nipun Gupta
@ 2017-10-10 17:51 ` Nipun Gupta
  2017-10-11  3:45   ` Rao, Nikhil
  2017-10-11  4:10   ` Rao, Nikhil
  2017-10-10 17:51 ` [dpdk-dev] [PATCH 4/4] event/dpaa2: improve the err handling and log msg Nipun Gupta
                   ` (4 subsequent siblings)
  6 siblings, 2 replies; 37+ messages in thread
From: Nipun Gupta @ 2017-10-10 17:51 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/event/Makefile               |  4 +-
 drivers/event/dpaa2/Makefile         |  2 +
 drivers/event/dpaa2/dpaa2_eventdev.c | 96 +++++++++++++++++++++++++++++++++++-
 drivers/event/dpaa2/dpaa2_eventdev.h |  8 +++
 4 files changed, 107 insertions(+), 3 deletions(-)

diff --git a/drivers/event/Makefile b/drivers/event/Makefile
index 3f6b898..accba6e 100644
--- a/drivers/event/Makefile
+++ b/drivers/event/Makefile
@@ -31,7 +31,7 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-core-libs := librte_eal librte_eventdev
+core-libs := librte_eal librte_ether librte_eventdev
 
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_EVENTDEV) += skeleton
 DEPDIRS-skeleton = $(core-libs)
@@ -40,6 +40,6 @@ DEPDIRS-sw = $(core-libs) librte_kvargs librte_ring
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += octeontx
 DEPDIRS-octeontx = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV) += dpaa2
-DEPDIRS-dpaa2 = $(core-libs) librte_bus_fslmc
+DEPDIRS-dpaa2 = $(core-libs) librte_bus_fslmc librte_pmd_dpaa2
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/event/dpaa2/Makefile b/drivers/event/dpaa2/Makefile
index 3497d09..2d1d7c4 100644
--- a/drivers/event/dpaa2/Makefile
+++ b/drivers/event/dpaa2/Makefile
@@ -45,6 +45,8 @@ CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/portal
 CFLAGS += -I$(RTE_SDK)/drivers/mempool/dpaa2
 CFLAGS += -I$(RTE_SDK)/drivers/event/dpaa2
 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal
+CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2
+CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2/mc
 
 # versioning export map
 EXPORT_MAP := rte_pmd_dpaa2_event_version.map
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 6967741..ca782c3 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -53,11 +53,14 @@
 #include <rte_memzone.h>
 #include <rte_pci.h>
 #include <rte_vdev.h>
+#include <rte_ethdev.h>
+#include <rte_event_eth_rx_adapter.h>
 
 #include <fslmc_vfio.h>
 #include <dpaa2_hw_pvt.h>
 #include <dpaa2_hw_mempool.h>
 #include <dpaa2_hw_dpio.h>
+#include <dpaa2_ethdev.h>
 #include "dpaa2_eventdev.h"
 #include <portal/dpaa2_hw_pvt.h>
 #include <mc/fsl_dpci.h>
@@ -557,6 +560,92 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 	RTE_SET_USED(f);
 }
 
+static int
+dpaa2_eventdev_eth_caps_get(const struct rte_eventdev *dev,
+			    const struct rte_eth_dev *eth_dev,
+			    uint32_t *caps)
+{
+	const char *ethdev_driver = eth_dev->device->driver->name;
+
+	PMD_DRV_FUNC_TRACE();
+
+	RTE_SET_USED(dev);
+
+	if (!strcmp(ethdev_driver, "net_dpaa2"))
+		*caps = RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP;
+	else
+		*caps = RTE_EVENT_ETH_RX_ADAPTER_SW_CAP;
+
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
+		const struct rte_eth_dev *eth_dev,
+		int32_t rx_queue_id,
+		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
+{
+	struct dpaa2_eventdev *priv = dev->data->dev_private;
+	uint8_t ev_qid = queue_conf->ev.queue_id;
+	uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
+	int ret;
+
+	PMD_DRV_FUNC_TRACE();
+
+	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);
+		return ret;
+	}
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_queue_del(const struct rte_eventdev *dev,
+			     const struct rte_eth_dev *eth_dev,
+			     int32_t rx_queue_id)
+{
+	int ret;
+
+	PMD_DRV_FUNC_TRACE();
+
+	RTE_SET_USED(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);
+		return ret;
+	}
+	return 0;
+
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_start(const struct rte_eventdev *dev,
+			 const struct rte_eth_dev *eth_dev)
+{
+	PMD_DRV_FUNC_TRACE();
+
+	RTE_SET_USED(dev);
+	RTE_SET_USED(eth_dev);
+
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_stop(const struct rte_eventdev *dev,
+			const struct rte_eth_dev *eth_dev)
+{
+	PMD_DRV_FUNC_TRACE();
+
+	RTE_SET_USED(dev);
+	RTE_SET_USED(eth_dev);
+
+	return 0;
+}
+
 static const struct rte_eventdev_ops dpaa2_eventdev_ops = {
 	.dev_infos_get    = dpaa2_eventdev_info_get,
 	.dev_configure    = dpaa2_eventdev_configure,
@@ -572,7 +661,12 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 	.port_link        = dpaa2_eventdev_port_link,
 	.port_unlink      = dpaa2_eventdev_port_unlink,
 	.timeout_ticks    = dpaa2_eventdev_timeout_ticks,
-	.dump             = dpaa2_eventdev_dump
+	.dump             = dpaa2_eventdev_dump,
+	.eth_rx_adapter_caps_get = dpaa2_eventdev_eth_caps_get,
+	.eth_rx_adapter_queue_add = dpaa2_eventdev_eth_queue_add,
+	.eth_rx_adapter_queue_del = dpaa2_eventdev_eth_queue_del,
+	.eth_rx_adapter_start = dpaa2_eventdev_eth_start,
+	.eth_rx_adapter_stop = dpaa2_eventdev_eth_stop,
 };
 
 static int
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.h b/drivers/event/dpaa2/dpaa2_eventdev.h
index f79f78a..ae8e07e 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.h
+++ b/drivers/event/dpaa2/dpaa2_eventdev.h
@@ -74,6 +74,14 @@ enum {
 	DPAA2_EVENT_DPCI_MAX_QUEUES
 };
 
+#define RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP \
+		(RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT | \
+		RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ | \
+		RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID)
+/**< Ethernet Rx adapter cap to return If the packet transfers from
+ * the ethdev to eventdev with DPAA2 devices.
+ */
+
 struct dpaa2_dpcon_dev {
 	TAILQ_ENTRY(dpaa2_dpcon_dev) next;
 	struct fsl_mc_io dpcon;
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-dev] [PATCH 4/4] event/dpaa2: improve the err handling and log msg
  2017-10-10 17:51 [dpdk-dev] [PATCH 1/4] drivers: add queue parameter in event processing callback Nipun Gupta
  2017-10-10 17:51 ` [dpdk-dev] [PATCH 2/4] net/dpaa2: add API's to support event eth adapter Nipun Gupta
  2017-10-10 17:51 ` [dpdk-dev] [PATCH 3/4] event/dpaa2: " Nipun Gupta
@ 2017-10-10 17:51 ` Nipun Gupta
  2017-10-12 17:18 ` [dpdk-dev] [PATCH v2 1/4] drivers: add queue parameter in event processing callback Nipun Gupta
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 37+ messages in thread
From: Nipun Gupta @ 2017-10-10 17:51 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/event/dpaa2/dpaa2_eventdev.c | 9 +++++++++
 drivers/event/dpaa2/dpaa2_hw_dpcon.c | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index ca782c3..7cb5d43 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -140,11 +140,20 @@
 			 */
 			struct rte_event *ev_temp = rte_malloc(NULL,
 				sizeof(struct rte_event), 0);
+
+			if (!ev_temp) {
+				if (!loop)
+					return num_tx;
+				frames_to_send = loop;
+				PMD_DRV_LOG(ERR, "Unable to allocate memory");
+				goto send_partial;
+			}
 			rte_memcpy(ev_temp, event, sizeof(struct rte_event));
 			DPAA2_SET_FD_ADDR((&fd_arr[loop]), ev_temp);
 			DPAA2_SET_FD_LEN((&fd_arr[loop]),
 					 sizeof(struct rte_event));
 		}
+send_partial:
 		loop = 0;
 		while (loop < frames_to_send) {
 			loop += qbman_swp_enqueue_multiple_eqdesc(swp,
diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
index d3e73f9..f889aa8 100644
--- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c
+++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
@@ -100,7 +100,7 @@
 
 	TAILQ_INSERT_TAIL(&dpcon_dev_list, dpcon_node, next);
 
-	PMD_DRV_LOG(DEBUG, "DPAA2: Added [dpcon.%d]", dpcon_id);
+	RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpcon.%d]\n", dpcon_id);
 
 	return 0;
 }
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-dev] [PATCH 3/4] event/dpaa2: support event eth adapter
  2017-10-10 17:51 ` [dpdk-dev] [PATCH 3/4] event/dpaa2: " Nipun Gupta
@ 2017-10-11  3:45   ` Rao, Nikhil
  2017-10-11 11:03     ` Nipun Gupta
  2017-10-11  4:10   ` Rao, Nikhil
  1 sibling, 1 reply; 37+ messages in thread
From: Rao, Nikhil @ 2017-10-11  3:45 UTC (permalink / raw)
  To: Nipun Gupta, dev; +Cc: hemant.agrawal, jerin.jacob


On 10/10/2017 11:21 PM, Nipun Gupta wrote:
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>   drivers/event/Makefile               |  4 +-
>   drivers/event/dpaa2/Makefile         |  2 +
>   drivers/event/dpaa2/dpaa2_eventdev.c | 96 +++++++++++++++++++++++++++++++++++-
>   drivers/event/dpaa2/dpaa2_eventdev.h |  8 +++
>   4 files changed, 107 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
> index 6967741..ca782c3 100644
> --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> @@ -53,11 +53,14 @@
>   #include <rte_memzone.h>
>   #include <rte_pci.h>
>   #include <rte_vdev.h>
> +#include <rte_ethdev.h>
> +#include <rte_event_eth_rx_adapter.h>
>   
>   #include <fslmc_vfio.h>
>   #include <dpaa2_hw_pvt.h>
>   #include <dpaa2_hw_mempool.h>
>   #include <dpaa2_hw_dpio.h>
> +#include <dpaa2_ethdev.h>
>   #include "dpaa2_eventdev.h"
>   #include <portal/dpaa2_hw_pvt.h>
>   #include <mc/fsl_dpci.h>
> @@ -557,6 +560,92 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
>   	RTE_SET_USED(f);
>   }
>   
> +static int
> +dpaa2_eventdev_eth_caps_get(const struct rte_eventdev *dev,
> +			    const struct rte_eth_dev *eth_dev,
> +			    uint32_t *caps)
> +{
> +	const char *ethdev_driver = eth_dev->device->driver->name;
> +
> +	PMD_DRV_FUNC_TRACE();
> +
> +	RTE_SET_USED(dev);
> +
> +	if (!strcmp(ethdev_driver, "net_dpaa2"))
> +		*caps = RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP;
> +	else
> +		*caps = RTE_EVENT_ETH_RX_ADAPTER_SW_CAP;
> +
> +	return 0;
> +}
> +
> +static int
> +dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
> +		const struct rte_eth_dev *eth_dev,
> +		int32_t rx_queue_id,
> +		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
> +{
> +	struct dpaa2_eventdev *priv = dev->data->dev_private;
> +	uint8_t ev_qid = queue_conf->ev.queue_id;
> +	uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
> +	int ret;
> +
> +	PMD_DRV_FUNC_TRACE();
> +
> +	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);
> +		return ret;
> +	}
> +	return 0;
> +}
> +
> +static int
> +dpaa2_eventdev_eth_queue_del(const struct rte_eventdev *dev,
> +			     const struct rte_eth_dev *eth_dev,
> +			     int32_t rx_queue_id)
> +{
> +	int ret;
> +
> +	PMD_DRV_FUNC_TRACE();
> +
> +	RTE_SET_USED(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);
> +		return ret;
> +	}
> +	return 0;
> +
> +	return 0;

Duplicate return.

Nikhil

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-dev] [PATCH 3/4] event/dpaa2: support event eth adapter
  2017-10-10 17:51 ` [dpdk-dev] [PATCH 3/4] event/dpaa2: " Nipun Gupta
  2017-10-11  3:45   ` Rao, Nikhil
@ 2017-10-11  4:10   ` Rao, Nikhil
  2017-10-11 11:03     ` Nipun Gupta
  1 sibling, 1 reply; 37+ messages in thread
From: Rao, Nikhil @ 2017-10-11  4:10 UTC (permalink / raw)
  To: Nipun Gupta, dev; +Cc: hemant.agrawal, jerin.jacob

On 10/10/2017 11:21 PM, Nipun Gupta wrote:
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>   drivers/event/Makefile               |  4 +-
>   drivers/event/dpaa2/Makefile         |  2 +
>   drivers/event/dpaa2/dpaa2_eventdev.c | 96 +++++++++++++++++++++++++++++++++++-
>   drivers/event/dpaa2/dpaa2_eventdev.h |  8 +++
>   4 files changed, 107 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
> index 6967741..ca782c3 100644
> --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> @@ -53,11 +53,14 @@
>   #include <rte_memzone.h>
>   #include <rte_pci.h>
>   #include <rte_vdev.h>
> +#include <rte_ethdev.h>
> +#include <rte_event_eth_rx_adapter.h>
>   
>   #include <fslmc_vfio.h>
>   #include <dpaa2_hw_pvt.h>
>   #include <dpaa2_hw_mempool.h>
>   #include <dpaa2_hw_dpio.h>
> +#include <dpaa2_ethdev.h>
>   #include "dpaa2_eventdev.h"
>   #include <portal/dpaa2_hw_pvt.h>
>   #include <mc/fsl_dpci.h>
> @@ -557,6 +560,92 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
>   	RTE_SET_USED(f);
>   }
>   
> +static int
> +dpaa2_eventdev_eth_caps_get(const struct rte_eventdev *dev,
> +			    const struct rte_eth_dev *eth_dev,
> +			    uint32_t *caps)
> +{
> +	const char *ethdev_driver = eth_dev->device->driver->name;
> +
> +	PMD_DRV_FUNC_TRACE();
> +
> +	RTE_SET_USED(dev);
> +
> +	if (!strcmp(ethdev_driver, "net_dpaa2"))
> +		*caps = RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP;
> +	else
> +		*caps = RTE_EVENT_ETH_RX_ADAPTER_SW_CAP;
> +
> +	return 0;
> +}
> +
> +static int
> +dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
> +		const struct rte_eth_dev *eth_dev,
> +		int32_t rx_queue_id,
> +		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
> +{
> +	struct dpaa2_eventdev *priv = dev->data->dev_private;
> +	uint8_t ev_qid = queue_conf->ev.queue_id;
> +	uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
> +	int ret;
> +
> +	PMD_DRV_FUNC_TRACE();
> +
> +	ret = dpaa2_eth_eventq_attach(eth_dev, rx_queue_id,
> +		dpcon_id, queue_conf);

Shouldn't the _add & _del functions be handling the case where 
rx_queue_id == -1 ?

> +	if (ret) {
> +		PMD_DRV_ERR("dpaa2_eth_eventq_attach failed: ret: %d\n", ret);
> +		return ret;
> +	}
> +	return 0;
> +}
> +
> +static int
> +dpaa2_eventdev_eth_queue_del(const struct rte_eventdev *dev,
> +			     const struct rte_eth_dev *eth_dev,
> +			     int32_t rx_queue_id)
> +{
> +	int ret;
> +
> +	PMD_DRV_FUNC_TRACE();
> +
> +	RTE_SET_USED(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);
> +		return ret;
> +	}
> +	return 0;
> +
> +	return 0;
> +}
> +

Nikhil

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-dev] [PATCH 3/4] event/dpaa2: support event eth adapter
  2017-10-11  3:45   ` Rao, Nikhil
@ 2017-10-11 11:03     ` Nipun Gupta
  0 siblings, 0 replies; 37+ messages in thread
From: Nipun Gupta @ 2017-10-11 11:03 UTC (permalink / raw)
  To: Rao, Nikhil, dev; +Cc: Hemant Agrawal, jerin.jacob



> -----Original Message-----
> From: Rao, Nikhil [mailto:nikhil.rao@intel.com]
> Sent: Wednesday, October 11, 2017 9:15
> To: Nipun Gupta <nipun.gupta@nxp.com>; dev@dpdk.org
> Cc: Hemant Agrawal <hemant.agrawal@nxp.com>;
> jerin.jacob@caviumnetworks.com
> Subject: Re: [PATCH 3/4] event/dpaa2: support event eth adapter
> 
> 
> On 10/10/2017 11:21 PM, Nipun Gupta wrote:
> > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > ---
> >   drivers/event/Makefile               |  4 +-
> >   drivers/event/dpaa2/Makefile         |  2 +
> >   drivers/event/dpaa2/dpaa2_eventdev.c | 96
> +++++++++++++++++++++++++++++++++++-
> >   drivers/event/dpaa2/dpaa2_eventdev.h |  8 +++
> >   4 files changed, 107 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c
> b/drivers/event/dpaa2/dpaa2_eventdev.c
> > index 6967741..ca782c3 100644
> > --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> > +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> > @@ -53,11 +53,14 @@
> >   #include <rte_memzone.h>
> >   #include <rte_pci.h>
> >   #include <rte_vdev.h>
> > +#include <rte_ethdev.h>
> > +#include <rte_event_eth_rx_adapter.h>
> >
> >   #include <fslmc_vfio.h>
> >   #include <dpaa2_hw_pvt.h>
> >   #include <dpaa2_hw_mempool.h>
> >   #include <dpaa2_hw_dpio.h>
> > +#include <dpaa2_ethdev.h>
> >   #include "dpaa2_eventdev.h"
> >   #include <portal/dpaa2_hw_pvt.h>
> >   #include <mc/fsl_dpci.h>
> > @@ -557,6 +560,92 @@ static void dpaa2_eventdev_process_atomic(struct
> qbman_swp *swp,
> >   	RTE_SET_USED(f);
> >   }
> >
> > +static int
> > +dpaa2_eventdev_eth_caps_get(const struct rte_eventdev *dev,
> > +			    const struct rte_eth_dev *eth_dev,
> > +			    uint32_t *caps)
> > +{
> > +	const char *ethdev_driver = eth_dev->device->driver->name;
> > +
> > +	PMD_DRV_FUNC_TRACE();
> > +
> > +	RTE_SET_USED(dev);
> > +
> > +	if (!strcmp(ethdev_driver, "net_dpaa2"))
> > +		*caps = RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP;
> > +	else
> > +		*caps = RTE_EVENT_ETH_RX_ADAPTER_SW_CAP;
> > +
> > +	return 0;
> > +}
> > +
> > +static int
> > +dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
> > +		const struct rte_eth_dev *eth_dev,
> > +		int32_t rx_queue_id,
> > +		const struct rte_event_eth_rx_adapter_queue_conf
> *queue_conf)
> > +{
> > +	struct dpaa2_eventdev *priv = dev->data->dev_private;
> > +	uint8_t ev_qid = queue_conf->ev.queue_id;
> > +	uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
> > +	int ret;
> > +
> > +	PMD_DRV_FUNC_TRACE();
> > +
> > +	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);
> > +		return ret;
> > +	}
> > +	return 0;
> > +}
> > +
> > +static int
> > +dpaa2_eventdev_eth_queue_del(const struct rte_eventdev *dev,
> > +			     const struct rte_eth_dev *eth_dev,
> > +			     int32_t rx_queue_id)
> > +{
> > +	int ret;
> > +
> > +	PMD_DRV_FUNC_TRACE();
> > +
> > +	RTE_SET_USED(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);
> > +		return ret;
> > +	}
> > +	return 0;
> > +
> > +	return 0;
> 
> Duplicate return.

Don't know  how this came up :/. Ill surely remove in next patch.

> 
> Nikhil

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-dev] [PATCH 3/4] event/dpaa2: support event eth adapter
  2017-10-11  4:10   ` Rao, Nikhil
@ 2017-10-11 11:03     ` Nipun Gupta
  0 siblings, 0 replies; 37+ messages in thread
From: Nipun Gupta @ 2017-10-11 11:03 UTC (permalink / raw)
  To: Rao, Nikhil, dev; +Cc: Hemant Agrawal, jerin.jacob



> -----Original Message-----
> From: Rao, Nikhil [mailto:nikhil.rao@intel.com]
> Sent: Wednesday, October 11, 2017 9:40
> To: Nipun Gupta <nipun.gupta@nxp.com>; dev@dpdk.org
> Cc: Hemant Agrawal <hemant.agrawal@nxp.com>;
> jerin.jacob@caviumnetworks.com
> Subject: Re: [PATCH 3/4] event/dpaa2: support event eth adapter
> 
> On 10/10/2017 11:21 PM, Nipun Gupta wrote:
> > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > ---
> >   drivers/event/Makefile               |  4 +-
> >   drivers/event/dpaa2/Makefile         |  2 +
> >   drivers/event/dpaa2/dpaa2_eventdev.c | 96
> +++++++++++++++++++++++++++++++++++-
> >   drivers/event/dpaa2/dpaa2_eventdev.h |  8 +++
> >   4 files changed, 107 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c
> b/drivers/event/dpaa2/dpaa2_eventdev.c
> > index 6967741..ca782c3 100644
> > --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> > +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> > @@ -53,11 +53,14 @@
> >   #include <rte_memzone.h>
> >   #include <rte_pci.h>
> >   #include <rte_vdev.h>
> > +#include <rte_ethdev.h>
> > +#include <rte_event_eth_rx_adapter.h>
> >
> >   #include <fslmc_vfio.h>
> >   #include <dpaa2_hw_pvt.h>
> >   #include <dpaa2_hw_mempool.h>
> >   #include <dpaa2_hw_dpio.h>
> > +#include <dpaa2_ethdev.h>
> >   #include "dpaa2_eventdev.h"
> >   #include <portal/dpaa2_hw_pvt.h>
> >   #include <mc/fsl_dpci.h>
> > @@ -557,6 +560,92 @@ static void dpaa2_eventdev_process_atomic(struct
> qbman_swp *swp,
> >   	RTE_SET_USED(f);
> >   }
> >
> > +static int
> > +dpaa2_eventdev_eth_caps_get(const struct rte_eventdev *dev,
> > +			    const struct rte_eth_dev *eth_dev,
> > +			    uint32_t *caps)
> > +{
> > +	const char *ethdev_driver = eth_dev->device->driver->name;
> > +
> > +	PMD_DRV_FUNC_TRACE();
> > +
> > +	RTE_SET_USED(dev);
> > +
> > +	if (!strcmp(ethdev_driver, "net_dpaa2"))
> > +		*caps = RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP;
> > +	else
> > +		*caps = RTE_EVENT_ETH_RX_ADAPTER_SW_CAP;
> > +
> > +	return 0;
> > +}
> > +
> > +static int
> > +dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
> > +		const struct rte_eth_dev *eth_dev,
> > +		int32_t rx_queue_id,
> > +		const struct rte_event_eth_rx_adapter_queue_conf
> *queue_conf)
> > +{
> > +	struct dpaa2_eventdev *priv = dev->data->dev_private;
> > +	uint8_t ev_qid = queue_conf->ev.queue_id;
> > +	uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
> > +	int ret;
> > +
> > +	PMD_DRV_FUNC_TRACE();
> > +
> > +	ret = dpaa2_eth_eventq_attach(eth_dev, rx_queue_id,
> > +		dpcon_id, queue_conf);
> 
> Shouldn't the _add & _del functions be handling the case where
> rx_queue_id == -1 ?

Thanks for pointing. I'll send a patch asap supporting this.

> 
> > +	if (ret) {
> > +		PMD_DRV_ERR("dpaa2_eth_eventq_attach failed: ret: %d\n",
> ret);
> > +		return ret;
> > +	}
> > +	return 0;
> > +}
> > +
> > +static int
> > +dpaa2_eventdev_eth_queue_del(const struct rte_eventdev *dev,
> > +			     const struct rte_eth_dev *eth_dev,
> > +			     int32_t rx_queue_id)
> > +{
> > +	int ret;
> > +
> > +	PMD_DRV_FUNC_TRACE();
> > +
> > +	RTE_SET_USED(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);
> > +		return ret;
> > +	}
> > +	return 0;
> > +
> > +	return 0;
> > +}
> > +
> 
> Nikhil

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-dev] [PATCH v2 1/4] drivers: add queue parameter in event processing callback
  2017-10-10 17:51 [dpdk-dev] [PATCH 1/4] drivers: add queue parameter in event processing callback Nipun Gupta
                   ` (2 preceding siblings ...)
  2017-10-10 17:51 ` [dpdk-dev] [PATCH 4/4] event/dpaa2: improve the err handling and log msg Nipun Gupta
@ 2017-10-12 17:18 ` Nipun Gupta
  2017-10-12 17:18   ` [dpdk-dev] [PATCH v2 2/4] net/dpaa2: add API's to support event eth adapter Nipun Gupta
                     ` (3 more replies)
  2017-10-16 21:44 ` [dpdk-dev] [PATCH v3 " Nipun Gupta
                   ` (2 subsequent siblings)
  6 siblings, 4 replies; 37+ messages in thread
From: Nipun Gupta @ 2017-10-12 17:18 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

For event dequeues for ethernet queues, a dpaa2_queue structure is
required to get the configuration for that ethernet queue. Based on
this configuration the rte_event is to be filled at the ingress side.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 4 ++++
 drivers/event/dpaa2/dpaa2_eventdev.c    | 8 +++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 8f39cfb..e14a9a9 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -125,9 +125,12 @@ struct queue_storage_info_t {
 	int toggle;
 };
 
+struct dpaa2_queue;
+
 typedef void (dpaa2_queue_cb_dqrr_t)(struct qbman_swp *swp,
 		const struct qbman_fd *fd,
 		const struct qbman_result *dq,
+		struct dpaa2_queue *rxq,
 		struct rte_event *ev);
 
 struct dpaa2_queue {
@@ -144,6 +147,7 @@ struct dpaa2_queue {
 		struct queue_storage_info_t *q_storage;
 		struct qbman_result *cscn;
 	};
+	struct rte_event ev;
 	dpaa2_queue_cb_dqrr_t *cb;
 };
 
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 81286a8..8a6a3e3 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -189,10 +189,14 @@ static void dpaa2_eventdev_dequeue_wait(uint64_t timeout_ticks)
 static void dpaa2_eventdev_process_parallel(struct qbman_swp *swp,
 					    const struct qbman_fd *fd,
 					    const struct qbman_result *dq,
+					    struct dpaa2_queue *rxq,
 					    struct rte_event *ev)
 {
 	struct rte_event *ev_temp =
 		(struct rte_event *)DPAA2_GET_FD_ADDR(fd);
+
+	RTE_SET_USED(rxq);
+
 	rte_memcpy(ev, ev_temp, sizeof(struct rte_event));
 	rte_free(ev_temp);
 
@@ -202,6 +206,7 @@ static void dpaa2_eventdev_process_parallel(struct qbman_swp *swp,
 static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 					  const struct qbman_fd *fd,
 					  const struct qbman_result *dq,
+					  struct dpaa2_queue *rxq,
 					  struct rte_event *ev)
 {
 	struct rte_event *ev_temp =
@@ -209,6 +214,7 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 	uint8_t dqrr_index = qbman_get_dqrr_idx(dq);
 
 	RTE_SET_USED(swp);
+	RTE_SET_USED(rxq);
 
 	rte_memcpy(ev, ev_temp, sizeof(struct rte_event));
 	rte_free(ev_temp);
@@ -265,7 +271,7 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 
 		rxq = (struct dpaa2_queue *)qbman_result_DQ_fqd_ctx(dq);
 		if (rxq) {
-			rxq->cb(swp, fd, dq, &ev[num_pkts]);
+			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");
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-dev] [PATCH v2 2/4] net/dpaa2: add API's to support event eth adapter
  2017-10-12 17:18 ` [dpdk-dev] [PATCH v2 1/4] drivers: add queue parameter in event processing callback Nipun Gupta
@ 2017-10-12 17:18   ` Nipun Gupta
  2017-10-13 14:55     ` Hemant Agrawal
  2017-10-12 17:18   ` [dpdk-dev] [PATCH v2 3/4] event/dpaa2: " Nipun Gupta
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 37+ messages in thread
From: Nipun Gupta @ 2017-10-12 17:18 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/net/dpaa2/dpaa2_ethdev.c            | 67 +++++++++++++++++++++++++++++
 drivers/net/dpaa2/dpaa2_ethdev.h            | 15 +++++++
 drivers/net/dpaa2/dpaa2_rxtx.c              | 20 +++++++++
 drivers/net/dpaa2/rte_pmd_dpaa2_version.map |  7 +++
 4 files changed, 109 insertions(+)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 39c32b3..724719a 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1634,6 +1634,73 @@ void dpaa2_dev_stats_get(struct rte_eth_dev *dev,
 	return 0;
 }
 
+int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
+		int eth_rx_queue_id,
+		uint16_t dpcon_id,
+		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
+{
+	struct dpaa2_dev_priv *eth_priv = dev->data->dev_private;
+	struct fsl_mc_io *dpni = (struct fsl_mc_io *)eth_priv->hw;
+	struct dpaa2_queue *dpaa2_ethq = eth_priv->rx_vq[eth_rx_queue_id];
+	uint8_t flow_id = dpaa2_ethq->flow_id;
+
+	struct dpni_queue cfg;
+	uint8_t options;
+	int ret;
+
+	memset(&cfg, 0, sizeof(struct dpni_queue));
+	options = DPNI_QUEUE_OPT_DEST;
+	cfg.destination.type = DPNI_DEST_DPCON;
+	cfg.destination.id = dpcon_id;
+	cfg.destination.priority = queue_conf->ev.priority;
+
+	options |= DPNI_QUEUE_OPT_USER_CTX;
+	cfg.user_context = (uint64_t)(dpaa2_ethq);
+
+	ret = dpni_set_queue(dpni, CMD_PRI_LOW,
+		eth_priv->token, DPNI_QUEUE_RX,
+		dpaa2_ethq->tc_index, flow_id, options, &cfg);
+	if (ret) {
+		RTE_LOG(ERR, PMD, "Error in dpni_set_queue: ret: %d\n", ret);
+		return ret;
+	}
+
+	if (queue_conf->ev.sched_type == RTE_SCHED_TYPE_PARALLEL)
+		dpaa2_ethq->cb = dpaa2_dev_process_parallel_event;
+	else
+		return -1;
+
+	memcpy(&dpaa2_ethq->ev, &queue_conf->ev, sizeof(struct rte_event));
+
+	return 0;
+}
+
+int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
+		int eth_rx_queue_id)
+{
+	struct dpaa2_dev_priv *eth_priv = dev->data->dev_private;
+	struct fsl_mc_io *dpni = (struct fsl_mc_io *)eth_priv->hw;
+	struct dpaa2_queue *dpaa2_ethq = eth_priv->rx_vq[eth_rx_queue_id];
+	uint8_t flow_id = dpaa2_ethq->flow_id;
+	struct dpni_queue cfg;
+	uint8_t options;
+	int ret;
+
+	memset(&cfg, 0, sizeof(struct dpni_queue));
+	options = DPNI_QUEUE_OPT_DEST;
+	cfg.destination.type = DPNI_DEST_NONE;
+
+	ret = dpni_set_queue(dpni, CMD_PRI_LOW,
+		eth_priv->token, DPNI_QUEUE_RX,
+		dpaa2_ethq->tc_index, flow_id, options, &cfg);
+	if (ret) {
+		RTE_LOG(ERR, PMD, "Error in dpni_set_queue: ret: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
 static struct eth_dev_ops dpaa2_ethdev_ops = {
 	.dev_configure	  = dpaa2_eth_dev_configure,
 	.dev_start	      = dpaa2_dev_start,
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
index 7b14ae0..b8e94aa 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.h
+++ b/drivers/net/dpaa2/dpaa2_ethdev.h
@@ -34,6 +34,8 @@
 #ifndef _DPAA2_ETHDEV_H
 #define _DPAA2_ETHDEV_H
 
+#include <rte_event_eth_rx_adapter.h>
+
 #include <mc/fsl_dpni.h>
 #include <mc/fsl_mc_sys.h>
 
@@ -100,8 +102,21 @@ int dpaa2_remove_flow_dist(struct rte_eth_dev *eth_dev,
 
 int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, void *blist);
 
+int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
+		int eth_rx_queue_id,
+		uint16_t dpcon_id,
+		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
+
+int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
+		int eth_rx_queue_id);
+
 uint16_t dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs,
 			       uint16_t nb_pkts);
+void dpaa2_dev_process_parallel_event(struct qbman_swp *swp,
+				      const struct qbman_fd *fd,
+				      const struct qbman_result *dq,
+				      struct dpaa2_queue *rxq,
+				      struct rte_event *ev);
 uint16_t dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
 uint16_t dummy_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
 #endif /* _DPAA2_ETHDEV_H */
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 7cfa73a..a317f7f 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -514,6 +514,26 @@ static inline int __attribute__((hot))
 	return num_rx;
 }
 
+void __attribute__((hot))
+dpaa2_dev_process_parallel_event(struct qbman_swp *swp,
+				 const struct qbman_fd *fd,
+				 const struct qbman_result *dq,
+				 struct dpaa2_queue *rxq,
+				 struct rte_event *ev)
+{
+	ev->mbuf = eth_fd_to_mbuf(fd);
+
+	ev->flow_id = rxq->ev.flow_id;
+	ev->sub_event_type = rxq->ev.sub_event_type;
+	ev->event_type = RTE_EVENT_TYPE_ETHDEV;
+	ev->op = RTE_EVENT_OP_NEW;
+	ev->sched_type = rxq->ev.sched_type;
+	ev->queue_id = rxq->ev.queue_id;
+	ev->priority = rxq->ev.priority;
+
+	qbman_swp_dqrr_consume(swp, dq);
+}
+
 /*
  * Callback to handle sending packets through WRIOP based interface
  */
diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
index 8591cc0..b741bc0 100644
--- a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
+++ b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
@@ -2,3 +2,10 @@ DPDK_17.05 {
 
 	local: *;
 };
+
+DPDK_17.11 {
+	global:
+
+	dpaa2_eth_eventq_attach;
+	dpaa2_eth_eventq_detach;
+};
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-dev] [PATCH v2 3/4] event/dpaa2: support event eth adapter
  2017-10-12 17:18 ` [dpdk-dev] [PATCH v2 1/4] drivers: add queue parameter in event processing callback Nipun Gupta
  2017-10-12 17:18   ` [dpdk-dev] [PATCH v2 2/4] net/dpaa2: add API's to support event eth adapter Nipun Gupta
@ 2017-10-12 17:18   ` Nipun Gupta
  2017-10-13  5:57     ` Rao, Nikhil
  2017-10-12 17:18   ` [dpdk-dev] [PATCH v2 4/4] event/dpaa2: improve the err handling and log msg Nipun Gupta
  2017-10-13 14:48   ` [dpdk-dev] [PATCH v2 1/4] drivers: add queue parameter in event processing callback Hemant Agrawal
  3 siblings, 1 reply; 37+ messages in thread
From: Nipun Gupta @ 2017-10-12 17:18 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/event/Makefile               |   4 +-
 drivers/event/dpaa2/Makefile         |   2 +
 drivers/event/dpaa2/dpaa2_eventdev.c | 151 ++++++++++++++++++++++++++++++++++-
 drivers/event/dpaa2/dpaa2_eventdev.h |   8 ++
 4 files changed, 162 insertions(+), 3 deletions(-)

diff --git a/drivers/event/Makefile b/drivers/event/Makefile
index 3f6b898..accba6e 100644
--- a/drivers/event/Makefile
+++ b/drivers/event/Makefile
@@ -31,7 +31,7 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-core-libs := librte_eal librte_eventdev
+core-libs := librte_eal librte_ether librte_eventdev
 
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_EVENTDEV) += skeleton
 DEPDIRS-skeleton = $(core-libs)
@@ -40,6 +40,6 @@ DEPDIRS-sw = $(core-libs) librte_kvargs librte_ring
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += octeontx
 DEPDIRS-octeontx = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV) += dpaa2
-DEPDIRS-dpaa2 = $(core-libs) librte_bus_fslmc
+DEPDIRS-dpaa2 = $(core-libs) librte_bus_fslmc librte_pmd_dpaa2
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/event/dpaa2/Makefile b/drivers/event/dpaa2/Makefile
index 3497d09..2d1d7c4 100644
--- a/drivers/event/dpaa2/Makefile
+++ b/drivers/event/dpaa2/Makefile
@@ -45,6 +45,8 @@ CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/portal
 CFLAGS += -I$(RTE_SDK)/drivers/mempool/dpaa2
 CFLAGS += -I$(RTE_SDK)/drivers/event/dpaa2
 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal
+CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2
+CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2/mc
 
 # versioning export map
 EXPORT_MAP := rte_pmd_dpaa2_event_version.map
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 8a6a3e3..ee3a164 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -53,11 +53,14 @@
 #include <rte_memzone.h>
 #include <rte_pci.h>
 #include <rte_vdev.h>
+#include <rte_ethdev.h>
+#include <rte_event_eth_rx_adapter.h>
 
 #include <fslmc_vfio.h>
 #include <dpaa2_hw_pvt.h>
 #include <dpaa2_hw_mempool.h>
 #include <dpaa2_hw_dpio.h>
+#include <dpaa2_ethdev.h>
 #include "dpaa2_eventdev.h"
 #include <portal/dpaa2_hw_pvt.h>
 #include <mc/fsl_dpci.h>
@@ -557,6 +560,147 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 	RTE_SET_USED(f);
 }
 
+static int
+dpaa2_eventdev_eth_caps_get(const struct rte_eventdev *dev,
+			    const struct rte_eth_dev *eth_dev,
+			    uint32_t *caps)
+{
+	const char *ethdev_driver = eth_dev->device->driver->name;
+
+	PMD_DRV_FUNC_TRACE();
+
+	RTE_SET_USED(dev);
+
+	if (!strcmp(ethdev_driver, "net_dpaa2"))
+		*caps = RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP;
+	else
+		*caps = RTE_EVENT_ETH_RX_ADAPTER_SW_CAP;
+
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_queue_add_all(const struct rte_eventdev *dev,
+		const struct rte_eth_dev *eth_dev,
+		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
+{
+	struct dpaa2_eventdev *priv = dev->data->dev_private;
+	uint8_t ev_qid = queue_conf->ev.queue_id;
+	uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
+	int i, ret;
+
+	PMD_DRV_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",
+				    ret);
+			goto fail;
+		}
+	}
+	return 0;
+fail:
+	for (i = (i - 1); i >= 0 ; i--)
+		dpaa2_eth_eventq_detach(eth_dev, i);
+
+	return ret;
+}
+
+static int
+dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
+		const struct rte_eth_dev *eth_dev,
+		int32_t rx_queue_id,
+		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
+{
+	struct dpaa2_eventdev *priv = dev->data->dev_private;
+	uint8_t ev_qid = queue_conf->ev.queue_id;
+	uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
+	int ret;
+
+	PMD_DRV_FUNC_TRACE();
+
+	if (rx_queue_id == -1)
+		return dpaa2_eventdev_eth_queue_add_all(dev,
+				eth_dev, queue_conf);
+
+	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);
+		return ret;
+	}
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_queue_del_all(const struct rte_eventdev *dev,
+			     const struct rte_eth_dev *eth_dev)
+{
+	int i, ret;
+
+	PMD_DRV_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",
+				    ret);
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_queue_del(const struct rte_eventdev *dev,
+			     const struct rte_eth_dev *eth_dev,
+			     int32_t rx_queue_id)
+{
+	int ret;
+
+	PMD_DRV_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);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_start(const struct rte_eventdev *dev,
+			 const struct rte_eth_dev *eth_dev)
+{
+	PMD_DRV_FUNC_TRACE();
+
+	RTE_SET_USED(dev);
+	RTE_SET_USED(eth_dev);
+
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_stop(const struct rte_eventdev *dev,
+			const struct rte_eth_dev *eth_dev)
+{
+	PMD_DRV_FUNC_TRACE();
+
+	RTE_SET_USED(dev);
+	RTE_SET_USED(eth_dev);
+
+	return 0;
+}
+
 static const struct rte_eventdev_ops dpaa2_eventdev_ops = {
 	.dev_infos_get    = dpaa2_eventdev_info_get,
 	.dev_configure    = dpaa2_eventdev_configure,
@@ -572,7 +716,12 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 	.port_link        = dpaa2_eventdev_port_link,
 	.port_unlink      = dpaa2_eventdev_port_unlink,
 	.timeout_ticks    = dpaa2_eventdev_timeout_ticks,
-	.dump             = dpaa2_eventdev_dump
+	.dump             = dpaa2_eventdev_dump,
+	.eth_rx_adapter_caps_get = dpaa2_eventdev_eth_caps_get,
+	.eth_rx_adapter_queue_add = dpaa2_eventdev_eth_queue_add,
+	.eth_rx_adapter_queue_del = dpaa2_eventdev_eth_queue_del,
+	.eth_rx_adapter_start = dpaa2_eventdev_eth_start,
+	.eth_rx_adapter_stop = dpaa2_eventdev_eth_stop,
 };
 
 static int
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.h b/drivers/event/dpaa2/dpaa2_eventdev.h
index f79f78a..ae8e07e 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.h
+++ b/drivers/event/dpaa2/dpaa2_eventdev.h
@@ -74,6 +74,14 @@ enum {
 	DPAA2_EVENT_DPCI_MAX_QUEUES
 };
 
+#define RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP \
+		(RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT | \
+		RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ | \
+		RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID)
+/**< Ethernet Rx adapter cap to return If the packet transfers from
+ * the ethdev to eventdev with DPAA2 devices.
+ */
+
 struct dpaa2_dpcon_dev {
 	TAILQ_ENTRY(dpaa2_dpcon_dev) next;
 	struct fsl_mc_io dpcon;
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-dev] [PATCH v2 4/4] event/dpaa2: improve the err handling and log msg
  2017-10-12 17:18 ` [dpdk-dev] [PATCH v2 1/4] drivers: add queue parameter in event processing callback Nipun Gupta
  2017-10-12 17:18   ` [dpdk-dev] [PATCH v2 2/4] net/dpaa2: add API's to support event eth adapter Nipun Gupta
  2017-10-12 17:18   ` [dpdk-dev] [PATCH v2 3/4] event/dpaa2: " Nipun Gupta
@ 2017-10-12 17:18   ` Nipun Gupta
  2017-10-13 14:52     ` Hemant Agrawal
  2017-10-13 14:48   ` [dpdk-dev] [PATCH v2 1/4] drivers: add queue parameter in event processing callback Hemant Agrawal
  3 siblings, 1 reply; 37+ messages in thread
From: Nipun Gupta @ 2017-10-12 17:18 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/event/dpaa2/dpaa2_eventdev.c | 9 +++++++++
 drivers/event/dpaa2/dpaa2_hw_dpcon.c | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index ee3a164..d1be5de 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -140,11 +140,20 @@
 			 */
 			struct rte_event *ev_temp = rte_malloc(NULL,
 				sizeof(struct rte_event), 0);
+
+			if (!ev_temp) {
+				if (!loop)
+					return num_tx;
+				frames_to_send = loop;
+				PMD_DRV_LOG(ERR, "Unable to allocate memory");
+				goto send_partial;
+			}
 			rte_memcpy(ev_temp, event, sizeof(struct rte_event));
 			DPAA2_SET_FD_ADDR((&fd_arr[loop]), ev_temp);
 			DPAA2_SET_FD_LEN((&fd_arr[loop]),
 					 sizeof(struct rte_event));
 		}
+send_partial:
 		loop = 0;
 		while (loop < frames_to_send) {
 			loop += qbman_swp_enqueue_multiple_desc(swp,
diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
index 2c416b5..005e623 100644
--- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c
+++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
@@ -100,7 +100,7 @@
 
 	TAILQ_INSERT_TAIL(&dpcon_dev_list, dpcon_node, next);
 
-	PMD_DRV_LOG(DEBUG, "DPAA2: Added [dpcon.%d]", dpcon_id);
+	RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpcon.%d]\n", dpcon_id);
 
 	return 0;
 }
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/4] event/dpaa2: support event eth adapter
  2017-10-12 17:18   ` [dpdk-dev] [PATCH v2 3/4] event/dpaa2: " Nipun Gupta
@ 2017-10-13  5:57     ` Rao, Nikhil
  2017-10-13 14:52       ` Hemant Agrawal
  0 siblings, 1 reply; 37+ messages in thread
From: Rao, Nikhil @ 2017-10-13  5:57 UTC (permalink / raw)
  To: Nipun Gupta, dev; +Cc: hemant.agrawal, jerin.jacob

On 10/12/2017 10:48 PM, Nipun Gupta wrote:
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>   drivers/event/Makefile               |   4 +-
>   drivers/event/dpaa2/Makefile         |   2 +
>   drivers/event/dpaa2/dpaa2_eventdev.c | 151 ++++++++++++++++++++++++++++++++++-
>   drivers/event/dpaa2/dpaa2_eventdev.h |   8 ++
>   4 files changed, 162 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/event/Makefile b/drivers/event/Makefile
> index 3f6b898..accba6e 100644
> --- a/drivers/event/Makefile
> +++ b/drivers/event/Makefile
> @@ -31,7 +31,7 @@
>   
>   include $(RTE_SDK)/mk/rte.vars.mk
>   
> -core-libs := librte_eal librte_eventdev
> +core-libs := librte_eal librte_ether librte_eventdev
>   
>   DIRS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_EVENTDEV) += skeleton
>   DEPDIRS-skeleton = $(core-libs)
> @@ -40,6 +40,6 @@ DEPDIRS-sw = $(core-libs) librte_kvargs librte_ring
>   DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += octeontx
>   DEPDIRS-octeontx = $(core-libs)
>   DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV) += dpaa2
> -DEPDIRS-dpaa2 = $(core-libs) librte_bus_fslmc
> +DEPDIRS-dpaa2 = $(core-libs) librte_bus_fslmc librte_pmd_dpaa2
>   
>   include $(RTE_SDK)/mk/rte.subdir.mk
> diff --git a/drivers/event/dpaa2/Makefile b/drivers/event/dpaa2/Makefile
> index 3497d09..2d1d7c4 100644
> --- a/drivers/event/dpaa2/Makefile
> +++ b/drivers/event/dpaa2/Makefile
> @@ -45,6 +45,8 @@ CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/portal
>   CFLAGS += -I$(RTE_SDK)/drivers/mempool/dpaa2
>   CFLAGS += -I$(RTE_SDK)/drivers/event/dpaa2
>   CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal
> +CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2
> +CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2/mc
>   
>   # versioning export map
>   EXPORT_MAP := rte_pmd_dpaa2_event_version.map
> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
> index 8a6a3e3..ee3a164 100644
> --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> @@ -53,11 +53,14 @@
>   #include <rte_memzone.h>
>   #include <rte_pci.h>
>   #include <rte_vdev.h>
> +#include <rte_ethdev.h>
> +#include <rte_event_eth_rx_adapter.h>
>   
>   #include <fslmc_vfio.h>
>   #include <dpaa2_hw_pvt.h>
>   #include <dpaa2_hw_mempool.h>
>   #include <dpaa2_hw_dpio.h>
> +#include <dpaa2_ethdev.h>
>   #include "dpaa2_eventdev.h"
>   #include <portal/dpaa2_hw_pvt.h>
>   #include <mc/fsl_dpci.h>
> @@ -557,6 +560,147 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
>   	RTE_SET_USED(f);
>   }
>   
> +static int
> +dpaa2_eventdev_eth_caps_get(const struct rte_eventdev *dev,
> +			    const struct rte_eth_dev *eth_dev,
> +			    uint32_t *caps)
> +{
> +	const char *ethdev_driver = eth_dev->device->driver->name;
> +
> +	PMD_DRV_FUNC_TRACE();
> +
> +	RTE_SET_USED(dev);
> +
> +	if (!strcmp(ethdev_driver, "net_dpaa2"))
> +		*caps = RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP;
> +	else
> +		*caps = RTE_EVENT_ETH_RX_ADAPTER_SW_CAP;
> +
> +	return 0;
> +}
> +
> +static int
> +dpaa2_eventdev_eth_queue_add_all(const struct rte_eventdev *dev,
> +		const struct rte_eth_dev *eth_dev,
> +		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
> +{
> +	struct dpaa2_eventdev *priv = dev->data->dev_private;
> +	uint8_t ev_qid = queue_conf->ev.queue_id;
> +	uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
> +	int i, ret;
> +
> +	PMD_DRV_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",
> +				    ret);
> +			goto fail;
> +		}
> +	}
> +	return 0;
> +fail:
> +	for (i = (i - 1); i >= 0 ; i--)
> +		dpaa2_eth_eventq_detach(eth_dev, i);
> +
> +	return ret;
> +}
> +
> +static int
> +dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
> +		const struct rte_eth_dev *eth_dev,
> +		int32_t rx_queue_id,
> +		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
> +{
> +	struct dpaa2_eventdev *priv = dev->data->dev_private;
> +	uint8_t ev_qid = queue_conf->ev.queue_id;
> +	uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
> +	int ret;
> +
> +	PMD_DRV_FUNC_TRACE();
> +
> +	if (rx_queue_id == -1)
> +		return dpaa2_eventdev_eth_queue_add_all(dev,
> +				eth_dev, queue_conf);
> +
> +	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);
> +		return ret;
> +	}
> +	return 0;
> +}
> +
> +static int
> +dpaa2_eventdev_eth_queue_del_all(const struct rte_eventdev *dev,
> +			     const struct rte_eth_dev *eth_dev)
> +{
> +	int i, ret;
> +
> +	PMD_DRV_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",
> +				    ret);
> +			return ret;
> +		}
> +	}
> +
> +	return 0;
> +}
> +
> +static int
> +dpaa2_eventdev_eth_queue_del(const struct rte_eventdev *dev,
> +			     const struct rte_eth_dev *eth_dev,
> +			     int32_t rx_queue_id)
> +{
> +	int ret;
> +
> +	PMD_DRV_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);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static int
> +dpaa2_eventdev_eth_start(const struct rte_eventdev *dev,
> +			 const struct rte_eth_dev *eth_dev)
> +{
> +	PMD_DRV_FUNC_TRACE();
> +
> +	RTE_SET_USED(dev);
> +	RTE_SET_USED(eth_dev);
> +
> +	return 0;
> +}
> +
> +static int
> +dpaa2_eventdev_eth_stop(const struct rte_eventdev *dev,
> +			const struct rte_eth_dev *eth_dev)
> +{
> +	PMD_DRV_FUNC_TRACE();
> +
> +	RTE_SET_USED(dev);
> +	RTE_SET_USED(eth_dev);
> +
> +	return 0;
> +}
> +
>   static const struct rte_eventdev_ops dpaa2_eventdev_ops = {
>   	.dev_infos_get    = dpaa2_eventdev_info_get,
>   	.dev_configure    = dpaa2_eventdev_configure,
> @@ -572,7 +716,12 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
>   	.port_link        = dpaa2_eventdev_port_link,
>   	.port_unlink      = dpaa2_eventdev_port_unlink,
>   	.timeout_ticks    = dpaa2_eventdev_timeout_ticks,
> -	.dump             = dpaa2_eventdev_dump
> +	.dump             = dpaa2_eventdev_dump,
> +	.eth_rx_adapter_caps_get = dpaa2_eventdev_eth_caps_get,
> +	.eth_rx_adapter_queue_add = dpaa2_eventdev_eth_queue_add,
> +	.eth_rx_adapter_queue_del = dpaa2_eventdev_eth_queue_del,
> +	.eth_rx_adapter_start = dpaa2_eventdev_eth_start,
> +	.eth_rx_adapter_stop = dpaa2_eventdev_eth_stop,
>   };
>   
>   static int
> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.h b/drivers/event/dpaa2/dpaa2_eventdev.h
> index f79f78a..ae8e07e 100644
> --- a/drivers/event/dpaa2/dpaa2_eventdev.h
> +++ b/drivers/event/dpaa2/dpaa2_eventdev.h
> @@ -74,6 +74,14 @@ enum {
>   	DPAA2_EVENT_DPCI_MAX_QUEUES
>   };
>   
> +#define RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP \
> +		(RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT | \
> +		RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ | \
> +		RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID)
> +/**< Ethernet Rx adapter cap to return If the packet transfers from
> + * the ethdev to eventdev with DPAA2 devices.
> + */
> +
>   struct dpaa2_dpcon_dev {
>   	TAILQ_ENTRY(dpaa2_dpcon_dev) next;
>   	struct fsl_mc_io dpcon;
> 

Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/4] drivers: add queue parameter in event processing callback
  2017-10-12 17:18 ` [dpdk-dev] [PATCH v2 1/4] drivers: add queue parameter in event processing callback Nipun Gupta
                     ` (2 preceding siblings ...)
  2017-10-12 17:18   ` [dpdk-dev] [PATCH v2 4/4] event/dpaa2: improve the err handling and log msg Nipun Gupta
@ 2017-10-13 14:48   ` Hemant Agrawal
  3 siblings, 0 replies; 37+ messages in thread
From: Hemant Agrawal @ 2017-10-13 14:48 UTC (permalink / raw)
  To: Nipun Gupta, dev; +Cc: jerin.jacob, nikhil.rao

On 10/12/2017 10:48 PM, Nipun Gupta wrote:
> For event dequeues for ethernet queues, a dpaa2_queue structure is
> required to get the configuration for that ethernet queue. Based on
> this configuration the rte_event is to be filled at the ingress side.
>
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>  drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 4 ++++
>  drivers/event/dpaa2/dpaa2_eventdev.c    | 8 +++++++-
>  2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
> index 8f39cfb..e14a9a9 100644
> --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
> @@ -125,9 +125,12 @@ struct queue_storage_info_t {
>  	int toggle;
>  };
>
> +struct dpaa2_queue;
> +
>  typedef void (dpaa2_queue_cb_dqrr_t)(struct qbman_swp *swp,
>  		const struct qbman_fd *fd,
>  		const struct qbman_result *dq,
> +		struct dpaa2_queue *rxq,
>  		struct rte_event *ev);
>
>  struct dpaa2_queue {
> @@ -144,6 +147,7 @@ struct dpaa2_queue {
>  		struct queue_storage_info_t *q_storage;
>  		struct qbman_result *cscn;
>  	};
> +	struct rte_event ev;
>  	dpaa2_queue_cb_dqrr_t *cb;
>  };
>
> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
> index 81286a8..8a6a3e3 100644
> --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> @@ -189,10 +189,14 @@ static void dpaa2_eventdev_dequeue_wait(uint64_t timeout_ticks)
>  static void dpaa2_eventdev_process_parallel(struct qbman_swp *swp,
>  					    const struct qbman_fd *fd,
>  					    const struct qbman_result *dq,
> +					    struct dpaa2_queue *rxq,
>  					    struct rte_event *ev)
>  {
>  	struct rte_event *ev_temp =
>  		(struct rte_event *)DPAA2_GET_FD_ADDR(fd);
> +
> +	RTE_SET_USED(rxq);
> +
>  	rte_memcpy(ev, ev_temp, sizeof(struct rte_event));
>  	rte_free(ev_temp);
>
> @@ -202,6 +206,7 @@ static void dpaa2_eventdev_process_parallel(struct qbman_swp *swp,
>  static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
>  					  const struct qbman_fd *fd,
>  					  const struct qbman_result *dq,
> +					  struct dpaa2_queue *rxq,
>  					  struct rte_event *ev)
>  {
>  	struct rte_event *ev_temp =
> @@ -209,6 +214,7 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
>  	uint8_t dqrr_index = qbman_get_dqrr_idx(dq);
>
>  	RTE_SET_USED(swp);
> +	RTE_SET_USED(rxq);
>
>  	rte_memcpy(ev, ev_temp, sizeof(struct rte_event));
>  	rte_free(ev_temp);
> @@ -265,7 +271,7 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
>
>  		rxq = (struct dpaa2_queue *)qbman_result_DQ_fqd_ctx(dq);
>  		if (rxq) {
> -			rxq->cb(swp, fd, dq, &ev[num_pkts]);
> +			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");
>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-dev] [PATCH v2 4/4] event/dpaa2: improve the err handling and log msg
  2017-10-12 17:18   ` [dpdk-dev] [PATCH v2 4/4] event/dpaa2: improve the err handling and log msg Nipun Gupta
@ 2017-10-13 14:52     ` Hemant Agrawal
  0 siblings, 0 replies; 37+ messages in thread
From: Hemant Agrawal @ 2017-10-13 14:52 UTC (permalink / raw)
  To: Nipun Gupta, dev; +Cc: jerin.jacob, nikhil.rao

On 10/12/2017 10:48 PM, Nipun Gupta wrote:
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>  drivers/event/dpaa2/dpaa2_eventdev.c | 9 +++++++++
>  drivers/event/dpaa2/dpaa2_hw_dpcon.c | 2 +-
>  2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
> index ee3a164..d1be5de 100644
> --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> @@ -140,11 +140,20 @@
>  			 */
>  			struct rte_event *ev_temp = rte_malloc(NULL,
>  				sizeof(struct rte_event), 0);
> +
> +			if (!ev_temp) {
> +				if (!loop)
> +					return num_tx;
> +				frames_to_send = loop;
> +				PMD_DRV_LOG(ERR, "Unable to allocate memory");
> +				goto send_partial;
> +			}
>  			rte_memcpy(ev_temp, event, sizeof(struct rte_event));
>  			DPAA2_SET_FD_ADDR((&fd_arr[loop]), ev_temp);
>  			DPAA2_SET_FD_LEN((&fd_arr[loop]),
>  					 sizeof(struct rte_event));
>  		}
> +send_partial:
>  		loop = 0;
>  		while (loop < frames_to_send) {
>  			loop += qbman_swp_enqueue_multiple_desc(swp,
> diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
> index 2c416b5..005e623 100644
> --- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c
> +++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
> @@ -100,7 +100,7 @@
>
>  	TAILQ_INSERT_TAIL(&dpcon_dev_list, dpcon_node, next);
>
> -	PMD_DRV_LOG(DEBUG, "DPAA2: Added [dpcon.%d]", dpcon_id);
> +	RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpcon.%d]\n", dpcon_id);
>
>  	return 0;
>  }
>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/4] event/dpaa2: support event eth adapter
  2017-10-13  5:57     ` Rao, Nikhil
@ 2017-10-13 14:52       ` Hemant Agrawal
  0 siblings, 0 replies; 37+ messages in thread
From: Hemant Agrawal @ 2017-10-13 14:52 UTC (permalink / raw)
  To: Rao, Nikhil, Nipun Gupta, dev; +Cc: jerin.jacob

On 10/13/2017 11:27 AM, Rao, Nikhil wrote:
> On 10/12/2017 10:48 PM, Nipun Gupta wrote:
>> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
>> ---
>>   drivers/event/Makefile               |   4 +-
>>   drivers/event/dpaa2/Makefile         |   2 +
>>   drivers/event/dpaa2/dpaa2_eventdev.c | 151
>> ++++++++++++++++++++++++++++++++++-
>>   drivers/event/dpaa2/dpaa2_eventdev.h |   8 ++
>>   4 files changed, 162 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/event/Makefile b/drivers/event/Makefile
>> index 3f6b898..accba6e 100644
>> --- a/drivers/event/Makefile
>> +++ b/drivers/event/Makefile
>> @@ -31,7 +31,7 @@
>>     include $(RTE_SDK)/mk/rte.vars.mk
>>   -core-libs := librte_eal librte_eventdev
>> +core-libs := librte_eal librte_ether librte_eventdev
>>     DIRS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_EVENTDEV) += skeleton
>>   DEPDIRS-skeleton = $(core-libs)
>> @@ -40,6 +40,6 @@ DEPDIRS-sw = $(core-libs) librte_kvargs librte_ring
>>   DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += octeontx
>>   DEPDIRS-octeontx = $(core-libs)
>>   DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV) += dpaa2
>> -DEPDIRS-dpaa2 = $(core-libs) librte_bus_fslmc
>> +DEPDIRS-dpaa2 = $(core-libs) librte_bus_fslmc librte_pmd_dpaa2
>>     include $(RTE_SDK)/mk/rte.subdir.mk
>> diff --git a/drivers/event/dpaa2/Makefile b/drivers/event/dpaa2/Makefile
>> index 3497d09..2d1d7c4 100644
>> --- a/drivers/event/dpaa2/Makefile
>> +++ b/drivers/event/dpaa2/Makefile
>> @@ -45,6 +45,8 @@ CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/portal
>>   CFLAGS += -I$(RTE_SDK)/drivers/mempool/dpaa2
>>   CFLAGS += -I$(RTE_SDK)/drivers/event/dpaa2
>>   CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal
>> +CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2
>> +CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2/mc
>>     # versioning export map
>>   EXPORT_MAP := rte_pmd_dpaa2_event_version.map
>> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c
>> b/drivers/event/dpaa2/dpaa2_eventdev.c
>> index 8a6a3e3..ee3a164 100644
>> --- a/drivers/event/dpaa2/dpaa2_eventdev.c
>> +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
>> @@ -53,11 +53,14 @@
>>   #include <rte_memzone.h>
>>   #include <rte_pci.h>
>>   #include <rte_vdev.h>
>> +#include <rte_ethdev.h>
>> +#include <rte_event_eth_rx_adapter.h>
>>     #include <fslmc_vfio.h>
>>   #include <dpaa2_hw_pvt.h>
>>   #include <dpaa2_hw_mempool.h>
>>   #include <dpaa2_hw_dpio.h>
>> +#include <dpaa2_ethdev.h>
>>   #include "dpaa2_eventdev.h"
>>   #include <portal/dpaa2_hw_pvt.h>
>>   #include <mc/fsl_dpci.h>
>> @@ -557,6 +560,147 @@ static void dpaa2_eventdev_process_atomic(struct
>> qbman_swp *swp,
>>       RTE_SET_USED(f);
>>   }
>>   +static int
>> +dpaa2_eventdev_eth_caps_get(const struct rte_eventdev *dev,
>> +                const struct rte_eth_dev *eth_dev,
>> +                uint32_t *caps)
>> +{
>> +    const char *ethdev_driver = eth_dev->device->driver->name;
>> +
>> +    PMD_DRV_FUNC_TRACE();
>> +
>> +    RTE_SET_USED(dev);
>> +
>> +    if (!strcmp(ethdev_driver, "net_dpaa2"))
>> +        *caps = RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP;
>> +    else
>> +        *caps = RTE_EVENT_ETH_RX_ADAPTER_SW_CAP;
>> +
>> +    return 0;
>> +}
>> +
>> +static int
>> +dpaa2_eventdev_eth_queue_add_all(const struct rte_eventdev *dev,
>> +        const struct rte_eth_dev *eth_dev,
>> +        const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
>> +{
>> +    struct dpaa2_eventdev *priv = dev->data->dev_private;
>> +    uint8_t ev_qid = queue_conf->ev.queue_id;
>> +    uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
>> +    int i, ret;
>> +
>> +    PMD_DRV_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",
>> +                    ret);
>> +            goto fail;
>> +        }
>> +    }
>> +    return 0;
>> +fail:
>> +    for (i = (i - 1); i >= 0 ; i--)
>> +        dpaa2_eth_eventq_detach(eth_dev, i);
>> +
>> +    return ret;
>> +}
>> +
>> +static int
>> +dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
>> +        const struct rte_eth_dev *eth_dev,
>> +        int32_t rx_queue_id,
>> +        const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
>> +{
>> +    struct dpaa2_eventdev *priv = dev->data->dev_private;
>> +    uint8_t ev_qid = queue_conf->ev.queue_id;
>> +    uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
>> +    int ret;
>> +
>> +    PMD_DRV_FUNC_TRACE();
>> +
>> +    if (rx_queue_id == -1)
>> +        return dpaa2_eventdev_eth_queue_add_all(dev,
>> +                eth_dev, queue_conf);
>> +
>> +    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);
>> +        return ret;
>> +    }
>> +    return 0;
>> +}
>> +
>> +static int
>> +dpaa2_eventdev_eth_queue_del_all(const struct rte_eventdev *dev,
>> +                 const struct rte_eth_dev *eth_dev)
>> +{
>> +    int i, ret;
>> +
>> +    PMD_DRV_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",
>> +                    ret);
>> +            return ret;
>> +        }
>> +    }
>> +
>> +    return 0;
>> +}
>> +
>> +static int
>> +dpaa2_eventdev_eth_queue_del(const struct rte_eventdev *dev,
>> +                 const struct rte_eth_dev *eth_dev,
>> +                 int32_t rx_queue_id)
>> +{
>> +    int ret;
>> +
>> +    PMD_DRV_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);
>> +        return ret;
>> +    }
>> +
>> +    return 0;
>> +}
>> +
>> +static int
>> +dpaa2_eventdev_eth_start(const struct rte_eventdev *dev,
>> +             const struct rte_eth_dev *eth_dev)
>> +{
>> +    PMD_DRV_FUNC_TRACE();
>> +
>> +    RTE_SET_USED(dev);
>> +    RTE_SET_USED(eth_dev);
>> +
>> +    return 0;
>> +}
>> +
>> +static int
>> +dpaa2_eventdev_eth_stop(const struct rte_eventdev *dev,
>> +            const struct rte_eth_dev *eth_dev)
>> +{
>> +    PMD_DRV_FUNC_TRACE();
>> +
>> +    RTE_SET_USED(dev);
>> +    RTE_SET_USED(eth_dev);
>> +
>> +    return 0;
>> +}
>> +
>>   static const struct rte_eventdev_ops dpaa2_eventdev_ops = {
>>       .dev_infos_get    = dpaa2_eventdev_info_get,
>>       .dev_configure    = dpaa2_eventdev_configure,
>> @@ -572,7 +716,12 @@ static void dpaa2_eventdev_process_atomic(struct
>> qbman_swp *swp,
>>       .port_link        = dpaa2_eventdev_port_link,
>>       .port_unlink      = dpaa2_eventdev_port_unlink,
>>       .timeout_ticks    = dpaa2_eventdev_timeout_ticks,
>> -    .dump             = dpaa2_eventdev_dump
>> +    .dump             = dpaa2_eventdev_dump,
>> +    .eth_rx_adapter_caps_get = dpaa2_eventdev_eth_caps_get,
>> +    .eth_rx_adapter_queue_add = dpaa2_eventdev_eth_queue_add,
>> +    .eth_rx_adapter_queue_del = dpaa2_eventdev_eth_queue_del,
>> +    .eth_rx_adapter_start = dpaa2_eventdev_eth_start,
>> +    .eth_rx_adapter_stop = dpaa2_eventdev_eth_stop,
>>   };
>>     static int
>> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.h
>> b/drivers/event/dpaa2/dpaa2_eventdev.h
>> index f79f78a..ae8e07e 100644
>> --- a/drivers/event/dpaa2/dpaa2_eventdev.h
>> +++ b/drivers/event/dpaa2/dpaa2_eventdev.h
>> @@ -74,6 +74,14 @@ enum {
>>       DPAA2_EVENT_DPCI_MAX_QUEUES
>>   };
>>   +#define RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP \
>> +        (RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT | \
>> +        RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ | \
>> +        RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID)
>> +/**< Ethernet Rx adapter cap to return If the packet transfers from
>> + * the ethdev to eventdev with DPAA2 devices.
>> + */
>> +
>>   struct dpaa2_dpcon_dev {
>>       TAILQ_ENTRY(dpaa2_dpcon_dev) next;
>>       struct fsl_mc_io dpcon;
>>
>
> Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>
>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/4] net/dpaa2: add API's to support event eth adapter
  2017-10-12 17:18   ` [dpdk-dev] [PATCH v2 2/4] net/dpaa2: add API's to support event eth adapter Nipun Gupta
@ 2017-10-13 14:55     ` Hemant Agrawal
  0 siblings, 0 replies; 37+ messages in thread
From: Hemant Agrawal @ 2017-10-13 14:55 UTC (permalink / raw)
  To: Nipun Gupta, dev; +Cc: jerin.jacob, nikhil.rao

On 10/12/2017 10:48 PM, Nipun Gupta wrote:
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>  drivers/net/dpaa2/dpaa2_ethdev.c            | 67 +++++++++++++++++++++++++++++
>  drivers/net/dpaa2/dpaa2_ethdev.h            | 15 +++++++
>  drivers/net/dpaa2/dpaa2_rxtx.c              | 20 +++++++++
>  drivers/net/dpaa2/rte_pmd_dpaa2_version.map |  7 +++
>  4 files changed, 109 insertions(+)
>
> diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
> index 39c32b3..724719a 100644
> --- a/drivers/net/dpaa2/dpaa2_ethdev.c
> +++ b/drivers/net/dpaa2/dpaa2_ethdev.c
> @@ -1634,6 +1634,73 @@ void dpaa2_dev_stats_get(struct rte_eth_dev *dev,
>  	return 0;
>  }
>
> +int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
> +		int eth_rx_queue_id,
> +		uint16_t dpcon_id,
> +		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
> +{
> +	struct dpaa2_dev_priv *eth_priv = dev->data->dev_private;
> +	struct fsl_mc_io *dpni = (struct fsl_mc_io *)eth_priv->hw;
> +	struct dpaa2_queue *dpaa2_ethq = eth_priv->rx_vq[eth_rx_queue_id];
> +	uint8_t flow_id = dpaa2_ethq->flow_id;
> +
> +	struct dpni_queue cfg;
> +	uint8_t options;
> +	int ret;
> +
> +	memset(&cfg, 0, sizeof(struct dpni_queue));
> +	options = DPNI_QUEUE_OPT_DEST;
> +	cfg.destination.type = DPNI_DEST_DPCON;
> +	cfg.destination.id = dpcon_id;
> +	cfg.destination.priority = queue_conf->ev.priority;
> +
> +	options |= DPNI_QUEUE_OPT_USER_CTX;
> +	cfg.user_context = (uint64_t)(dpaa2_ethq);
> +
> +	ret = dpni_set_queue(dpni, CMD_PRI_LOW,
> +		eth_priv->token, DPNI_QUEUE_RX,
> +		dpaa2_ethq->tc_index, flow_id, options, &cfg);
> +	if (ret) {
> +		RTE_LOG(ERR, PMD, "Error in dpni_set_queue: ret: %d\n", ret);
> +		return ret;
> +	}
> +
> +	if (queue_conf->ev.sched_type == RTE_SCHED_TYPE_PARALLEL)
> +		dpaa2_ethq->cb = dpaa2_dev_process_parallel_event;
> +	else
> +		return -1;
> +
Should not you check the type supported in the start of function?
This way you will not be doing hw "dpni_set_queue" for not supported case?

> +	memcpy(&dpaa2_ethq->ev, &queue_conf->ev, sizeof(struct rte_event));
> +
> +	return 0;
> +}
> +
> +int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
> +		int eth_rx_queue_id)
> +{
> +	struct dpaa2_dev_priv *eth_priv = dev->data->dev_private;
> +	struct fsl_mc_io *dpni = (struct fsl_mc_io *)eth_priv->hw;
> +	struct dpaa2_queue *dpaa2_ethq = eth_priv->rx_vq[eth_rx_queue_id];
> +	uint8_t flow_id = dpaa2_ethq->flow_id;
> +	struct dpni_queue cfg;
> +	uint8_t options;
> +	int ret;
> +
> +	memset(&cfg, 0, sizeof(struct dpni_queue));
> +	options = DPNI_QUEUE_OPT_DEST;
> +	cfg.destination.type = DPNI_DEST_NONE;
> +
> +	ret = dpni_set_queue(dpni, CMD_PRI_LOW,
> +		eth_priv->token, DPNI_QUEUE_RX,
> +		dpaa2_ethq->tc_index, flow_id, options, &cfg);
> +	if (ret) {
> +		RTE_LOG(ERR, PMD, "Error in dpni_set_queue: ret: %d\n", ret);
> +		return ret;
> +	}
> +
> +	return 0;

trivial one.
you can simply "return ret" in both cases.

> +}
> +
>  static struct eth_dev_ops dpaa2_ethdev_ops = {
>  	.dev_configure	  = dpaa2_eth_dev_configure,
>  	.dev_start	      = dpaa2_dev_start,
> diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
> index 7b14ae0..b8e94aa 100644
> --- a/drivers/net/dpaa2/dpaa2_ethdev.h
> +++ b/drivers/net/dpaa2/dpaa2_ethdev.h
> @@ -34,6 +34,8 @@
>  #ifndef _DPAA2_ETHDEV_H
>  #define _DPAA2_ETHDEV_H
>
> +#include <rte_event_eth_rx_adapter.h>
> +
>  #include <mc/fsl_dpni.h>
>  #include <mc/fsl_mc_sys.h>
>
> @@ -100,8 +102,21 @@ int dpaa2_remove_flow_dist(struct rte_eth_dev *eth_dev,
>
>  int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, void *blist);
>
> +int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
> +		int eth_rx_queue_id,
> +		uint16_t dpcon_id,
> +		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
> +
> +int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
> +		int eth_rx_queue_id);
> +
>  uint16_t dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs,
>  			       uint16_t nb_pkts);
> +void dpaa2_dev_process_parallel_event(struct qbman_swp *swp,
> +				      const struct qbman_fd *fd,
> +				      const struct qbman_result *dq,
> +				      struct dpaa2_queue *rxq,
> +				      struct rte_event *ev);
>  uint16_t dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
>  uint16_t dummy_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
>  #endif /* _DPAA2_ETHDEV_H */
> diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
> index 7cfa73a..a317f7f 100644
> --- a/drivers/net/dpaa2/dpaa2_rxtx.c
> +++ b/drivers/net/dpaa2/dpaa2_rxtx.c
> @@ -514,6 +514,26 @@ static inline int __attribute__((hot))
>  	return num_rx;
>  }
>
> +void __attribute__((hot))
> +dpaa2_dev_process_parallel_event(struct qbman_swp *swp,
> +				 const struct qbman_fd *fd,
> +				 const struct qbman_result *dq,
> +				 struct dpaa2_queue *rxq,
> +				 struct rte_event *ev)
> +{
> +	ev->mbuf = eth_fd_to_mbuf(fd);
> +
> +	ev->flow_id = rxq->ev.flow_id;
> +	ev->sub_event_type = rxq->ev.sub_event_type;
> +	ev->event_type = RTE_EVENT_TYPE_ETHDEV;
> +	ev->op = RTE_EVENT_OP_NEW;
> +	ev->sched_type = rxq->ev.sched_type;
> +	ev->queue_id = rxq->ev.queue_id;
> +	ev->priority = rxq->ev.priority;
> +
> +	qbman_swp_dqrr_consume(swp, dq);
> +}
> +
>  /*
>   * Callback to handle sending packets through WRIOP based interface
>   */
> diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
> index 8591cc0..b741bc0 100644
> --- a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
> +++ b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
> @@ -2,3 +2,10 @@ DPDK_17.05 {
>
>  	local: *;
>  };
> +
> +DPDK_17.11 {
> +	global:
> +
> +	dpaa2_eth_eventq_attach;
> +	dpaa2_eth_eventq_detach;
> +};
>

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-dev] [PATCH v3 1/4] drivers: add queue parameter in event processing callback
  2017-10-10 17:51 [dpdk-dev] [PATCH 1/4] drivers: add queue parameter in event processing callback Nipun Gupta
                   ` (3 preceding siblings ...)
  2017-10-12 17:18 ` [dpdk-dev] [PATCH v2 1/4] drivers: add queue parameter in event processing callback Nipun Gupta
@ 2017-10-16 21:44 ` Nipun Gupta
  2017-10-16 21:44   ` [dpdk-dev] [PATCH v3 2/4] net/dpaa2: add API's to support event eth adapter Nipun Gupta
                     ` (2 more replies)
  2017-10-17 16:38 ` [dpdk-dev] [PATCH v4 1/5] drivers: add queue parameter in event processing callback Nipun Gupta
  2017-10-23 12:37 ` [dpdk-dev] [PATCH v5 1/5] drivers: add queue parameter in event processing callback Nipun Gupta
  6 siblings, 3 replies; 37+ messages in thread
From: Nipun Gupta @ 2017-10-16 21:44 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

For event dequeues for ethernet queues, a dpaa2_queue structure is
required to get the configuration for that ethernet queue. Based on
this configuration the rte_event is to be filled at the ingress side.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
This patch series is based over the following patch:
http://dpdk.org/dev/patchwork/patch/30430/

 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 4 ++++
 drivers/event/dpaa2/dpaa2_eventdev.c    | 8 +++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 8f39cfb..e14a9a9 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -125,9 +125,12 @@ struct queue_storage_info_t {
 	int toggle;
 };
 
+struct dpaa2_queue;
+
 typedef void (dpaa2_queue_cb_dqrr_t)(struct qbman_swp *swp,
 		const struct qbman_fd *fd,
 		const struct qbman_result *dq,
+		struct dpaa2_queue *rxq,
 		struct rte_event *ev);
 
 struct dpaa2_queue {
@@ -144,6 +147,7 @@ struct dpaa2_queue {
 		struct queue_storage_info_t *q_storage;
 		struct qbman_result *cscn;
 	};
+	struct rte_event ev;
 	dpaa2_queue_cb_dqrr_t *cb;
 };
 
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 81286a8..8a6a3e3 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -189,10 +189,14 @@ static void dpaa2_eventdev_dequeue_wait(uint64_t timeout_ticks)
 static void dpaa2_eventdev_process_parallel(struct qbman_swp *swp,
 					    const struct qbman_fd *fd,
 					    const struct qbman_result *dq,
+					    struct dpaa2_queue *rxq,
 					    struct rte_event *ev)
 {
 	struct rte_event *ev_temp =
 		(struct rte_event *)DPAA2_GET_FD_ADDR(fd);
+
+	RTE_SET_USED(rxq);
+
 	rte_memcpy(ev, ev_temp, sizeof(struct rte_event));
 	rte_free(ev_temp);
 
@@ -202,6 +206,7 @@ static void dpaa2_eventdev_process_parallel(struct qbman_swp *swp,
 static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 					  const struct qbman_fd *fd,
 					  const struct qbman_result *dq,
+					  struct dpaa2_queue *rxq,
 					  struct rte_event *ev)
 {
 	struct rte_event *ev_temp =
@@ -209,6 +214,7 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 	uint8_t dqrr_index = qbman_get_dqrr_idx(dq);
 
 	RTE_SET_USED(swp);
+	RTE_SET_USED(rxq);
 
 	rte_memcpy(ev, ev_temp, sizeof(struct rte_event));
 	rte_free(ev_temp);
@@ -265,7 +271,7 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 
 		rxq = (struct dpaa2_queue *)qbman_result_DQ_fqd_ctx(dq);
 		if (rxq) {
-			rxq->cb(swp, fd, dq, &ev[num_pkts]);
+			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");
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-dev] [PATCH v3 2/4] net/dpaa2: add API's to support event eth adapter
  2017-10-16 21:44 ` [dpdk-dev] [PATCH v3 " Nipun Gupta
@ 2017-10-16 21:44   ` Nipun Gupta
  2017-10-16 21:44   ` [dpdk-dev] [PATCH v3 3/4] event/dpaa2: " Nipun Gupta
  2017-10-16 21:44   ` [dpdk-dev] [PATCH v3 4/4] event/dpaa2: improve the err handling and log msg Nipun Gupta
  2 siblings, 0 replies; 37+ messages in thread
From: Nipun Gupta @ 2017-10-16 21:44 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
Changes in v3:
  Check the queue schedule type before configuring MC (Hemant)

 drivers/net/dpaa2/dpaa2_ethdev.c            | 62 +++++++++++++++++++++++++++++
 drivers/net/dpaa2/dpaa2_ethdev.h            | 15 +++++++
 drivers/net/dpaa2/dpaa2_rxtx.c              | 20 ++++++++++
 drivers/net/dpaa2/rte_pmd_dpaa2_version.map |  7 ++++
 4 files changed, 104 insertions(+)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 1ac607c..14d79b9 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1634,6 +1634,68 @@ int dpaa2_dev_stats_get(struct rte_eth_dev *dev,
 	return 0;
 }
 
+int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
+		int eth_rx_queue_id,
+		uint16_t dpcon_id,
+		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
+{
+	struct dpaa2_dev_priv *eth_priv = dev->data->dev_private;
+	struct fsl_mc_io *dpni = (struct fsl_mc_io *)eth_priv->hw;
+	struct dpaa2_queue *dpaa2_ethq = eth_priv->rx_vq[eth_rx_queue_id];
+	uint8_t flow_id = dpaa2_ethq->flow_id;
+	struct dpni_queue cfg;
+	uint8_t options;
+	int ret;
+
+	if (queue_conf->ev.sched_type == RTE_SCHED_TYPE_PARALLEL)
+		dpaa2_ethq->cb = dpaa2_dev_process_parallel_event;
+	else
+		return -EINVAL;
+
+	memset(&cfg, 0, sizeof(struct dpni_queue));
+	options = DPNI_QUEUE_OPT_DEST;
+	cfg.destination.type = DPNI_DEST_DPCON;
+	cfg.destination.id = dpcon_id;
+	cfg.destination.priority = queue_conf->ev.priority;
+
+	options |= DPNI_QUEUE_OPT_USER_CTX;
+	cfg.user_context = (uint64_t)(dpaa2_ethq);
+
+	ret = dpni_set_queue(dpni, CMD_PRI_LOW, eth_priv->token, DPNI_QUEUE_RX,
+			     dpaa2_ethq->tc_index, flow_id, options, &cfg);
+	if (ret) {
+		RTE_LOG(ERR, PMD, "Error in dpni_set_queue: ret: %d\n", ret);
+		return ret;
+	}
+
+	memcpy(&dpaa2_ethq->ev, &queue_conf->ev, sizeof(struct rte_event));
+
+	return 0;
+}
+
+int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
+		int eth_rx_queue_id)
+{
+	struct dpaa2_dev_priv *eth_priv = dev->data->dev_private;
+	struct fsl_mc_io *dpni = (struct fsl_mc_io *)eth_priv->hw;
+	struct dpaa2_queue *dpaa2_ethq = eth_priv->rx_vq[eth_rx_queue_id];
+	uint8_t flow_id = dpaa2_ethq->flow_id;
+	struct dpni_queue cfg;
+	uint8_t options;
+	int ret;
+
+	memset(&cfg, 0, sizeof(struct dpni_queue));
+	options = DPNI_QUEUE_OPT_DEST;
+	cfg.destination.type = DPNI_DEST_NONE;
+
+	ret = dpni_set_queue(dpni, CMD_PRI_LOW, eth_priv->token, DPNI_QUEUE_RX,
+			     dpaa2_ethq->tc_index, flow_id, options, &cfg);
+	if (ret)
+		RTE_LOG(ERR, PMD, "Error in dpni_set_queue: ret: %d\n", ret);
+
+	return ret;
+}
+
 static struct eth_dev_ops dpaa2_ethdev_ops = {
 	.dev_configure	  = dpaa2_eth_dev_configure,
 	.dev_start	      = dpaa2_dev_start,
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
index 7b14ae0..b8e94aa 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.h
+++ b/drivers/net/dpaa2/dpaa2_ethdev.h
@@ -34,6 +34,8 @@
 #ifndef _DPAA2_ETHDEV_H
 #define _DPAA2_ETHDEV_H
 
+#include <rte_event_eth_rx_adapter.h>
+
 #include <mc/fsl_dpni.h>
 #include <mc/fsl_mc_sys.h>
 
@@ -100,8 +102,21 @@ int dpaa2_remove_flow_dist(struct rte_eth_dev *eth_dev,
 
 int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, void *blist);
 
+int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
+		int eth_rx_queue_id,
+		uint16_t dpcon_id,
+		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
+
+int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
+		int eth_rx_queue_id);
+
 uint16_t dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs,
 			       uint16_t nb_pkts);
+void dpaa2_dev_process_parallel_event(struct qbman_swp *swp,
+				      const struct qbman_fd *fd,
+				      const struct qbman_result *dq,
+				      struct dpaa2_queue *rxq,
+				      struct rte_event *ev);
 uint16_t dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
 uint16_t dummy_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
 #endif /* _DPAA2_ETHDEV_H */
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 7cfa73a..a317f7f 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -514,6 +514,26 @@ static inline int __attribute__((hot))
 	return num_rx;
 }
 
+void __attribute__((hot))
+dpaa2_dev_process_parallel_event(struct qbman_swp *swp,
+				 const struct qbman_fd *fd,
+				 const struct qbman_result *dq,
+				 struct dpaa2_queue *rxq,
+				 struct rte_event *ev)
+{
+	ev->mbuf = eth_fd_to_mbuf(fd);
+
+	ev->flow_id = rxq->ev.flow_id;
+	ev->sub_event_type = rxq->ev.sub_event_type;
+	ev->event_type = RTE_EVENT_TYPE_ETHDEV;
+	ev->op = RTE_EVENT_OP_NEW;
+	ev->sched_type = rxq->ev.sched_type;
+	ev->queue_id = rxq->ev.queue_id;
+	ev->priority = rxq->ev.priority;
+
+	qbman_swp_dqrr_consume(swp, dq);
+}
+
 /*
  * Callback to handle sending packets through WRIOP based interface
  */
diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
index 8591cc0..b741bc0 100644
--- a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
+++ b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
@@ -2,3 +2,10 @@ DPDK_17.05 {
 
 	local: *;
 };
+
+DPDK_17.11 {
+	global:
+
+	dpaa2_eth_eventq_attach;
+	dpaa2_eth_eventq_detach;
+};
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-dev] [PATCH v3 3/4] event/dpaa2: support event eth adapter
  2017-10-16 21:44 ` [dpdk-dev] [PATCH v3 " Nipun Gupta
  2017-10-16 21:44   ` [dpdk-dev] [PATCH v3 2/4] net/dpaa2: add API's to support event eth adapter Nipun Gupta
@ 2017-10-16 21:44   ` Nipun Gupta
  2017-10-17  5:00     ` Jerin Jacob
  2017-10-16 21:44   ` [dpdk-dev] [PATCH v3 4/4] event/dpaa2: improve the err handling and log msg Nipun Gupta
  2 siblings, 1 reply; 37+ messages in thread
From: Nipun Gupta @ 2017-10-16 21:44 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
Changes in v3:
  Fix shared library build
Changes in v2:
  Support rx_queue_id = -1 in eth adapter queue and and del (Nikhil)
  Remove duplicate returns (Nikhil)

 drivers/Makefile                     |   2 +-
 drivers/event/Makefile               |   4 +-
 drivers/event/dpaa2/Makefile         |   2 +
 drivers/event/dpaa2/dpaa2_eventdev.c | 151 ++++++++++++++++++++++++++++++++++-
 drivers/event/dpaa2/dpaa2_eventdev.h |   8 ++
 5 files changed, 163 insertions(+), 4 deletions(-)

diff --git a/drivers/Makefile b/drivers/Makefile
index 0467250..db0cd76 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -39,6 +39,6 @@ DEPDIRS-net := bus mempool
 DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto
 DEPDIRS-crypto := bus mempool
 DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event
-DEPDIRS-event := bus mempool
+DEPDIRS-event := bus mempool net
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/event/Makefile b/drivers/event/Makefile
index d09be74..e119d60 100644
--- a/drivers/event/Makefile
+++ b/drivers/event/Makefile
@@ -31,7 +31,7 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-core-libs := librte_eal librte_eventdev
+core-libs := librte_eal librte_ether librte_eventdev
 
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_EVENTDEV) += skeleton
 DEPDIRS-skeleton = $(core-libs)
@@ -40,6 +40,6 @@ DEPDIRS-sw = $(core-libs) librte_kvargs librte_ring
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += octeontx
 DEPDIRS-octeontx = $(core-libs) librte_mempool_octeontx
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV) += dpaa2
-DEPDIRS-dpaa2 = $(core-libs) librte_bus_fslmc
+DEPDIRS-dpaa2 = $(core-libs) librte_bus_fslmc librte_pmd_dpaa2
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/event/dpaa2/Makefile b/drivers/event/dpaa2/Makefile
index 3497d09..2d1d7c4 100644
--- a/drivers/event/dpaa2/Makefile
+++ b/drivers/event/dpaa2/Makefile
@@ -45,6 +45,8 @@ CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/portal
 CFLAGS += -I$(RTE_SDK)/drivers/mempool/dpaa2
 CFLAGS += -I$(RTE_SDK)/drivers/event/dpaa2
 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal
+CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2
+CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2/mc
 
 # versioning export map
 EXPORT_MAP := rte_pmd_dpaa2_event_version.map
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 8a6a3e3..ee3a164 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -53,11 +53,14 @@
 #include <rte_memzone.h>
 #include <rte_pci.h>
 #include <rte_vdev.h>
+#include <rte_ethdev.h>
+#include <rte_event_eth_rx_adapter.h>
 
 #include <fslmc_vfio.h>
 #include <dpaa2_hw_pvt.h>
 #include <dpaa2_hw_mempool.h>
 #include <dpaa2_hw_dpio.h>
+#include <dpaa2_ethdev.h>
 #include "dpaa2_eventdev.h"
 #include <portal/dpaa2_hw_pvt.h>
 #include <mc/fsl_dpci.h>
@@ -557,6 +560,147 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 	RTE_SET_USED(f);
 }
 
+static int
+dpaa2_eventdev_eth_caps_get(const struct rte_eventdev *dev,
+			    const struct rte_eth_dev *eth_dev,
+			    uint32_t *caps)
+{
+	const char *ethdev_driver = eth_dev->device->driver->name;
+
+	PMD_DRV_FUNC_TRACE();
+
+	RTE_SET_USED(dev);
+
+	if (!strcmp(ethdev_driver, "net_dpaa2"))
+		*caps = RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP;
+	else
+		*caps = RTE_EVENT_ETH_RX_ADAPTER_SW_CAP;
+
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_queue_add_all(const struct rte_eventdev *dev,
+		const struct rte_eth_dev *eth_dev,
+		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
+{
+	struct dpaa2_eventdev *priv = dev->data->dev_private;
+	uint8_t ev_qid = queue_conf->ev.queue_id;
+	uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
+	int i, ret;
+
+	PMD_DRV_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",
+				    ret);
+			goto fail;
+		}
+	}
+	return 0;
+fail:
+	for (i = (i - 1); i >= 0 ; i--)
+		dpaa2_eth_eventq_detach(eth_dev, i);
+
+	return ret;
+}
+
+static int
+dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
+		const struct rte_eth_dev *eth_dev,
+		int32_t rx_queue_id,
+		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
+{
+	struct dpaa2_eventdev *priv = dev->data->dev_private;
+	uint8_t ev_qid = queue_conf->ev.queue_id;
+	uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
+	int ret;
+
+	PMD_DRV_FUNC_TRACE();
+
+	if (rx_queue_id == -1)
+		return dpaa2_eventdev_eth_queue_add_all(dev,
+				eth_dev, queue_conf);
+
+	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);
+		return ret;
+	}
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_queue_del_all(const struct rte_eventdev *dev,
+			     const struct rte_eth_dev *eth_dev)
+{
+	int i, ret;
+
+	PMD_DRV_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",
+				    ret);
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_queue_del(const struct rte_eventdev *dev,
+			     const struct rte_eth_dev *eth_dev,
+			     int32_t rx_queue_id)
+{
+	int ret;
+
+	PMD_DRV_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);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_start(const struct rte_eventdev *dev,
+			 const struct rte_eth_dev *eth_dev)
+{
+	PMD_DRV_FUNC_TRACE();
+
+	RTE_SET_USED(dev);
+	RTE_SET_USED(eth_dev);
+
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_stop(const struct rte_eventdev *dev,
+			const struct rte_eth_dev *eth_dev)
+{
+	PMD_DRV_FUNC_TRACE();
+
+	RTE_SET_USED(dev);
+	RTE_SET_USED(eth_dev);
+
+	return 0;
+}
+
 static const struct rte_eventdev_ops dpaa2_eventdev_ops = {
 	.dev_infos_get    = dpaa2_eventdev_info_get,
 	.dev_configure    = dpaa2_eventdev_configure,
@@ -572,7 +716,12 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 	.port_link        = dpaa2_eventdev_port_link,
 	.port_unlink      = dpaa2_eventdev_port_unlink,
 	.timeout_ticks    = dpaa2_eventdev_timeout_ticks,
-	.dump             = dpaa2_eventdev_dump
+	.dump             = dpaa2_eventdev_dump,
+	.eth_rx_adapter_caps_get = dpaa2_eventdev_eth_caps_get,
+	.eth_rx_adapter_queue_add = dpaa2_eventdev_eth_queue_add,
+	.eth_rx_adapter_queue_del = dpaa2_eventdev_eth_queue_del,
+	.eth_rx_adapter_start = dpaa2_eventdev_eth_start,
+	.eth_rx_adapter_stop = dpaa2_eventdev_eth_stop,
 };
 
 static int
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.h b/drivers/event/dpaa2/dpaa2_eventdev.h
index f79f78a..ae8e07e 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.h
+++ b/drivers/event/dpaa2/dpaa2_eventdev.h
@@ -74,6 +74,14 @@ enum {
 	DPAA2_EVENT_DPCI_MAX_QUEUES
 };
 
+#define RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP \
+		(RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT | \
+		RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ | \
+		RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID)
+/**< Ethernet Rx adapter cap to return If the packet transfers from
+ * the ethdev to eventdev with DPAA2 devices.
+ */
+
 struct dpaa2_dpcon_dev {
 	TAILQ_ENTRY(dpaa2_dpcon_dev) next;
 	struct fsl_mc_io dpcon;
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-dev] [PATCH v3 4/4] event/dpaa2: improve the err handling and log msg
  2017-10-16 21:44 ` [dpdk-dev] [PATCH v3 " Nipun Gupta
  2017-10-16 21:44   ` [dpdk-dev] [PATCH v3 2/4] net/dpaa2: add API's to support event eth adapter Nipun Gupta
  2017-10-16 21:44   ` [dpdk-dev] [PATCH v3 3/4] event/dpaa2: " Nipun Gupta
@ 2017-10-16 21:44   ` Nipun Gupta
  2 siblings, 0 replies; 37+ messages in thread
From: Nipun Gupta @ 2017-10-16 21:44 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/event/dpaa2/dpaa2_eventdev.c | 9 +++++++++
 drivers/event/dpaa2/dpaa2_hw_dpcon.c | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index ee3a164..d1be5de 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -140,11 +140,20 @@
 			 */
 			struct rte_event *ev_temp = rte_malloc(NULL,
 				sizeof(struct rte_event), 0);
+
+			if (!ev_temp) {
+				if (!loop)
+					return num_tx;
+				frames_to_send = loop;
+				PMD_DRV_LOG(ERR, "Unable to allocate memory");
+				goto send_partial;
+			}
 			rte_memcpy(ev_temp, event, sizeof(struct rte_event));
 			DPAA2_SET_FD_ADDR((&fd_arr[loop]), ev_temp);
 			DPAA2_SET_FD_LEN((&fd_arr[loop]),
 					 sizeof(struct rte_event));
 		}
+send_partial:
 		loop = 0;
 		while (loop < frames_to_send) {
 			loop += qbman_swp_enqueue_multiple_desc(swp,
diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
index 2c416b5..005e623 100644
--- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c
+++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
@@ -100,7 +100,7 @@
 
 	TAILQ_INSERT_TAIL(&dpcon_dev_list, dpcon_node, next);
 
-	PMD_DRV_LOG(DEBUG, "DPAA2: Added [dpcon.%d]", dpcon_id);
+	RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpcon.%d]\n", dpcon_id);
 
 	return 0;
 }
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-dev] [PATCH v3 3/4] event/dpaa2: support event eth adapter
  2017-10-16 21:44   ` [dpdk-dev] [PATCH v3 3/4] event/dpaa2: " Nipun Gupta
@ 2017-10-17  5:00     ` Jerin Jacob
  2017-10-17 10:28       ` Nipun Gupta
  0 siblings, 1 reply; 37+ messages in thread
From: Jerin Jacob @ 2017-10-17  5:00 UTC (permalink / raw)
  To: Nipun Gupta; +Cc: dev, hemant.agrawal, nikhil.rao

-----Original Message-----
> Date: Tue, 17 Oct 2017 03:14:34 +0530
> From: Nipun Gupta <nipun.gupta@nxp.com>
> To: dev@dpdk.org
> CC: hemant.agrawal@nxp.com, jerin.jacob@caviumnetworks.com,
>  nikhil.rao@intel.com, Nipun Gupta <nipun.gupta@nxp.com>
> Subject: [PATCH v3 3/4] event/dpaa2: support event eth adapter
> X-Mailer: git-send-email 1.9.1
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>
> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
> Changes in v3:
>   Fix shared library build
> Changes in v2:
>   Support rx_queue_id = -1 in eth adapter queue and and del (Nikhil)
>   Remove duplicate returns (Nikhil)
> 
>  drivers/Makefile                     |   2 +-
>  drivers/event/Makefile               |   4 +-
>  drivers/event/dpaa2/Makefile         |   2 +
>  drivers/event/dpaa2/dpaa2_eventdev.c | 151 ++++++++++++++++++++++++++++++++++-
>  drivers/event/dpaa2/dpaa2_eventdev.h |   8 ++
>  5 files changed, 163 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/Makefile b/drivers/Makefile
> index 0467250..db0cd76 100644
> --- a/drivers/Makefile
> +++ b/drivers/Makefile
> @@ -39,6 +39,6 @@ DEPDIRS-net := bus mempool
>  DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto
>  DEPDIRS-crypto := bus mempool
>  DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event
> -DEPDIRS-event := bus mempool
> +DEPDIRS-event := bus mempool net
>  
>  include $(RTE_SDK)/mk/rte.subdir.mk
> diff --git a/drivers/event/Makefile b/drivers/event/Makefile
> index d09be74..e119d60 100644
> --- a/drivers/event/Makefile
> +++ b/drivers/event/Makefile
> @@ -31,7 +31,7 @@
>  
>  include $(RTE_SDK)/mk/rte.vars.mk
>  
> -core-libs := librte_eal librte_eventdev
> +core-libs := librte_eal librte_ether librte_eventdev

The above two changes makes sense to me as eventdev-ethdev Rx adapter is
depended on ethdev and there could be an Rx adapter implementation in
event area that may use ethdev driver exported API.

Can you split driver/event and driver/Makefile change to different
patch?

Other than that, This patch set looks good to me and it is ready to merge. 

But, There is a compilation error[1] in event-next tree be case of
Hemant reported problem[2].I can apply this patch set once the solution for
the reported problem[3] is applied to master branch(so that I pull those
changes to next-eventdev to avoid build issue)

[1]
Applying: event/dpaa2: support event eth adapter
/export/dpdk-next-eventdev/mk/rte.subdir.mk:62: target 'event' given
more than once in the same rule
make[2]: Circular mempool <- event dependency dropped.

[2]
http://dpdk.org/ml/archives/dev/2017-October/079249.html

[3]
http://dpdk.org/ml/archives/dev/2017-October/079324.html

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-dev] [PATCH v3 3/4] event/dpaa2: support event eth adapter
  2017-10-17  5:00     ` Jerin Jacob
@ 2017-10-17 10:28       ` Nipun Gupta
  0 siblings, 0 replies; 37+ messages in thread
From: Nipun Gupta @ 2017-10-17 10:28 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev, Hemant Agrawal, nikhil.rao



> -----Original Message-----
> From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> Sent: Tuesday, October 17, 2017 10:31
> To: Nipun Gupta <nipun.gupta@nxp.com>
> Cc: dev@dpdk.org; Hemant Agrawal <hemant.agrawal@nxp.com>;
> nikhil.rao@intel.com
> Subject: Re: [PATCH v3 3/4] event/dpaa2: support event eth adapter
> 
> -----Original Message-----
> > Date: Tue, 17 Oct 2017 03:14:34 +0530
> > From: Nipun Gupta <nipun.gupta@nxp.com>
> > To: dev@dpdk.org
> > CC: hemant.agrawal@nxp.com, jerin.jacob@caviumnetworks.com,
> >  nikhil.rao@intel.com, Nipun Gupta <nipun.gupta@nxp.com>
> > Subject: [PATCH v3 3/4] event/dpaa2: support event eth adapter
> > X-Mailer: git-send-email 1.9.1
> >
> > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>
> > Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> > ---
> > Changes in v3:
> >   Fix shared library build
> > Changes in v2:
> >   Support rx_queue_id = -1 in eth adapter queue and and del (Nikhil)
> >   Remove duplicate returns (Nikhil)
> >
> >  drivers/Makefile                     |   2 +-
> >  drivers/event/Makefile               |   4 +-
> >  drivers/event/dpaa2/Makefile         |   2 +
> >  drivers/event/dpaa2/dpaa2_eventdev.c | 151
> ++++++++++++++++++++++++++++++++++-
> >  drivers/event/dpaa2/dpaa2_eventdev.h |   8 ++
> >  5 files changed, 163 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/Makefile b/drivers/Makefile
> > index 0467250..db0cd76 100644
> > --- a/drivers/Makefile
> > +++ b/drivers/Makefile
> > @@ -39,6 +39,6 @@ DEPDIRS-net := bus mempool
> >  DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto
> >  DEPDIRS-crypto := bus mempool
> >  DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event
> > -DEPDIRS-event := bus mempool
> > +DEPDIRS-event := bus mempool net
> >
> >  include $(RTE_SDK)/mk/rte.subdir.mk
> > diff --git a/drivers/event/Makefile b/drivers/event/Makefile
> > index d09be74..e119d60 100644
> > --- a/drivers/event/Makefile
> > +++ b/drivers/event/Makefile
> > @@ -31,7 +31,7 @@
> >
> >  include $(RTE_SDK)/mk/rte.vars.mk
> >
> > -core-libs := librte_eal librte_eventdev
> > +core-libs := librte_eal librte_ether librte_eventdev
> 
> The above two changes makes sense to me as eventdev-ethdev Rx adapter is
> depended on ethdev and there could be an Rx adapter implementation in
> event area that may use ethdev driver exported API.
> 
> Can you split driver/event and driver/Makefile change to different
> patch?

I have sent the v4 for this series.

> 
> Other than that, This patch set looks good to me and it is ready to merge.
> 
> But, There is a compilation error[1] in event-next tree be case of
> Hemant reported problem[2].I can apply this patch set once the solution for
> the reported problem[3] is applied to master branch(so that I pull those
> changes to next-eventdev to avoid build issue)

I understand this :)

Thanks,
Nipun

> 
> [1]
> Applying: event/dpaa2: support event eth adapter
> /export/dpdk-next-eventdev/mk/rte.subdir.mk:62: target 'event' given
> more than once in the same rule
> make[2]: Circular mempool <- event dependency dropped.
> 
> [2]
> http://dpdk.org/ml/archives/dev/2017-October/079249.html
> 
> [3]
> http://dpdk.org/ml/archives/dev/2017-October/079324.html

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-dev] [PATCH v4 2/5] net/dpaa2: add API's to support event eth adapter
  2017-10-17 16:38   ` [dpdk-dev] [PATCH v4 2/5] net/dpaa2: add API's to support event eth adapter Nipun Gupta
@ 2017-10-17 12:32     ` Hemant Agrawal
  0 siblings, 0 replies; 37+ messages in thread
From: Hemant Agrawal @ 2017-10-17 12:32 UTC (permalink / raw)
  To: Nipun Gupta, dev; +Cc: jerin.jacob, nikhil.rao

On 10/17/2017 10:08 PM, Nipun Gupta wrote:
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
> Changes in v3:
>   Check the queue schedule type before configuring MC (Hemant)
>
>  drivers/net/dpaa2/dpaa2_ethdev.c            | 62 +++++++++++++++++++++++++++++
>  drivers/net/dpaa2/dpaa2_ethdev.h            | 15 +++++++
>  drivers/net/dpaa2/dpaa2_rxtx.c              | 20 ++++++++++
>  drivers/net/dpaa2/rte_pmd_dpaa2_version.map |  7 ++++
>  4 files changed, 104 insertions(+)
>
> diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
> index 1ac607c..14d79b9 100644
> --- a/drivers/net/dpaa2/dpaa2_ethdev.c
> +++ b/drivers/net/dpaa2/dpaa2_ethdev.c
> @@ -1634,6 +1634,68 @@ int dpaa2_dev_stats_get(struct rte_eth_dev *dev,
>  	return 0;
>  }
>
> +int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
> +		int eth_rx_queue_id,
> +		uint16_t dpcon_id,
> +		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
> +{
> +	struct dpaa2_dev_priv *eth_priv = dev->data->dev_private;
> +	struct fsl_mc_io *dpni = (struct fsl_mc_io *)eth_priv->hw;
> +	struct dpaa2_queue *dpaa2_ethq = eth_priv->rx_vq[eth_rx_queue_id];
> +	uint8_t flow_id = dpaa2_ethq->flow_id;
> +	struct dpni_queue cfg;
> +	uint8_t options;
> +	int ret;
> +
> +	if (queue_conf->ev.sched_type == RTE_SCHED_TYPE_PARALLEL)
> +		dpaa2_ethq->cb = dpaa2_dev_process_parallel_event;
> +	else
> +		return -EINVAL;
> +
> +	memset(&cfg, 0, sizeof(struct dpni_queue));
> +	options = DPNI_QUEUE_OPT_DEST;
> +	cfg.destination.type = DPNI_DEST_DPCON;
> +	cfg.destination.id = dpcon_id;
> +	cfg.destination.priority = queue_conf->ev.priority;
> +
> +	options |= DPNI_QUEUE_OPT_USER_CTX;
> +	cfg.user_context = (uint64_t)(dpaa2_ethq);
> +
> +	ret = dpni_set_queue(dpni, CMD_PRI_LOW, eth_priv->token, DPNI_QUEUE_RX,
> +			     dpaa2_ethq->tc_index, flow_id, options, &cfg);
> +	if (ret) {
> +		RTE_LOG(ERR, PMD, "Error in dpni_set_queue: ret: %d\n", ret);
> +		return ret;
> +	}
> +
> +	memcpy(&dpaa2_ethq->ev, &queue_conf->ev, sizeof(struct rte_event));
> +
> +	return 0;
> +}
> +
> +int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
> +		int eth_rx_queue_id)
> +{
> +	struct dpaa2_dev_priv *eth_priv = dev->data->dev_private;
> +	struct fsl_mc_io *dpni = (struct fsl_mc_io *)eth_priv->hw;
> +	struct dpaa2_queue *dpaa2_ethq = eth_priv->rx_vq[eth_rx_queue_id];
> +	uint8_t flow_id = dpaa2_ethq->flow_id;
> +	struct dpni_queue cfg;
> +	uint8_t options;
> +	int ret;
> +
> +	memset(&cfg, 0, sizeof(struct dpni_queue));
> +	options = DPNI_QUEUE_OPT_DEST;
> +	cfg.destination.type = DPNI_DEST_NONE;
> +
> +	ret = dpni_set_queue(dpni, CMD_PRI_LOW, eth_priv->token, DPNI_QUEUE_RX,
> +			     dpaa2_ethq->tc_index, flow_id, options, &cfg);
> +	if (ret)
> +		RTE_LOG(ERR, PMD, "Error in dpni_set_queue: ret: %d\n", ret);
> +
> +	return ret;
> +}
> +
>  static struct eth_dev_ops dpaa2_ethdev_ops = {
>  	.dev_configure	  = dpaa2_eth_dev_configure,
>  	.dev_start	      = dpaa2_dev_start,
> diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
> index 7b14ae0..b8e94aa 100644
> --- a/drivers/net/dpaa2/dpaa2_ethdev.h
> +++ b/drivers/net/dpaa2/dpaa2_ethdev.h
> @@ -34,6 +34,8 @@
>  #ifndef _DPAA2_ETHDEV_H
>  #define _DPAA2_ETHDEV_H
>
> +#include <rte_event_eth_rx_adapter.h>
> +
>  #include <mc/fsl_dpni.h>
>  #include <mc/fsl_mc_sys.h>
>
> @@ -100,8 +102,21 @@ int dpaa2_remove_flow_dist(struct rte_eth_dev *eth_dev,
>
>  int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, void *blist);
>
> +int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
> +		int eth_rx_queue_id,
> +		uint16_t dpcon_id,
> +		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
> +
> +int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
> +		int eth_rx_queue_id);
> +
>  uint16_t dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs,
>  			       uint16_t nb_pkts);
> +void dpaa2_dev_process_parallel_event(struct qbman_swp *swp,
> +				      const struct qbman_fd *fd,
> +				      const struct qbman_result *dq,
> +				      struct dpaa2_queue *rxq,
> +				      struct rte_event *ev);
>  uint16_t dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
>  uint16_t dummy_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
>  #endif /* _DPAA2_ETHDEV_H */
> diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
> index 7cfa73a..a317f7f 100644
> --- a/drivers/net/dpaa2/dpaa2_rxtx.c
> +++ b/drivers/net/dpaa2/dpaa2_rxtx.c
> @@ -514,6 +514,26 @@ static inline int __attribute__((hot))
>  	return num_rx;
>  }
>
> +void __attribute__((hot))
> +dpaa2_dev_process_parallel_event(struct qbman_swp *swp,
> +				 const struct qbman_fd *fd,
> +				 const struct qbman_result *dq,
> +				 struct dpaa2_queue *rxq,
> +				 struct rte_event *ev)
> +{
> +	ev->mbuf = eth_fd_to_mbuf(fd);
> +
> +	ev->flow_id = rxq->ev.flow_id;
> +	ev->sub_event_type = rxq->ev.sub_event_type;
> +	ev->event_type = RTE_EVENT_TYPE_ETHDEV;
> +	ev->op = RTE_EVENT_OP_NEW;
> +	ev->sched_type = rxq->ev.sched_type;
> +	ev->queue_id = rxq->ev.queue_id;
> +	ev->priority = rxq->ev.priority;
> +
> +	qbman_swp_dqrr_consume(swp, dq);
> +}
> +
>  /*
>   * Callback to handle sending packets through WRIOP based interface
>   */
> diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
> index 8591cc0..b741bc0 100644
> --- a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
> +++ b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
> @@ -2,3 +2,10 @@ DPDK_17.05 {
>
>  	local: *;
>  };
> +
> +DPDK_17.11 {
> +	global:
> +
> +	dpaa2_eth_eventq_attach;
> +	dpaa2_eth_eventq_detach;
> +};
>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-dev] [PATCH v4 1/5] drivers: add queue parameter in event processing callback
  2017-10-10 17:51 [dpdk-dev] [PATCH 1/4] drivers: add queue parameter in event processing callback Nipun Gupta
                   ` (4 preceding siblings ...)
  2017-10-16 21:44 ` [dpdk-dev] [PATCH v3 " Nipun Gupta
@ 2017-10-17 16:38 ` Nipun Gupta
  2017-10-17 16:38   ` [dpdk-dev] [PATCH v4 2/5] net/dpaa2: add API's to support event eth adapter Nipun Gupta
                     ` (3 more replies)
  2017-10-23 12:37 ` [dpdk-dev] [PATCH v5 1/5] drivers: add queue parameter in event processing callback Nipun Gupta
  6 siblings, 4 replies; 37+ messages in thread
From: Nipun Gupta @ 2017-10-17 16:38 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

For event dequeues for ethernet queues, a dpaa2_queue structure is
required to get the configuration for that ethernet queue. Based on
this configuration the rte_event is to be filled at the ingress side.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
This patch series is based over the following patch:
http://dpdk.org/dev/patchwork/patch/30430/

 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 4 ++++
 drivers/event/dpaa2/dpaa2_eventdev.c    | 8 +++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 8f39cfb..e14a9a9 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -125,9 +125,12 @@ struct queue_storage_info_t {
 	int toggle;
 };
 
+struct dpaa2_queue;
+
 typedef void (dpaa2_queue_cb_dqrr_t)(struct qbman_swp *swp,
 		const struct qbman_fd *fd,
 		const struct qbman_result *dq,
+		struct dpaa2_queue *rxq,
 		struct rte_event *ev);
 
 struct dpaa2_queue {
@@ -144,6 +147,7 @@ struct dpaa2_queue {
 		struct queue_storage_info_t *q_storage;
 		struct qbman_result *cscn;
 	};
+	struct rte_event ev;
 	dpaa2_queue_cb_dqrr_t *cb;
 };
 
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 81286a8..8a6a3e3 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -189,10 +189,14 @@ static void dpaa2_eventdev_dequeue_wait(uint64_t timeout_ticks)
 static void dpaa2_eventdev_process_parallel(struct qbman_swp *swp,
 					    const struct qbman_fd *fd,
 					    const struct qbman_result *dq,
+					    struct dpaa2_queue *rxq,
 					    struct rte_event *ev)
 {
 	struct rte_event *ev_temp =
 		(struct rte_event *)DPAA2_GET_FD_ADDR(fd);
+
+	RTE_SET_USED(rxq);
+
 	rte_memcpy(ev, ev_temp, sizeof(struct rte_event));
 	rte_free(ev_temp);
 
@@ -202,6 +206,7 @@ static void dpaa2_eventdev_process_parallel(struct qbman_swp *swp,
 static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 					  const struct qbman_fd *fd,
 					  const struct qbman_result *dq,
+					  struct dpaa2_queue *rxq,
 					  struct rte_event *ev)
 {
 	struct rte_event *ev_temp =
@@ -209,6 +214,7 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 	uint8_t dqrr_index = qbman_get_dqrr_idx(dq);
 
 	RTE_SET_USED(swp);
+	RTE_SET_USED(rxq);
 
 	rte_memcpy(ev, ev_temp, sizeof(struct rte_event));
 	rte_free(ev_temp);
@@ -265,7 +271,7 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 
 		rxq = (struct dpaa2_queue *)qbman_result_DQ_fqd_ctx(dq);
 		if (rxq) {
-			rxq->cb(swp, fd, dq, &ev[num_pkts]);
+			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");
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-dev] [PATCH v4 2/5] net/dpaa2: add API's to support event eth adapter
  2017-10-17 16:38 ` [dpdk-dev] [PATCH v4 1/5] drivers: add queue parameter in event processing callback Nipun Gupta
@ 2017-10-17 16:38   ` Nipun Gupta
  2017-10-17 12:32     ` Hemant Agrawal
  2017-10-17 16:38   ` [dpdk-dev] [PATCH v4 3/5] drivers: add net as dependency for event drivers Nipun Gupta
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 37+ messages in thread
From: Nipun Gupta @ 2017-10-17 16:38 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
Changes in v3:
  Check the queue schedule type before configuring MC (Hemant)

 drivers/net/dpaa2/dpaa2_ethdev.c            | 62 +++++++++++++++++++++++++++++
 drivers/net/dpaa2/dpaa2_ethdev.h            | 15 +++++++
 drivers/net/dpaa2/dpaa2_rxtx.c              | 20 ++++++++++
 drivers/net/dpaa2/rte_pmd_dpaa2_version.map |  7 ++++
 4 files changed, 104 insertions(+)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 1ac607c..14d79b9 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1634,6 +1634,68 @@ int dpaa2_dev_stats_get(struct rte_eth_dev *dev,
 	return 0;
 }
 
+int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
+		int eth_rx_queue_id,
+		uint16_t dpcon_id,
+		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
+{
+	struct dpaa2_dev_priv *eth_priv = dev->data->dev_private;
+	struct fsl_mc_io *dpni = (struct fsl_mc_io *)eth_priv->hw;
+	struct dpaa2_queue *dpaa2_ethq = eth_priv->rx_vq[eth_rx_queue_id];
+	uint8_t flow_id = dpaa2_ethq->flow_id;
+	struct dpni_queue cfg;
+	uint8_t options;
+	int ret;
+
+	if (queue_conf->ev.sched_type == RTE_SCHED_TYPE_PARALLEL)
+		dpaa2_ethq->cb = dpaa2_dev_process_parallel_event;
+	else
+		return -EINVAL;
+
+	memset(&cfg, 0, sizeof(struct dpni_queue));
+	options = DPNI_QUEUE_OPT_DEST;
+	cfg.destination.type = DPNI_DEST_DPCON;
+	cfg.destination.id = dpcon_id;
+	cfg.destination.priority = queue_conf->ev.priority;
+
+	options |= DPNI_QUEUE_OPT_USER_CTX;
+	cfg.user_context = (uint64_t)(dpaa2_ethq);
+
+	ret = dpni_set_queue(dpni, CMD_PRI_LOW, eth_priv->token, DPNI_QUEUE_RX,
+			     dpaa2_ethq->tc_index, flow_id, options, &cfg);
+	if (ret) {
+		RTE_LOG(ERR, PMD, "Error in dpni_set_queue: ret: %d\n", ret);
+		return ret;
+	}
+
+	memcpy(&dpaa2_ethq->ev, &queue_conf->ev, sizeof(struct rte_event));
+
+	return 0;
+}
+
+int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
+		int eth_rx_queue_id)
+{
+	struct dpaa2_dev_priv *eth_priv = dev->data->dev_private;
+	struct fsl_mc_io *dpni = (struct fsl_mc_io *)eth_priv->hw;
+	struct dpaa2_queue *dpaa2_ethq = eth_priv->rx_vq[eth_rx_queue_id];
+	uint8_t flow_id = dpaa2_ethq->flow_id;
+	struct dpni_queue cfg;
+	uint8_t options;
+	int ret;
+
+	memset(&cfg, 0, sizeof(struct dpni_queue));
+	options = DPNI_QUEUE_OPT_DEST;
+	cfg.destination.type = DPNI_DEST_NONE;
+
+	ret = dpni_set_queue(dpni, CMD_PRI_LOW, eth_priv->token, DPNI_QUEUE_RX,
+			     dpaa2_ethq->tc_index, flow_id, options, &cfg);
+	if (ret)
+		RTE_LOG(ERR, PMD, "Error in dpni_set_queue: ret: %d\n", ret);
+
+	return ret;
+}
+
 static struct eth_dev_ops dpaa2_ethdev_ops = {
 	.dev_configure	  = dpaa2_eth_dev_configure,
 	.dev_start	      = dpaa2_dev_start,
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
index 7b14ae0..b8e94aa 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.h
+++ b/drivers/net/dpaa2/dpaa2_ethdev.h
@@ -34,6 +34,8 @@
 #ifndef _DPAA2_ETHDEV_H
 #define _DPAA2_ETHDEV_H
 
+#include <rte_event_eth_rx_adapter.h>
+
 #include <mc/fsl_dpni.h>
 #include <mc/fsl_mc_sys.h>
 
@@ -100,8 +102,21 @@ int dpaa2_remove_flow_dist(struct rte_eth_dev *eth_dev,
 
 int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, void *blist);
 
+int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
+		int eth_rx_queue_id,
+		uint16_t dpcon_id,
+		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
+
+int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
+		int eth_rx_queue_id);
+
 uint16_t dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs,
 			       uint16_t nb_pkts);
+void dpaa2_dev_process_parallel_event(struct qbman_swp *swp,
+				      const struct qbman_fd *fd,
+				      const struct qbman_result *dq,
+				      struct dpaa2_queue *rxq,
+				      struct rte_event *ev);
 uint16_t dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
 uint16_t dummy_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
 #endif /* _DPAA2_ETHDEV_H */
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 7cfa73a..a317f7f 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -514,6 +514,26 @@ static inline int __attribute__((hot))
 	return num_rx;
 }
 
+void __attribute__((hot))
+dpaa2_dev_process_parallel_event(struct qbman_swp *swp,
+				 const struct qbman_fd *fd,
+				 const struct qbman_result *dq,
+				 struct dpaa2_queue *rxq,
+				 struct rte_event *ev)
+{
+	ev->mbuf = eth_fd_to_mbuf(fd);
+
+	ev->flow_id = rxq->ev.flow_id;
+	ev->sub_event_type = rxq->ev.sub_event_type;
+	ev->event_type = RTE_EVENT_TYPE_ETHDEV;
+	ev->op = RTE_EVENT_OP_NEW;
+	ev->sched_type = rxq->ev.sched_type;
+	ev->queue_id = rxq->ev.queue_id;
+	ev->priority = rxq->ev.priority;
+
+	qbman_swp_dqrr_consume(swp, dq);
+}
+
 /*
  * Callback to handle sending packets through WRIOP based interface
  */
diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
index 8591cc0..b741bc0 100644
--- a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
+++ b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
@@ -2,3 +2,10 @@ DPDK_17.05 {
 
 	local: *;
 };
+
+DPDK_17.11 {
+	global:
+
+	dpaa2_eth_eventq_attach;
+	dpaa2_eth_eventq_detach;
+};
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-dev] [PATCH v4 3/5] drivers: add net as dependency for event drivers
  2017-10-17 16:38 ` [dpdk-dev] [PATCH v4 1/5] drivers: add queue parameter in event processing callback Nipun Gupta
  2017-10-17 16:38   ` [dpdk-dev] [PATCH v4 2/5] net/dpaa2: add API's to support event eth adapter Nipun Gupta
@ 2017-10-17 16:38   ` Nipun Gupta
  2017-10-21 10:05     ` Jerin Jacob
  2017-10-17 16:38   ` [dpdk-dev] [PATCH v4 4/5] event/dpaa2: support event eth adapter Nipun Gupta
  2017-10-17 16:38   ` [dpdk-dev] [PATCH v4 5/5] event/dpaa2: improve the err handling and log msg Nipun Gupta
  3 siblings, 1 reply; 37+ messages in thread
From: Nipun Gupta @ 2017-10-17 16:38 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
Changes in v4:
  This change is separated from patch-3/4 from v3 of this
  patchset (Jerin)

 drivers/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/Makefile b/drivers/Makefile
index 0467250..db0cd76 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -39,6 +39,6 @@ DEPDIRS-net := bus mempool
 DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto
 DEPDIRS-crypto := bus mempool
 DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event
-DEPDIRS-event := bus mempool
+DEPDIRS-event := bus mempool net
 
 include $(RTE_SDK)/mk/rte.subdir.mk
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-dev] [PATCH v4 4/5] event/dpaa2: support event eth adapter
  2017-10-17 16:38 ` [dpdk-dev] [PATCH v4 1/5] drivers: add queue parameter in event processing callback Nipun Gupta
  2017-10-17 16:38   ` [dpdk-dev] [PATCH v4 2/5] net/dpaa2: add API's to support event eth adapter Nipun Gupta
  2017-10-17 16:38   ` [dpdk-dev] [PATCH v4 3/5] drivers: add net as dependency for event drivers Nipun Gupta
@ 2017-10-17 16:38   ` Nipun Gupta
  2017-10-17 16:38   ` [dpdk-dev] [PATCH v4 5/5] event/dpaa2: improve the err handling and log msg Nipun Gupta
  3 siblings, 0 replies; 37+ messages in thread
From: Nipun Gupta @ 2017-10-17 16:38 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
Changes in v4:
  Move driver/Makefile changes in separate patch (Jerin)
Changes in v3:
  Fix shared library build
Changes in v2:
  Support rx_queue_id = -1 in eth adapter queue and and del (Nikhil)
  Remove duplicate returns (Nikhil)

 drivers/event/Makefile               |   4 +-
 drivers/event/dpaa2/Makefile         |   2 +
 drivers/event/dpaa2/dpaa2_eventdev.c | 151 ++++++++++++++++++++++++++++++++++-
 drivers/event/dpaa2/dpaa2_eventdev.h |   8 ++
 4 files changed, 162 insertions(+), 3 deletions(-)

diff --git a/drivers/event/Makefile b/drivers/event/Makefile
index d09be74..e119d60 100644
--- a/drivers/event/Makefile
+++ b/drivers/event/Makefile
@@ -31,7 +31,7 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-core-libs := librte_eal librte_eventdev
+core-libs := librte_eal librte_ether librte_eventdev
 
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_EVENTDEV) += skeleton
 DEPDIRS-skeleton = $(core-libs)
@@ -40,6 +40,6 @@ DEPDIRS-sw = $(core-libs) librte_kvargs librte_ring
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += octeontx
 DEPDIRS-octeontx = $(core-libs) librte_mempool_octeontx
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV) += dpaa2
-DEPDIRS-dpaa2 = $(core-libs) librte_bus_fslmc
+DEPDIRS-dpaa2 = $(core-libs) librte_bus_fslmc librte_pmd_dpaa2
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/event/dpaa2/Makefile b/drivers/event/dpaa2/Makefile
index 3497d09..2d1d7c4 100644
--- a/drivers/event/dpaa2/Makefile
+++ b/drivers/event/dpaa2/Makefile
@@ -45,6 +45,8 @@ CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/portal
 CFLAGS += -I$(RTE_SDK)/drivers/mempool/dpaa2
 CFLAGS += -I$(RTE_SDK)/drivers/event/dpaa2
 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal
+CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2
+CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2/mc
 
 # versioning export map
 EXPORT_MAP := rte_pmd_dpaa2_event_version.map
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 8a6a3e3..ee3a164 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -53,11 +53,14 @@
 #include <rte_memzone.h>
 #include <rte_pci.h>
 #include <rte_vdev.h>
+#include <rte_ethdev.h>
+#include <rte_event_eth_rx_adapter.h>
 
 #include <fslmc_vfio.h>
 #include <dpaa2_hw_pvt.h>
 #include <dpaa2_hw_mempool.h>
 #include <dpaa2_hw_dpio.h>
+#include <dpaa2_ethdev.h>
 #include "dpaa2_eventdev.h"
 #include <portal/dpaa2_hw_pvt.h>
 #include <mc/fsl_dpci.h>
@@ -557,6 +560,147 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 	RTE_SET_USED(f);
 }
 
+static int
+dpaa2_eventdev_eth_caps_get(const struct rte_eventdev *dev,
+			    const struct rte_eth_dev *eth_dev,
+			    uint32_t *caps)
+{
+	const char *ethdev_driver = eth_dev->device->driver->name;
+
+	PMD_DRV_FUNC_TRACE();
+
+	RTE_SET_USED(dev);
+
+	if (!strcmp(ethdev_driver, "net_dpaa2"))
+		*caps = RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP;
+	else
+		*caps = RTE_EVENT_ETH_RX_ADAPTER_SW_CAP;
+
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_queue_add_all(const struct rte_eventdev *dev,
+		const struct rte_eth_dev *eth_dev,
+		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
+{
+	struct dpaa2_eventdev *priv = dev->data->dev_private;
+	uint8_t ev_qid = queue_conf->ev.queue_id;
+	uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
+	int i, ret;
+
+	PMD_DRV_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",
+				    ret);
+			goto fail;
+		}
+	}
+	return 0;
+fail:
+	for (i = (i - 1); i >= 0 ; i--)
+		dpaa2_eth_eventq_detach(eth_dev, i);
+
+	return ret;
+}
+
+static int
+dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
+		const struct rte_eth_dev *eth_dev,
+		int32_t rx_queue_id,
+		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
+{
+	struct dpaa2_eventdev *priv = dev->data->dev_private;
+	uint8_t ev_qid = queue_conf->ev.queue_id;
+	uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
+	int ret;
+
+	PMD_DRV_FUNC_TRACE();
+
+	if (rx_queue_id == -1)
+		return dpaa2_eventdev_eth_queue_add_all(dev,
+				eth_dev, queue_conf);
+
+	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);
+		return ret;
+	}
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_queue_del_all(const struct rte_eventdev *dev,
+			     const struct rte_eth_dev *eth_dev)
+{
+	int i, ret;
+
+	PMD_DRV_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",
+				    ret);
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_queue_del(const struct rte_eventdev *dev,
+			     const struct rte_eth_dev *eth_dev,
+			     int32_t rx_queue_id)
+{
+	int ret;
+
+	PMD_DRV_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);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_start(const struct rte_eventdev *dev,
+			 const struct rte_eth_dev *eth_dev)
+{
+	PMD_DRV_FUNC_TRACE();
+
+	RTE_SET_USED(dev);
+	RTE_SET_USED(eth_dev);
+
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_stop(const struct rte_eventdev *dev,
+			const struct rte_eth_dev *eth_dev)
+{
+	PMD_DRV_FUNC_TRACE();
+
+	RTE_SET_USED(dev);
+	RTE_SET_USED(eth_dev);
+
+	return 0;
+}
+
 static const struct rte_eventdev_ops dpaa2_eventdev_ops = {
 	.dev_infos_get    = dpaa2_eventdev_info_get,
 	.dev_configure    = dpaa2_eventdev_configure,
@@ -572,7 +716,12 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 	.port_link        = dpaa2_eventdev_port_link,
 	.port_unlink      = dpaa2_eventdev_port_unlink,
 	.timeout_ticks    = dpaa2_eventdev_timeout_ticks,
-	.dump             = dpaa2_eventdev_dump
+	.dump             = dpaa2_eventdev_dump,
+	.eth_rx_adapter_caps_get = dpaa2_eventdev_eth_caps_get,
+	.eth_rx_adapter_queue_add = dpaa2_eventdev_eth_queue_add,
+	.eth_rx_adapter_queue_del = dpaa2_eventdev_eth_queue_del,
+	.eth_rx_adapter_start = dpaa2_eventdev_eth_start,
+	.eth_rx_adapter_stop = dpaa2_eventdev_eth_stop,
 };
 
 static int
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.h b/drivers/event/dpaa2/dpaa2_eventdev.h
index f79f78a..ae8e07e 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.h
+++ b/drivers/event/dpaa2/dpaa2_eventdev.h
@@ -74,6 +74,14 @@ enum {
 	DPAA2_EVENT_DPCI_MAX_QUEUES
 };
 
+#define RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP \
+		(RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT | \
+		RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ | \
+		RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID)
+/**< Ethernet Rx adapter cap to return If the packet transfers from
+ * the ethdev to eventdev with DPAA2 devices.
+ */
+
 struct dpaa2_dpcon_dev {
 	TAILQ_ENTRY(dpaa2_dpcon_dev) next;
 	struct fsl_mc_io dpcon;
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-dev] [PATCH v4 5/5] event/dpaa2: improve the err handling and log msg
  2017-10-17 16:38 ` [dpdk-dev] [PATCH v4 1/5] drivers: add queue parameter in event processing callback Nipun Gupta
                     ` (2 preceding siblings ...)
  2017-10-17 16:38   ` [dpdk-dev] [PATCH v4 4/5] event/dpaa2: support event eth adapter Nipun Gupta
@ 2017-10-17 16:38   ` Nipun Gupta
  3 siblings, 0 replies; 37+ messages in thread
From: Nipun Gupta @ 2017-10-17 16:38 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/event/dpaa2/dpaa2_eventdev.c | 9 +++++++++
 drivers/event/dpaa2/dpaa2_hw_dpcon.c | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index ee3a164..d1be5de 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -140,11 +140,20 @@
 			 */
 			struct rte_event *ev_temp = rte_malloc(NULL,
 				sizeof(struct rte_event), 0);
+
+			if (!ev_temp) {
+				if (!loop)
+					return num_tx;
+				frames_to_send = loop;
+				PMD_DRV_LOG(ERR, "Unable to allocate memory");
+				goto send_partial;
+			}
 			rte_memcpy(ev_temp, event, sizeof(struct rte_event));
 			DPAA2_SET_FD_ADDR((&fd_arr[loop]), ev_temp);
 			DPAA2_SET_FD_LEN((&fd_arr[loop]),
 					 sizeof(struct rte_event));
 		}
+send_partial:
 		loop = 0;
 		while (loop < frames_to_send) {
 			loop += qbman_swp_enqueue_multiple_desc(swp,
diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
index 2c416b5..005e623 100644
--- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c
+++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
@@ -100,7 +100,7 @@
 
 	TAILQ_INSERT_TAIL(&dpcon_dev_list, dpcon_node, next);
 
-	PMD_DRV_LOG(DEBUG, "DPAA2: Added [dpcon.%d]", dpcon_id);
+	RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpcon.%d]\n", dpcon_id);
 
 	return 0;
 }
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-dev] [PATCH v4 3/5] drivers: add net as dependency for event drivers
  2017-10-17 16:38   ` [dpdk-dev] [PATCH v4 3/5] drivers: add net as dependency for event drivers Nipun Gupta
@ 2017-10-21 10:05     ` Jerin Jacob
  0 siblings, 0 replies; 37+ messages in thread
From: Jerin Jacob @ 2017-10-21 10:05 UTC (permalink / raw)
  To: Nipun Gupta; +Cc: dev, hemant.agrawal, nikhil.rao

-----Original Message-----
> Date: Tue, 17 Oct 2017 22:08:32 +0530
> From: Nipun Gupta <nipun.gupta@nxp.com>
> To: dev@dpdk.org
> CC: hemant.agrawal@nxp.com, jerin.jacob@caviumnetworks.com,
>  nikhil.rao@intel.com, Nipun Gupta <nipun.gupta@nxp.com>
> Subject: [PATCH v4 3/5] drivers: add net as dependency for event drivers
> X-Mailer: git-send-email 1.9.1
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>

The git commit message is missing for this patch. Can you add and send the next
version?

Details discussed here in the patch
http://dpdk.org/dev/patchwork/patch/30442/

> ---
> Changes in v4:
>   This change is separated from patch-3/4 from v3 of this
>   patchset (Jerin)
> 
>  drivers/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/Makefile b/drivers/Makefile
> index 0467250..db0cd76 100644
> --- a/drivers/Makefile
> +++ b/drivers/Makefile
> @@ -39,6 +39,6 @@ DEPDIRS-net := bus mempool
>  DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto
>  DEPDIRS-crypto := bus mempool
>  DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event
> -DEPDIRS-event := bus mempool
> +DEPDIRS-event := bus mempool net
>  
>  include $(RTE_SDK)/mk/rte.subdir.mk
> -- 
> 1.9.1
> 

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-dev] [PATCH v5 3/5] drivers: add net as dependency for event drivers
  2017-10-23 12:37   ` [dpdk-dev] [PATCH v5 3/5] drivers: add net as dependency for event drivers Nipun Gupta
@ 2017-10-23  6:24     ` Jerin Jacob
  0 siblings, 0 replies; 37+ messages in thread
From: Jerin Jacob @ 2017-10-23  6:24 UTC (permalink / raw)
  To: Nipun Gupta; +Cc: dev, hemant.agrawal, nikhil.rao

-----Original Message-----
> Date: Mon, 23 Oct 2017 18:07:04 +0530
> From: Nipun Gupta <nipun.gupta@nxp.com>
> To: dev@dpdk.org
> CC: hemant.agrawal@nxp.com, jerin.jacob@caviumnetworks.com,
>  nikhil.rao@intel.com, Nipun Gupta <nipun.gupta@nxp.com>
> Subject: [PATCH v5 3/5] drivers: add net as dependency for event drivers
> X-Mailer: git-send-email 1.9.1
> 
> With the introduction of eventdev-ethdev RX adapter support in event
> device, some of the event device will have dependency on their respective
> ethernet drivers. This patch adds the net as a dependency for eventdevs.
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>

Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-dev] [PATCH v5 1/5] drivers: add queue parameter in event processing callback
  2017-10-10 17:51 [dpdk-dev] [PATCH 1/4] drivers: add queue parameter in event processing callback Nipun Gupta
                   ` (5 preceding siblings ...)
  2017-10-17 16:38 ` [dpdk-dev] [PATCH v4 1/5] drivers: add queue parameter in event processing callback Nipun Gupta
@ 2017-10-23 12:37 ` Nipun Gupta
  2017-10-23 12:37   ` [dpdk-dev] [PATCH v5 2/5] net/dpaa2: add API's to support event eth adapter Nipun Gupta
                     ` (4 more replies)
  6 siblings, 5 replies; 37+ messages in thread
From: Nipun Gupta @ 2017-10-23 12:37 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

For event dequeues for ethernet queues, a dpaa2_queue structure is
required to get the configuration for that ethernet queue. Based on
this configuration the rte_event is to be filled at the ingress side.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
This patch series is based over the following patch:
http://dpdk.org/dev/patchwork/patch/30430/

 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 4 ++++
 drivers/event/dpaa2/dpaa2_eventdev.c    | 8 +++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 8f39cfb..e14a9a9 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -125,9 +125,12 @@ struct queue_storage_info_t {
 	int toggle;
 };
 
+struct dpaa2_queue;
+
 typedef void (dpaa2_queue_cb_dqrr_t)(struct qbman_swp *swp,
 		const struct qbman_fd *fd,
 		const struct qbman_result *dq,
+		struct dpaa2_queue *rxq,
 		struct rte_event *ev);
 
 struct dpaa2_queue {
@@ -144,6 +147,7 @@ struct dpaa2_queue {
 		struct queue_storage_info_t *q_storage;
 		struct qbman_result *cscn;
 	};
+	struct rte_event ev;
 	dpaa2_queue_cb_dqrr_t *cb;
 };
 
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 81286a8..8a6a3e3 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -189,10 +189,14 @@ static void dpaa2_eventdev_dequeue_wait(uint64_t timeout_ticks)
 static void dpaa2_eventdev_process_parallel(struct qbman_swp *swp,
 					    const struct qbman_fd *fd,
 					    const struct qbman_result *dq,
+					    struct dpaa2_queue *rxq,
 					    struct rte_event *ev)
 {
 	struct rte_event *ev_temp =
 		(struct rte_event *)DPAA2_GET_FD_ADDR(fd);
+
+	RTE_SET_USED(rxq);
+
 	rte_memcpy(ev, ev_temp, sizeof(struct rte_event));
 	rte_free(ev_temp);
 
@@ -202,6 +206,7 @@ static void dpaa2_eventdev_process_parallel(struct qbman_swp *swp,
 static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 					  const struct qbman_fd *fd,
 					  const struct qbman_result *dq,
+					  struct dpaa2_queue *rxq,
 					  struct rte_event *ev)
 {
 	struct rte_event *ev_temp =
@@ -209,6 +214,7 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 	uint8_t dqrr_index = qbman_get_dqrr_idx(dq);
 
 	RTE_SET_USED(swp);
+	RTE_SET_USED(rxq);
 
 	rte_memcpy(ev, ev_temp, sizeof(struct rte_event));
 	rte_free(ev_temp);
@@ -265,7 +271,7 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 
 		rxq = (struct dpaa2_queue *)qbman_result_DQ_fqd_ctx(dq);
 		if (rxq) {
-			rxq->cb(swp, fd, dq, &ev[num_pkts]);
+			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");
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-dev] [PATCH v5 2/5] net/dpaa2: add API's to support event eth adapter
  2017-10-23 12:37 ` [dpdk-dev] [PATCH v5 1/5] drivers: add queue parameter in event processing callback Nipun Gupta
@ 2017-10-23 12:37   ` Nipun Gupta
  2017-10-23 12:37   ` [dpdk-dev] [PATCH v5 3/5] drivers: add net as dependency for event drivers Nipun Gupta
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 37+ messages in thread
From: Nipun Gupta @ 2017-10-23 12:37 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
Changes in v3:
  Check the queue schedule type before configuring MC (Hemant)

 drivers/net/dpaa2/dpaa2_ethdev.c            | 62 +++++++++++++++++++++++++++++
 drivers/net/dpaa2/dpaa2_ethdev.h            | 15 +++++++
 drivers/net/dpaa2/dpaa2_rxtx.c              | 20 ++++++++++
 drivers/net/dpaa2/rte_pmd_dpaa2_version.map |  7 ++++
 4 files changed, 104 insertions(+)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 1ac607c..14d79b9 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1634,6 +1634,68 @@ int dpaa2_dev_stats_get(struct rte_eth_dev *dev,
 	return 0;
 }
 
+int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
+		int eth_rx_queue_id,
+		uint16_t dpcon_id,
+		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
+{
+	struct dpaa2_dev_priv *eth_priv = dev->data->dev_private;
+	struct fsl_mc_io *dpni = (struct fsl_mc_io *)eth_priv->hw;
+	struct dpaa2_queue *dpaa2_ethq = eth_priv->rx_vq[eth_rx_queue_id];
+	uint8_t flow_id = dpaa2_ethq->flow_id;
+	struct dpni_queue cfg;
+	uint8_t options;
+	int ret;
+
+	if (queue_conf->ev.sched_type == RTE_SCHED_TYPE_PARALLEL)
+		dpaa2_ethq->cb = dpaa2_dev_process_parallel_event;
+	else
+		return -EINVAL;
+
+	memset(&cfg, 0, sizeof(struct dpni_queue));
+	options = DPNI_QUEUE_OPT_DEST;
+	cfg.destination.type = DPNI_DEST_DPCON;
+	cfg.destination.id = dpcon_id;
+	cfg.destination.priority = queue_conf->ev.priority;
+
+	options |= DPNI_QUEUE_OPT_USER_CTX;
+	cfg.user_context = (uint64_t)(dpaa2_ethq);
+
+	ret = dpni_set_queue(dpni, CMD_PRI_LOW, eth_priv->token, DPNI_QUEUE_RX,
+			     dpaa2_ethq->tc_index, flow_id, options, &cfg);
+	if (ret) {
+		RTE_LOG(ERR, PMD, "Error in dpni_set_queue: ret: %d\n", ret);
+		return ret;
+	}
+
+	memcpy(&dpaa2_ethq->ev, &queue_conf->ev, sizeof(struct rte_event));
+
+	return 0;
+}
+
+int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
+		int eth_rx_queue_id)
+{
+	struct dpaa2_dev_priv *eth_priv = dev->data->dev_private;
+	struct fsl_mc_io *dpni = (struct fsl_mc_io *)eth_priv->hw;
+	struct dpaa2_queue *dpaa2_ethq = eth_priv->rx_vq[eth_rx_queue_id];
+	uint8_t flow_id = dpaa2_ethq->flow_id;
+	struct dpni_queue cfg;
+	uint8_t options;
+	int ret;
+
+	memset(&cfg, 0, sizeof(struct dpni_queue));
+	options = DPNI_QUEUE_OPT_DEST;
+	cfg.destination.type = DPNI_DEST_NONE;
+
+	ret = dpni_set_queue(dpni, CMD_PRI_LOW, eth_priv->token, DPNI_QUEUE_RX,
+			     dpaa2_ethq->tc_index, flow_id, options, &cfg);
+	if (ret)
+		RTE_LOG(ERR, PMD, "Error in dpni_set_queue: ret: %d\n", ret);
+
+	return ret;
+}
+
 static struct eth_dev_ops dpaa2_ethdev_ops = {
 	.dev_configure	  = dpaa2_eth_dev_configure,
 	.dev_start	      = dpaa2_dev_start,
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
index 7b14ae0..b8e94aa 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.h
+++ b/drivers/net/dpaa2/dpaa2_ethdev.h
@@ -34,6 +34,8 @@
 #ifndef _DPAA2_ETHDEV_H
 #define _DPAA2_ETHDEV_H
 
+#include <rte_event_eth_rx_adapter.h>
+
 #include <mc/fsl_dpni.h>
 #include <mc/fsl_mc_sys.h>
 
@@ -100,8 +102,21 @@ int dpaa2_remove_flow_dist(struct rte_eth_dev *eth_dev,
 
 int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, void *blist);
 
+int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
+		int eth_rx_queue_id,
+		uint16_t dpcon_id,
+		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
+
+int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
+		int eth_rx_queue_id);
+
 uint16_t dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs,
 			       uint16_t nb_pkts);
+void dpaa2_dev_process_parallel_event(struct qbman_swp *swp,
+				      const struct qbman_fd *fd,
+				      const struct qbman_result *dq,
+				      struct dpaa2_queue *rxq,
+				      struct rte_event *ev);
 uint16_t dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
 uint16_t dummy_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
 #endif /* _DPAA2_ETHDEV_H */
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 7cfa73a..a317f7f 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -514,6 +514,26 @@ static inline int __attribute__((hot))
 	return num_rx;
 }
 
+void __attribute__((hot))
+dpaa2_dev_process_parallel_event(struct qbman_swp *swp,
+				 const struct qbman_fd *fd,
+				 const struct qbman_result *dq,
+				 struct dpaa2_queue *rxq,
+				 struct rte_event *ev)
+{
+	ev->mbuf = eth_fd_to_mbuf(fd);
+
+	ev->flow_id = rxq->ev.flow_id;
+	ev->sub_event_type = rxq->ev.sub_event_type;
+	ev->event_type = RTE_EVENT_TYPE_ETHDEV;
+	ev->op = RTE_EVENT_OP_NEW;
+	ev->sched_type = rxq->ev.sched_type;
+	ev->queue_id = rxq->ev.queue_id;
+	ev->priority = rxq->ev.priority;
+
+	qbman_swp_dqrr_consume(swp, dq);
+}
+
 /*
  * Callback to handle sending packets through WRIOP based interface
  */
diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
index 8591cc0..b741bc0 100644
--- a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
+++ b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
@@ -2,3 +2,10 @@ DPDK_17.05 {
 
 	local: *;
 };
+
+DPDK_17.11 {
+	global:
+
+	dpaa2_eth_eventq_attach;
+	dpaa2_eth_eventq_detach;
+};
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-dev] [PATCH v5 3/5] drivers: add net as dependency for event drivers
  2017-10-23 12:37 ` [dpdk-dev] [PATCH v5 1/5] drivers: add queue parameter in event processing callback Nipun Gupta
  2017-10-23 12:37   ` [dpdk-dev] [PATCH v5 2/5] net/dpaa2: add API's to support event eth adapter Nipun Gupta
@ 2017-10-23 12:37   ` Nipun Gupta
  2017-10-23  6:24     ` Jerin Jacob
  2017-10-23 12:37   ` [dpdk-dev] [PATCH v5 4/5] event/dpaa2: support event eth adapter Nipun Gupta
                     ` (2 subsequent siblings)
  4 siblings, 1 reply; 37+ messages in thread
From: Nipun Gupta @ 2017-10-23 12:37 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

With the introduction of eventdev-ethdev RX adapter support in event
device, some of the event device will have dependency on their respective
ethernet drivers. This patch adds the net as a dependency for eventdevs.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
Changes in v5:
  Added get commit message (Jerin)
Changes in v4:
  This change is separated from patch-3/4 from v3 of this
  patchset (Jerin)

 drivers/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/Makefile b/drivers/Makefile
index 0467250..db0cd76 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -39,6 +39,6 @@ DEPDIRS-net := bus mempool
 DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto
 DEPDIRS-crypto := bus mempool
 DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event
-DEPDIRS-event := bus mempool
+DEPDIRS-event := bus mempool net
 
 include $(RTE_SDK)/mk/rte.subdir.mk
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-dev] [PATCH v5 4/5] event/dpaa2: support event eth adapter
  2017-10-23 12:37 ` [dpdk-dev] [PATCH v5 1/5] drivers: add queue parameter in event processing callback Nipun Gupta
  2017-10-23 12:37   ` [dpdk-dev] [PATCH v5 2/5] net/dpaa2: add API's to support event eth adapter Nipun Gupta
  2017-10-23 12:37   ` [dpdk-dev] [PATCH v5 3/5] drivers: add net as dependency for event drivers Nipun Gupta
@ 2017-10-23 12:37   ` Nipun Gupta
  2017-10-23 12:37   ` [dpdk-dev] [PATCH v5 5/5] event/dpaa2: improve the err handling and log msg Nipun Gupta
  2017-10-23 17:49   ` [dpdk-dev] [PATCH v5 1/5] drivers: add queue parameter in event processing callback Jerin Jacob
  4 siblings, 0 replies; 37+ messages in thread
From: Nipun Gupta @ 2017-10-23 12:37 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
Changes in v4:
  Move driver/Makefile changes in separate patch (Jerin)
Changes in v3:
  Fix shared library build
Changes in v2:
  Support rx_queue_id = -1 in eth adapter queue and and del (Nikhil)
  Remove duplicate returns (Nikhil)

 drivers/event/Makefile               |   4 +-
 drivers/event/dpaa2/Makefile         |   2 +
 drivers/event/dpaa2/dpaa2_eventdev.c | 151 ++++++++++++++++++++++++++++++++++-
 drivers/event/dpaa2/dpaa2_eventdev.h |   8 ++
 4 files changed, 162 insertions(+), 3 deletions(-)

diff --git a/drivers/event/Makefile b/drivers/event/Makefile
index d09be74..e119d60 100644
--- a/drivers/event/Makefile
+++ b/drivers/event/Makefile
@@ -31,7 +31,7 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
-core-libs := librte_eal librte_eventdev
+core-libs := librte_eal librte_ether librte_eventdev
 
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_EVENTDEV) += skeleton
 DEPDIRS-skeleton = $(core-libs)
@@ -40,6 +40,6 @@ DEPDIRS-sw = $(core-libs) librte_kvargs librte_ring
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += octeontx
 DEPDIRS-octeontx = $(core-libs) librte_mempool_octeontx
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV) += dpaa2
-DEPDIRS-dpaa2 = $(core-libs) librte_bus_fslmc
+DEPDIRS-dpaa2 = $(core-libs) librte_bus_fslmc librte_pmd_dpaa2
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/event/dpaa2/Makefile b/drivers/event/dpaa2/Makefile
index 3497d09..2d1d7c4 100644
--- a/drivers/event/dpaa2/Makefile
+++ b/drivers/event/dpaa2/Makefile
@@ -45,6 +45,8 @@ CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/portal
 CFLAGS += -I$(RTE_SDK)/drivers/mempool/dpaa2
 CFLAGS += -I$(RTE_SDK)/drivers/event/dpaa2
 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal
+CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2
+CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2/mc
 
 # versioning export map
 EXPORT_MAP := rte_pmd_dpaa2_event_version.map
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 8a6a3e3..ee3a164 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -53,11 +53,14 @@
 #include <rte_memzone.h>
 #include <rte_pci.h>
 #include <rte_vdev.h>
+#include <rte_ethdev.h>
+#include <rte_event_eth_rx_adapter.h>
 
 #include <fslmc_vfio.h>
 #include <dpaa2_hw_pvt.h>
 #include <dpaa2_hw_mempool.h>
 #include <dpaa2_hw_dpio.h>
+#include <dpaa2_ethdev.h>
 #include "dpaa2_eventdev.h"
 #include <portal/dpaa2_hw_pvt.h>
 #include <mc/fsl_dpci.h>
@@ -557,6 +560,147 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 	RTE_SET_USED(f);
 }
 
+static int
+dpaa2_eventdev_eth_caps_get(const struct rte_eventdev *dev,
+			    const struct rte_eth_dev *eth_dev,
+			    uint32_t *caps)
+{
+	const char *ethdev_driver = eth_dev->device->driver->name;
+
+	PMD_DRV_FUNC_TRACE();
+
+	RTE_SET_USED(dev);
+
+	if (!strcmp(ethdev_driver, "net_dpaa2"))
+		*caps = RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP;
+	else
+		*caps = RTE_EVENT_ETH_RX_ADAPTER_SW_CAP;
+
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_queue_add_all(const struct rte_eventdev *dev,
+		const struct rte_eth_dev *eth_dev,
+		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
+{
+	struct dpaa2_eventdev *priv = dev->data->dev_private;
+	uint8_t ev_qid = queue_conf->ev.queue_id;
+	uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
+	int i, ret;
+
+	PMD_DRV_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",
+				    ret);
+			goto fail;
+		}
+	}
+	return 0;
+fail:
+	for (i = (i - 1); i >= 0 ; i--)
+		dpaa2_eth_eventq_detach(eth_dev, i);
+
+	return ret;
+}
+
+static int
+dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
+		const struct rte_eth_dev *eth_dev,
+		int32_t rx_queue_id,
+		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
+{
+	struct dpaa2_eventdev *priv = dev->data->dev_private;
+	uint8_t ev_qid = queue_conf->ev.queue_id;
+	uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
+	int ret;
+
+	PMD_DRV_FUNC_TRACE();
+
+	if (rx_queue_id == -1)
+		return dpaa2_eventdev_eth_queue_add_all(dev,
+				eth_dev, queue_conf);
+
+	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);
+		return ret;
+	}
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_queue_del_all(const struct rte_eventdev *dev,
+			     const struct rte_eth_dev *eth_dev)
+{
+	int i, ret;
+
+	PMD_DRV_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",
+				    ret);
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_queue_del(const struct rte_eventdev *dev,
+			     const struct rte_eth_dev *eth_dev,
+			     int32_t rx_queue_id)
+{
+	int ret;
+
+	PMD_DRV_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);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_start(const struct rte_eventdev *dev,
+			 const struct rte_eth_dev *eth_dev)
+{
+	PMD_DRV_FUNC_TRACE();
+
+	RTE_SET_USED(dev);
+	RTE_SET_USED(eth_dev);
+
+	return 0;
+}
+
+static int
+dpaa2_eventdev_eth_stop(const struct rte_eventdev *dev,
+			const struct rte_eth_dev *eth_dev)
+{
+	PMD_DRV_FUNC_TRACE();
+
+	RTE_SET_USED(dev);
+	RTE_SET_USED(eth_dev);
+
+	return 0;
+}
+
 static const struct rte_eventdev_ops dpaa2_eventdev_ops = {
 	.dev_infos_get    = dpaa2_eventdev_info_get,
 	.dev_configure    = dpaa2_eventdev_configure,
@@ -572,7 +716,12 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
 	.port_link        = dpaa2_eventdev_port_link,
 	.port_unlink      = dpaa2_eventdev_port_unlink,
 	.timeout_ticks    = dpaa2_eventdev_timeout_ticks,
-	.dump             = dpaa2_eventdev_dump
+	.dump             = dpaa2_eventdev_dump,
+	.eth_rx_adapter_caps_get = dpaa2_eventdev_eth_caps_get,
+	.eth_rx_adapter_queue_add = dpaa2_eventdev_eth_queue_add,
+	.eth_rx_adapter_queue_del = dpaa2_eventdev_eth_queue_del,
+	.eth_rx_adapter_start = dpaa2_eventdev_eth_start,
+	.eth_rx_adapter_stop = dpaa2_eventdev_eth_stop,
 };
 
 static int
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.h b/drivers/event/dpaa2/dpaa2_eventdev.h
index f79f78a..ae8e07e 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.h
+++ b/drivers/event/dpaa2/dpaa2_eventdev.h
@@ -74,6 +74,14 @@ enum {
 	DPAA2_EVENT_DPCI_MAX_QUEUES
 };
 
+#define RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP \
+		(RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT | \
+		RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ | \
+		RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID)
+/**< Ethernet Rx adapter cap to return If the packet transfers from
+ * the ethdev to eventdev with DPAA2 devices.
+ */
+
 struct dpaa2_dpcon_dev {
 	TAILQ_ENTRY(dpaa2_dpcon_dev) next;
 	struct fsl_mc_io dpcon;
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [dpdk-dev] [PATCH v5 5/5] event/dpaa2: improve the err handling and log msg
  2017-10-23 12:37 ` [dpdk-dev] [PATCH v5 1/5] drivers: add queue parameter in event processing callback Nipun Gupta
                     ` (2 preceding siblings ...)
  2017-10-23 12:37   ` [dpdk-dev] [PATCH v5 4/5] event/dpaa2: support event eth adapter Nipun Gupta
@ 2017-10-23 12:37   ` Nipun Gupta
  2017-10-23 17:49   ` [dpdk-dev] [PATCH v5 1/5] drivers: add queue parameter in event processing callback Jerin Jacob
  4 siblings, 0 replies; 37+ messages in thread
From: Nipun Gupta @ 2017-10-23 12:37 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, jerin.jacob, nikhil.rao, Nipun Gupta

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/event/dpaa2/dpaa2_eventdev.c | 9 +++++++++
 drivers/event/dpaa2/dpaa2_hw_dpcon.c | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index ee3a164..d1be5de 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -140,11 +140,20 @@
 			 */
 			struct rte_event *ev_temp = rte_malloc(NULL,
 				sizeof(struct rte_event), 0);
+
+			if (!ev_temp) {
+				if (!loop)
+					return num_tx;
+				frames_to_send = loop;
+				PMD_DRV_LOG(ERR, "Unable to allocate memory");
+				goto send_partial;
+			}
 			rte_memcpy(ev_temp, event, sizeof(struct rte_event));
 			DPAA2_SET_FD_ADDR((&fd_arr[loop]), ev_temp);
 			DPAA2_SET_FD_LEN((&fd_arr[loop]),
 					 sizeof(struct rte_event));
 		}
+send_partial:
 		loop = 0;
 		while (loop < frames_to_send) {
 			loop += qbman_swp_enqueue_multiple_desc(swp,
diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
index 2c416b5..005e623 100644
--- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c
+++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c
@@ -100,7 +100,7 @@
 
 	TAILQ_INSERT_TAIL(&dpcon_dev_list, dpcon_node, next);
 
-	PMD_DRV_LOG(DEBUG, "DPAA2: Added [dpcon.%d]", dpcon_id);
+	RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpcon.%d]\n", dpcon_id);
 
 	return 0;
 }
-- 
1.9.1

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [dpdk-dev] [PATCH v5 1/5] drivers: add queue parameter in event processing callback
  2017-10-23 12:37 ` [dpdk-dev] [PATCH v5 1/5] drivers: add queue parameter in event processing callback Nipun Gupta
                     ` (3 preceding siblings ...)
  2017-10-23 12:37   ` [dpdk-dev] [PATCH v5 5/5] event/dpaa2: improve the err handling and log msg Nipun Gupta
@ 2017-10-23 17:49   ` Jerin Jacob
  4 siblings, 0 replies; 37+ messages in thread
From: Jerin Jacob @ 2017-10-23 17:49 UTC (permalink / raw)
  To: Nipun Gupta; +Cc: dev, hemant.agrawal, nikhil.rao

-----Original Message-----
> Date: Mon, 23 Oct 2017 18:07:02 +0530
> From: Nipun Gupta <nipun.gupta@nxp.com>
> To: dev@dpdk.org
> CC: hemant.agrawal@nxp.com, jerin.jacob@caviumnetworks.com,
>  nikhil.rao@intel.com, Nipun Gupta <nipun.gupta@nxp.com>
> Subject: [PATCH v5 1/5] drivers: add queue parameter in event processing
>  callback
> X-Mailer: git-send-email 1.9.1
> 
> For event dequeues for ethernet queues, a dpaa2_queue structure is
> required to get the configuration for that ethernet queue. Based on
> this configuration the rte_event is to be filled at the ingress side.
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
> This patch series is based over the following patch:
> http://dpdk.org/dev/patchwork/patch/30430/

Series applied to dpdk-next-eventdev/master. Thanks.

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2017-10-23 17:49 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-10 17:51 [dpdk-dev] [PATCH 1/4] drivers: add queue parameter in event processing callback Nipun Gupta
2017-10-10 17:51 ` [dpdk-dev] [PATCH 2/4] net/dpaa2: add API's to support event eth adapter Nipun Gupta
2017-10-10 17:51 ` [dpdk-dev] [PATCH 3/4] event/dpaa2: " Nipun Gupta
2017-10-11  3:45   ` Rao, Nikhil
2017-10-11 11:03     ` Nipun Gupta
2017-10-11  4:10   ` Rao, Nikhil
2017-10-11 11:03     ` Nipun Gupta
2017-10-10 17:51 ` [dpdk-dev] [PATCH 4/4] event/dpaa2: improve the err handling and log msg Nipun Gupta
2017-10-12 17:18 ` [dpdk-dev] [PATCH v2 1/4] drivers: add queue parameter in event processing callback Nipun Gupta
2017-10-12 17:18   ` [dpdk-dev] [PATCH v2 2/4] net/dpaa2: add API's to support event eth adapter Nipun Gupta
2017-10-13 14:55     ` Hemant Agrawal
2017-10-12 17:18   ` [dpdk-dev] [PATCH v2 3/4] event/dpaa2: " Nipun Gupta
2017-10-13  5:57     ` Rao, Nikhil
2017-10-13 14:52       ` Hemant Agrawal
2017-10-12 17:18   ` [dpdk-dev] [PATCH v2 4/4] event/dpaa2: improve the err handling and log msg Nipun Gupta
2017-10-13 14:52     ` Hemant Agrawal
2017-10-13 14:48   ` [dpdk-dev] [PATCH v2 1/4] drivers: add queue parameter in event processing callback Hemant Agrawal
2017-10-16 21:44 ` [dpdk-dev] [PATCH v3 " Nipun Gupta
2017-10-16 21:44   ` [dpdk-dev] [PATCH v3 2/4] net/dpaa2: add API's to support event eth adapter Nipun Gupta
2017-10-16 21:44   ` [dpdk-dev] [PATCH v3 3/4] event/dpaa2: " Nipun Gupta
2017-10-17  5:00     ` Jerin Jacob
2017-10-17 10:28       ` Nipun Gupta
2017-10-16 21:44   ` [dpdk-dev] [PATCH v3 4/4] event/dpaa2: improve the err handling and log msg Nipun Gupta
2017-10-17 16:38 ` [dpdk-dev] [PATCH v4 1/5] drivers: add queue parameter in event processing callback Nipun Gupta
2017-10-17 16:38   ` [dpdk-dev] [PATCH v4 2/5] net/dpaa2: add API's to support event eth adapter Nipun Gupta
2017-10-17 12:32     ` Hemant Agrawal
2017-10-17 16:38   ` [dpdk-dev] [PATCH v4 3/5] drivers: add net as dependency for event drivers Nipun Gupta
2017-10-21 10:05     ` Jerin Jacob
2017-10-17 16:38   ` [dpdk-dev] [PATCH v4 4/5] event/dpaa2: support event eth adapter Nipun Gupta
2017-10-17 16:38   ` [dpdk-dev] [PATCH v4 5/5] event/dpaa2: improve the err handling and log msg Nipun Gupta
2017-10-23 12:37 ` [dpdk-dev] [PATCH v5 1/5] drivers: add queue parameter in event processing callback Nipun Gupta
2017-10-23 12:37   ` [dpdk-dev] [PATCH v5 2/5] net/dpaa2: add API's to support event eth adapter Nipun Gupta
2017-10-23 12:37   ` [dpdk-dev] [PATCH v5 3/5] drivers: add net as dependency for event drivers Nipun Gupta
2017-10-23  6:24     ` Jerin Jacob
2017-10-23 12:37   ` [dpdk-dev] [PATCH v5 4/5] event/dpaa2: support event eth adapter Nipun Gupta
2017-10-23 12:37   ` [dpdk-dev] [PATCH v5 5/5] event/dpaa2: improve the err handling and log msg Nipun Gupta
2017-10-23 17:49   ` [dpdk-dev] [PATCH v5 1/5] drivers: add queue parameter in event processing callback Jerin Jacob

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).