DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] event/dpaa2: set priority as per the dpcon device
@ 2019-10-04 11:57 Nipun Gupta
  2019-10-04 11:57 ` [dpdk-dev] [PATCH 2/2] event/dpaa2: support Tx adapter Nipun Gupta
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Nipun Gupta @ 2019-10-04 11:57 UTC (permalink / raw)
  To: dev; +Cc: jerinj, hemant.agrawal, Nipun Gupta

This patch sets the priority of the dpcon dev, such that it is
within the supported range of dpcon

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h     | 11 +++++++++++
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 10 +++++++---
 drivers/crypto/dpaa2_sec/dpaa2_sec_event.h  |  2 +-
 drivers/event/dpaa2/dpaa2_eventdev.c        | 17 ++++++++---------
 drivers/event/dpaa2/dpaa2_eventdev.h        | 11 -----------
 drivers/net/dpaa2/dpaa2_ethdev.c            | 11 +++++++----
 drivers/net/dpaa2/dpaa2_ethdev.h            |  2 +-
 7 files changed, 35 insertions(+), 29 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 4bb6b26c7..3853003cc 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -182,6 +182,17 @@ struct dpaa2_dpci_dev {
 	struct dpaa2_queue tx_queue[DPAA2_DPCI_MAX_QUEUES];
 };
 
+struct dpaa2_dpcon_dev {
+	TAILQ_ENTRY(dpaa2_dpcon_dev) next;
+	struct fsl_mc_io dpcon;
+	uint16_t token;
+	rte_atomic16_t in_use;
+	uint32_t dpcon_id;
+	uint16_t qbman_ch_id;
+	uint8_t num_priorities;
+	uint8_t channel_index;
+};
+
 /*! Global MCP list */
 extern void *(*rte_mcp_ptr_list);
 
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 26458e5d1..30cf46170 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -3155,13 +3155,14 @@ dpaa2_sec_process_atomic_event(struct qbman_swp *swp __attribute__((unused)),
 int
 dpaa2_sec_eventq_attach(const struct rte_cryptodev *dev,
 		int qp_id,
-		uint16_t dpcon_id,
+		struct dpaa2_dpcon_dev *dpcon,
 		const struct rte_event *event)
 {
 	struct dpaa2_sec_dev_private *priv = dev->data->dev_private;
 	struct fsl_mc_io *dpseci = (struct fsl_mc_io *)priv->hw;
 	struct dpaa2_sec_qp *qp = dev->data->queue_pairs[qp_id];
 	struct dpseci_rx_queue_cfg cfg;
+	uint8_t priority;
 	int ret;
 
 	if (event->sched_type == RTE_SCHED_TYPE_PARALLEL)
@@ -3171,11 +3172,14 @@ dpaa2_sec_eventq_attach(const struct rte_cryptodev *dev,
 	else
 		return -EINVAL;
 
+	priority = (RTE_EVENT_DEV_PRIORITY_LOWEST / event->priority) *
+		   (dpcon->num_priorities - 1);
+
 	memset(&cfg, 0, sizeof(struct dpseci_rx_queue_cfg));
 	cfg.options = DPSECI_QUEUE_OPT_DEST;
 	cfg.dest_cfg.dest_type = DPSECI_DEST_DPCON;
-	cfg.dest_cfg.dest_id = dpcon_id;
-	cfg.dest_cfg.priority = event->priority;
+	cfg.dest_cfg.dest_id = dpcon->dpcon_id;
+	cfg.dest_cfg.priority = priority;
 
 	cfg.options |= DPSECI_QUEUE_OPT_USER_CTX;
 	cfg.user_ctx = (size_t)(qp);
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_event.h b/drivers/crypto/dpaa2_sec/dpaa2_sec_event.h
index 977099429..c779d5d83 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_event.h
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_event.h
@@ -9,7 +9,7 @@
 int
 dpaa2_sec_eventq_attach(const struct rte_cryptodev *dev,
 		int qp_id,
-		uint16_t dpcon_id,
+		struct dpaa2_dpcon_dev *dpcon,
 		const struct rte_event *event);
 
 int dpaa2_sec_eventq_detach(const struct rte_cryptodev *dev,
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 5249d2fe4..56cea5f90 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -688,14 +688,14 @@ dpaa2_eventdev_eth_queue_add_all(const struct rte_eventdev *dev,
 {
 	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;
+	struct dpaa2_dpcon_dev *dpcon = priv->evq_info[ev_qid].dpcon;
 	int i, ret;
 
 	EVENTDEV_INIT_FUNC_TRACE();
 
 	for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
 		ret = dpaa2_eth_eventq_attach(eth_dev, i,
-				dpcon_id, queue_conf);
+					      dpcon, queue_conf);
 		if (ret) {
 			DPAA2_EVENTDEV_ERR(
 				"Event queue attach failed: err(%d)", ret);
@@ -718,7 +718,7 @@ dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
 {
 	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;
+	struct dpaa2_dpcon_dev *dpcon = priv->evq_info[ev_qid].dpcon;
 	int ret;
 
 	EVENTDEV_INIT_FUNC_TRACE();
@@ -728,7 +728,7 @@ dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
 				eth_dev, queue_conf);
 
 	ret = dpaa2_eth_eventq_attach(eth_dev, rx_queue_id,
-			dpcon_id, queue_conf);
+				      dpcon, queue_conf);
 	if (ret) {
 		DPAA2_EVENTDEV_ERR(
 			"Event queue attach failed: err(%d)", ret);
@@ -831,14 +831,13 @@ dpaa2_eventdev_crypto_queue_add_all(const struct rte_eventdev *dev,
 {
 	struct dpaa2_eventdev *priv = dev->data->dev_private;
 	uint8_t ev_qid = ev->queue_id;
-	uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
+	struct dpaa2_dpcon_dev *dpcon = priv->evq_info[ev_qid].dpcon;
 	int i, ret;
 
 	EVENTDEV_INIT_FUNC_TRACE();
 
 	for (i = 0; i < cryptodev->data->nb_queue_pairs; i++) {
-		ret = dpaa2_sec_eventq_attach(cryptodev, i,
-				dpcon_id, ev);
+		ret = dpaa2_sec_eventq_attach(cryptodev, i, dpcon, ev);
 		if (ret) {
 			DPAA2_EVENTDEV_ERR("dpaa2_sec_eventq_attach failed: ret %d\n",
 				    ret);
@@ -861,7 +860,7 @@ dpaa2_eventdev_crypto_queue_add(const struct rte_eventdev *dev,
 {
 	struct dpaa2_eventdev *priv = dev->data->dev_private;
 	uint8_t ev_qid = ev->queue_id;
-	uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
+	struct dpaa2_dpcon_dev *dpcon = priv->evq_info[ev_qid].dpcon;
 	int ret;
 
 	EVENTDEV_INIT_FUNC_TRACE();
@@ -871,7 +870,7 @@ dpaa2_eventdev_crypto_queue_add(const struct rte_eventdev *dev,
 				cryptodev, ev);
 
 	ret = dpaa2_sec_eventq_attach(cryptodev, rx_queue_id,
-			dpcon_id, ev);
+				      dpcon, ev);
 	if (ret) {
 		DPAA2_EVENTDEV_ERR(
 			"dpaa2_sec_eventq_attach failed: ret: %d\n", ret);
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.h b/drivers/event/dpaa2/dpaa2_eventdev.h
index abc038e49..7c5d00550 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.h
+++ b/drivers/event/dpaa2/dpaa2_eventdev.h
@@ -52,17 +52,6 @@ enum {
  * the ethdev to eventdev with DPAA2 devices.
  */
 
-struct dpaa2_dpcon_dev {
-	TAILQ_ENTRY(dpaa2_dpcon_dev) next;
-	struct fsl_mc_io dpcon;
-	uint16_t token;
-	rte_atomic16_t in_use;
-	uint32_t dpcon_id;
-	uint16_t qbman_ch_id;
-	uint8_t num_priorities;
-	uint8_t channel_index;
-};
-
 struct dpaa2_eventq {
 	/* DPcon device */
 	struct dpaa2_dpcon_dev *dpcon;
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index dd6a78f9f..7753af53d 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1800,7 +1800,7 @@ dpaa2_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 
 int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
 		int eth_rx_queue_id,
-		uint16_t dpcon_id,
+		struct dpaa2_dpcon_dev *dpcon,
 		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
 {
 	struct dpaa2_dev_priv *eth_priv = dev->data->dev_private;
@@ -1808,7 +1808,7 @@ int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
 	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;
+	uint8_t options, priority;
 	int ret;
 
 	if (queue_conf->ev.sched_type == RTE_SCHED_TYPE_PARALLEL)
@@ -1820,11 +1820,14 @@ int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
 	else
 		return -EINVAL;
 
+	priority = (RTE_EVENT_DEV_PRIORITY_LOWEST / queue_conf->ev.priority) *
+		   (dpcon->num_priorities - 1);
+
 	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;
+	cfg.destination.id = dpcon->dpcon_id;
+	cfg.destination.priority = priority;
 
 	if (queue_conf->ev.sched_type == RTE_SCHED_TYPE_ATOMIC) {
 		options |= DPNI_QUEUE_OPT_HOLD_ACTIVE;
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
index 33b1506aa..9f10d3ad0 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.h
+++ b/drivers/net/dpaa2/dpaa2_ethdev.h
@@ -142,7 +142,7 @@ 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,
+		struct dpaa2_dpcon_dev *dpcon,
 		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
 
 int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
-- 
2.17.1


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

* [dpdk-dev] [PATCH 2/2] event/dpaa2: support Tx adapter
  2019-10-04 11:57 [dpdk-dev] [PATCH 1/2] event/dpaa2: set priority as per the dpcon device Nipun Gupta
@ 2019-10-04 11:57 ` Nipun Gupta
  2019-10-10 12:29   ` Hemant Agrawal
  2019-10-10 12:29 ` [dpdk-dev] [PATCH 1/2] event/dpaa2: set priority as per the dpcon device Hemant Agrawal
  2019-10-17  8:29 ` [dpdk-dev] [PATCH 1/2 v2] " Nipun Gupta
  2 siblings, 1 reply; 10+ messages in thread
From: Nipun Gupta @ 2019-10-04 11:57 UTC (permalink / raw)
  To: dev; +Cc: jerinj, hemant.agrawal, Nipun Gupta

This patch adds the support of Tx adapter for DPAA2 platform

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---

This patch is based over "eventdev: flag to identify same destined
packets enqueue" patch

 drivers/event/dpaa2/dpaa2_eventdev.c | 75 ++++++++++++++++++++++++++--
 drivers/event/dpaa2/dpaa2_eventdev.h |  3 +-
 2 files changed, 72 insertions(+), 6 deletions(-)

diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 56cea5f90..4ee2c460e 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -27,6 +27,7 @@
 #include <rte_ethdev_driver.h>
 #include <rte_cryptodev.h>
 #include <rte_event_eth_rx_adapter.h>
+#include <rte_event_eth_tx_adapter.h>
 
 #include <fslmc_vfio.h>
 #include <dpaa2_hw_pvt.h>
@@ -947,6 +948,66 @@ dpaa2_eventdev_crypto_stop(const struct rte_eventdev *dev,
 	return 0;
 }
 
+static int
+dpaa2_eventdev_tx_adapter_create(uint8_t id,
+				 const struct rte_eventdev *dev)
+{
+	RTE_SET_USED(id);
+	RTE_SET_USED(dev);
+
+	/* Nothing to do. Simply return. */
+	return 0;
+}
+
+static int
+dpaa2_eventdev_tx_adapter_caps(const struct rte_eventdev *dev,
+			       const struct rte_eth_dev *eth_dev,
+			       uint32_t *caps)
+{
+	RTE_SET_USED(dev);
+	RTE_SET_USED(eth_dev);
+
+	*caps = RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT;
+	return 0;
+}
+
+static uint16_t
+dpaa2_eventdev_txa_enqueue_same_dest(void *port,
+				     struct rte_event ev[],
+				     uint16_t nb_events)
+{
+	struct rte_mbuf *m[DPAA2_EVENT_MAX_PORT_ENQUEUE_DEPTH], *m0;
+	uint8_t qid, i;
+
+	RTE_SET_USED(port);
+
+	m0 = (struct rte_mbuf *)ev[0].mbuf;
+	qid = rte_event_eth_tx_adapter_txq_get(m0);
+
+	for (i = 0; i < nb_events; i++)
+		m[i] = (struct rte_mbuf *)ev[i].mbuf;
+
+	return rte_eth_tx_burst(m0->port, qid, m, nb_events);
+}
+
+static uint16_t
+dpaa2_eventdev_txa_enqueue(void *port,
+			   struct rte_event ev[],
+			   uint16_t nb_events)
+{
+	struct rte_mbuf *m = (struct rte_mbuf *)ev[0].mbuf;
+	uint8_t qid, i;
+
+	RTE_SET_USED(port);
+
+	for (i = 0; i < nb_events; i++) {
+		qid = rte_event_eth_tx_adapter_txq_get(m);
+		rte_eth_tx_burst(m->port, qid, &m, 1);
+	}
+
+	return nb_events;
+}
+
 static struct rte_eventdev_ops dpaa2_eventdev_ops = {
 	.dev_infos_get    = dpaa2_eventdev_info_get,
 	.dev_configure    = dpaa2_eventdev_configure,
@@ -964,11 +1025,13 @@ static struct rte_eventdev_ops dpaa2_eventdev_ops = {
 	.timeout_ticks    = dpaa2_eventdev_timeout_ticks,
 	.dump             = dpaa2_eventdev_dump,
 	.dev_selftest     = test_eventdev_dpaa2,
-	.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,
+	.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,
+	.eth_tx_adapter_caps_get	= dpaa2_eventdev_tx_adapter_caps,
+	.eth_tx_adapter_create		= dpaa2_eventdev_tx_adapter_create,
 	.crypto_adapter_caps_get	= dpaa2_eventdev_crypto_caps_get,
 	.crypto_adapter_queue_pair_add	= dpaa2_eventdev_crypto_queue_add,
 	.crypto_adapter_queue_pair_del	= dpaa2_eventdev_crypto_queue_del,
@@ -1035,6 +1098,8 @@ dpaa2_eventdev_create(const char *name)
 	eventdev->enqueue_forward_burst = dpaa2_eventdev_enqueue_burst;
 	eventdev->dequeue       = dpaa2_eventdev_dequeue;
 	eventdev->dequeue_burst = dpaa2_eventdev_dequeue_burst;
+	eventdev->txa_enqueue	= dpaa2_eventdev_txa_enqueue;
+	eventdev->txa_enqueue_same_dest	= dpaa2_eventdev_txa_enqueue_same_dest;
 
 	/* For secondary processes, the primary has done all the work */
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.h b/drivers/event/dpaa2/dpaa2_eventdev.h
index 7c5d00550..785e52032 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.h
+++ b/drivers/event/dpaa2/dpaa2_eventdev.h
@@ -38,7 +38,8 @@ enum {
 #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)
+		RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID | \
+		RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)
 
 /**< Crypto Rx adapter cap to return If the packet transfers from
  * the cryptodev to eventdev with DPAA2 devices.
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH 1/2] event/dpaa2: set priority as per the dpcon device
  2019-10-04 11:57 [dpdk-dev] [PATCH 1/2] event/dpaa2: set priority as per the dpcon device Nipun Gupta
  2019-10-04 11:57 ` [dpdk-dev] [PATCH 2/2] event/dpaa2: support Tx adapter Nipun Gupta
