get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 94870,
    "url": "https://patches.dpdk.org/api/patches/94870/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/2c5edb9640bbc0e25c57a3e693b38cf3f4260286.1624629506.git.anatoly.burakov@intel.com/",
    "project": {
        "id": 1,
        "url": "https://patches.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": "<2c5edb9640bbc0e25c57a3e693b38cf3f4260286.1624629506.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/2c5edb9640bbc0e25c57a3e693b38cf3f4260286.1624629506.git.anatoly.burakov@intel.com",
    "date": "2021-06-25T14:00:09",
    "name": "[v2,6/7] power: support monitoring multiple Rx queues",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "975973e7e27b75ea3a159c75cff5965b923647f3",
    "submitter": {
        "id": 4,
        "url": "https://patches.dpdk.org/api/people/4/?format=api",
        "name": "Anatoly Burakov",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/2c5edb9640bbc0e25c57a3e693b38cf3f4260286.1624629506.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 17490,
            "url": "https://patches.dpdk.org/api/series/17490/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=17490",
            "date": "2021-06-25T14:00:03",
            "name": "Enhancements for PMD power management",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/17490/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/94870/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/94870/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 7ACFAA0547;\n\tFri, 25 Jun 2021 16:01:13 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 79A2440E78;\n\tFri, 25 Jun 2021 16:01:00 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n by mails.dpdk.org (Postfix) with ESMTP id 651C0410D8\n for <dev@dpdk.org>; Fri, 25 Jun 2021 16:00:49 +0200 (CEST)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 25 Jun 2021 07:00:27 -0700",
            "from silpixa00399498.ir.intel.com (HELO\n silpixa00399498.ger.corp.intel.com) ([10.237.223.53])\n by FMSMGA003.fm.intel.com with ESMTP; 25 Jun 2021 07:00:25 -0700"
        ],
        "IronPort-SDR": [
            "\n qeMi9KWYKdFW7qQztjI14i1hable7OStb3GzIV5M5vZpQLmM+sgAB9mm5x9OPagC5CI20a0ZzL\n xQZTf+ywjCJA==",
            "\n c5HpLNxtx9cQt0SSRVP8wRXpNSmgbsBrOltUqbN7U+W/isAPod/VKVxBTWYEjuMquU2wgpzFzP\n SQcgHQXG29CA=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10026\"; a=\"204664529\"",
            "E=Sophos;i=\"5.83,298,1616482800\"; d=\"scan'208\";a=\"204664529\"",
            "E=Sophos;i=\"5.83,298,1616482800\"; d=\"scan'208\";a=\"481858773\""
        ],
        "X-ExtLoop1": "1",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org,\n\tDavid Hunt <david.hunt@intel.com>",
        "Cc": "ciara.loftus@intel.com",
        "Date": "Fri, 25 Jun 2021 14:00:09 +0000",
        "Message-Id": "\n <2c5edb9640bbc0e25c57a3e693b38cf3f4260286.1624629506.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<cover.1624629506.git.anatoly.burakov@intel.com>",
        "References": "<cover.1622548381.git.anatoly.burakov@intel.com>\n <cover.1624629506.git.anatoly.burakov@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v2 6/7] power: support monitoring multiple Rx\n queues",
        "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": "Use the new multi-monitor intrinsic to allow monitoring multiple ethdev\nRx queues while entering the energy efficient power state. The multi\nversion will be used unconditionally if supported, and the UMWAIT one\nwill only be used when multi-monitor is not supported by the hardware.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n doc/guides/prog_guide/power_man.rst |  9 ++--\n lib/power/rte_power_pmd_mgmt.c      | 76 ++++++++++++++++++++++++++++-\n 2 files changed, 80 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/doc/guides/prog_guide/power_man.rst b/doc/guides/prog_guide/power_man.rst\nindex 38f876466a..defb61bdc4 100644\n--- a/doc/guides/prog_guide/power_man.rst\n+++ b/doc/guides/prog_guide/power_man.rst\n@@ -221,13 +221,16 @@ power saving whenever empty poll count reaches a certain number.\n The \"monitor\" mode is only supported in the following configurations and scenarios:\n \n * If ``rte_cpu_get_intrinsics_support()`` function indicates that\n+  ``rte_power_monitor_multi()`` function is supported by the platform, then\n+  monitoring multiple Ethernet Rx queues for traffic will be supported.\n+\n+* If ``rte_cpu_get_intrinsics_support()`` function indicates that only\n   ``rte_power_monitor()`` is supported by the platform, then monitoring will be\n   limited to a mapping of 1 core 1 queue (thus, each Rx queue will have to be\n   monitored from a different lcore).\n \n-* If ``rte_cpu_get_intrinsics_support()`` function indicates that the\n-  ``rte_power_monitor()`` function is not supported, then monitor mode will not\n-  be supported.\n+* If ``rte_cpu_get_intrinsics_support()`` function indicates that neither of the\n+  two monitoring functions are supported, then monitor mode will not be supported.\n \n * Not all Ethernet devices support monitoring, even if the underlying\n   platform may support the necessary CPU instructions. Support for monitoring is\ndiff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgmt.c\nindex 7762cd39b8..aab2d4f1ee 100644\n--- a/lib/power/rte_power_pmd_mgmt.c\n+++ b/lib/power/rte_power_pmd_mgmt.c\n@@ -155,6 +155,24 @@ queue_list_remove(struct pmd_core_cfg *cfg, const union queue *q)\n \treturn 0;\n }\n \n+static inline int\n+get_monitor_addresses(struct pmd_core_cfg *cfg,\n+\t\tstruct rte_power_monitor_cond *pmc)\n+{\n+\tconst struct queue_list_entry *qle;\n+\tsize_t i = 0;\n+\tint ret;\n+\n+\tTAILQ_FOREACH(qle, &cfg->head, next) {\n+\t\tstruct rte_power_monitor_cond *cur = &pmc[i];\n+\t\tconst union queue *q = &qle->queue;\n+\t\tret = rte_eth_get_monitor_addr(q->portid, q->qid, cur);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t}\n+\treturn 0;\n+}\n+\n static void\n calc_tsc(void)\n {\n@@ -183,6 +201,48 @@ calc_tsc(void)\n \t}\n }\n \n+static uint16_t\n+clb_multiwait(uint16_t port_id, uint16_t qidx,\n+\t\tstruct rte_mbuf **pkts __rte_unused, uint16_t nb_rx,\n+\t\tuint16_t max_pkts __rte_unused, void *addr __rte_unused)\n+{\n+\tconst unsigned int lcore = rte_lcore_id();\n+\tconst union queue q = {.portid = port_id, .qid = qidx};\n+\tconst bool empty = nb_rx == 0;\n+\tstruct pmd_core_cfg *q_conf;\n+\n+\tq_conf = &lcore_cfg[lcore];\n+\n+\t/* early exit */\n+\tif (likely(!empty)) {\n+\t\tq_conf->empty_poll_stats = 0;\n+\t} else {\n+\t\t/* do we care about this particular queue? */\n+\t\tif (!queue_is_power_save(q_conf, &q))\n+\t\t\treturn nb_rx;\n+\n+\t\t/*\n+\t\t * we can increment unconditionally here because if there were\n+\t\t * non-empty polls in other queues assigned to this core, we\n+\t\t * dropped the counter to zero anyway.\n+\t\t */\n+\t\tq_conf->empty_poll_stats++;\n+\t\tif (unlikely(q_conf->empty_poll_stats > EMPTYPOLL_MAX)) {\n+\t\t\tstruct rte_power_monitor_cond pmc[RTE_MAX_ETHPORTS];\n+\t\t\tuint16_t ret;\n+\n+\t\t\t/* gather all monitoring conditions */\n+\t\t\tret = get_monitor_addresses(q_conf, pmc);\n+\n+\t\t\tif (ret == 0)\n+\t\t\t\trte_power_monitor_multi(pmc,\n+\t\t\t\t\tq_conf->n_queues, UINT64_MAX);\n+\t\t}\n+\t}\n+\n+\treturn nb_rx;\n+}\n+\n static uint16_t\n clb_umwait(uint16_t port_id, uint16_t qidx, struct rte_mbuf **pkts __rte_unused,\n \t\tuint16_t nb_rx, uint16_t max_pkts __rte_unused,\n@@ -348,14 +408,19 @@ static int\n check_monitor(struct pmd_core_cfg *cfg, const union queue *qdata)\n {\n \tstruct rte_power_monitor_cond dummy;\n+\tbool multimonitor_supported;\n \n \t/* check if rte_power_monitor is supported */\n \tif (!global_data.intrinsics_support.power_monitor) {\n \t\tRTE_LOG(DEBUG, POWER, \"Monitoring intrinsics are not supported\\n\");\n \t\treturn -ENOTSUP;\n \t}\n+\t/* check if multi-monitor is supported */\n+\tmultimonitor_supported =\n+\t\t\tglobal_data.intrinsics_support.power_monitor_multi;\n \n-\tif (cfg->n_queues > 0) {\n+\t/* if we're adding a new queue, do we support multiple queues? */\n+\tif (cfg->n_queues > 0 && !multimonitor_supported) {\n \t\tRTE_LOG(DEBUG, POWER, \"Monitoring multiple queues is not supported\\n\");\n \t\treturn -ENOTSUP;\n \t}\n@@ -371,6 +436,13 @@ check_monitor(struct pmd_core_cfg *cfg, const union queue *qdata)\n \treturn 0;\n }\n \n+static inline rte_rx_callback_fn\n+get_monitor_callback(void)\n+{\n+\treturn global_data.intrinsics_support.power_monitor_multi ?\n+\t\tclb_multiwait : clb_umwait;\n+}\n+\n int\n rte_power_ethdev_pmgmt_queue_enable(unsigned int lcore_id, uint16_t port_id,\n \t\tuint16_t queue_id, enum rte_power_pmd_mgmt_type mode)\n@@ -434,7 +506,7 @@ rte_power_ethdev_pmgmt_queue_enable(unsigned int lcore_id, uint16_t port_id,\n \t\tif (ret < 0)\n \t\t\tgoto end;\n \n-\t\tclb = clb_umwait;\n+\t\tclb = get_monitor_callback();\n \t\tbreak;\n \tcase RTE_POWER_MGMT_TYPE_SCALE:\n \t\t/* check if we can add a new queue */\n",
    "prefixes": [
        "v2",
        "6/7"
    ]
}