Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/86974/?format=api
http://patchwork.dpdk.org/api/patches/86974/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/f1a44bfcea4d9cba02971041a8b237b5dda856f9.1611143368.git.anatoly.burakov@intel.com/", "project": { "id": 1, "url": "http://patchwork.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<f1a44bfcea4d9cba02971041a8b237b5dda856f9.1611143368.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/f1a44bfcea4d9cba02971041a8b237b5dda856f9.1611143368.git.anatoly.burakov@intel.com", "date": "2021-01-20T11:50:29", "name": "[v19,4/4] examples/l3fwd-power: enable PMD power mgmt", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "e1b7d32fd876ceb77535d71d86bbf92e85528ef6", "submitter": { "id": 4, "url": "http://patchwork.dpdk.org/api/people/4/?format=api", "name": "Anatoly Burakov", "email": "anatoly.burakov@intel.com" }, "delegate": { "id": 1, "url": "http://patchwork.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/f1a44bfcea4d9cba02971041a8b237b5dda856f9.1611143368.git.anatoly.burakov@intel.com/mbox/", "series": [ { "id": 14866, "url": "http://patchwork.dpdk.org/api/series/14866/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=14866", "date": "2021-01-20T11:50:25", "name": "Add PMD power management", "version": 19, "mbox": "http://patchwork.dpdk.org/series/14866/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/86974/comments/", "check": "fail", "checks": "http://patchwork.dpdk.org/api/patches/86974/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id C1C60A0A05;\n\tWed, 20 Jan 2021 12:51:01 +0100 (CET)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 25E1B140D6F;\n\tWed, 20 Jan 2021 12:50:43 +0100 (CET)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n by mails.dpdk.org (Postfix) with ESMTP id 6CE81140D29\n for <dev@dpdk.org>; Wed, 20 Jan 2021 12:50:39 +0100 (CET)", "from fmsmga006.fm.intel.com ([10.253.24.20])\n by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 20 Jan 2021 03:50:38 -0800", "from silpixa00399498.ir.intel.com (HELO\n silpixa00399498.ger.corp.intel.com) ([10.237.222.179])\n by fmsmga006.fm.intel.com with ESMTP; 20 Jan 2021 03:50:37 -0800" ], "IronPort-SDR": [ "\n BX8aMErEvbrYm7G45Sxlg5IzzvbX8yVrU3TGacLtVq3frQtWtGxaW5iZ9oRMzMu9DZDMqT/wff\n H5Z4KzQJIMhg==", "\n ih44+fBtgc7KicBVQfuVJ8+n47tVLIqCXEAUgP4C3oSSR1yY+m6SCRvHdlxwQpi8DmMfpV6GJC\n mxqjTSuG0z6Q==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6000,8403,9869\"; a=\"178313190\"", "E=Sophos;i=\"5.79,361,1602572400\"; d=\"scan'208\";a=\"178313190\"", "E=Sophos;i=\"5.79,361,1602572400\"; d=\"scan'208\";a=\"571319273\"" ], "X-ExtLoop1": "1", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Cc": "Liang Ma <liang.j.ma@intel.com>, David Hunt <david.hunt@intel.com>,\n thomas@monjalon.net", "Date": "Wed, 20 Jan 2021 11:50:29 +0000", "Message-Id": "\n <f1a44bfcea4d9cba02971041a8b237b5dda856f9.1611143368.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<cover.1611143367.git.anatoly.burakov@intel.com>", "References": "<cover.1611074697.git.anatoly.burakov@intel.com>\n <cover.1611143367.git.anatoly.burakov@intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH v19 4/4] examples/l3fwd-power: enable PMD power\n mgmt", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "From: Liang Ma <liang.j.ma@intel.com>\n\nAdd PMD power management feature support to l3fwd-power sample app.\n\nSigned-off-by: Liang Ma <liang.j.ma@intel.com>\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\nAcked-by: David Hunt <david.hunt@intel.com>\n---\n\nNotes:\n v12:\n - Allow selecting PMD power management scheme from command-line\n - Enforce 1 core 1 queue rule\n\n .../sample_app_ug/l3_forward_power_man.rst | 35 ++++++++\n examples/l3fwd-power/main.c | 90 ++++++++++++++++++-\n 2 files changed, 123 insertions(+), 2 deletions(-)", "diff": "diff --git a/doc/guides/sample_app_ug/l3_forward_power_man.rst b/doc/guides/sample_app_ug/l3_forward_power_man.rst\nindex 85a78a5c1e..aaa9367fae 100644\n--- a/doc/guides/sample_app_ug/l3_forward_power_man.rst\n+++ b/doc/guides/sample_app_ug/l3_forward_power_man.rst\n@@ -109,6 +109,8 @@ where,\n \n * --telemetry: Telemetry mode.\n \n+* --pmd-mgmt: PMD power management mode.\n+\n See :doc:`l3_forward` for details.\n The L3fwd-power example reuses the L3fwd command line options.\n \n@@ -456,3 +458,36 @@ reference cycles and accordingly busy rate is set to either 0% or\n \n The new stats ``empty_poll`` , ``full_poll`` and ``busy_percent`` can be viewed by running the script\n ``/usertools/dpdk-telemetry-client.py`` and selecting the menu option ``Send for global Metrics``.\n+\n+PMD power management Mode\n+-------------------------\n+\n+The PMD power management mode support for ``l3fwd-power`` is a standalone mode, in this mode\n+``l3fwd-power`` does simple l3fwding along with enable the power saving scheme on specific\n+port/queue/lcore. Main purpose for this mode is to demonstrate how to use the PMD power management API.\n+\n+.. code-block:: console\n+\n+ ./build/examples/dpdk-l3fwd-power -l 1-3 -- --pmd-mgmt -p 0x0f --config=\"(0,0,2),(0,1,3)\"\n+\n+PMD Power Management Mode\n+-------------------------\n+There is also a traffic-aware operating mode that, instead of using explicit\n+power management, will use automatic PMD power management. This mode is limited\n+to one queue per core, and has three available power management schemes:\n+\n+* ``monitor`` - this will use ``rte_power_monitor()`` function to enter a\n+ power-optimized state (subject to platform support).\n+\n+* ``pause`` - this will use ``rte_power_pause()`` or ``rte_pause()`` to avoid\n+ busy looping when there is no traffic.\n+\n+* ``scale`` - this will use frequency scaling routines available in the\n+ ``librte_power`` library.\n+\n+See :doc:`Power Management<../prog_guide/power_man>` chapter in the DPDK\n+Programmer's Guide for more details on PMD power management.\n+\n+.. code-block:: console\n+\n+ ./<build_dir>/examples/dpdk-l3fwd-power -l 1-3 -- -p 0x0f --config=\"(0,0,2),(0,1,3)\" --pmd-mgmt=scale\ndiff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c\nindex 995a3b6ad7..61fbae6c4f 100644\n--- a/examples/l3fwd-power/main.c\n+++ b/examples/l3fwd-power/main.c\n@@ -47,6 +47,7 @@\n #include <rte_power_empty_poll.h>\n #include <rte_metrics.h>\n #include <rte_telemetry.h>\n+#include <rte_power_pmd_mgmt.h>\n \n #include \"perf_core.h\"\n #include \"main.h\"\n@@ -199,11 +200,14 @@ enum appmode {\n \tAPP_MODE_LEGACY,\n \tAPP_MODE_EMPTY_POLL,\n \tAPP_MODE_TELEMETRY,\n-\tAPP_MODE_INTERRUPT\n+\tAPP_MODE_INTERRUPT,\n+\tAPP_MODE_PMD_MGMT\n };\n \n enum appmode app_mode;\n \n+static enum rte_power_pmd_mgmt_type pmgmt_type;\n+\n enum freq_scale_hint_t\n {\n \tFREQ_LOWER = -1,\n@@ -1611,7 +1615,9 @@ print_usage(const char *prgname)\n \t\t\" follow (training_flag, high_threshold, med_threshold)\\n\"\n \t\t\" --telemetry: enable telemetry mode, to update\"\n \t\t\" empty polls, full polls, and core busyness to telemetry\\n\"\n-\t\t\" --interrupt-only: enable interrupt-only mode\\n\",\n+\t\t\" --interrupt-only: enable interrupt-only mode\\n\"\n+\t\t\" --pmd-mgmt MODE: enable PMD power management mode. \"\n+\t\t\"Currently supported modes: monitor, pause, scale\\n\",\n \t\tprgname);\n }\n \n@@ -1701,6 +1707,32 @@ parse_config(const char *q_arg)\n \n \treturn 0;\n }\n+\n+static int\n+parse_pmd_mgmt_config(const char *name)\n+{\n+#define PMD_MGMT_MONITOR \"monitor\"\n+#define PMD_MGMT_PAUSE \"pause\"\n+#define PMD_MGMT_SCALE \"scale\"\n+\n+\tif (strncmp(PMD_MGMT_MONITOR, name, sizeof(PMD_MGMT_MONITOR)) == 0) {\n+\t\tpmgmt_type = RTE_POWER_MGMT_TYPE_MONITOR;\n+\t\treturn 0;\n+\t}\n+\n+\tif (strncmp(PMD_MGMT_PAUSE, name, sizeof(PMD_MGMT_PAUSE)) == 0) {\n+\t\tpmgmt_type = RTE_POWER_MGMT_TYPE_PAUSE;\n+\t\treturn 0;\n+\t}\n+\n+\tif (strncmp(PMD_MGMT_SCALE, name, sizeof(PMD_MGMT_SCALE)) == 0) {\n+\t\tpmgmt_type = RTE_POWER_MGMT_TYPE_SCALE;\n+\t\treturn 0;\n+\t}\n+\t/* unknown PMD power management mode */\n+\treturn -1;\n+}\n+\n static int\n parse_ep_config(const char *q_arg)\n {\n@@ -1755,6 +1787,7 @@ parse_ep_config(const char *q_arg)\n #define CMD_LINE_OPT_EMPTY_POLL \"empty-poll\"\n #define CMD_LINE_OPT_INTERRUPT_ONLY \"interrupt-only\"\n #define CMD_LINE_OPT_TELEMETRY \"telemetry\"\n+#define CMD_LINE_OPT_PMD_MGMT \"pmd-mgmt\"\n \n /* Parse the argument given in the command line of the application */\n static int\n@@ -1776,6 +1809,7 @@ parse_args(int argc, char **argv)\n \t\t{CMD_LINE_OPT_LEGACY, 0, 0, 0},\n \t\t{CMD_LINE_OPT_TELEMETRY, 0, 0, 0},\n \t\t{CMD_LINE_OPT_INTERRUPT_ONLY, 0, 0, 0},\n+\t\t{CMD_LINE_OPT_PMD_MGMT, 1, 0, 0},\n \t\t{NULL, 0, 0, 0}\n \t};\n \n@@ -1886,6 +1920,21 @@ parse_args(int argc, char **argv)\n \t\t\t\tprintf(\"telemetry mode is enabled\\n\");\n \t\t\t}\n \n+\t\t\tif (!strncmp(lgopts[option_index].name,\n+\t\t\t\t\tCMD_LINE_OPT_PMD_MGMT,\n+\t\t\t\t\tsizeof(CMD_LINE_OPT_PMD_MGMT))) {\n+\t\t\t\tif (app_mode != APP_MODE_DEFAULT) {\n+\t\t\t\t\tprintf(\" power mgmt mode is mutually exclusive with other modes\\n\");\n+\t\t\t\t\treturn -1;\n+\t\t\t\t}\n+\t\t\t\tif (parse_pmd_mgmt_config(optarg) < 0) {\n+\t\t\t\t\tprintf(\" Invalid PMD power management mode: %s\\n\",\n+\t\t\t\t\t\t\toptarg);\n+\t\t\t\t\treturn -1;\n+\t\t\t\t}\n+\t\t\t\tapp_mode = APP_MODE_PMD_MGMT;\n+\t\t\t\tprintf(\"PMD power mgmt mode is enabled\\n\");\n+\t\t\t}\n \t\t\tif (!strncmp(lgopts[option_index].name,\n \t\t\t\t\tCMD_LINE_OPT_INTERRUPT_ONLY,\n \t\t\t\t\tsizeof(CMD_LINE_OPT_INTERRUPT_ONLY))) {\n@@ -2442,6 +2491,8 @@ mode_to_str(enum appmode mode)\n \t\treturn \"telemetry\";\n \tcase APP_MODE_INTERRUPT:\n \t\treturn \"interrupt-only\";\n+\tcase APP_MODE_PMD_MGMT:\n+\t\treturn \"pmd mgmt\";\n \tdefault:\n \t\treturn \"invalid\";\n \t}\n@@ -2671,6 +2722,13 @@ main(int argc, char **argv)\n \t\tqconf = &lcore_conf[lcore_id];\n \t\tprintf(\"\\nInitializing rx queues on lcore %u ... \", lcore_id );\n \t\tfflush(stdout);\n+\n+\t\t/* PMD power management mode can only do 1 queue per core */\n+\t\tif (app_mode == APP_MODE_PMD_MGMT && qconf->n_rx_queue > 1) {\n+\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t\"In PMD power management mode, only one queue per lcore is allowed\\n\");\n+\t\t}\n+\n \t\t/* init RX queues */\n \t\tfor(queue = 0; queue < qconf->n_rx_queue; ++queue) {\n \t\t\tstruct rte_eth_rxconf rxq_conf;\n@@ -2708,6 +2766,16 @@ main(int argc, char **argv)\n \t\t\t\t\trte_exit(EXIT_FAILURE,\n \t\t\t\t\t\t \"Fail to add ptype cb\\n\");\n \t\t\t}\n+\n+\t\t\tif (app_mode == APP_MODE_PMD_MGMT) {\n+\t\t\t\tret = rte_power_ethdev_pmgmt_queue_enable(\n+\t\t\t\t\t\tlcore_id, portid, queueid,\n+\t\t\t\t\t\tpmgmt_type);\n+\t\t\t\tif (ret < 0)\n+\t\t\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t\t\t\"rte_power_ethdev_pmgmt_queue_enable: err=%d, port=%d\\n\",\n+\t\t\t\t\t\t\tret, portid);\n+\t\t\t}\n \t\t}\n \t}\n \n@@ -2798,6 +2866,9 @@ main(int argc, char **argv)\n \t\t\t\t\t\tSKIP_MAIN);\n \t} else if (app_mode == APP_MODE_INTERRUPT) {\n \t\trte_eal_mp_remote_launch(main_intr_loop, NULL, CALL_MAIN);\n+\t} else if (app_mode == APP_MODE_PMD_MGMT) {\n+\t\t/* reuse telemetry loop for PMD power management mode */\n+\t\trte_eal_mp_remote_launch(main_telemetry_loop, NULL, CALL_MAIN);\n \t}\n \n \tif (app_mode == APP_MODE_EMPTY_POLL || app_mode == APP_MODE_TELEMETRY)\n@@ -2824,6 +2895,21 @@ main(int argc, char **argv)\n \tif (app_mode == APP_MODE_EMPTY_POLL)\n \t\trte_power_empty_poll_stat_free();\n \n+\tif (app_mode == APP_MODE_PMD_MGMT) {\n+\t\tfor (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {\n+\t\t\tif (rte_lcore_is_enabled(lcore_id) == 0)\n+\t\t\t\tcontinue;\n+\t\t\tqconf = &lcore_conf[lcore_id];\n+\t\t\tfor (queue = 0; queue < qconf->n_rx_queue; ++queue) {\n+\t\t\t\tportid = qconf->rx_queue_list[queue].port_id;\n+\t\t\t\tqueueid = qconf->rx_queue_list[queue].queue_id;\n+\n+\t\t\t\trte_power_ethdev_pmgmt_queue_disable(lcore_id,\n+\t\t\t\t\t\tportid, queueid);\n+\t\t\t}\n+\t\t}\n+\t}\n+\n \tif ((app_mode == APP_MODE_LEGACY || app_mode == APP_MODE_EMPTY_POLL) &&\n \t\t\tdeinit_power_library())\n \t\trte_exit(EXIT_FAILURE, \"deinit_power_library failed\\n\");\n", "prefixes": [ "v19", "4/4" ] }{ "id": 86974, "url": "