From: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
To: <jerinjacobk@gmail.com>, <harry.van.haaren@intel.com>,
<anatoly.burakov@intel.com>
Cc: <dev@dpdk.org>, <ferruh.yigit@amd.com>, <david.hunt@intel.com>
Subject: [PATCH v1 6/6] examples/eventdev_p: add eventdev power management
Date: Mon, 16 Oct 2023 13:57:15 -0700 [thread overview]
Message-ID: <20231016205715.970999-6-sivaprasad.tummala@amd.com> (raw)
In-Reply-To: <20231016205715.970999-1-sivaprasad.tummala@amd.com>
Add power management feature support to eventdev_pipeline sample app.
A new command option "--pmd-mgmt" was added to select power management
mode on worker cores. Options currently supported are "pause/monitor".
Default, no power management features are enabled on the worker ports.
Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
---
.../sample_app_ug/eventdev_pipeline.rst | 3 +-
examples/eventdev_pipeline/main.c | 64 ++++++++++++++++++-
examples/eventdev_pipeline/pipeline_common.h | 1 +
.../pipeline_worker_generic.c | 1 +
4 files changed, 66 insertions(+), 3 deletions(-)
diff --git a/doc/guides/sample_app_ug/eventdev_pipeline.rst b/doc/guides/sample_app_ug/eventdev_pipeline.rst
index 19ff53803e..1186d0af3d 100644
--- a/doc/guides/sample_app_ug/eventdev_pipeline.rst
+++ b/doc/guides/sample_app_ug/eventdev_pipeline.rst
@@ -44,11 +44,12 @@ these settings is shown below:
* ``-c32``: worker dequeue depth of 32
* ``-W1000``: do 1000 cycles of work per packet in each stage
* ``-D``: dump statistics on exit
+ * ``--pmd-mgmt=pause``: worker core power management using pause;
.. code-block:: console
./<build_dir>/examples/dpdk-eventdev_pipeline -l 0,2,8-15 --vdev event_sw0 \
- -- -r1 -t1 -e4 -w FF00 -s4 -n0 -c32 -W1000 -D
+ -- -r1 -t1 -e4 -w FF00 -s4 -n0 -c32 -W1000 -D --pmd-mgmt=pause
The application has some sanity checking built-in, so if there is a function
(e.g.; the RX core) which doesn't have a cpu core mask assigned, the application
diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c
index 0c995d1a70..3bb55054ce 100644
--- a/examples/eventdev_pipeline/main.c
+++ b/examples/eventdev_pipeline/main.c
@@ -24,6 +24,9 @@ struct config_data cdata = {
.worker_cq_depth = 16
};
+static enum rte_power_pmd_mgmt_type pmgmt_mode;
+bool pmgmt_enabled;
+
static void
dump_core_info(unsigned int lcore_id, struct worker_data *data,
unsigned int worker_idx)
@@ -122,6 +125,8 @@ parse_coremask(const char *coremask)
return mask;
}
+#define CMD_LINE_OPT_PMD_MGMT "pmd-mgmt"
+
static struct option long_options[] = {
{"workers", required_argument, 0, 'w'},
{"packets", required_argument, 0, 'n'},
@@ -139,6 +144,7 @@ static struct option long_options[] = {
{"quiet", no_argument, 0, 'q'},
{"use-atq", no_argument, 0, 'a'},
{"dump", no_argument, 0, 'D'},
+ {CMD_LINE_OPT_PMD_MGMT, 1, 0, 0},
{0, 0, 0, 0}
};
@@ -163,12 +169,38 @@ usage(void)
" -q, --quiet Minimize printed output\n"
" -a, --use-atq Use all type queues\n"
" -m, --mempool-size=N Dictate the mempool size\n"
- " -D, --dump Print detailed statistics before exit"
+ " -D, --dump Print detailed statistics before exit\n"
+ " --pmd-mgmt MODE enable PMD power management mode."
"\n";
fprintf(stderr, "%s", usage_str);
exit(1);
}
+static int
+parse_pmd_mgmt_config(const char *name)
+{
+#define PMD_MGMT_MONITOR "monitor"
+#define PMD_MGMT_PAUSE "pause"
+#define PMD_MGMT_SCALE "scale"
+
+ if (strncmp(PMD_MGMT_MONITOR, name, sizeof(PMD_MGMT_MONITOR)) == 0) {
+ pmgmt_mode = RTE_POWER_MGMT_TYPE_MONITOR;
+ return 0;
+ }
+
+ if (strncmp(PMD_MGMT_PAUSE, name, sizeof(PMD_MGMT_PAUSE)) == 0) {
+ pmgmt_mode = RTE_POWER_MGMT_TYPE_PAUSE;
+ return 0;
+ }
+
+ if (strncmp(PMD_MGMT_SCALE, name, sizeof(PMD_MGMT_SCALE)) == 0) {
+ pmgmt_mode = RTE_POWER_MGMT_TYPE_SCALE;
+ return 0;
+ }
+ /* unknown PMD power management mode */
+ return -1;
+}
+
static void
parse_app_args(int argc, char **argv)
{
@@ -246,6 +278,21 @@ parse_app_args(int argc, char **argv)
case 'm':
cdata.num_mbuf = (uint64_t)atol(optarg);
break;
+ /* long options */
+ case 0:
+ if (!strncmp(long_options[option_index].name,
+ CMD_LINE_OPT_PMD_MGMT,
+ sizeof(CMD_LINE_OPT_PMD_MGMT))) {
+ if (parse_pmd_mgmt_config(optarg) < 0) {
+ printf(" Invalid power mgmt mode: %s\n",
+ optarg);
+ return;
+ }
+ pmgmt_enabled = true;
+ printf("PMD power mgmt mode is enabled\n");
+ }
+ break;
+
default:
usage();
}
@@ -430,7 +477,20 @@ main(int argc, char **argv)
continue;
dump_core_info(lcore_id, worker_data, worker_idx);
-
+ if (pmgmt_enabled) {
+ 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,
+ pmgmt_mode);
+ 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
--
2.34.1
prev parent reply other threads:[~2023-10-16 20:58 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-19 9:54 [RFC PATCH 1/5] eventdev: add power monitoring API on event port Sivaprasad Tummala
2023-04-19 9:54 ` [RFC PATCH 2/5] event/sw: support power monitor Sivaprasad Tummala
2023-04-19 9:54 ` [RFC PATCH 3/5] eventdev: support optional dequeue callbacks Sivaprasad Tummala
2023-04-24 16:06 ` Ferruh Yigit
2023-05-17 14:22 ` Burakov, Anatoly
2023-04-19 9:54 ` [RFC PATCH 4/5] power: add eventdev support for power management Sivaprasad Tummala
2023-05-17 14:43 ` Burakov, Anatoly
2023-05-24 12:34 ` Tummala, Sivaprasad
2023-04-19 9:54 ` [RFC PATCH 5/5] examples/eventdev_p: add eventdev " Sivaprasad Tummala
2023-04-19 10:15 ` [RFC PATCH 1/5] eventdev: add power monitoring API on event port Jerin Jacob
2023-04-24 16:06 ` Ferruh Yigit
2023-04-25 4:09 ` Jerin Jacob
2023-05-02 11:19 ` Ferruh Yigit
2023-05-03 7:58 ` Jerin Jacob
2023-05-03 8:13 ` Ferruh Yigit
2023-05-03 8:26 ` Jerin Jacob
2023-05-03 15:11 ` Tummala, Sivaprasad
2023-04-25 6:19 ` Mattias Rönnblom
2023-05-02 10:43 ` Ferruh Yigit
2023-05-17 14:48 ` Burakov, Anatoly
2023-10-16 20:57 ` [PATCH v1 1/6] " Sivaprasad Tummala
2023-10-16 20:57 ` [PATCH v1 2/6] event/sw: support power monitor Sivaprasad Tummala
2023-10-16 23:41 ` Tyler Retzlaff
2023-10-16 20:57 ` [PATCH v1 3/6] eventdev: support optional dequeue callbacks Sivaprasad Tummala
2023-10-16 23:47 ` Tyler Retzlaff
2023-10-16 20:57 ` [PATCH v1 4/6] event/sw: " Sivaprasad Tummala
2023-10-16 20:57 ` [PATCH v1 5/6] power: add eventdev support for power management Sivaprasad Tummala
2023-10-16 23:51 ` Tyler Retzlaff
2023-10-17 3:03 ` Tummala, Sivaprasad
2023-10-17 3:22 ` Jerin Jacob
2023-10-18 7:08 ` Tummala, Sivaprasad
2023-10-18 7:13 ` Jerin Jacob
2023-10-16 20:57 ` Sivaprasad Tummala [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231016205715.970999-6-sivaprasad.tummala@amd.com \
--to=sivaprasad.tummala@amd.com \
--cc=anatoly.burakov@intel.com \
--cc=david.hunt@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=harry.van.haaren@intel.com \
--cc=jerinjacobk@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).