@ 2019-10-10 12:29 ` Hemant Agrawal
  2019-10-16  7:39   ` Jerin Jacob
  2019-10-17  8:29 ` [dpdk-dev] [PATCH 1/2 v2] " Nipun Gupta
  2 siblings, 1 reply; 10+ messages in thread
From: Hemant Agrawal @ 2019-10-10 12:29 UTC (permalink / raw)
  To: Nipun Gupta, dpdk-dev

Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

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

* Re: [dpdk-dev] [PATCH 2/2] event/dpaa2: support Tx adapter
  2019-10-04 11:57 ` [dpdk-dev] [PATCH 2/2] event/dpaa2: support Tx adapter Nipun Gupta
@ 2019-10-10 12:29   ` Hemant Agrawal
  0 siblings, 0 replies; 10+ messages in thread
From: Hemant Agrawal @ 2019-10-10 12:29 UTC (permalink / raw)
  To: Nipun Gupta, dev; +Cc: jerinj, Nipun Gupta

Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

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

* Re: [dpdk-dev] [PATCH 1/2] event/dpaa2: set priority as per the dpcon device
  2019-10-10 12:29 ` [dpdk-dev] [PATCH 1/2] event/dpaa2: set priority as per the dpcon device Hemant Agrawal
@ 2019-10-16  7:39   ` Jerin Jacob
  0 siblings, 0 replies; 10+ messages in thread
From: Jerin Jacob @ 2019-10-16  7:39 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: Nipun Gupta, dpdk-dev

On Thu, Oct 10, 2019 at 5:59 PM Hemant Agrawal <hemant.agrawal@nxp.com> wrote:
>
> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>


There is a build issue with shared lib.

config: x86_64-native-linuxapp-gcc+shared+debug

/usr/bin/ld: dpaa2_eventdev.c:(.text+0x87): undefined reference to
`rte_eth_dev_is_valid_port'
/usr/bin/ld: dpaa2_eventdev.c:(.text+0x96): undefined reference to
`rte_eth_dev_logtype'
/usr/bin/ld: dpaa2_eventdev.c:(.text+0xf0): undefined reference to
`rte_eth_dev_logtype'

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

