diff mbox

[dpdk-dev,v3,7/8] app/eventdev: add service core configuration

Message ID 20171211151346.14405-7-pbhagavatula@caviumnetworks.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply patch file failure

Commit Message

Pavan Nikhilesh Dec. 11, 2017, 3:13 p.m. UTC
Add service core configuration for Rx adapter. The configuration picks
the least used service core to run the service on.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---
 app/test-eventdev/evt_common.h       | 41 ++++++++++++++++--------------------
 app/test-eventdev/test_perf_atq.c    | 12 +++++++----
 app/test-eventdev/test_perf_common.c | 13 ++++++++++++
 app/test-eventdev/test_perf_queue.c  | 12 +++++++----
 4 files changed, 47 insertions(+), 31 deletions(-)

Comments

Van Haaren, Harry Dec. 19, 2017, 10:25 a.m. UTC | #1
> From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com]
<snip>
> Add service core configuration for Rx adapter. The configuration picks
> the least used service core to run the service on.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> ---
>  app/test-eventdev/evt_common.h       | 41 ++++++++++++++++-----------------
> ---
>  app/test-eventdev/test_perf_atq.c    | 12 +++++++----
>  app/test-eventdev/test_perf_common.c | 13 ++++++++++++
>  app/test-eventdev/test_perf_queue.c  | 12 +++++++----
>  4 files changed, 47 insertions(+), 31 deletions(-)
> 
> diff --git a/app/test-eventdev/evt_common.h b/app/test-eventdev/evt_common.h
> index 0fadab4a0..042823a52 100644
> --- a/app/test-eventdev/evt_common.h
> +++ b/app/test-eventdev/evt_common.h
> @@ -94,41 +94,36 @@ evt_has_all_types_queue(uint8_t dev_id)
>  }
> 
>  static inline int
> -evt_service_setup(uint8_t dev_id)
> +evt_service_setup(uint32_t service_id)
>  {
> -	uint32_t service_id;
>  	int32_t core_cnt;
>  	unsigned int lcore = 0;
>  	uint32_t core_array[RTE_MAX_LCORE];
>  	uint8_t cnt;
>  	uint8_t min_cnt = UINT8_MAX;
> 
> -	if (evt_has_distributed_sched(dev_id))
> -		return 0;
> -
>  	if (!rte_service_lcore_count())
>  		return -ENOENT;

See last comment - we can try to get next lcore, and add it as a service core to continue running test?

> 
> -	if (!rte_event_dev_service_id_get(dev_id, &service_id)) {
> -		core_cnt = rte_service_lcore_list(core_array,
> -				RTE_MAX_LCORE);
> -		if (core_cnt < 0)
> -			return -ENOENT;
> -		/* Get the core which has least number of services running. */
> -		while (core_cnt--) {
> -			/* Reset default mapping */

> -			rte_service_map_lcore_set(service_id,
> -					core_array[core_cnt], 0);

Nit: these two can be on the same line

> 
> +		if (!(cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT)) {
> +			uint32_t service_id;
> +
> +			rte_event_eth_rx_adapter_service_id_get(prod,
> +					&service_id);
> +			ret = evt_service_setup(service_id);

> +			if (ret) {
> +				evt_err("Failed to setup service core"
> +						" for Rx adapter\n");

No need to split strings here.


> +	if (!evt_has_distributed_sched(opt->dev_id)) {
> +		uint32_t service_id;
> +		rte_event_dev_service_id_get(opt->dev_id, &service_id);
> +		ret = evt_service_setup(service_id);
> +		if (ret) {
> +			evt_err("No service lcore found to run event dev.");
> +			return ret;

Would it be better to try get next lcore, and add as a service core here? That way we could continue running the test.


With above suggestions;
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
diff mbox

Patch

diff --git a/app/test-eventdev/evt_common.h b/app/test-eventdev/evt_common.h
index 0fadab4a0..042823a52 100644
--- a/app/test-eventdev/evt_common.h
+++ b/app/test-eventdev/evt_common.h
@@ -94,41 +94,36 @@  evt_has_all_types_queue(uint8_t dev_id)
 }
 
 static inline int
-evt_service_setup(uint8_t dev_id)
+evt_service_setup(uint32_t service_id)
 {
-	uint32_t service_id;
 	int32_t core_cnt;
 	unsigned int lcore = 0;
 	uint32_t core_array[RTE_MAX_LCORE];
 	uint8_t cnt;
 	uint8_t min_cnt = UINT8_MAX;
 
-	if (evt_has_distributed_sched(dev_id))
-		return 0;
-
 	if (!rte_service_lcore_count())
 		return -ENOENT;
 
-	if (!rte_event_dev_service_id_get(dev_id, &service_id)) {
-		core_cnt = rte_service_lcore_list(core_array,
-				RTE_MAX_LCORE);
-		if (core_cnt < 0)
-			return -ENOENT;
-		/* Get the core which has least number of services running. */
-		while (core_cnt--) {
-			/* Reset default mapping */
-			rte_service_map_lcore_set(service_id,
-					core_array[core_cnt], 0);
-			cnt = rte_service_lcore_count_services(
-					core_array[core_cnt]);
-			if (cnt < min_cnt) {
-				lcore = core_array[core_cnt];
-				min_cnt = cnt;
-			}
+	core_cnt = rte_service_lcore_list(core_array,
+			RTE_MAX_LCORE);
+	if (core_cnt < 0)
+		return -ENOENT;
+	/* Get the core which has least number of services running. */
+	while (core_cnt--) {
+		/* Reset default mapping */
+		rte_service_map_lcore_set(service_id,
+				core_array[core_cnt], 0);
+		cnt = rte_service_lcore_count_services(
+				core_array[core_cnt]);
+		if (cnt < min_cnt) {
+			lcore = core_array[core_cnt];
+			min_cnt = cnt;
 		}
-		if (rte_service_map_lcore_set(service_id, lcore, 1))
-			return -ENOENT;
 	}
+	if (rte_service_map_lcore_set(service_id, lcore, 1))
+		return -ENOENT;
+
 	return 0;
 }
 
diff --git a/app/test-eventdev/test_perf_atq.c b/app/test-eventdev/test_perf_atq.c
index 1fe16ed63..8ca07d4f8 100644
--- a/app/test-eventdev/test_perf_atq.c
+++ b/app/test-eventdev/test_perf_atq.c
@@ -239,10 +239,14 @@  perf_atq_eventdev_setup(struct evt_test *test, struct evt_options *opt)
 	if (ret)
 		return ret;
 
-	ret = evt_service_setup(opt->dev_id);
-	if (ret) {
-		evt_err("No service lcore found to run event dev.");
-		return ret;
+	if (!evt_has_distributed_sched(opt->dev_id)) {
+		uint32_t service_id;
+		rte_event_dev_service_id_get(opt->dev_id, &service_id);
+		ret = evt_service_setup(service_id);
+		if (ret) {
+			evt_err("No service lcore found to run event dev.");
+			return ret;
+		}
 	}
 
 	ret = rte_event_dev_start(opt->dev_id);
diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
index 1fd7ef8b1..9aff31f20 100644
--- a/app/test-eventdev/test_perf_common.c
+++ b/app/test-eventdev/test_perf_common.c
@@ -267,6 +267,19 @@  perf_event_rx_adapter_setup(struct evt_options *opt, uint8_t stride,
 			return ret;
 		}
 
+		if (!(cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT)) {
+			uint32_t service_id;
+
+			rte_event_eth_rx_adapter_service_id_get(prod,
+					&service_id);
+			ret = evt_service_setup(service_id);
+			if (ret) {
+				evt_err("Failed to setup service core"
+						" for Rx adapter\n");
+				return ret;
+			}
+		}
+
 		ret = rte_eth_dev_start(prod);
 		if (ret) {
 			evt_err("Ethernet dev [%d] failed to start."
diff --git a/app/test-eventdev/test_perf_queue.c b/app/test-eventdev/test_perf_queue.c
index e446c5437..4583122b3 100644
--- a/app/test-eventdev/test_perf_queue.c
+++ b/app/test-eventdev/test_perf_queue.c
@@ -252,10 +252,14 @@  perf_queue_eventdev_setup(struct evt_test *test, struct evt_options *opt)
 	if (ret)
 		return ret;
 
-	ret = evt_service_setup(opt->dev_id);
-	if (ret) {
-		evt_err("No service lcore found to run event dev.");
-		return ret;
+	if (!evt_has_distributed_sched(opt->dev_id)) {
+		uint32_t service_id;
+		rte_event_dev_service_id_get(opt->dev_id, &service_id);
+		ret = evt_service_setup(service_id);
+		if (ret) {
+			evt_err("No service lcore found to run event dev.");
+			return ret;
+		}
 	}
 
 	ret = rte_event_dev_start(opt->dev_id);