get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 94984,
    "url": "http://patchwork.dpdk.org/api/patches/94984/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/351ec2cd10ee91e9497330447783ed8d26789aad.1624981670.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": "<351ec2cd10ee91e9497330447783ed8d26789aad.1624981670.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/351ec2cd10ee91e9497330447783ed8d26789aad.1624981670.git.anatoly.burakov@intel.com",
    "date": "2021-06-29T15:48:29",
    "name": "[v5,6/7] power: support monitoring multiple Rx queues",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "2f2af75d347c85bb17f3aa46fce6b5b0d936d2a5",
    "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/351ec2cd10ee91e9497330447783ed8d26789aad.1624981670.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 17525,
            "url": "http://patchwork.dpdk.org/api/series/17525/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=17525",
            "date": "2021-06-29T15:48:25",
            "name": "Enhancements for PMD power management",
            "version": 5,
            "mbox": "http://patchwork.dpdk.org/series/17525/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/94984/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/94984/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 CCF59A0C3F;\n\tTue, 29 Jun 2021 17:50:00 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 2EBBA411E3;\n\tTue, 29 Jun 2021 17:49:35 +0200 (CEST)",
            "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n by mails.dpdk.org (Postfix) with ESMTP id 1C5E3411C0\n for <dev@dpdk.org>; Tue, 29 Jun 2021 17:49:27 +0200 (CEST)",
            "from orsmga006.jf.intel.com ([10.7.209.51])\n by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 29 Jun 2021 08:48:46 -0700",
            "from silpixa00399498.ir.intel.com (HELO\n silpixa00399498.ger.corp.intel.com) ([10.237.223.53])\n by orsmga006.jf.intel.com with ESMTP; 29 Jun 2021 08:48:45 -0700"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10030\"; a=\"269304859\"",
            "E=Sophos;i=\"5.83,309,1616482800\"; d=\"scan'208\";a=\"269304859\"",
            "E=Sophos;i=\"5.83,309,1616482800\"; d=\"scan'208\";a=\"408213665\""
        ],
        "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": "Tue, 29 Jun 2021 15:48:29 +0000",
        "Message-Id": "\n <351ec2cd10ee91e9497330447783ed8d26789aad.1624981670.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<cover.1624981669.git.anatoly.burakov@intel.com>",
        "References": "<cover.1624895595.git.anatoly.burakov@intel.com>\n <cover.1624981669.git.anatoly.burakov@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v5 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      | 81 ++++++++++++++++++++++++++++-\n 2 files changed, 85 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/doc/guides/prog_guide/power_man.rst b/doc/guides/prog_guide/power_man.rst\nindex ec04a72108..94353ca012 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 drivers 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 fccfd236c2..2056996b9c 100644\n--- a/lib/power/rte_power_pmd_mgmt.c\n+++ b/lib/power/rte_power_pmd_mgmt.c\n@@ -124,6 +124,32 @@ queue_list_take(struct pmd_core_cfg *cfg, const union queue *q)\n \treturn found;\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@@ -190,6 +216,45 @@ lcore_can_sleep(struct pmd_core_cfg *cfg)\n \treturn true;\n }\n \n+static uint16_t\n+clb_multiwait(uint16_t port_id __rte_unused, uint16_t qidx __rte_unused,\n+\t\tstruct rte_mbuf **pkts __rte_unused, uint16_t nb_rx,\n+\t\tuint16_t max_pkts __rte_unused, void *arg)\n+{\n+\tconst unsigned int lcore = rte_lcore_id();\n+\tstruct queue_list_entry *queue_conf = arg;\n+\tstruct pmd_core_cfg *lcore_conf;\n+\tconst bool empty = nb_rx == 0;\n+\n+\tlcore_conf = &lcore_cfgs[lcore];\n+\n+\t/* early exit */\n+\tif (likely(!empty))\n+\t\t/* early exit */\n+\t\tqueue_reset(lcore_conf, queue_conf);\n+\telse {\n+\t\tstruct rte_power_monitor_cond pmc[RTE_MAX_ETHPORTS];\n+\t\tint ret;\n+\n+\t\t/* can this queue sleep? */\n+\t\tif (!queue_can_sleep(lcore_conf, queue_conf))\n+\t\t\treturn nb_rx;\n+\n+\t\t/* can this lcore sleep? */\n+\t\tif (!lcore_can_sleep(lcore_conf))\n+\t\t\treturn nb_rx;\n+\n+\t\t/* gather all monitoring conditions */\n+\t\tret = get_monitor_addresses(lcore_conf, pmc, RTE_DIM(pmc));\n+\t\tif (ret < 0)\n+\t\t\treturn nb_rx;\n+\n+\t\trte_power_monitor_multi(pmc, lcore_conf->n_queues, UINT64_MAX);\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, void *arg)\n@@ -341,14 +406,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@@ -364,6 +434,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@@ -428,7 +505,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": [
        "v5",
        "6/7"
    ]
}