* [dpdk-dev] [PATCH 1/2 v2] event/dpaa2: set priority as per the dpcon device
  2019-10-04 11:57 [dpdk-dev] [PATCH 1/2] event/dpaa2: set priority as per the dpcon device Nipun Gupta
  2019-10-04 11:57 ` [dpdk-dev] [PATCH 2/2] event/dpaa2: support Tx adapter Nipun Gupta
  2019-10-10 12:29 ` [dpdk-dev] [PATCH 1/2] event/dpaa2: set priority as per the dpcon device Hemant Agrawal
@ 2019-10-17  8:29 ` Nipun Gupta
  2019-10-17  8:29   ` [dpdk-dev] [PATCH 2/2 v2] event/dpaa2: support Tx adapter Nipun Gupta
  2019-10-17  8:47   ` [dpdk-dev] [PATCH 1/2 v2] event/dpaa2: set priority as per the dpcon device Nipun Gupta
  2 siblings, 2 replies; 10+ messages in thread
From: Nipun Gupta @ 2019-10-17  8:29 UTC (permalink / raw)
  To: dev; +Cc: jerinj, hemant.agrawal, Nipun Gupta

This patch sets the priority of the dpcon dev, such that it is
within the supported range of dpcon

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h     | 11 +++++++++++
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 10 +++++++---
 drivers/crypto/dpaa2_sec/dpaa2_sec_event.h  |  2 +-
 drivers/event/dpaa2/dpaa2_eventdev.c        | 17 ++++++++---------
 drivers/event/dpaa2/dpaa2_eventdev.h        | 11 -----------
 drivers/net/dpaa2/dpaa2_ethdev.c            | 11 +++++++----
 drivers/net/dpaa2/dpaa2_ethdev.h            |  2 +-
 7 files changed, 35 insertions(+), 29 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 5087f68c6..db6dad544 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -185,6 +185,17 @@ struct dpaa2_dpci_dev {
 	struct dpaa2_queue tx_queue[DPAA2_DPCI_MAX_QUEUES];
 };
 
+struct dpaa2_dpcon_dev {
+	TAILQ_ENTRY(dpaa2_dpcon_dev) next;
+	struct fsl_mc_io dpcon;
+	uint16_t token;
+	rte_atomic16_t in_use;
+	uint32_t dpcon_id;
+	uint16_t qbman_ch_id;
+	uint8_t num_priorities;
+	uint8_t channel_index;
+};
+
 /*! Global MCP list */
 extern void *(*rte_mcp_ptr_list);
 
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 2ab34a00f..5db3f9540 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -3487,13 +3487,14 @@ dpaa2_sec_process_atomic_event(struct qbman_swp *swp __attribute__((unused)),
 int
 dpaa2_sec_eventq_attach(const struct rte_cryptodev *dev,
 		int qp_id,
-		uint16_t dpcon_id,
+		struct dpaa2_dpcon_dev *dpcon,
 		const struct rte_event *event)
 {
 	struct dpaa2_sec_dev_private *priv = dev->data->dev_private;
 	struct fsl_mc_io *dpseci = (struct fsl_mc_io *)priv->hw;
 	struct dpaa2_sec_qp *qp = dev->data->queue_pairs[qp_id];
 	struct dpseci_rx_queue_cfg cfg;
+	uint8_t priority;
 	int ret;
 
 	if (event->sched_type == RTE_SCHED_TYPE_PARALLEL)
@@ -3503,11 +3504,14 @@ dpaa2_sec_eventq_attach(const struct rte_cryptodev *dev,
 	else
 		return -EINVAL;
 
+	priority = (RTE_EVENT_DEV_PRIORITY_LOWEST / event->priority) *
+		   (dpcon->num_priorities - 1);
+
 	memset(&cfg, 0, sizeof(struct dpseci_rx_queue_cfg));
 	cfg.options = DPSECI_QUEUE_OPT_DEST;
 	cfg.dest_cfg.dest_type = DPSECI_DEST_DPCON;
-	cfg.dest_cfg.dest_id = dpcon_id;
-	cfg.dest_cfg.priority = event->priority;
+	cfg.dest_cfg.dest_id = dpcon->dpcon_id;
+	cfg.dest_cfg.priority = priority;
 
 	cfg.options |= DPSECI_QUEUE_OPT_USER_CTX;
 	cfg.user_ctx = (size_t)(qp);
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_event.h b/drivers/crypto/dpaa2_sec/dpaa2_sec_event.h
index 977099429..c779d5d83 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_event.h
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_event.h
@@ -9,7 +9,7 @@
 int
 dpaa2_sec_eventq_attach(const struct rte_cryptodev *dev,
 		int qp_id,
-		uint16_t dpcon_id,
+		struct dpaa2_dpcon_dev *dpcon,
 		const struct rte_event *event);
 
 int dpaa2_sec_eventq_detach(const struct rte_cryptodev *dev,
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 5249d2fe4..56cea5f90 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -688,14 +688,14 @@ dpaa2_eventdev_eth_queue_add_all(const struct rte_eventdev *dev,
 {
 	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;
+	struct dpaa2_dpcon_dev *dpcon = priv->evq_info[ev_qid].dpcon;
 	int i, ret;
 
 	EVENTDEV_INIT_FUNC_TRACE();
 
 	for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
 		ret = dpaa2_eth_eventq_attach(eth_dev, i,
-				dpcon_id, queue_conf);
+					      dpcon, queue_conf);
 		if (ret) {
 			DPAA2_EVENTDEV_ERR(
 				"Event queue attach failed: err(%d)", ret);
@@ -718,7 +718,7 @@ dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
 {
 	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;
+	struct dpaa2_dpcon_dev *dpcon = priv->evq_info[ev_qid].dpcon;
 	int ret;
 
 	EVENTDEV_INIT_FUNC_TRACE();
@@ -728,7 +728,7 @@ dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
 				eth_dev, queue_conf);
 
 	ret = dpaa2_eth_eventq_attach(eth_dev, rx_queue_id,
-			dpcon_id, queue_conf);
+				      dpcon, queue_conf);
 	if (ret) {
 		DPAA2_EVENTDEV_ERR(
 			"Event queue attach failed: err(%d)", ret);
@@ -831,14 +831,13 @@ dpaa2_eventdev_crypto_queue_add_all(const struct rte_eventdev *dev,
 {
 	struct dpaa2_eventdev *priv = dev->data->dev_private;
 	uint8_t ev_qid = ev->queue_id;
-	uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
+	struct dpaa2_dpcon_dev *dpcon = priv->evq_info[ev_qid].dpcon;
 	int i, ret;
 
 	EVENTDEV_INIT_FUNC_TRACE();
 
 	for (i = 0; i < cryptodev->data->nb_queue_pairs; i++) {
-		ret = dpaa2_sec_eventq_attach(cryptodev, i,
-				dpcon_id, ev);
+		ret = dpaa2_sec_eventq_attach(cryptodev, i, dpcon, ev);
 		if (ret) {
 			DPAA2_EVENTDEV_ERR("dpaa2_sec_eventq_attach failed: ret %d\n",
 				    ret);
@@ -861,7 +860,7 @@ dpaa2_eventdev_crypto_queue_add(const struct rte_eventdev *dev,
 {
 	struct dpaa2_eventdev *priv = dev->data->dev_private;
 	uint8_t ev_qid = ev->queue_id;
-	uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
+	struct dpaa2_dpcon_dev *dpcon = priv->evq_info[ev_qid].dpcon;
 	int ret;
 
 	EVENTDEV_INIT_FUNC_TRACE();
@@ -871,7 +870,7 @@ dpaa2_eventdev_crypto_queue_add(const struct rte_eventdev *dev,
 				cryptodev, ev);
 
 	ret = dpaa2_sec_eventq_attach(cryptodev, rx_queue_id,
-			dpcon_id, ev);
+				      dpcon, ev);
 	if (ret) {
 		DPAA2_EVENTDEV_ERR(
 			"dpaa2_sec_eventq_attach failed: ret: %d\n", ret);
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.h b/drivers/event/dpaa2/dpaa2_eventdev.h
index abc038e49..7c5d00550 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.h
+++ b/drivers/event/dpaa2/dpaa2_eventdev.h
@@ -52,17 +52,6 @@ enum {
  * the ethdev to eventdev with DPAA2 devices.
  */
 
-struct dpaa2_dpcon_dev {
-	TAILQ_ENTRY(dpaa2_dpcon_dev) next;
-	struct fsl_mc_io dpcon;
-	uint16_t token;
-	rte_atomic16_t in_use;
-	uint32_t dpcon_id;
-	uint16_t qbman_ch_id;
-	uint8_t num_priorities;
-	uint8_t channel_index;
-};
-
 struct dpaa2_eventq {
 	/* DPcon device */
 	struct dpaa2_dpcon_dev *dpcon;
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 848bb421e..d241643d8 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -2006,7 +2006,7 @@ dpaa2_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 
 int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
 		int eth_rx_queue_id,
-		uint16_t dpcon_id,
+		struct dpaa2_dpcon_dev *dpcon,
 		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
 {
 	struct dpaa2_dev_priv *eth_priv = dev->data->dev_private;
@@ -2014,7 +2014,7 @@ int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
 	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;
+	uint8_t options, priority;
 	int ret;
 
 	if (queue_conf->ev.sched_type == RTE_SCHED_TYPE_PARALLEL)
@@ -2026,11 +2026,14 @@ int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
 	else
 		return -EINVAL;
 
+	priority = (RTE_EVENT_DEV_PRIORITY_LOWEST / queue_conf->ev.priority) *
+		   (dpcon->num_priorities - 1);
+
 	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;
+	cfg.destination.id = dpcon->dpcon_id;
+	cfg.destination.priority = priority;
 
 	if (queue_conf->ev.sched_type == RTE_SCHED_TYPE_ATOMIC) {
 		options |= DPNI_QUEUE_OPT_HOLD_ACTIVE;
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
index 823f9e97c..95674b26b 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.h
+++ b/drivers/net/dpaa2/dpaa2_ethdev.h
@@ -164,7 +164,7 @@ 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,
+		struct dpaa2_dpcon_dev *dpcon,
 		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
 
 int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
-- 
2.17.1


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

* [dpdk-dev] [PATCH 2/2 v2] event/dpaa2: support Tx adapter
  2019-10-17  8:29 ` [dpdk-dev] [PATCH 1/2 v2] " Nipun Gupta
