Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/71800/?format=api
http://patchwork.dpdk.org/api/patches/71800/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/8db5cf85a95de3157b53f754715cabc8c9dbdad1.1592563994.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": "<8db5cf85a95de3157b53f754715cabc8c9dbdad1.1592563994.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/8db5cf85a95de3157b53f754715cabc8c9dbdad1.1592563994.git.anatoly.burakov@intel.com", "date": "2020-06-19T10:53:53", "name": "[v3,5/7] l3fwd-power: add interrupt-only mode", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "4646d6e5a02687d48e2f2c7a3f2e0d4bf675f6ec", "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/8db5cf85a95de3157b53f754715cabc8c9dbdad1.1592563994.git.anatoly.burakov@intel.com/mbox/", "series": [ { "id": 10521, "url": "http://patchwork.dpdk.org/api/series/10521/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=10521", "date": "2020-06-19T10:53:49", "name": "Add interrupt-only mode to l3fwd-power", "version": 3, "mbox": "http://patchwork.dpdk.org/series/10521/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/71800/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/71800/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id F1167A0518;\n\tFri, 19 Jun 2020 12:54:42 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 4BE641BED9;\n\tFri, 19 Jun 2020 12:54:09 +0200 (CEST)", "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n by dpdk.org (Postfix) with ESMTP id 4FA4A1BEA9\n for <dev@dpdk.org>; Fri, 19 Jun 2020 12:54:04 +0200 (CEST)", "from orsmga007.jf.intel.com ([10.7.209.58])\n by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 19 Jun 2020 03:54:04 -0700", "from silpixa00399498.ir.intel.com (HELO\n silpixa00399498.ger.corp.intel.com) ([10.237.222.52])\n by orsmga007.jf.intel.com with ESMTP; 19 Jun 2020 03:54:02 -0700" ], "IronPort-SDR": [ "\n dQf/XH59Pg2cln5l27cikqyIcGw3IOu/Vn9Imdf4yUhTsOIAjG3xLPb+MKxNsTgPXImpryLcg8\n idJ+FL2cQc0g==", "\n GQoiXgZd0PRx1i+EZG9sBiAO9p0JqRrKSnohx28xm9HPaBgHMG1Y+enYYjYuHTR2spGIabpwgU\n OYoglu6Kjz/w==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6000,8403,9656\"; a=\"131318780\"", "E=Sophos;i=\"5.75,255,1589266800\"; d=\"scan'208\";a=\"131318780\"", "E=Sophos;i=\"5.75,255,1589266800\"; d=\"scan'208\";a=\"263347545\"" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Cc": "David Hunt <david.hunt@intel.com>, reshma.pattan@intel.com,\n hkalra@marvell.com, jerinjacobk@gmail.com, yinan.wang@intel.com", "Date": "Fri, 19 Jun 2020 11:53:53 +0100", "Message-Id": "\n <8db5cf85a95de3157b53f754715cabc8c9dbdad1.1592563994.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": [ "<cover.1592563994.git.anatoly.burakov@intel.com>", "<cover.1592563994.git.anatoly.burakov@intel.com>" ], "References": [ "<cover.1592563994.git.anatoly.burakov@intel.com>", "<cover.1592500565.git.anatoly.burakov@intel.com>\n <cover.1592563994.git.anatoly.burakov@intel.com>" ], "Subject": "[dpdk-dev] [PATCH v3 5/7] l3fwd-power: add interrupt-only mode", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "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": "In addition to existing modes, add a mode which is very similar to\nlegacy mode, but does not do frequency scaling, and thus does not\ndepend on the power library.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\nTested-by: Yinan Wang <yinan.wang@intel.com>\n---\n examples/l3fwd-power/main.c | 188 +++++++++++++++++++++++++++++++++++-\n 1 file changed, 185 insertions(+), 3 deletions(-)", "diff": "diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c\nindex c02b0a3574..51acbfd87d 100644\n--- a/examples/l3fwd-power/main.c\n+++ b/examples/l3fwd-power/main.c\n@@ -198,7 +198,8 @@ enum appmode {\n \tAPP_MODE_DEFAULT = 0,\n \tAPP_MODE_LEGACY,\n \tAPP_MODE_EMPTY_POLL,\n-\tAPP_MODE_TELEMETRY\n+\tAPP_MODE_TELEMETRY,\n+\tAPP_MODE_INTERRUPT\n };\n \n enum appmode app_mode;\n@@ -901,6 +902,170 @@ static int event_register(struct lcore_conf *qconf)\n \n \treturn 0;\n }\n+\n+/* main processing loop */\n+static int main_intr_loop(__rte_unused void *dummy)\n+{\n+\tstruct rte_mbuf *pkts_burst[MAX_PKT_BURST];\n+\tunsigned int lcore_id;\n+\tuint64_t prev_tsc, diff_tsc, cur_tsc;\n+\tint i, j, nb_rx;\n+\tuint8_t queueid;\n+\tuint16_t portid;\n+\tstruct lcore_conf *qconf;\n+\tstruct lcore_rx_queue *rx_queue;\n+\tuint32_t lcore_rx_idle_count = 0;\n+\tuint32_t lcore_idle_hint = 0;\n+\tint intr_en = 0;\n+\n+\tconst uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) /\n+\t\t\t\t US_PER_S * BURST_TX_DRAIN_US;\n+\n+\tprev_tsc = 0;\n+\n+\tlcore_id = rte_lcore_id();\n+\tqconf = &lcore_conf[lcore_id];\n+\n+\tif (qconf->n_rx_queue == 0) {\n+\t\tRTE_LOG(INFO, L3FWD_POWER, \"lcore %u has nothing to do\\n\",\n+\t\t\t\tlcore_id);\n+\t\treturn 0;\n+\t}\n+\n+\tRTE_LOG(INFO, L3FWD_POWER, \"entering main interrupt loop on lcore %u\\n\",\n+\t\t\tlcore_id);\n+\n+\tfor (i = 0; i < qconf->n_rx_queue; i++) {\n+\t\tportid = qconf->rx_queue_list[i].port_id;\n+\t\tqueueid = qconf->rx_queue_list[i].queue_id;\n+\t\tRTE_LOG(INFO, L3FWD_POWER,\n+\t\t\t\t\" -- lcoreid=%u portid=%u rxqueueid=%hhu\\n\",\n+\t\t\t\tlcore_id, portid, queueid);\n+\t}\n+\n+\t/* add into event wait list */\n+\tif (event_register(qconf) == 0)\n+\t\tintr_en = 1;\n+\telse\n+\t\tRTE_LOG(INFO, L3FWD_POWER, \"RX interrupt won't enable.\\n\");\n+\n+\twhile (!is_done()) {\n+\t\tstats[lcore_id].nb_iteration_looped++;\n+\n+\t\tcur_tsc = rte_rdtsc();\n+\n+\t\t/*\n+\t\t * TX burst queue drain\n+\t\t */\n+\t\tdiff_tsc = cur_tsc - prev_tsc;\n+\t\tif (unlikely(diff_tsc > drain_tsc)) {\n+\t\t\tfor (i = 0; i < qconf->n_tx_port; ++i) {\n+\t\t\t\tportid = qconf->tx_port_id[i];\n+\t\t\t\trte_eth_tx_buffer_flush(portid,\n+\t\t\t\t\t\tqconf->tx_queue_id[portid],\n+\t\t\t\t\t\tqconf->tx_buffer[portid]);\n+\t\t\t}\n+\t\t\tprev_tsc = cur_tsc;\n+\t\t}\n+\n+start_rx:\n+\t\t/*\n+\t\t * Read packet from RX queues\n+\t\t */\n+\t\tlcore_rx_idle_count = 0;\n+\t\tfor (i = 0; i < qconf->n_rx_queue; ++i) {\n+\t\t\trx_queue = &(qconf->rx_queue_list[i]);\n+\t\t\trx_queue->idle_hint = 0;\n+\t\t\tportid = rx_queue->port_id;\n+\t\t\tqueueid = rx_queue->queue_id;\n+\n+\t\t\tnb_rx = rte_eth_rx_burst(portid, queueid, pkts_burst,\n+\t\t\t\t\tMAX_PKT_BURST);\n+\n+\t\t\tstats[lcore_id].nb_rx_processed += nb_rx;\n+\t\t\tif (unlikely(nb_rx == 0)) {\n+\t\t\t\t/**\n+\t\t\t\t * no packet received from rx queue, try to\n+\t\t\t\t * sleep for a while forcing CPU enter deeper\n+\t\t\t\t * C states.\n+\t\t\t\t */\n+\t\t\t\trx_queue->zero_rx_packet_count++;\n+\n+\t\t\t\tif (rx_queue->zero_rx_packet_count <=\n+\t\t\t\t\t\tMIN_ZERO_POLL_COUNT)\n+\t\t\t\t\tcontinue;\n+\n+\t\t\t\trx_queue->idle_hint = power_idle_heuristic(\n+\t\t\t\t\t\trx_queue->zero_rx_packet_count);\n+\t\t\t\tlcore_rx_idle_count++;\n+\t\t\t} else {\n+\t\t\t\trx_queue->zero_rx_packet_count = 0;\n+\t\t\t}\n+\n+\t\t\t/* Prefetch first packets */\n+\t\t\tfor (j = 0; j < PREFETCH_OFFSET && j < nb_rx; j++) {\n+\t\t\t\trte_prefetch0(rte_pktmbuf_mtod(\n+\t\t\t\t\t\tpkts_burst[j], void *));\n+\t\t\t}\n+\n+\t\t\t/* Prefetch and forward already prefetched packets */\n+\t\t\tfor (j = 0; j < (nb_rx - PREFETCH_OFFSET); j++) {\n+\t\t\t\trte_prefetch0(rte_pktmbuf_mtod(\n+\t\t\t\t\t\tpkts_burst[j + PREFETCH_OFFSET],\n+\t\t\t\t\t\tvoid *));\n+\t\t\t\tl3fwd_simple_forward(\n+\t\t\t\t\t\tpkts_burst[j], portid, qconf);\n+\t\t\t}\n+\n+\t\t\t/* Forward remaining prefetched packets */\n+\t\t\tfor (; j < nb_rx; j++) {\n+\t\t\t\tl3fwd_simple_forward(\n+\t\t\t\t\t\tpkts_burst[j], portid, qconf);\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (unlikely(lcore_rx_idle_count == qconf->n_rx_queue)) {\n+\t\t\t/**\n+\t\t\t * All Rx queues empty in recent consecutive polls,\n+\t\t\t * sleep in a conservative manner, meaning sleep as\n+\t\t\t * less as possible.\n+\t\t\t */\n+\t\t\tfor (i = 1,\n+\t\t\t lcore_idle_hint = qconf->rx_queue_list[0].idle_hint;\n+\t\t\t\t\ti < qconf->n_rx_queue; ++i) {\n+\t\t\t\trx_queue = &(qconf->rx_queue_list[i]);\n+\t\t\t\tif (rx_queue->idle_hint < lcore_idle_hint)\n+\t\t\t\t\tlcore_idle_hint = rx_queue->idle_hint;\n+\t\t\t}\n+\n+\t\t\tif (lcore_idle_hint < SUSPEND_THRESHOLD)\n+\t\t\t\t/**\n+\t\t\t\t * execute \"pause\" instruction to avoid context\n+\t\t\t\t * switch which generally take hundred of\n+\t\t\t\t * microseconds for short sleep.\n+\t\t\t\t */\n+\t\t\t\trte_delay_us(lcore_idle_hint);\n+\t\t\telse {\n+\t\t\t\t/* suspend until rx interrupt triggers */\n+\t\t\t\tif (intr_en) {\n+\t\t\t\t\tturn_on_off_intr(qconf, 1);\n+\t\t\t\t\tsleep_until_rx_interrupt(\n+\t\t\t\t\t\t\tqconf->n_rx_queue);\n+\t\t\t\t\tturn_on_off_intr(qconf, 0);\n+\t\t\t\t\t/**\n+\t\t\t\t\t * start receiving packets immediately\n+\t\t\t\t\t */\n+\t\t\t\t\tif (likely(!is_done()))\n+\t\t\t\t\t\tgoto start_rx;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tstats[lcore_id].sleep_time += lcore_idle_hint;\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n /* main processing loop */\n static int\n main_telemetry_loop(__rte_unused void *dummy)\n@@ -1440,7 +1605,8 @@ print_usage(const char *prgname)\n \t\t\" --empty-poll: enable empty poll detection\"\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\" empty polls, full polls, and core busyness to telemetry\\n\"\n+\t\t\" --interrupt-only: enable interrupt-only mode\\n\",\n \t\tprgname);\n }\n \n@@ -1585,6 +1751,7 @@ parse_ep_config(const char *q_arg)\n #define CMD_LINE_OPT_PARSE_PTYPE \"parse-ptype\"\n #define CMD_LINE_OPT_LEGACY \"legacy\"\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 \n /* Parse the argument given in the command line of the application */\n@@ -1606,6 +1773,7 @@ parse_args(int argc, char **argv)\n \t\t{CMD_LINE_OPT_PARSE_PTYPE, 0, 0, 0},\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{NULL, 0, 0, 0}\n \t};\n \n@@ -1716,6 +1884,17 @@ 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_INTERRUPT_ONLY,\n+\t\t\t\t\tsizeof(CMD_LINE_OPT_INTERRUPT_ONLY))) {\n+\t\t\t\tif (app_mode != APP_MODE_DEFAULT) {\n+\t\t\t\t\tprintf(\" interrupt-only mode is mutually exclusive with other modes\\n\");\n+\t\t\t\t\treturn -1;\n+\t\t\t\t}\n+\t\t\t\tapp_mode = APP_MODE_INTERRUPT;\n+\t\t\t\tprintf(\"interrupt-only mode is enabled\\n\");\n+\t\t\t}\n+\n \t\t\tif (!strncmp(lgopts[option_index].name,\n \t\t\t\t\t\"enable-jumbo\", 12)) {\n \t\t\t\tstruct option lenopts =\n@@ -2298,7 +2477,8 @@ main(int argc, char **argv)\n \tRTE_ETH_FOREACH_DEV(portid) {\n \t\tstruct rte_eth_conf local_port_conf = port_conf;\n \t\t/* not all app modes need interrupts */\n-\t\tbool need_intr = app_mode == APP_MODE_LEGACY;\n+\t\tbool need_intr = app_mode == APP_MODE_LEGACY ||\n+\t\t\t\tapp_mode == APP_MODE_INTERRUPT;\n \n \t\t/* skip ports that are not enabled */\n \t\tif ((enabled_port_mask & (1 << portid)) == 0) {\n@@ -2576,6 +2756,8 @@ main(int argc, char **argv)\n \t\t\t\t\"Returns global power stats. Parameters: None\");\n \t\trte_eal_mp_remote_launch(main_telemetry_loop, NULL,\n \t\t\t\t\t\tSKIP_MASTER);\n+\t} else if (app_mode == APP_MODE_INTERRUPT) {\n+\t\trte_eal_mp_remote_launch(main_intr_loop, NULL, CALL_MASTER);\n \t}\n \n \tif (app_mode == APP_MODE_EMPTY_POLL || app_mode == APP_MODE_TELEMETRY)\n", "prefixes": [ "v3", "5/7" ] }{ "id": 71800, "url": "