[dpdk-dev] [PATCH v2 07/10] examples/l2fwd-event: add service core setup

pbhagavatula at marvell.com pbhagavatula at marvell.com
Thu Sep 19 11:26:01 CEST 2019


From: Sunil Kumar Kori <skori at marvell.com>

Add service core setup when eventdev and Rx/Tx adapter don't have
internal port capability.

Signed-off-by: Sunil Kumar Kori <skori at marvell.com>
---
 examples/l2fwd-event/l2fwd_eventdev_generic.c | 31 +++++++++++++++++++
 .../l2fwd_eventdev_internal_port.c            |  6 ++++
 examples/l2fwd-event/main.c                   |  2 ++
 3 files changed, 39 insertions(+)

diff --git a/examples/l2fwd-event/l2fwd_eventdev_generic.c b/examples/l2fwd-event/l2fwd_eventdev_generic.c
index 68b63279a..e1e603052 100644
--- a/examples/l2fwd-event/l2fwd_eventdev_generic.c
+++ b/examples/l2fwd-event/l2fwd_eventdev_generic.c
@@ -17,6 +17,36 @@
 #include "l2fwd_common.h"
 #include "l2fwd_eventdev.h"
 
+static void
+eventdev_service_setup_generic(void)
+{
+	struct eventdev_resources *eventdev_rsrc = get_eventdev_rsrc();
+	uint32_t lcore_id[RTE_MAX_LCORE] = {0};
+	int32_t req_service_cores = 3;
+	int32_t avail_service_cores;
+
+	avail_service_cores = rte_service_lcore_list(lcore_id, RTE_MAX_LCORE);
+	if (avail_service_cores < req_service_cores) {
+		rte_exit(EXIT_FAILURE, "Enough services cores are not present"
+			 " Required = %d Available = %d",
+			 req_service_cores, avail_service_cores);
+	}
+
+	/* Start eventdev scheduler service */
+	rte_service_map_lcore_set(eventdev_rsrc->service_id, lcore_id[0], 1);
+	rte_service_lcore_start(lcore_id[0]);
+
+	/* Start eventdev Rx adapter service */
+	rte_service_map_lcore_set(eventdev_rsrc->rx_adptr.service_id,
+				  lcore_id[1], 1);
+	rte_service_lcore_start(lcore_id[1]);
+
+	/* Start eventdev Tx adapter service */
+	rte_service_map_lcore_set(eventdev_rsrc->tx_adptr.service_id,
+				  lcore_id[2], 1);
+	rte_service_lcore_start(lcore_id[2]);
+}
+
 static uint32_t
 eventdev_setup_generic(uint16_t ethdev_count)
 {
@@ -315,4 +345,5 @@ eventdev_set_generic_ops(struct eventdev_setup_ops *ops)
 	ops->event_queue_setup = event_queue_setup_generic;
 	ops->event_port_setup = event_port_setup_generic;
 	ops->adapter_setup = rx_tx_adapter_setup_generic;
+	ops->service_setup = eventdev_service_setup_generic;
 }
diff --git a/examples/l2fwd-event/l2fwd_eventdev_internal_port.c b/examples/l2fwd-event/l2fwd_eventdev_internal_port.c
index 02663242f..39fcb4326 100644
--- a/examples/l2fwd-event/l2fwd_eventdev_internal_port.c
+++ b/examples/l2fwd-event/l2fwd_eventdev_internal_port.c
@@ -265,6 +265,11 @@ rx_tx_adapter_setup_internal_port(uint16_t ethdev_count)
 	}
 }
 
+static void
+eventdev_service_setup_internal_port(void)
+{
+}
+
 void
 eventdev_set_internal_port_ops(struct eventdev_setup_ops *ops)
 {
@@ -272,4 +277,5 @@ eventdev_set_internal_port_ops(struct eventdev_setup_ops *ops)
 	ops->event_queue_setup = event_queue_setup_internal_port;
 	ops->event_port_setup = event_port_setup_internal_port;
 	ops->adapter_setup = rx_tx_adapter_setup_internal_port;
+	ops->service_setup = eventdev_service_setup_internal_port;
 }
diff --git a/examples/l2fwd-event/main.c b/examples/l2fwd-event/main.c
index f24bdd4a4..09c86d2cd 100644
--- a/examples/l2fwd-event/main.c
+++ b/examples/l2fwd-event/main.c
@@ -616,6 +616,8 @@ main(int argc, char **argv)
 					 ret, portid);
 		}
 
+		/* Now start internal services */
+		eventdev_rsrc->ops.service_setup();
 		goto skip_port_config;
 	}
 
-- 
2.17.1



More information about the dev mailing list