@ 2019-10-17  8:29   ` Nipun Gupta
  2019-10-17  8:47     ` Nipun Gupta
  2019-10-17  8:47   ` [dpdk-dev] [PATCH 1/2 v2] event/dpaa2: set priority as per the dpcon device Nipun Gupta
  1 sibling, 1 reply; 10+ messages in thread
From: Nipun Gupta @ 2019-10-17  8:29 UTC (permalink / raw)
  To: dev; +Cc: jerinj, hemant.agrawal, Nipun Gupta

This patch adds the support of Tx adapter for DPAA2 platform

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---

Changes in v2:
 - Fix build with RTE_LIBRTE_ETHDEV_DEBUG enabled

 drivers/event/dpaa2/Makefile         |  2 +-
 drivers/event/dpaa2/dpaa2_eventdev.c | 75 ++++++++++++++++++++++++++--
 drivers/event/dpaa2/dpaa2_eventdev.h |  3 +-
 3 files changed, 73 insertions(+), 7 deletions(-)

diff --git a/drivers/event/dpaa2/Makefile b/drivers/event/dpaa2/Makefile
index c6ab326da..c4019d688 100644
--- a/drivers/event/dpaa2/Makefile
+++ b/drivers/event/dpaa2/Makefile
@@ -20,7 +20,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/event/dpaa2
 LDLIBS += -lrte_eal -lrte_eventdev
 LDLIBS += -lrte_common_dpaax
 LDLIBS += -lrte_bus_fslmc -lrte_mempool_dpaa2 -lrte_pmd_dpaa2
-LDLIBS += -lrte_bus_vdev -lrte_mempool -lrte_mbuf
+LDLIBS += -lrte_bus_vdev -lrte_mempool -lrte_mbuf -lrte_ethdev
 CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2
 CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2/mc
 
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
index 56cea5f90..4ee2c460e 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.c
+++ b/drivers/event/dpaa2/dpaa2_eventdev.c
@@ -27,6 +27,7 @@
 #include <rte_ethdev_driver.h>
 #include <rte_cryptodev.h>
 #include <rte_event_eth_rx_adapter.h>
+#include <rte_event_eth_tx_adapter.h>
 
 #include <fslmc_vfio.h>
 #include <dpaa2_hw_pvt.h>
@@ -947,6 +948,66 @@ dpaa2_eventdev_crypto_stop(const struct rte_eventdev *dev,
 	return 0;
 }
 
+static int
+dpaa2_eventdev_tx_adapter_create(uint8_t id,
+				 const struct rte_eventdev *dev)
+{
+	RTE_SET_USED(id);
+	RTE_SET_USED(dev);
+
+	/* Nothing to do. Simply return. */
+	return 0;
+}
+
+static int
+dpaa2_eventdev_tx_adapter_caps(const struct rte_eventdev *dev,
+			       const struct rte_eth_dev *eth_dev,
+			       uint32_t *caps)
+{
+	RTE_SET_USED(dev);
+	RTE_SET_USED(eth_dev);
+
+	*caps = RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT;
+	return 0;
+}
+
+static uint16_t
+dpaa2_eventdev_txa_enqueue_same_dest(void *port,
+				     struct rte_event ev[],
+				     uint16_t nb_events)
+{
+	struct rte_mbuf *m[DPAA2_EVENT_MAX_PORT_ENQUEUE_DEPTH], *m0;
+	uint8_t qid, i;
+
+	RTE_SET_USED(port);
+
+	m0 = (struct rte_mbuf *)ev[0].mbuf;
+	qid = rte_event_eth_tx_adapter_txq_get(m0);
+
+	for (i = 0; i < nb_events; i++)
+		m[i] = (struct rte_mbuf *)ev[i].mbuf;
+
+	return rte_eth_tx_burst(m0->port, qid, m, nb_events);
+}
+
+static uint16_t
+dpaa2_eventdev_txa_enqueue(void *port,
+			   struct rte_event ev[],
+			   uint16_t nb_events)
+{
+	struct rte_mbuf *m = (struct rte_mbuf *)ev[0].mbuf;
+	uint8_t qid, i;
+
+	RTE_SET_USED(port);
+
+	for (i = 0; i < nb_events; i++) {
+		qid = rte_event_eth_tx_adapter_txq_get(m);
+		rte_eth_tx_burst(m->port, qid, &m, 1);
+	}
+
+	return nb_events;
+}
+
 static struct rte_eventdev_ops dpaa2_eventdev_ops = {
 	.dev_infos_get    = dpaa2_eventdev_info_get,
 	.dev_configure    = dpaa2_eventdev_configure,
@@ -964,11 +1025,13 @@ static struct rte_eventdev_ops dpaa2_eventdev_ops = {
 	.timeout_ticks    = dpaa2_eventdev_timeout_ticks,
 	.dump             = dpaa2_eventdev_dump,
 	.dev_selftest     = test_eventdev_dpaa2,
-	.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,
+	.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,
+	.eth_tx_adapter_caps_get	= dpaa2_eventdev_tx_adapter_caps,
+	.eth_tx_adapter_create		= dpaa2_eventdev_tx_adapter_create,
 	.crypto_adapter_caps_get	= dpaa2_eventdev_crypto_caps_get,
 	.crypto_adapter_queue_pair_add	= dpaa2_eventdev_crypto_queue_add,
 	.crypto_adapter_queue_pair_del	= dpaa2_eventdev_crypto_queue_del,
@@ -1035,6 +1098,8 @@ dpaa2_eventdev_create(const char *name)
 	eventdev->enqueue_forward_burst = dpaa2_eventdev_enqueue_burst;
 	eventdev->dequeue       = dpaa2_eventdev_dequeue;
 	eventdev->dequeue_burst = dpaa2_eventdev_dequeue_burst;
+	eventdev->txa_enqueue	= dpaa2_eventdev_txa_enqueue;
+	eventdev->txa_enqueue_same_dest	= dpaa2_eventdev_txa_enqueue_same_dest;
 
 	/* For secondary processes, the primary has done all the work */
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
diff --git a/drivers/event/dpaa2/dpaa2_eventdev.h b/drivers/event/dpaa2/dpaa2_eventdev.h
index 7c5d00550..785e52032 100644
--- a/drivers/event/dpaa2/dpaa2_eventdev.h
+++ b/drivers/event/dpaa2/dpaa2_eventdev.h
@@ -38,7 +38,8 @@ enum {
 #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)
+		RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID | \
+		RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)
 
 /**< Crypto Rx adapter cap to return If the packet transfers from
  * the cryptodev to eventdev with DPAA2 devices.
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH 1/2 v2] event/dpaa2: set priority as per the dpcon device
  2019-10-17  8:29 ` [dpdk-dev] [PATCH 1/2 v2] " Nipun Gupta
  2019-10-17  8:29   ` [dpdk-dev] [PATCH 2/2 v2] event/dpaa2: support Tx adapter Nipun Gupta
@ 2019-10-17  8:47   ` Nipun Gupta
  2019-10-18  6:21     ` Jerin Jacob
  1 sibling, 1 reply; 10+ messages in thread
From: Nipun Gupta @ 2019-10-17  8:47 UTC (permalink / raw)
  To: dev; +Cc: jerinj, Hemant Agrawal

Forgot to add in patch:

Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

> -----Original Message-----
> From: Nipun Gupta <nipun.gupta@nxp.com>
> Sent: Thursday, October 17, 2019 1:59 PM
> To: dev@dpdk.org
> Cc: jerinj@marvell.com; Hemant Agrawal <hemant.agrawal@nxp.com>;
> Nipun Gupta <nipun.gupta@nxp.com>
> Subject: [PATCH 1/2 v2] event/dpaa2: set priority as per the dpcon device
> 
> This patch sets the priority of the dpcon dev, such that it is
> within the supported range of dpcon
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>  drivers/bus/fslmc/portal/dpaa2_hw_pvt.h     | 11 +++++++++++
>  drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 10 +++++++---
>  drivers/crypto/dpaa2_sec/dpaa2_sec_event.h  |  2 +-
>  drivers/event/dpaa2/dpaa2_eventdev.c        | 17 ++++++++---------
>  drivers/event/dpaa2/dpaa2_eventdev.h        | 11 -----------
>  drivers/net/dpaa2/dpaa2_ethdev.c            | 11 +++++++----
>  drivers/net/dpaa2/dpaa2_ethdev.h            |  2 +-
>  7 files changed, 35 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
> b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
> index 5087f68c6..db6dad544 100644
> --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
> @@ -185,6 +185,17 @@ struct dpaa2_dpci_dev {
>  	struct dpaa2_queue tx_queue[DPAA2_DPCI_MAX_QUEUES];
>  };
> 
> +struct dpaa2_dpcon_dev {
> +	TAILQ_ENTRY(dpaa2_dpcon_dev) next;
> +	struct fsl_mc_io dpcon;
> +	uint16_t token;
> +	rte_atomic16_t in_use;
> +	uint32_t dpcon_id;
> +	uint16_t qbman_ch_id;
> +	uint8_t num_priorities;
> +	uint8_t channel_index;
> +};
> +
>  /*! Global MCP list */
>  extern void *(*rte_mcp_ptr_list);
> 
> diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> index 2ab34a00f..5db3f9540 100644
> --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> @@ -3487,13 +3487,14 @@ dpaa2_sec_process_atomic_event(struct
> qbman_swp *swp __attribute__((unused)),
>  int
>  dpaa2_sec_eventq_attach(const struct rte_cryptodev *dev,
>  		int qp_id,
> -		uint16_t dpcon_id,
> +		struct dpaa2_dpcon_dev *dpcon,
>  		const struct rte_event *event)
>  {
>  	struct dpaa2_sec_dev_private *priv = dev->data->dev_private;
>  	struct fsl_mc_io *dpseci = (struct fsl_mc_io *)priv->hw;
>  	struct dpaa2_sec_qp *qp = dev->data->queue_pairs[qp_id];
>  	struct dpseci_rx_queue_cfg cfg;
> +	uint8_t priority;
>  	int ret;
> 
>  	if (event->sched_type == RTE_SCHED_TYPE_PARALLEL)
> @@ -3503,11 +3504,14 @@ dpaa2_sec_eventq_attach(const struct
> rte_cryptodev *dev,
>  	else
>  		return -EINVAL;
> 
> +	priority = (RTE_EVENT_DEV_PRIORITY_LOWEST / event->priority) *
> +		   (dpcon->num_priorities - 1);
> +
>  	memset(&cfg, 0, sizeof(struct dpseci_rx_queue_cfg));
>  	cfg.options = DPSECI_QUEUE_OPT_DEST;
>  	cfg.dest_cfg.dest_type = DPSECI_DEST_DPCON;
> -	cfg.dest_cfg.dest_id = dpcon_id;
> -	cfg.dest_cfg.priority = event->priority;
> +	cfg.dest_cfg.dest_id = dpcon->dpcon_id;
> +	cfg.dest_cfg.priority = priority;
> 
>  	cfg.options |= DPSECI_QUEUE_OPT_USER_CTX;
>  	cfg.user_ctx = (size_t)(qp);
> diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_event.h
> b/drivers/crypto/dpaa2_sec/dpaa2_sec_event.h
> index 977099429..c779d5d83 100644
> --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_event.h
> +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_event.h
> @@ -9,7 +9,7 @@
>  int
>  dpaa2_sec_eventq_attach(const struct rte_cryptodev *dev,
>  		int qp_id,
> -		uint16_t dpcon_id,
> +		struct dpaa2_dpcon_dev *dpcon,
>  		const struct rte_event *event);
> 
>  int dpaa2_sec_eventq_detach(const struct rte_cryptodev *dev,
> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c
> b/drivers/event/dpaa2/dpaa2_eventdev.c
> index 5249d2fe4..56cea5f90 100644
> --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> @@ -688,14 +688,14 @@ dpaa2_eventdev_eth_queue_add_all(const struct
> rte_eventdev *dev,
>  {
>  	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;
> +	struct dpaa2_dpcon_dev *dpcon = priv->evq_info[ev_qid].dpcon;
>  	int i, ret;
> 
>  	EVENTDEV_INIT_FUNC_TRACE();
> 
>  	for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
>  		ret = dpaa2_eth_eventq_attach(eth_dev, i,
> -				dpcon_id, queue_conf);
> +					      dpcon, queue_conf);
>  		if (ret) {
>  			DPAA2_EVENTDEV_ERR(
>  				"Event queue attach failed: err(%d)", ret);
> @@ -718,7 +718,7 @@ dpaa2_eventdev_eth_queue_add(const struct
> rte_eventdev *dev,
>  {
>  	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;
> +	struct dpaa2_dpcon_dev *dpcon = priv->evq_info[ev_qid].dpcon;
>  	int ret;
> 
>  	EVENTDEV_INIT_FUNC_TRACE();
> @@ -728,7 +728,7 @@ dpaa2_eventdev_eth_queue_add(const struct
> rte_eventdev *dev,
>  				eth_dev, queue_conf);
> 
>  	ret = dpaa2_eth_eventq_attach(eth_dev, rx_queue_id,
> -			dpcon_id, queue_conf);
> +				      dpcon, queue_conf);
>  	if (ret) {
>  		DPAA2_EVENTDEV_ERR(
>  			"Event queue attach failed: err(%d)", ret);
> @@ -831,14 +831,13 @@ dpaa2_eventdev_crypto_queue_add_all(const
> struct rte_eventdev *dev,
>  {
>  	struct dpaa2_eventdev *priv = dev->data->dev_private;
>  	uint8_t ev_qid = ev->queue_id;
> -	uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
> +	struct dpaa2_dpcon_dev *dpcon = priv->evq_info[ev_qid].dpcon;
>  	int i, ret;
> 
>  	EVENTDEV_INIT_FUNC_TRACE();
> 
>  	for (i = 0; i < cryptodev->data->nb_queue_pairs; i++) {
> -		ret = dpaa2_sec_eventq_attach(cryptodev, i,
> -				dpcon_id, ev);
> +		ret = dpaa2_sec_eventq_attach(cryptodev, i, dpcon, ev);
>  		if (ret) {
>  			DPAA2_EVENTDEV_ERR("dpaa2_sec_eventq_attach
> failed: ret %d\n",
>  				    ret);
> @@ -861,7 +860,7 @@ dpaa2_eventdev_crypto_queue_add(const struct
> rte_eventdev *dev,
>  {
>  	struct dpaa2_eventdev *priv = dev->data->dev_private;
>  	uint8_t ev_qid = ev->queue_id;
> -	uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
> +	struct dpaa2_dpcon_dev *dpcon = priv->evq_info[ev_qid].dpcon;
>  	int ret;
> 
>  	EVENTDEV_INIT_FUNC_TRACE();
> @@ -871,7 +870,7 @@ dpaa2_eventdev_crypto_queue_add(const struct
> rte_eventdev *dev,
>  				cryptodev, ev);
> 
>  	ret = dpaa2_sec_eventq_attach(cryptodev, rx_queue_id,
> -			dpcon_id, ev);
> +				      dpcon, ev);
>  	if (ret) {
>  		DPAA2_EVENTDEV_ERR(
>  			"dpaa2_sec_eventq_attach failed: ret: %d\n", ret);
> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.h
> b/drivers/event/dpaa2/dpaa2_eventdev.h
> index abc038e49..7c5d00550 100644
> --- a/drivers/event/dpaa2/dpaa2_eventdev.h
> +++ b/drivers/event/dpaa2/dpaa2_eventdev.h
> @@ -52,17 +52,6 @@ enum {
>   * the ethdev to eventdev with DPAA2 devices.
>   */
> 
> -struct dpaa2_dpcon_dev {
> -	TAILQ_ENTRY(dpaa2_dpcon_dev) next;
> -	struct fsl_mc_io dpcon;
> -	uint16_t token;
> -	rte_atomic16_t in_use;
> -	uint32_t dpcon_id;
> -	uint16_t qbman_ch_id;
> -	uint8_t num_priorities;
> -	uint8_t channel_index;
> -};
> -
>  struct dpaa2_eventq {
>  	/* DPcon device */
>  	struct dpaa2_dpcon_dev *dpcon;
> diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c
> b/drivers/net/dpaa2/dpaa2_ethdev.c
> index 848bb421e..d241643d8 100644
> --- a/drivers/net/dpaa2/dpaa2_ethdev.c
> +++ b/drivers/net/dpaa2/dpaa2_ethdev.c
> @@ -2006,7 +2006,7 @@ dpaa2_dev_rss_hash_conf_get(struct rte_eth_dev
> *dev,
> 
>  int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
>  		int eth_rx_queue_id,
> -		uint16_t dpcon_id,
> +		struct dpaa2_dpcon_dev *dpcon,
>  		const struct rte_event_eth_rx_adapter_queue_conf
> *queue_conf)
>  {
>  	struct dpaa2_dev_priv *eth_priv = dev->data->dev_private;
> @@ -2014,7 +2014,7 @@ int dpaa2_eth_eventq_attach(const struct
> rte_eth_dev *dev,
>  	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;
> +	uint8_t options, priority;
>  	int ret;
> 
>  	if (queue_conf->ev.sched_type == RTE_SCHED_TYPE_PARALLEL)
> @@ -2026,11 +2026,14 @@ int dpaa2_eth_eventq_attach(const struct
> rte_eth_dev *dev,
>  	else
>  		return -EINVAL;
> 
> +	priority = (RTE_EVENT_DEV_PRIORITY_LOWEST / queue_conf-
> >ev.priority) *
> +		   (dpcon->num_priorities - 1);
> +
>  	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;
> +	cfg.destination.id = dpcon->dpcon_id;
> +	cfg.destination.priority = priority;
> 
>  	if (queue_conf->ev.sched_type == RTE_SCHED_TYPE_ATOMIC) {
>  		options |= DPNI_QUEUE_OPT_HOLD_ACTIVE;
> diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h
> b/drivers/net/dpaa2/dpaa2_ethdev.h
> index 823f9e97c..95674b26b 100644
> --- a/drivers/net/dpaa2/dpaa2_ethdev.h
> +++ b/drivers/net/dpaa2/dpaa2_ethdev.h
> @@ -164,7 +164,7 @@ 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,
> +		struct dpaa2_dpcon_dev *dpcon,
>  		const struct rte_event_eth_rx_adapter_queue_conf
> *queue_conf);
> 
>  int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
> --
> 2.17.1


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

* Re: [dpdk-dev] [PATCH 2/2 v2] event/dpaa2: support Tx adapter
  2019-10-17  8:29   ` [dpdk-dev] [PATCH 2/2 v2] event/dpaa2: support Tx adapter Nipun Gupta
