get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 94905,
    "url": "http://patchwork.dpdk.org/api/patches/94905/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/94d79ab2b78d18048d71cd2980a9667bc35afb07.1624895595.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": "<94d79ab2b78d18048d71cd2980a9667bc35afb07.1624895595.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/94d79ab2b78d18048d71cd2980a9667bc35afb07.1624895595.git.anatoly.burakov@intel.com",
    "date": "2021-06-28T15:54:13",
    "name": "[v4,6/7] power: support monitoring multiple Rx queues",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "dfa119cdd7f097792b5f3da666c5b56c7eb0bf58",
    "submitter": {
        "id": 4,
        "url": "http://patchwork.dpdk.org/api/people/4/?format=api",
        "name": "Anatoly Burakov",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/94d79ab2b78d18048d71cd2980a9667bc35afb07.1624895595.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 17504,
            "url": "http://patchwork.dpdk.org/api/series/17504/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=17504",
            "date": "2021-06-28T15:54:07",
            "name": "Enhancements for PMD power management",
            "version": 4,
            "mbox": "http://patchwork.dpdk.org/series/17504/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/94905/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/94905/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 68E59A0A0C;\n\tMon, 28 Jun 2021 17:55:04 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 9B3F64116D;\n\tMon, 28 Jun 2021 17:54:43 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n by mails.dpdk.org (Postfix) with ESMTP id 6C9B94115E\n for <dev@dpdk.org>; Mon, 28 Jun 2021 17:54:32 +0200 (CEST)",
            "from orsmga005.jf.intel.com ([10.7.209.41])\n by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 28 Jun 2021 08:54:31 -0700",
            "from silpixa00399498.ir.intel.com (HELO\n silpixa00399498.ger.corp.intel.com) ([10.237.223.53])\n by orsmga005.jf.intel.com with ESMTP; 28 Jun 2021 08:54:30 -0700"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10029\"; a=\"204975518\"",
            "E=Sophos;i=\"5.83,306,1616482800\"; d=\"scan'208\";a=\"204975518\"",
            "E=Sophos;i=\"5.83,306,1616482800\"; d=\"scan'208\";a=\"625296703\""
        ],
        "X-ExtLoop1": "1",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org,\n\tDavid Hunt <david.hunt@intel.com>",
        "Cc": "konstantin.ananyev@intel.com,\n\tciara.loftus@intel.com",
        "Date": "Mon, 28 Jun 2021 15:54:13 +0000",
        "Message-Id": "\n <94d79ab2b78d18048d71cd2980a9667bc35afb07.1624895595.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<cover.1624895595.git.anatoly.burakov@intel.com>",
        "References": "<cover.1624884053.git.anatoly.burakov@intel.com>\n <cover.1624895595.git.anatoly.burakov@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v4 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\nNotes:\n    v4:\n    - Fix possible out of bounds access\n    - Added missing index increment\n\n doc/guides/prog_guide/power_man.rst |  9 ++--\n lib/power/rte_power_pmd_mgmt.c      | 84 ++++++++++++++++++++++++++++-\n 2 files changed, 88 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/doc/guides/prog_guide/power_man.rst b/doc/guides/prog_guide/power_man.rst\nindex fac2c19516..3245a5ebed 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. Please refer to\ndiff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgmt.c\nindex 7762cd39b8..97c9f1ea36 100644\n--- a/lib/power/rte_power_pmd_mgmt.c\n+++ b/lib/power/rte_power_pmd_mgmt.c\n@@ -155,6 +155,32 @@ 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, size_t len)\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\tconst union queue *q = &qle->queue;\n+\t\tstruct rte_power_monitor_cond *cur;\n+\n+\t\t/* attempted out of bounds access */\n+\t\tif (i >= len) {\n+\t\t\tRTE_LOG(ERR, POWER, \"Too many queues being monitored\\n\");\n+\t\t\treturn -1;\n+\t\t}\n+\n+\t\tcur = &pmc[i++];\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 +209,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, RTE_DIM(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 +416,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 +444,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 +514,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": [
        "v4",
        "6/7"
    ]
}