From: Kevin Laatz <kevin.laatz@intel.com>
To: dev@dpdk.org
Cc: anatoly.burakov@intel.com, Kevin Laatz <kevin.laatz@intel.com>,
David Hunt <david.hunt@intel.com>
Subject: [PATCH v5 4/4] examples/l3fwd_power: add cli for configurable options
Date: Tue, 31 May 2022 10:59:36 +0100 [thread overview]
Message-ID: <20220531095936.1965727-5-kevin.laatz@intel.com> (raw)
In-Reply-To: <20220531095936.1965727-1-kevin.laatz@intel.com>
Add CLI options to l3fwd_power to utilize the new power APIs introduced in
this patchset. These CLI options allow the user to configure the
heuritstics made available through the new API via the l3fwd_power
application options.
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
v3: move setters out of arg parsing
v2: add doc update for l3fwd-power
---
.../sample_app_ug/l3_forward_power_man.rst | 8 ++
examples/l3fwd-power/main.c | 86 ++++++++++++++++++-
2 files changed, 93 insertions(+), 1 deletion(-)
diff --git a/doc/guides/sample_app_ug/l3_forward_power_man.rst b/doc/guides/sample_app_ug/l3_forward_power_man.rst
index 2e350c45f1..8f6d906200 100644
--- a/doc/guides/sample_app_ug/l3_forward_power_man.rst
+++ b/doc/guides/sample_app_ug/l3_forward_power_man.rst
@@ -109,6 +109,14 @@ where,
* --pmd-mgmt: PMD power management mode.
+* --max-empty-polls : Number of empty polls to wait before entering sleep state. Applies to --pmd-mgmt mode only.
+
+* --pause-duration: Set the duration of the pause callback (microseconds). Applies to --pmd-mgmt mode only.
+
+* --scale-freq-min: Set minimum frequency for scaling. Applies to --pmd-mgmt mode only.
+
+* --scale-freq-max: Set maximum frequency for scaling. Applies to --pmd-mgmt mode only.
+
See :doc:`l3_forward` for details.
The L3fwd-power example reuses the L3fwd command line options.
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 20e5b59af9..887c6eae3f 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -265,6 +265,10 @@ static struct rte_eth_conf port_conf = {
};
static uint32_t max_pkt_len;
+static uint32_t max_empty_polls = 512;
+static uint32_t pause_duration = 1;
+static uint32_t scale_freq_min;
+static uint32_t scale_freq_max;
static struct rte_mempool * pktmbuf_pool[NB_SOCKETS];
@@ -1626,10 +1630,32 @@ print_usage(const char *prgname)
" empty polls, full polls, and core busyness to telemetry\n"
" --interrupt-only: enable interrupt-only mode\n"
" --pmd-mgmt MODE: enable PMD power management mode. "
- "Currently supported modes: baseline, monitor, pause, scale\n",
+ "Currently supported modes: baseline, monitor, pause, scale\n"
+ " --max-empty-polls MAX_EMPTY_POLLS: number of empty polls to"
+ " wait before entering sleep state\n"
+ " --pause-duration DURATION: set the duration, in microseconds,"
+ " of the pause callback\n"
+ " --scale-freq-min FREQ_MIN: set minimum frequency for scaling mode for"
+ " all application lcores (FREQ_MIN must be in kHz, in increments of 100MHz)\n"
+ " --scale-freq-max FREQ_MAX: set maximum frequency for scaling mode for"
+ " all application lcores (FREQ_MAX must be in kHz, in increments of 100MHz)\n",
prgname);
}
+static int
+parse_int(const char *opt)
+{
+ char *end = NULL;
+ unsigned long val;
+
+ /* parse integer string */
+ val = strtoul(opt, &end, 10);
+ if ((opt[0] == '\0') || (end == NULL) || (*end != '\0'))
+ return -1;
+
+ return val;
+}
+
static int parse_max_pkt_len(const char *pktlen)
{
char *end = NULL;
@@ -1803,6 +1829,10 @@ parse_ep_config(const char *q_arg)
#define CMD_LINE_OPT_TELEMETRY "telemetry"
#define CMD_LINE_OPT_PMD_MGMT "pmd-mgmt"
#define CMD_LINE_OPT_MAX_PKT_LEN "max-pkt-len"
+#define CMD_LINE_OPT_MAX_EMPTY_POLLS "max-empty-polls"
+#define CMD_LINE_OPT_PAUSE_DURATION "pause-duration"
+#define CMD_LINE_OPT_SCALE_FREQ_MIN "scale-freq-min"
+#define CMD_LINE_OPT_SCALE_FREQ_MAX "scale-freq-max"
/* Parse the argument given in the command line of the application */
static int
@@ -1825,6 +1855,10 @@ parse_args(int argc, char **argv)
{CMD_LINE_OPT_TELEMETRY, 0, 0, 0},
{CMD_LINE_OPT_INTERRUPT_ONLY, 0, 0, 0},
{CMD_LINE_OPT_PMD_MGMT, 1, 0, 0},
+ {CMD_LINE_OPT_MAX_EMPTY_POLLS, 1, 0, 0},
+ {CMD_LINE_OPT_PAUSE_DURATION, 1, 0, 0},
+ {CMD_LINE_OPT_SCALE_FREQ_MIN, 1, 0, 0},
+ {CMD_LINE_OPT_SCALE_FREQ_MAX, 1, 0, 0},
{NULL, 0, 0, 0}
};
@@ -1975,6 +2009,34 @@ parse_args(int argc, char **argv)
parse_ptype = 1;
}
+ if (!strncmp(lgopts[option_index].name,
+ CMD_LINE_OPT_MAX_EMPTY_POLLS,
+ sizeof(CMD_LINE_OPT_MAX_EMPTY_POLLS))) {
+ printf("Maximum empty polls configured\n");
+ max_empty_polls = parse_int(optarg);
+ }
+
+ if (!strncmp(lgopts[option_index].name,
+ CMD_LINE_OPT_PAUSE_DURATION,
+ sizeof(CMD_LINE_OPT_PAUSE_DURATION))) {
+ printf("Pause duration configured\n");
+ pause_duration = parse_int(optarg);
+ }
+
+ if (!strncmp(lgopts[option_index].name,
+ CMD_LINE_OPT_SCALE_FREQ_MIN,
+ sizeof(CMD_LINE_OPT_SCALE_FREQ_MIN))) {
+ printf("Scaling frequency minimum configured\n");
+ scale_freq_min = parse_int(optarg);
+ }
+
+ if (!strncmp(lgopts[option_index].name,
+ CMD_LINE_OPT_SCALE_FREQ_MAX,
+ sizeof(CMD_LINE_OPT_SCALE_FREQ_MAX))) {
+ printf("Scaling frequency maximum configured\n");
+ scale_freq_max = parse_int(optarg);
+ }
+
break;
default:
@@ -2801,6 +2863,28 @@ main(int argc, char **argv)
}
if (app_mode == APP_MODE_PMD_MGMT && !baseline_enabled) {
+ /* Set power_pmd_mgmt configs passed by user */
+ rte_power_pmd_mgmt_set_emptypoll_max(max_empty_polls);
+ ret = rte_power_pmd_mgmt_set_pause_duration(pause_duration);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Error setting pause_duration: err=%d, lcore=%d\n",
+ ret, lcore_id);
+
+ ret = rte_power_pmd_mgmt_set_scaling_freq_min(lcore_id,
+ scale_freq_min);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Error setting scaling freq min: err=%d, lcore=%d\n",
+ ret, lcore_id);
+
+ ret = rte_power_pmd_mgmt_set_scaling_freq_max(lcore_id,
+ scale_freq_max);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Error setting scaling freq max: err=%d, lcore %d\n",
+ ret, lcore_id);
+
ret = rte_power_ethdev_pmgmt_queue_enable(
lcore_id, portid, queueid,
pmgmt_type);
--
2.31.1
next prev parent reply other threads:[~2022-05-31 9:58 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-08 14:08 [PATCH 0/4] Add APIs for configurable power options Kevin Laatz
2022-04-08 14:08 ` [PATCH 1/4] lib/power: add get and set API for emptypoll max Kevin Laatz
2022-04-15 14:43 ` Ray Kinsella
2022-04-19 11:25 ` Kevin Laatz
2022-04-08 14:08 ` [PATCH 2/4] lib/power: add get and set API for pause duration Kevin Laatz
2022-04-08 14:08 ` [PATCH 3/4] lib/power: add get and set API for scaling freq min and max with pstate mode Kevin Laatz
2022-04-08 14:08 ` [PATCH 4/4] examples/l3fwd_power: add cli for configurable options Kevin Laatz
2022-04-19 11:24 ` [PATCH v2 0/4] Add APIs for configurable power options Kevin Laatz
2022-04-19 11:24 ` [PATCH v2 1/4] lib/power: add get and set API for emptypoll max Kevin Laatz
2022-04-19 15:42 ` Ray Kinsella
2022-04-19 11:24 ` [PATCH v2 2/4] lib/power: add get and set API for pause duration Kevin Laatz
2022-04-19 15:42 ` Ray Kinsella
2022-05-18 8:58 ` Burakov, Anatoly
2022-04-19 11:25 ` [PATCH v2 3/4] lib/power: add get and set API for scaling freq min and max with pstate mode Kevin Laatz
2022-04-19 15:43 ` Ray Kinsella
2022-05-18 9:05 ` Burakov, Anatoly
2022-05-23 16:25 ` Kevin Laatz
2022-04-19 11:25 ` [PATCH v2 4/4] examples/l3fwd_power: add cli for configurable options Kevin Laatz
2022-05-18 9:11 ` Burakov, Anatoly
2022-05-23 16:54 ` Kevin Laatz
2022-05-23 20:21 ` [PATCH v3 0/4] Add APIs for configurable power options Kevin Laatz
2022-05-23 20:21 ` [PATCH v3 1/4] lib/power: add get and set API for emptypoll max Kevin Laatz
2022-05-24 13:45 ` Ray Kinsella
2022-05-23 20:21 ` [PATCH v3 2/4] lib/power: add get and set API for pause duration Kevin Laatz
2022-05-23 20:21 ` [PATCH v3 3/4] lib/power: add get and set API for scaling freq min and max with pstate mode Kevin Laatz
2022-05-24 10:00 ` Burakov, Anatoly
2022-05-23 20:21 ` [PATCH v3 4/4] examples/l3fwd_power: add cli for configurable options Kevin Laatz
2022-05-24 10:03 ` Burakov, Anatoly
2022-05-24 13:14 ` [PATCH v4 0/4] Add APIs for configurable power options Kevin Laatz
2022-05-24 13:14 ` [PATCH v4 1/4] lib/power: add get and set API for emptypoll max Kevin Laatz
2022-05-24 14:40 ` David Hunt
2022-05-24 13:14 ` [PATCH v4 2/4] lib/power: add get and set API for pause duration Kevin Laatz
2022-05-24 14:39 ` David Hunt
2022-05-24 13:14 ` [PATCH v4 3/4] lib/power: add get and set API for scaling freq min and max with pstate mode Kevin Laatz
2022-05-24 14:39 ` David Hunt
2022-05-24 13:14 ` [PATCH v4 4/4] examples/l3fwd_power: add cli for configurable options Kevin Laatz
2022-05-24 14:38 ` David Hunt
2022-05-27 16:04 ` [PATCH v4 0/4] Add APIs for configurable power options Burakov, Anatoly
2022-05-31 9:59 ` [PATCH v5 " Kevin Laatz
2022-05-31 9:59 ` [PATCH v5 1/4] lib/power: add get and set API for emptypoll max Kevin Laatz
2022-05-31 9:59 ` [PATCH v5 2/4] lib/power: add get and set API for pause duration Kevin Laatz
2022-06-02 14:01 ` Burakov, Anatoly
2022-06-02 14:53 ` Kevin Laatz
2022-05-31 9:59 ` [PATCH v5 3/4] lib/power: add get and set API for scaling freq min and max with pstate mode Kevin Laatz
2022-05-31 9:59 ` Kevin Laatz [this message]
2022-06-02 15:13 ` [PATCH v6 0/4] Add APIs for configurable power options Kevin Laatz
2022-06-02 15:13 ` [PATCH v6 1/4] lib/power: add get and set API for emptypoll max Kevin Laatz
2022-06-02 15:13 ` [PATCH v6 2/4] lib/power: add get and set API for pause duration Kevin Laatz
2022-06-02 15:13 ` [PATCH v6 3/4] lib/power: add get and set API for scaling freq min and max with pstate mode Kevin Laatz
2022-06-02 15:13 ` [PATCH v6 4/4] examples/l3fwd_power: add cli for configurable options Kevin Laatz
2022-06-04 20:43 ` [PATCH v6 0/4] Add APIs for configurable power options Thomas Monjalon
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=20220531095936.1965727-5-kevin.laatz@intel.com \
--to=kevin.laatz@intel.com \
--cc=anatoly.burakov@intel.com \
--cc=david.hunt@intel.com \
--cc=dev@dpdk.org \
/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).