get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/117445/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 117445,
    "url": "http://patchwork.dpdk.org/api/patches/117445/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20221006093803.2076768-3-tadhg.kearney@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": "<20221006093803.2076768-3-tadhg.kearney@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20221006093803.2076768-3-tadhg.kearney@intel.com",
    "date": "2022-10-06T09:38:02",
    "name": "[v9,2/3] l3fwd-power: add option to call uncore API",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "fa520c3796e5704877f82e9c7bb491cd2f71d06c",
    "submitter": {
        "id": 2533,
        "url": "http://patchwork.dpdk.org/api/people/2533/?format=api",
        "name": "Tadhg Kearney",
        "email": "tadhg.kearney@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/20221006093803.2076768-3-tadhg.kearney@intel.com/mbox/",
    "series": [
        {
            "id": 25007,
            "url": "http://patchwork.dpdk.org/api/series/25007/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=25007",
            "date": "2022-10-06T09:38:00",
            "name": "add Intel uncore api to be called through l3fwd-power",
            "version": 9,
            "mbox": "http://patchwork.dpdk.org/series/25007/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/117445/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/117445/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 5B680A00C2;\n\tThu,  6 Oct 2022 11:38:57 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 1E4E942BE3;\n\tThu,  6 Oct 2022 11:38:51 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by mails.dpdk.org (Postfix) with ESMTP id 21B9242BDC\n for <dev@dpdk.org>; Thu,  6 Oct 2022 11:38:47 +0200 (CEST)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 06 Oct 2022 02:38:47 -0700",
            "from silpixa00401183.ir.intel.com ([10.55.129.143])\n by fmsmga002.fm.intel.com with ESMTP; 06 Oct 2022 02:38:46 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1665049128; x=1696585128;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=WoMT9IcfCZsF0yJ3RU4zW8JMbsNVYNigQKP8coIOGAM=;\n b=KDxUKFI8Xz5COCrPJrV2Z+WwGQYWjun81uuNB7NrcKgFTUuPZXE1nEDi\n 5Csem/bYR95qCpKaeCIAuQwK8OZCPHpWMjVI8ptTkAjgeska+dDorMN3E\n 67WaS3dY2d7s2tVWxpKh+MVwQSoSvY2aUe8+aVNy5qLDBKbETEnlwQFcA\n OtfW6HU89UC4Y0ADxHeeZXwM9U7bSLqIUhf+YY9Ma9pnS61pP6GL4J9i2\n K/1xgUeOCBvC/tlBt83lKcAqHVURpUJg9aplYnU0OwZKslJkZ/BJ+DcCP\n Q5cocK7FemzH1rYVVTy1CnyzHWVlv50ToiMxmwSqJiFsQWneTSJkXPNgm A==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6500,9779,10491\"; a=\"329821571\"",
            "E=Sophos;i=\"5.95,163,1661842800\"; d=\"scan'208\";a=\"329821571\"",
            "E=McAfee;i=\"6500,9779,10491\"; a=\"729072510\"",
            "E=Sophos;i=\"5.95,163,1661842800\"; d=\"scan'208\";a=\"729072510\""
        ],
        "X-ExtLoop1": "1",
        "From": "Tadhg Kearney <tadhg.kearney@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "david.hunt@intel.com, anatoly.burakov@intel.com, reshma.pattan@intel.com,\n thomas@monjalon.net, Tadhg Kearney <tadhg.kearney@intel.com>",
        "Subject": "[PATCH v9 2/3] l3fwd-power: add option to call uncore API",
        "Date": "Thu,  6 Oct 2022 09:38:02 +0000",
        "Message-Id": "<20221006093803.2076768-3-tadhg.kearney@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20221006093803.2076768-1-tadhg.kearney@intel.com>",
        "References": "<20221005162023.1923558-1-tadhg.kearney@intel.com>\n <20221006093803.2076768-1-tadhg.kearney@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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"
    },
    "content": "Add option for setting uncore frequency min/max/index, through uncore API.\nThis will be set for each package and die on the SKU. On exit, uncore min\nand max frequency will be reverted back to previous frequencies.\n\nSigned-off-by: Tadhg Kearney <tadhg.kearney@intel.com>\nReviewed-by: David Hunt <david.hunt@intel.com>\nAcked-by: David Hunt <david.hunt@intel.com>\n---\n .../sample_app_ug/l3_forward_power_man.rst    |  29 ++++\n examples/l3fwd-power/main.c                   | 126 +++++++++++++++++-\n 2 files changed, 153 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 8f6d906200..08ac8ef369 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@@ -97,6 +97,12 @@ where,\n *   -P: Sets all ports to promiscuous mode so that packets are accepted regardless of the packet's Ethernet MAC destination address.\n     Without this option, only packets with the Ethernet MAC destination address set to the Ethernet address of the port are accepted.\n \n+*   -u: optional, sets uncore min/max frequency to minimum value.\n+\n+*   -U: optional, sets uncore min/max frequency to maximum value.\n+\n+*   -i (frequency index): optional, sets uncore frequency to frequency index value, by setting min and max values to be the same.\n+\n *   --config (port,queue,lcore)[,(port,queue,lcore)]: determines which queues from which ports are mapped to which cores.\n \n *   --max-pkt-len: optional, maximum packet length in decimal (64-9600)\n@@ -364,3 +370,26 @@ in the DPDK Programmer's Guide for more details on PMD power management.\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\n+\n+Setting Uncore Values\n+---------------------\n+\n+Uncore frequency can be adjusted through manipulating related sysfs entries to adjust the minimum and maximum uncore values.\n+This will be set for each package and die on the SKU. The driver for enabling this is available from kernel version 5.6 and above.\n+Three options are available for setting uncore frequency:\n+\n+``-u``\n+  This will set uncore minimum and maximum frequencies to minimum possible value.\n+\n+``-U``\n+  This will set uncore minimum and maximum frequencies to maximum possible value.\n+\n+``-i``\n+  This will allow you to set the specific uncore frequency index that you want, by setting\n+  the uncore frequency to a frequency pointed by index. Frequency index's are set 100MHz apart from\n+  maximum to minimum.\n+  Frequency index values are in descending order, ie, index 0 is maximum frequency index.\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)\" -i 1\ndiff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c\nindex 887c6eae3f..d6d71719e5 100644\n--- a/examples/l3fwd-power/main.c\n+++ b/examples/l3fwd-power/main.c\n@@ -47,6 +47,7 @@\n #include <rte_metrics.h>\n #include <rte_telemetry.h>\n #include <rte_power_pmd_mgmt.h>\n+#include <rte_power_intel_uncore.h>\n \n #include \"perf_core.h\"\n #include \"main.h\"\n@@ -161,6 +162,9 @@ static struct rte_timer telemetry_timer;\n /* stats index returned by metrics lib */\n int telstats_index;\n \n+/* flag to check if uncore option enabled */\n+int enabled_uncore = -1;\n+\n struct telstats_name {\n \tchar name[RTE_ETH_XSTATS_NAME_SIZE];\n };\n@@ -179,6 +183,12 @@ enum busy_rate {\n \tFULL = 100\n };\n \n+enum uncore_choice {\n+\tUNCORE_MIN = 0,\n+\tUNCORE_MAX = 1,\n+\tUNCORE_IDX = 2\n+};\n+\n /* reference poll count to measure core busyness */\n #define DEFAULT_COUNT 10000\n /*\n@@ -1616,6 +1626,9 @@ print_usage(const char *prgname)\n \t\t\"  [--max-pkt-len PKTLEN]\\n\"\n \t\t\"  -p PORTMASK: hexadecimal bitmask of ports to configure\\n\"\n \t\t\"  -P: enable promiscuous mode\\n\"\n+\t\t\"  -u: set min/max frequency for uncore to minimum value\\n\"\n+\t\t\"  -U: set min/max frequency for uncore to maximum value\\n\"\n+\t\t\"  -i (frequency index): set min/max frequency for uncore to specified frequency index\\n\"\n \t\t\"  --config (port,queue,lcore): rx queues configuration\\n\"\n \t\t\"  --high-perf-cores CORELIST: list of high performance cores\\n\"\n \t\t\"  --perf-config: similar as config, cores specified as indices\"\n@@ -1672,6 +1685,74 @@ static int parse_max_pkt_len(const char *pktlen)\n \treturn len;\n }\n \n+static int\n+parse_uncore_options(enum uncore_choice choice, const char *argument)\n+{\n+\tunsigned int die, pkg, max_pkg, max_die;\n+\tint ret = 0;\n+\tmax_pkg = rte_power_uncore_get_num_pkgs();\n+\tif (max_pkg == 0)\n+\t\treturn -1;\n+\n+\tfor (pkg = 0; pkg < max_pkg; pkg++) {\n+\t\tmax_die = rte_power_uncore_get_num_dies(pkg);\n+\t\tif (max_die == 0)\n+\t\t\treturn -1;\n+\t\tfor (die = 0; die < max_die; die++) {\n+\t\t\tret = rte_power_uncore_init(pkg, die);\n+\t\t\tif (ret == -1) {\n+\t\t\t\tRTE_LOG(INFO, L3FWD_POWER, \"Unable to initialize uncore for pkg %02u die %02u\\n\"\n+\t\t\t\t, pkg, die);\n+\t\t\t\treturn ret;\n+\t\t\t}\n+\t\t\tif (choice == UNCORE_MIN) {\n+\t\t\t\tret = rte_power_uncore_freq_min(pkg, die);\n+\t\t\t\tif (ret == -1) {\n+\t\t\t\t\tRTE_LOG(INFO, L3FWD_POWER,\n+\t\t\t\t\t\"Unable to set the uncore min/max to minimum uncore frequency value for pkg %02u die %02u\\n\"\n+\t\t\t\t\t, pkg, die);\n+\t\t\t\t\treturn ret;\n+\t\t\t\t}\n+\t\t\t} else if (choice == UNCORE_MAX) {\n+\t\t\t\tret = rte_power_uncore_freq_max(pkg, die);\n+\t\t\t\tif (ret == -1) {\n+\t\t\t\t\tRTE_LOG(INFO, L3FWD_POWER,\n+\t\t\t\t\t\"Unable to set uncore min/max to maximum uncore frequency value for pkg %02u die %02u\\n\"\n+\t\t\t\t\t, pkg, die);\n+\t\t\t\t\treturn ret;\n+\t\t\t\t}\n+\t\t\t} else if (choice == UNCORE_IDX) {\n+\t\t\t\tchar *ptr = NULL;\n+\t\t\t\tint frequency_index = strtol(argument, &ptr, 10);\n+\t\t\t\tif (argument == ptr) {\n+\t\t\t\t\tRTE_LOG(INFO, L3FWD_POWER, \"Index given is not a valid number.\");\n+\t\t\t\t\treturn -1;\n+\t\t\t\t}\n+\t\t\t\tint freq_array_len = rte_power_uncore_get_num_freqs(pkg, die);\n+\t\t\t\tif (frequency_index > freq_array_len - 1) {\n+\t\t\t\t\tRTE_LOG(INFO, L3FWD_POWER,\n+\t\t\t\t\t\"Frequency index given out of range, please choose a value from 0 to %d.\\n\",\n+\t\t\t\t\tfreq_array_len);\n+\t\t\t\t\treturn -1;\n+\t\t\t\t}\n+\t\t\t\tret = rte_power_set_uncore_freq(pkg, die, frequency_index);\n+\t\t\t\tif (ret == -1) {\n+\t\t\t\t\tRTE_LOG(INFO, L3FWD_POWER,\n+\t\t\t\t\t\"Unable to set min/max uncore index value for pkg %02u die %02u\\n\",\n+\t\t\t\t\tpkg, die);\n+\t\t\t\t\treturn ret;\n+\t\t\t\t}\n+\t\t\t} else {\n+\t\t\t\tRTE_LOG(INFO, L3FWD_POWER, \"Uncore choice provided invalid\\n\");\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\tRTE_LOG(INFO, L3FWD_POWER, \"Successfully set max/min/index uncore frequency.\\n\");\n+\treturn ret;\n+}\n+\n static int\n parse_portmask(const char *portmask)\n {\n@@ -1864,7 +1945,7 @@ parse_args(int argc, char **argv)\n \n \targvopt = argv;\n \n-\twhile ((opt = getopt_long(argc, argvopt, \"p:l:m:h:P\",\n+\twhile ((opt = getopt_long(argc, argvopt, \"p:l:m:h:PuUi:\",\n \t\t\t\tlgopts, &option_index)) != EOF) {\n \n \t\tswitch (opt) {\n@@ -1893,6 +1974,27 @@ parse_args(int argc, char **argv)\n \t\t\tlimit = parse_max_pkt_len(optarg);\n \t\t\tfreq_tlb[HGH] = limit;\n \t\t\tbreak;\n+\t\tcase 'u':\n+\t\t\tenabled_uncore = parse_uncore_options(UNCORE_MIN, NULL);\n+\t\t\tif (enabled_uncore < 0) {\n+\t\t\t\tprint_usage(prgname);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t\tbreak;\n+\t\tcase 'U':\n+\t\t\tenabled_uncore = parse_uncore_options(UNCORE_MAX, NULL);\n+\t\t\tif (enabled_uncore < 0) {\n+\t\t\t\tprint_usage(prgname);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t\tbreak;\n+\t\tcase 'i':\n+\t\t\tenabled_uncore = parse_uncore_options(UNCORE_IDX, optarg);\n+\t\t\tif (enabled_uncore < 0) {\n+\t\t\t\tprint_usage(prgname);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t\tbreak;\n \t\t/* long options */\n \t\tcase 0:\n \t\t\tif (!strncmp(lgopts[option_index].name, \"config\", 6)) {\n@@ -2364,7 +2466,7 @@ init_power_library(void)\n static int\n deinit_power_library(void)\n {\n-\tunsigned int lcore_id;\n+\tunsigned int lcore_id, max_pkg, max_die, die, pkg;\n \tint ret = 0;\n \n \tRTE_LCORE_FOREACH(lcore_id) {\n@@ -2377,6 +2479,26 @@ deinit_power_library(void)\n \t\t\treturn ret;\n \t\t}\n \t}\n+\n+\t/* if uncore option was set */\n+\tif (enabled_uncore == 0) {\n+\t\tmax_pkg = rte_power_uncore_get_num_pkgs();\n+\t\tif (max_pkg == 0)\n+\t\t\treturn -1;\n+\t\tfor (pkg = 0; pkg < max_pkg; pkg++) {\n+\t\t\tmax_die = rte_power_uncore_get_num_dies(pkg);\n+\t\t\tif (max_die == 0)\n+\t\t\t\treturn -1;\n+\t\t\tfor (die = 0; die < max_die; die++) {\n+\t\t\t\tret = rte_power_uncore_exit(pkg, die);\n+\t\t\t\tif (ret < 0) {\n+\t\t\t\t\tRTE_LOG(ERR, L3FWD_POWER, \"Failed to exit uncore deinit successfully for pkg %02u die %02u\\n\"\n+\t\t\t\t\t\t, pkg, die);\n+\t\t\t\t\treturn -1;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t}\n+\t}\n \treturn ret;\n }\n \n",
    "prefixes": [
        "v9",
        "2/3"
    ]
}