@ 2019-10-17  8:47     ` Nipun Gupta
  0 siblings, 0 replies; 10+ messages in thread
From: Nipun Gupta @ 2019-10-17  8:47 UTC (permalink / raw)
  To: dev; +Cc: jerinj, Hemant Agrawal

Forgot to add in patch:

Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

> -----Original Message-----
> From: Nipun Gupta <nipun.gupta@nxp.com>
> Sent: Thursday, October 17, 2019 1:59 PM
> To: dev@dpdk.org
> Cc: jerinj@marvell.com; Hemant Agrawal <hemant.agrawal@nxp.com>;
> Nipun Gupta <nipun.gupta@nxp.com>
> Subject: [PATCH 2/2 v2] event/dpaa2: support Tx adapter
> 
> This patch adds the support of Tx adapter for DPAA2 platform
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
> 
> Changes in v2:
>  - Fix build with RTE_LIBRTE_ETHDEV_DEBUG enabled
> 
>  drivers/event/dpaa2/Makefile         |  2 +-
>  drivers/event/dpaa2/dpaa2_eventdev.c | 75
> ++++++++++++++++++++++++++--
>  drivers/event/dpaa2/dpaa2_eventdev.h |  3 +-
>  3 files changed, 73 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/event/dpaa2/Makefile b/drivers/event/dpaa2/Makefile
> index c6ab326da..c4019d688 100644
> --- a/drivers/event/dpaa2/Makefile
> +++ b/drivers/event/dpaa2/Makefile
> @@ -20,7 +20,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/event/dpaa2
>  LDLIBS += -lrte_eal -lrte_eventdev
>  LDLIBS += -lrte_common_dpaax
>  LDLIBS += -lrte_bus_fslmc -lrte_mempool_dpaa2 -lrte_pmd_dpaa2
> -LDLIBS += -lrte_bus_vdev -lrte_mempool -lrte_mbuf
> +LDLIBS += -lrte_bus_vdev -lrte_mempool -lrte_mbuf -lrte_ethdev
>  CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2
>  CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2/mc
> 
> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c
> b/drivers/event/dpaa2/dpaa2_eventdev.c
> index 56cea5f90..4ee2c460e 100644
> --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> @@ -27,6 +27,7 @@
>  #include <rte_ethdev_driver.h>
>  #include <rte_cryptodev.h>
>  #include <rte_event_eth_rx_adapter.h>
> +#include <rte_event_eth_tx_adapter.h>
> 
>  #include <fslmc_vfio.h>
>  #include <dpaa2_hw_pvt.h>
> @@ -947,6 +948,66 @@ dpaa2_eventdev_crypto_stop(const struct
> rte_eventdev *dev,
>  	return 0;
>  }
> 
> +static int
> +dpaa2_eventdev_tx_adapter_create(uint8_t id,
> +				 const struct rte_eventdev *dev)
> +{
> +	RTE_SET_USED(id);
> +	RTE_SET_USED(dev);
> +
> +	/* Nothing to do. Simply return. */
> +	return 0;
> +}
> +
> +static int
> +dpaa2_eventdev_tx_adapter_caps(const struct rte_eventdev *dev,
> +			       const struct rte_eth_dev *eth_dev,
> +			       uint32_t *caps)
> +{
> +	RTE_SET_USED(dev);
> +	RTE_SET_USED(eth_dev);
> +
> +	*caps = RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT;
> +	return 0;
> +}
> +
> +static uint16_t
> +dpaa2_eventdev_txa_enqueue_same_dest(void *port,
> +				     struct rte_event ev[],
> +				     uint16_t nb_events)
> +{
> +	struct rte_mbuf *m[DPAA2_EVENT_MAX_PORT_ENQUEUE_DEPTH],
> *m0;
> +	uint8_t qid, i;
> +
> +	RTE_SET_USED(port);
> +
> +	m0 = (struct rte_mbuf *)ev[0].mbuf;
> +	qid = rte_event_eth_tx_adapter_txq_get(m0);
> +
> +	for (i = 0; i < nb_events; i++)
> +		m[i] = (struct rte_mbuf *)ev[i].mbuf;
> +
> +	return rte_eth_tx_burst(m0->port, qid, m, nb_events);
> +}
> +
> +static uint16_t
> +dpaa2_eventdev_txa_enqueue(void *port,
> +			   struct rte_event ev[],
> +			   uint16_t nb_events)
> +{
> +	struct rte_mbuf *m = (struct rte_mbuf *)ev[0].mbuf;
> +	uint8_t qid, i;
> +
> +	RTE_SET_USED(port);
> +
> +	for (i = 0; i < nb_events; i++) {
> +		qid = rte_event_eth_tx_adapter_txq_get(m);
> +		rte_eth_tx_burst(m->port, qid, &m, 1);
> +	}
> +
> +	return nb_events;
> +}
> +
>  static struct rte_eventdev_ops dpaa2_eventdev_ops = {
>  	.dev_infos_get    = dpaa2_eventdev_info_get,
>  	.dev_configure    = dpaa2_eventdev_configure,
> @@ -964,11 +1025,13 @@ static struct rte_eventdev_ops
> dpaa2_eventdev_ops = {
>  	.timeout_ticks    = dpaa2_eventdev_timeout_ticks,
>  	.dump             = dpaa2_eventdev_dump,
>  	.dev_selftest     = test_eventdev_dpaa2,
> -	.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,
> +	.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,
> +	.eth_tx_adapter_caps_get	= dpaa2_eventdev_tx_adapter_caps,
> +	.eth_tx_adapter_create		=
> dpaa2_eventdev_tx_adapter_create,
>  	.crypto_adapter_caps_get	= dpaa2_eventdev_crypto_caps_get,
>  	.crypto_adapter_queue_pair_add	=
> dpaa2_eventdev_crypto_queue_add,
>  	.crypto_adapter_queue_pair_del	=
> dpaa2_eventdev_crypto_queue_del,
> @@ -1035,6 +1098,8 @@ dpaa2_eventdev_create(const char *name)
>  	eventdev->enqueue_forward_burst =
> dpaa2_eventdev_enqueue_burst;
>  	eventdev->dequeue       = dpaa2_eventdev_dequeue;
>  	eventdev->dequeue_burst = dpaa2_eventdev_dequeue_burst;
> +	eventdev->txa_enqueue	= dpaa2_eventdev_txa_enqueue;
> +	eventdev->txa_enqueue_same_dest	=
> dpaa2_eventdev_txa_enqueue_same_dest;
> 
>  	/* For secondary processes, the primary has done all the work */
>  	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.h
> b/drivers/event/dpaa2/dpaa2_eventdev.h
> index 7c5d00550..785e52032 100644
> --- a/drivers/event/dpaa2/dpaa2_eventdev.h
> +++ b/drivers/event/dpaa2/dpaa2_eventdev.h
> @@ -38,7 +38,8 @@ enum {
>  #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)
> +		RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID |
> \
> +		RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)
> 
>  /**< Crypto Rx adapter cap to return If the packet transfers from
>   * the cryptodev to eventdev with DPAA2 devices.
> --
> 2.17.1


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

* Re: [dpdk-dev] [PATCH 1/2 v2] event/dpaa2: set priority as per the dpcon device
  2019-10-17  8:47   ` [dpdk-dev] [PATCH 1/2 v2] event/dpaa2: set priority as per the dpcon device Nipun Gupta
