[RFC,5/5] examples/eventdev_p: add eventdev power management

Message ID 20230419095427.563185-5-sivaprasad.tummala@amd.com (mailing list archive)
State Changes Requested, archived
Delegated to: Jerin Jacob
Headers
Series [RFC,1/5] eventdev: add power monitoring API on event port |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation fail ninja build failure
ci/Intel-compilation fail Compilation issues

Commit Message

Sivaprasad Tummala April 19, 2023, 9:54 a.m. UTC
  From: Sivaprasad Tummala <Sivaprasad.Tummala@amd.com>

Add power management feature support to eventdev_pipeline sample app.

Signed-off-by: Sivaprasad Tummala <Sivaprasad.Tummala@amd.com>
---
 examples/eventdev_pipeline/main.c                 | 15 ++++++++++++++-
 examples/eventdev_pipeline/pipeline_common.h      |  1 +
 .../eventdev_pipeline/pipeline_worker_generic.c   |  1 +
 3 files changed, 16 insertions(+), 1 deletion(-)
  

Patch

diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c
index 8d6c90f15d..bd6d568b78 100644
--- a/examples/eventdev_pipeline/main.c
+++ b/examples/eventdev_pipeline/main.c
@@ -430,7 +430,20 @@  main(int argc, char **argv)
 			continue;
 
 		dump_core_info(lcore_id, worker_data, worker_idx);
-
+		{
+			if (fdata->worker_core[lcore_id]) {
+				err = rte_power_eventdev_pmgmt_port_enable(
+							lcore_id, worker_data[worker_idx].dev_id,
+							worker_data[worker_idx].port_id,
+							RTE_POWER_MGMT_TYPE_MONITOR);
+				if (err) {
+					RTE_LOG(ERR, POWER,
+						"Power Management enabled failed on core %u\n",
+						lcore_id);
+					continue;
+				}
+			}
+		}
 		err = rte_eal_remote_launch(fdata->cap.worker,
 				&worker_data[worker_idx], lcore_id);
 		if (err) {
diff --git a/examples/eventdev_pipeline/pipeline_common.h b/examples/eventdev_pipeline/pipeline_common.h
index 28b6ab85ff..b33162adfb 100644
--- a/examples/eventdev_pipeline/pipeline_common.h
+++ b/examples/eventdev_pipeline/pipeline_common.h
@@ -19,6 +19,7 @@ 
 #include <rte_event_eth_tx_adapter.h>
 #include <rte_service.h>
 #include <rte_service_component.h>
+#include <rte_power_pmd_mgmt.h>
 
 #define MAX_NUM_STAGES 8
 #define BATCH_SIZE 16
diff --git a/examples/eventdev_pipeline/pipeline_worker_generic.c b/examples/eventdev_pipeline/pipeline_worker_generic.c
index 783f68c91e..22d644bd51 100644
--- a/examples/eventdev_pipeline/pipeline_worker_generic.c
+++ b/examples/eventdev_pipeline/pipeline_worker_generic.c
@@ -6,6 +6,7 @@ 
 
 #include <stdlib.h>
 
+#include <rte_power_pmd_mgmt.h>
 #include "pipeline_common.h"
 
 static __rte_always_inline int