get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 40816,
    "url": "http://patchwork.dpdk.org/api/patches/40816/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1528451833-3617-2-git-send-email-liang.j.ma@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": "<1528451833-3617-2-git-send-email-liang.j.ma@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1528451833-3617-2-git-send-email-liang.j.ma@intel.com",
    "date": "2018-06-08T09:57:13",
    "name": "[dpdk-dev,v1,2/2] examples/l3fwd-power: simple app update to support new API",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "d09832c0ec7bfec165c94c10361c24a9241fdfb3",
    "submitter": {
        "id": 904,
        "url": "http://patchwork.dpdk.org/api/people/904/?format=api",
        "name": "Liang, Ma",
        "email": "liang.j.ma@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/1528451833-3617-2-git-send-email-liang.j.ma@intel.com/mbox/",
    "series": [
        {
            "id": 48,
            "url": "http://patchwork.dpdk.org/api/series/48/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=48",
            "date": "2018-06-08T09:57:12",
            "name": "[dpdk-dev,v1,1/2] lib/librte_power: traffic pattern aware power control",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/48/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/40816/comments/",
    "check": "fail",
    "checks": "http://patchwork.dpdk.org/api/patches/40816/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 2D3C95F2F;\n\tFri,  8 Jun 2018 11:57:42 +0200 (CEST)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby dpdk.org (Postfix) with ESMTP id 1C78D5F0D\n\tfor <dev@dpdk.org>; Fri,  8 Jun 2018 11:57:39 +0200 (CEST)",
            "from orsmga004.jf.intel.com ([10.7.209.38])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t08 Jun 2018 02:57:38 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga004.jf.intel.com with ESMTP; 08 Jun 2018 02:57:37 -0700",
            "from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com\n\t[10.237.217.45])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tw589vbep028840; Fri, 8 Jun 2018 10:57:37 +0100",
            "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w589vaqS003791;\n\tFri, 8 Jun 2018 10:57:36 +0100",
            "(from lma25@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w589vaBs003787;\n\tFri, 8 Jun 2018 10:57:36 +0100"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.49,490,1520924400\"; d=\"scan'208\";a=\"206373292\"",
        "From": "Liang Ma <liang.j.ma@intel.com>",
        "To": "david.hunt@intel.com",
        "Cc": "dev@dpdk.org, radu.nicolau@intel.com, Liang Ma <liang.j.ma@intel.com>",
        "Date": "Fri,  8 Jun 2018 10:57:13 +0100",
        "Message-Id": "<1528451833-3617-2-git-send-email-liang.j.ma@intel.com>",
        "X-Mailer": "git-send-email 1.7.7.4",
        "In-Reply-To": "<1528451833-3617-1-git-send-email-liang.j.ma@intel.com>",
        "References": "<1528451833-3617-1-git-send-email-liang.j.ma@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v1 2/2] examples/l3fwd-power: simple app update\n\tto support new API",
        "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://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Add the support for new traffic pattern aware power control\npower management API.\n\nExample:\n./l3fwd-power -l xxx   -n 4   -w 0000:xx:00.0 -w 0000:xx:00.1 -- -p 0x3\n-P --config=\"(0,0,xx),(1,0,xx)\" --empty-poll\n\nSigned-off-by: Liang Ma <liang.j.ma@intel.com>\n---\n examples/l3fwd-power/main.c | 229 ++++++++++++++++++++++++++++++++++++++++----\n 1 file changed, 211 insertions(+), 18 deletions(-)",
    "diff": "diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c\nindex 596d645..22a0e4e 100644\n--- a/examples/l3fwd-power/main.c\n+++ b/examples/l3fwd-power/main.c\n@@ -43,6 +43,7 @@\n #include <rte_timer.h>\n #include <rte_power.h>\n #include <rte_spinlock.h>\n+#include <rte_empty_poll.h>\n \n #define RTE_LOGTYPE_L3FWD_POWER RTE_LOGTYPE_USER1\n \n@@ -129,6 +130,9 @@ static uint32_t enabled_port_mask = 0;\n static int promiscuous_on = 0;\n /* NUMA is enabled by default. */\n static int numa_on = 1;\n+/* emptypoll is disabled by default. */\n+static bool empty_poll_on;\n+volatile bool empty_poll_stop;\n static int parse_ptype; /**< Parse packet type using rx callback, and */\n \t\t\t/**< disabled by default */\n \n@@ -336,6 +340,10 @@ static inline uint32_t power_idle_heuristic(uint32_t zero_rx_packet_count);\n static inline enum freq_scale_hint_t power_freq_scaleup_heuristic( \\\n \t\tunsigned int lcore_id, uint16_t port_id, uint16_t queue_id);\n \n+static int is_done(void)\n+{\n+\treturn empty_poll_stop;\n+}\n /* exit signal handler */\n static void\n signal_exit_now(int sigtype)\n@@ -344,7 +352,15 @@ signal_exit_now(int sigtype)\n \tunsigned int portid;\n \tint ret;\n \n+\tRTE_SET_USED(lcore_id);\n+\tRTE_SET_USED(portid);\n+\tRTE_SET_USED(ret);\n+\n \tif (sigtype == SIGINT) {\n+\t\tif (empty_poll_on)\n+\t\t\tempty_poll_stop = true;\n+\n+\n \t\tfor (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {\n \t\t\tif (rte_lcore_is_enabled(lcore_id) == 0)\n \t\t\t\tcontinue;\n@@ -353,20 +369,23 @@ signal_exit_now(int sigtype)\n \t\t\tret = rte_power_exit(lcore_id);\n \t\t\tif (ret)\n \t\t\t\trte_exit(EXIT_FAILURE, \"Power management \"\n-\t\t\t\t\t\"library de-initialization failed on \"\n-\t\t\t\t\t\t\t\"core%u\\n\", lcore_id);\n+\t\t\t\t\t\t\"library de-initialization failed on \"\n+\t\t\t\t\t\t\"core%u\\n\", lcore_id);\n \t\t}\n \n-\t\tRTE_ETH_FOREACH_DEV(portid) {\n-\t\t\tif ((enabled_port_mask & (1 << portid)) == 0)\n-\t\t\t\tcontinue;\n+\t\tif (!empty_poll_on) {\n+\t\t\tRTE_ETH_FOREACH_DEV(portid) {\n+\t\t\t\tif ((enabled_port_mask & (1 << portid)) == 0)\n+\t\t\t\t\tcontinue;\n \n-\t\t\trte_eth_dev_stop(portid);\n-\t\t\trte_eth_dev_close(portid);\n+\t\t\t\trte_eth_dev_stop(portid);\n+\t\t\t\trte_eth_dev_close(portid);\n+\t\t\t}\n \t\t}\n \t}\n \n-\trte_exit(EXIT_SUCCESS, \"User forced exit\\n\");\n+\tif (!empty_poll_on)\n+\t\trte_exit(EXIT_SUCCESS, \"User forced exit\\n\");\n }\n \n /*  Freqency scale down timer callback */\n@@ -831,6 +850,108 @@ static int event_register(struct lcore_conf *qconf)\n \n \treturn 0;\n }\n+/* main processing loop */\n+static int\n+main_empty_poll_loop(__attribute__((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+\n+\tconst uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) / 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\", lcore_id);\n+\t\treturn 0;\n+\t}\n+\n+\tRTE_LOG(INFO, L3FWD_POWER, \"entering main empty_poll loop on lcore %u\\n\", lcore_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, \" -- lcoreid=%u portid=%u \"\n+\t\t\t\t\"rxqueueid=%hhu\\n\", lcore_id, portid, queueid);\n+\t}\n+\n+\twhile (!is_done()) {\n+\t\tstats[lcore_id].nb_iteration_looped++;\n+\n+\t\tcur_tsc = rte_rdtsc();\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+\t\t/*\n+\t\t * Read packet from RX queues\n+\t\t */\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+\n+\t\t\tif (nb_rx == 0) {\n+\n+\t\t\t\trte_empty_poll_stat_update(lcore_id);\n+\n+\t\t\t\tcontinue;\n+\t\t\t} else {\n+\t\t\t\trte_poll_stat_update(lcore_id, nb_rx);\n+\t\t\t}\n+\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\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(pkts_burst[\n+\t\t\t\t\t\t\tj + PREFETCH_OFFSET], void *));\n+\t\t\t\tl3fwd_simple_forward(pkts_burst[j], portid,\n+\t\t\t\t\t\tqconf);\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(pkts_burst[j], portid,\n+\t\t\t\t\t\tqconf);\n+\t\t\t}\n+\n+\t\t}\n+\n+\t}\n+\n+\treturn 0;\n+}\n \n /* main processing loop */\n static int\n@@ -1128,7 +1249,8 @@ print_usage(const char *prgname)\n \t\t\"  --no-numa: optional, disable numa awareness\\n\"\n \t\t\"  --enable-jumbo: enable jumbo frame\"\n \t\t\" which max packet len is PKTLEN in decimal (64-9600)\\n\"\n-\t\t\"  --parse-ptype: parse packet type by software\\n\",\n+\t\t\"  --parse-ptype: parse packet type by software\\n\"\n+\t\t\"  --empty=poll: enable empty poll detection\\n\",\n \t\tprgname);\n }\n \n@@ -1231,10 +1353,12 @@ parse_args(int argc, char **argv)\n \tint opt, ret;\n \tchar **argvopt;\n \tint option_index;\n+\tuint32_t limit;\n \tchar *prgname = argv[0];\n \tstatic struct option lgopts[] = {\n \t\t{\"config\", 1, 0, 0},\n \t\t{\"no-numa\", 0, 0, 0},\n+\t\t{\"empty-poll\", 0, 0, 0},\n \t\t{\"enable-jumbo\", 0, 0, 0},\n \t\t{CMD_LINE_OPT_PARSE_PTYPE, 0, 0, 0},\n \t\t{NULL, 0, 0, 0}\n@@ -1259,7 +1383,18 @@ parse_args(int argc, char **argv)\n \t\t\tprintf(\"Promiscuous mode selected\\n\");\n \t\t\tpromiscuous_on = 1;\n \t\t\tbreak;\n-\n+\t\tcase 'l':\n+\t\t\tlimit = parse_portmask(optarg);\n+\t\t\trte_empty_poll_set_freq(LOW, limit);\n+\t\t\tbreak;\n+\t\tcase 'm':\n+\t\t\tlimit = parse_portmask(optarg);\n+\t\t\trte_empty_poll_set_freq(MED, limit);\n+\t\t\tbreak;\n+\t\tcase 'h':\n+\t\t\tlimit = parse_portmask(optarg);\n+\t\t\trte_empty_poll_set_freq(HGH, limit);\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@@ -1278,6 +1413,12 @@ parse_args(int argc, char **argv)\n \t\t\t}\n \n \t\t\tif (!strncmp(lgopts[option_index].name,\n+\t\t\t\t\t\t\"empty-poll\", 10)) {\n+\t\t\t\tprintf(\"empty-poll is enabled\\n\");\n+\t\t\t\tempty_poll_on = true;\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 \t\t\t\t\t{\"max-pkt-len\", required_argument, \\\n@@ -1609,6 +1750,41 @@ static int check_ptype(uint16_t portid)\n \n }\n \n+static int\n+launch_timer(unsigned int lcore_id)\n+{\n+\tint64_t prev_tsc = 0, cur_tsc, diff_tsc, cycles_10ms;\n+\n+\tRTE_SET_USED(lcore_id);\n+\n+\n+\tif (rte_get_master_lcore() != lcore_id) {\n+\t\trte_panic(\"timer on lcore:%d which is not master core:%d\\n\",\n+\t\t\t\tlcore_id,\n+\t\t\t\trte_get_master_lcore());\n+\t}\n+\n+\tRTE_LOG(INFO, POWER, \"Bring up the Timer\\n\");\n+\n+\trte_empty_poll_setup_timer();\n+\n+\tcycles_10ms = rte_get_timer_hz() / 100;\n+\n+\twhile (!is_done()) {\n+\t\tcur_tsc = rte_rdtsc();\n+\t\tdiff_tsc = cur_tsc - prev_tsc;\n+\t\tif (diff_tsc > cycles_10ms) {\n+\t\t\trte_timer_manage();\n+\t\t\tprev_tsc = cur_tsc;\n+\t\t\tcycles_10ms = rte_get_timer_hz() / 100;\n+\t\t}\n+\t}\n+\n+\tRTE_LOG(INFO, POWER, \"Timer_subsystem is done\\n\");\n+\n+\treturn 0;\n+}\n+\n int\n main(int argc, char **argv)\n {\n@@ -1780,14 +1956,15 @@ main(int argc, char **argv)\n \t\t\t\t\"Library initialization failed on core %u\\n\", lcore_id);\n \n \t\t/* init timer structures for each enabled lcore */\n-\t\trte_timer_init(&power_timers[lcore_id]);\n-\t\thz = rte_get_timer_hz();\n-\t\trte_timer_reset(&power_timers[lcore_id],\n-\t\t\thz/TIMER_NUMBER_PER_SECOND, SINGLE, lcore_id,\n-\t\t\t\t\t\tpower_timer_cb, NULL);\n-\n+\t\tif (empty_poll_on == false) {\n+\t\t\trte_timer_init(&power_timers[lcore_id]);\n+\t\t\thz = rte_get_timer_hz();\n+\t\t\trte_timer_reset(&power_timers[lcore_id],\n+\t\t\t\t\thz/TIMER_NUMBER_PER_SECOND, SINGLE, lcore_id,\n+\t\t\t\t\tpower_timer_cb, NULL);\n+\t\t}\n \t\tqconf = &lcore_conf[lcore_id];\n-\t\tprintf(\"\\nInitializing rx queues on lcore %u ... \", lcore_id );\n+\t\tprintf(\"\\nInitializing rx queues on lcore %u ...\\n\", lcore_id);\n \t\tfflush(stdout);\n \t\t/* init RX queues */\n \t\tfor(queue = 0; queue < qconf->n_rx_queue; ++queue) {\n@@ -1856,12 +2033,28 @@ main(int argc, char **argv)\n \n \tcheck_all_ports_link_status(enabled_port_mask);\n \n+\tif (empty_poll_on == true)\n+\t\trte_empty_poll_stat_init();\n+\n+\n \t/* launch per-lcore init on every lcore */\n-\trte_eal_mp_remote_launch(main_loop, NULL, CALL_MASTER);\n+\tif (empty_poll_on == false) {\n+\t\trte_eal_mp_remote_launch(main_loop, NULL, CALL_MASTER);\n+\t} else {\n+\t\tempty_poll_stop = false;\n+\t\trte_eal_mp_remote_launch(main_empty_poll_loop, NULL, SKIP_MASTER);\n+\t}\n+\n+\tif (empty_poll_on == true)\n+\t\tlaunch_timer(rte_lcore_id());\n+\n \tRTE_LCORE_FOREACH_SLAVE(lcore_id) {\n \t\tif (rte_eal_wait_lcore(lcore_id) < 0)\n \t\t\treturn -1;\n \t}\n \n+\tif (empty_poll_on)\n+\t\trte_empty_poll_stat_free();\n+\n \treturn 0;\n }\n",
    "prefixes": [
        "dpdk-dev",
        "v1",
        "2/2"
    ]
}