@ 2019-10-18  6:21     ` Jerin Jacob
  0 siblings, 0 replies; 10+ messages in thread
From: Jerin Jacob @ 2019-10-18  6:21 UTC (permalink / raw)
  To: Nipun Gupta; +Cc: dev, jerinj, Hemant Agrawal

On Thu, Oct 17, 2019 at 2:17 PM Nipun Gupta <nipun.gupta@nxp.com> wrote:
>
> Forgot to add in patch:
>
> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>


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

>
> > -----Original Message-----
> > From: Nipun Gupta <nipun.gupta@nxp.com>
> > Sent: Thursday, October 17, 2019 1:59 PM
> > To: dev@dpdk.org
> > Cc: jerinj@marvell.com; Hemant Agrawal <hemant.agrawal@nxp.com>;
> > Nipun Gupta <nipun.gupta@nxp.com>
> > Subject: [PATCH 1/2 v2] event/dpaa2: set priority as per the dpcon device
> >
> > This patch sets the priority of the dpcon dev, such that it is
> > within the supported range of dpcon
> >
> > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > ---
> >  drivers/bus/fslmc/portal/dpaa2_hw_pvt.h     | 11 +++++++++++
> >  drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 10 +++++++---
> >  drivers/crypto/dpaa2_sec/dpaa2_sec_event.h  |  2 +-
> >  drivers/event/dpaa2/dpaa2_eventdev.c        | 17 ++++++++---------
> >  drivers/event/dpaa2/dpaa2_eventdev.h        | 11 -----------
> >  drivers/net/dpaa2/dpaa2_ethdev.c            | 11 +++++++----
> >  drivers/net/dpaa2/dpaa2_ethdev.h            |  2 +-
> >  7 files changed, 35 insertions(+), 29 deletions(-)
> >
> > diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
> > b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
> > index 5087f68c6..db6dad544 100644
> > --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
> > +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
> > @@ -185,6 +185,17 @@ struct dpaa2_dpci_dev {
> >       struct dpaa2_queue tx_queue[DPAA2_DPCI_MAX_QUEUES];
> >  };
> >
> > +struct dpaa2_dpcon_dev {
> > +     TAILQ_ENTRY(dpaa2_dpcon_dev) next;
> > +     struct fsl_mc_io dpcon;
> > +     uint16_t token;
> > +     rte_atomic16_t in_use;
> > +     uint32_t dpcon_id;
> > +     uint16_t qbman_ch_id;
> > +     uint8_t num_priorities;
> > +     uint8_t channel_index;
> > +};
> > +
> >  /*! Global MCP list */
> >  extern void *(*rte_mcp_ptr_list);
> >
> > diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> > b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> > index 2ab34a00f..5db3f9540 100644
> > --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> > +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> > @@ -3487,13 +3487,14 @@ dpaa2_sec_process_atomic_event(struct
> > qbman_swp *swp __attribute__((unused)),
> >  int
> >  dpaa2_sec_eventq_attach(const struct rte_cryptodev *dev,
> >               int qp_id,
> > -             uint16_t dpcon_id,
> > +             struct dpaa2_dpcon_dev *dpcon,
> >               const struct rte_event *event)
> >  {
> >       struct dpaa2_sec_dev_private *priv = dev->data->dev_private;
> >       struct fsl_mc_io *dpseci = (struct fsl_mc_io *)priv->hw;
> >       struct dpaa2_sec_qp *qp = dev->data->queue_pairs[qp_id];
> >       struct dpseci_rx_queue_cfg cfg;
> > +     uint8_t priority;
> >       int ret;
> >
> >       if (event->sched_type == RTE_SCHED_TYPE_PARALLEL)
> > @@ -3503,11 +3504,14 @@ dpaa2_sec_eventq_attach(const struct
> > rte_cryptodev *dev,
> >       else
> >               return -EINVAL;
> >
> > +     priority = (RTE_EVENT_DEV_PRIORITY_LOWEST / event->priority) *
> > +                (dpcon->num_priorities - 1);
> > +
> >       memset(&cfg, 0, sizeof(struct dpseci_rx_queue_cfg));
> >       cfg.options = DPSECI_QUEUE_OPT_DEST;
> >       cfg.dest_cfg.dest_type = DPSECI_DEST_DPCON;
> > -     cfg.dest_cfg.dest_id = dpcon_id;
> > -     cfg.dest_cfg.priority = event->priority;
> > +     cfg.dest_cfg.dest_id = dpcon->dpcon_id;
> > +     cfg.dest_cfg.priority = priority;
> >
> >       cfg.options |= DPSECI_QUEUE_OPT_USER_CTX;
> >       cfg.user_ctx = (size_t)(qp);
> > diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_event.h
> > b/drivers/crypto/dpaa2_sec/dpaa2_sec_event.h
> > index 977099429..c779d5d83 100644
> > --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_event.h
> > +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_event.h
> > @@ -9,7 +9,7 @@
> >  int
> >  dpaa2_sec_eventq_attach(const struct rte_cryptodev *dev,
> >               int qp_id,
> > -             uint16_t dpcon_id,
> > +             struct dpaa2_dpcon_dev *dpcon,
> >               const struct rte_event *event);
> >
> >  int dpaa2_sec_eventq_detach(const struct rte_cryptodev *dev,
> > diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c
> > b/drivers/event/dpaa2/dpaa2_eventdev.c
> > index 5249d2fe4..56cea5f90 100644
> > --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> > +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> > @@ -688,14 +688,14 @@ dpaa2_eventdev_eth_queue_add_all(const struct
> > rte_eventdev *dev,
> >  {
> >       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;
> > +     struct dpaa2_dpcon_dev *dpcon = priv->evq_info[ev_qid].dpcon;
> >       int i, ret;
> >
> >       EVENTDEV_INIT_FUNC_TRACE();
> >
> >       for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
> >               ret = dpaa2_eth_eventq_attach(eth_dev, i,
> > -                             dpcon_id, queue_conf);
> > +                                           dpcon, queue_conf);
> >               if (ret) {
> >                       DPAA2_EVENTDEV_ERR(
> >                               "Event queue attach failed: err(%d)", ret);
> > @@ -718,7 +718,7 @@ dpaa2_eventdev_eth_queue_add(const struct
> > rte_eventdev *dev,
> >  {
> >       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;
> > +     struct dpaa2_dpcon_dev *dpcon = priv->evq_info[ev_qid].dpcon;
> >       int ret;
> >
> >       EVENTDEV_INIT_FUNC_TRACE();
> > @@ -728,7 +728,7 @@ dpaa2_eventdev_eth_queue_add(const struct
> > rte_eventdev *dev,
> >                               eth_dev, queue_conf);
> >
> >       ret = dpaa2_eth_eventq_attach(eth_dev, rx_queue_id,
> > -                     dpcon_id, queue_conf);
> > +                                   dpcon, queue_conf);
> >       if (ret) {
> >               DPAA2_EVENTDEV_ERR(
> >                       "Event queue attach failed: err(%d)", ret);
> > @@ -831,14 +831,13 @@ dpaa2_eventdev_crypto_queue_add_all(const
> > struct rte_eventdev *dev,
> >  {
> >       struct dpaa2_eventdev *priv = dev->data->dev_private;
> >       uint8_t ev_qid = ev->queue_id;
> > -     uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
> > +     struct dpaa2_dpcon_dev *dpcon = priv->evq_info[ev_qid].dpcon;
> >       int i, ret;
> >
> >       EVENTDEV_INIT_FUNC_TRACE();
> >
> >       for (i = 0; i < cryptodev->data->nb_queue_pairs; i++) {
> > -             ret = dpaa2_sec_eventq_attach(cryptodev, i,
> > -                             dpcon_id, ev);
> > +             ret = dpaa2_sec_eventq_attach(cryptodev, i, dpcon, ev);
> >               if (ret) {
> >                       DPAA2_EVENTDEV_ERR("dpaa2_sec_eventq_attach
> > failed: ret %d\n",
> >                                   ret);
> > @@ -861,7 +860,7 @@ dpaa2_eventdev_crypto_queue_add(const struct
> > rte_eventdev *dev,
> >  {
> >       struct dpaa2_eventdev *priv = dev->data->dev_private;
> >       uint8_t ev_qid = ev->queue_id;
> > -     uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
> > +     struct dpaa2_dpcon_dev *dpcon = priv->evq_info[ev_qid].dpcon;
> >       int ret;
> >
> >       EVENTDEV_INIT_FUNC_TRACE();
> > @@ -871,7 +870,7 @@ dpaa2_eventdev_crypto_queue_add(const struct
> > rte_eventdev *dev,
> >                               cryptodev, ev);
> >
> >       ret = dpaa2_sec_eventq_attach(cryptodev, rx_queue_id,
> > -                     dpcon_id, ev);
> > +                                   dpcon, ev);
> >       if (ret) {
> >               DPAA2_EVENTDEV_ERR(
> >                       "dpaa2_sec_eventq_attach failed: ret: %d\n", ret);
> > diff --git a/drivers/event/dpaa2/dpaa2_eventdev.h
> > b/drivers/event/dpaa2/dpaa2_eventdev.h
> > index abc038e49..7c5d00550 100644
> > --- a/drivers/event/dpaa2/dpaa2_eventdev.h
> > +++ b/drivers/event/dpaa2/dpaa2_eventdev.h
> > @@ -52,17 +52,6 @@ enum {
> >   * the ethdev to eventdev with DPAA2 devices.
> >   */
> >
> > -struct dpaa2_dpcon_dev {
> > -     TAILQ_ENTRY(dpaa2_dpcon_dev) next;
> > -     struct fsl_mc_io dpcon;
> > -     uint16_t token;
> > -     rte_atomic16_t in_use;
> > -     uint32_t dpcon_id;
> > -     uint16_t qbman_ch_id;
> > -     uint8_t num_priorities;
> > -     uint8_t channel_index;
> > -};
> > -
> >  struct dpaa2_eventq {
> >       /* DPcon device */
> >       struct dpaa2_dpcon_dev *dpcon;
> > diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c
> > b/drivers/net/dpaa2/dpaa2_ethdev.c
> > index 848bb421e..d241643d8 100644
> > --- a/drivers/net/dpaa2/dpaa2_ethdev.c
> > +++ b/drivers/net/dpaa2/dpaa2_ethdev.c
> > @@ -2006,7 +2006,7 @@ dpaa2_dev_rss_hash_conf_get(struct rte_eth_dev
> > *dev,
> >
> >  int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
> >               int eth_rx_queue_id,
> > -             uint16_t dpcon_id,
> > +             struct dpaa2_dpcon_dev *dpcon,
> >               const struct rte_event_eth_rx_adapter_queue_conf
> > *queue_conf)
> >  {
> >       struct dpaa2_dev_priv *eth_priv = dev->data->dev_private;
> > @@ -2014,7 +2014,7 @@ int dpaa2_eth_eventq_attach(const struct
> > rte_eth_dev *dev,
> >       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;
> > +     uint8_t options, priority;
> >       int ret;
> >
> >       if (queue_conf->ev.sched_type == RTE_SCHED_TYPE_PARALLEL)
> > @@ -2026,11 +2026,14 @@ int dpaa2_eth_eventq_attach(const struct
> > rte_eth_dev *dev,
> >       else
> >               return -EINVAL;
> >
> > +     priority = (RTE_EVENT_DEV_PRIORITY_LOWEST / queue_conf-
> > >ev.priority) *
> > +                (dpcon->num_priorities - 1);
> > +
> >       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;
> > +     cfg.destination.id = dpcon->dpcon_id;
> > +     cfg.destination.priority = priority;
> >
> >       if (queue_conf->ev.sched_type == RTE_SCHED_TYPE_ATOMIC) {
> >               options |= DPNI_QUEUE_OPT_HOLD_ACTIVE;
> > diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h
> > b/drivers/net/dpaa2/dpaa2_ethdev.h
> > index 823f9e97c..95674b26b 100644
> > --- a/drivers/net/dpaa2/dpaa2_ethdev.h
> > +++ b/drivers/net/dpaa2/dpaa2_ethdev.h
> > @@ -164,7 +164,7 @@ 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,
> > +             struct dpaa2_dpcon_dev *dpcon,
> >               const struct rte_event_eth_rx_adapter_queue_conf
> > *queue_conf);
> >
> >  int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
> > --
> > 2.17.1
>

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

end of thread, other threads:[~2019-10-18  6:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-04 11:57 [dpdk-dev] [PATCH 1/2] event/dpaa2: set priority as per the dpcon device Nipun Gupta
2019-10-04 11:57 ` [dpdk-dev] [PATCH 2/2] event/dpaa2: support Tx adapter Nipun Gupta
2019-10-10 12:29   ` Hemant Agrawal
2019-10-10 12:29 ` [dpdk-dev] [PATCH 1/2] event/dpaa2: set priority as per the dpcon device Hemant Agrawal
2019-10-16  7:39   ` Jerin Jacob
2019-10-17  8:29 ` [dpdk-dev] [PATCH 1/2 v2] " Nipun Gupta
2019-10-17  8:29   ` [dpdk-dev] [PATCH 2/2 v2] event/dpaa2: support Tx adapter Nipun Gupta
2019-10-17  8:47     ` Nipun Gupta
2019-10-17  8:47   ` [dpdk-dev] [PATCH 1/2 v2] event/dpaa2: set priority as per the dpcon device Nipun Gupta
2019-10-18  6:21     ` 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).