get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 204,
    "url": "https://patches.dpdk.org/api/patches/204/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1408947174-11323-3-git-send-email-cunming.liang@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": "<1408947174-11323-3-git-send-email-cunming.liang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1408947174-11323-3-git-send-email-cunming.liang@intel.com",
    "date": "2014-08-25T06:12:51",
    "name": "[dpdk-dev,2/5] app/test: measure standalone rx or tx cycles/packet",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "309398e381bfc0d35cadb04afa7baeaf427b6e34",
    "submitter": {
        "id": 46,
        "url": "https://patches.dpdk.org/api/people/46/?format=api",
        "name": "Cunming Liang",
        "email": "cunming.liang@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1408947174-11323-3-git-send-email-cunming.liang@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/204/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/204/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<cliang18@shecgisg004.sh.intel.com>",
        "Received": [
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id 45775B385\n\tfor <dev@dpdk.org>; Mon, 25 Aug 2014 08:09:42 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga101.jf.intel.com with ESMTP; 24 Aug 2014 23:13:35 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby orsmga001.jf.intel.com with ESMTP; 24 Aug 2014 23:13:34 -0700",
            "from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com\n\t[10.239.29.89])\n\tby shvmail01.sh.intel.com with ESMTP id s7P6DWbH012203;\n\tMon, 25 Aug 2014 14:13:32 +0800",
            "from shecgisg004.sh.intel.com (localhost [127.0.0.1])\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP\n\tid s7P6DTAo011389; Mon, 25 Aug 2014 14:13:31 +0800",
            "(from cliang18@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s7P6DSqI011385; \n\tMon, 25 Aug 2014 14:13:28 +0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.04,395,1406617200\"; d=\"scan'208\";a=\"562947739\"",
        "From": "Cunming Liang <cunming.liang@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Mon, 25 Aug 2014 14:12:51 +0800",
        "Message-Id": "<1408947174-11323-3-git-send-email-cunming.liang@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "In-Reply-To": "<1408947174-11323-1-git-send-email-cunming.liang@intel.com>",
        "References": "<1408947174-11323-1-git-send-email-cunming.liang@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 2/5] app/test: measure standalone rx or tx\n\tcycles/packet",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://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": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-List-Received-Date": "Mon, 25 Aug 2014 06:09:43 -0000"
    },
    "content": "Signed-off-by: Cunming Liang <cunming.liang@intel.com>\nAcked-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n app/test/commands.c      |  38 ++++++++++\n app/test/test.h          |   1 +\n app/test/test_pmd_perf.c | 175 +++++++++++++++++++++++++++++++++++++++--------\n 3 files changed, 185 insertions(+), 29 deletions(-)",
    "diff": "diff --git a/app/test/commands.c b/app/test/commands.c\nindex d0e583e..8721e25 100644\n--- a/app/test/commands.c\n+++ b/app/test/commands.c\n@@ -490,6 +490,43 @@ cmdline_parse_inst_t cmd_set_rxtx = {\n \n /****************/\n \n+/****************/\n+\n+struct cmd_set_rxtx_anchor {\n+\tcmdline_fixed_string_t set;\n+\tcmdline_fixed_string_t type;\n+};\n+\n+static void\n+cmd_set_rxtx_anchor_parsed(void *parsed_result,\n+\t\t\t   struct cmdline *cl,\n+\t\t\t   __attribute__((unused)) void *data)\n+{\n+\tstruct cmd_set_rxtx_anchor *res = parsed_result;\n+\tif (test_set_rxtx_anchor(res->type) < 0)\n+\t\tcmdline_printf(cl, \"Cannot find such anchor\\n\");\n+}\n+\n+cmdline_parse_token_string_t cmd_set_rxtx_anchor_set =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_rxtx_anchor, set,\n+\t\t\t\t \"set_rxtx_anchor\");\n+\n+cmdline_parse_token_string_t cmd_set_rxtx_anchor_type =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_rxtx_anchor, type, NULL);\n+\n+cmdline_parse_inst_t cmd_set_rxtx_anchor = {\n+\t.f = cmd_set_rxtx_anchor_parsed,  /* function to call */\n+\t.data = NULL,      /* 2nd arg of func */\n+\t.help_str = \"set rxtx anchor: \"\n+\t\t\t\"set_rxtx_anchor <type>\",\n+\t.tokens = {        /* token list, NULL terminated */\n+\t\t(void *)&cmd_set_rxtx_anchor_set,\n+\t\t(void *)&cmd_set_rxtx_anchor_type,\n+\t\tNULL,\n+\t},\n+};\n+\n+/****************/\n \n cmdline_parse_ctx_t main_ctx[] = {\n \t(cmdline_parse_inst_t *)&cmd_autotest,\n@@ -498,6 +535,7 @@ cmdline_parse_ctx_t main_ctx[] = {\n \t(cmdline_parse_inst_t *)&cmd_set_ring,\n \t(cmdline_parse_inst_t *)&cmd_quit,\n \t(cmdline_parse_inst_t *)&cmd_set_rxtx,\n+\t(cmdline_parse_inst_t *)&cmd_set_rxtx_anchor,\n \tNULL,\n };\n \ndiff --git a/app/test/test.h b/app/test/test.h\nindex ad01eec..c24ce9f 100644\n--- a/app/test/test.h\n+++ b/app/test/test.h\n@@ -185,6 +185,7 @@ int test_devargs(void);\n int test_link_bonding(void);\n int test_pmd_perf(void);\n int test_set_rxtx_conf(cmdline_fixed_string_t mode);\n+int test_set_rxtx_anchor(cmdline_fixed_string_t type);\n \n \n int test_pci_run;\ndiff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c\nindex ee527d3..5d02fac 100644\n--- a/app/test/test_pmd_perf.c\n+++ b/app/test/test_pmd_perf.c\n@@ -364,6 +364,125 @@ signal_handler(int signum)\n #define MAX_TRAFIC_BURST                (4096)\n struct rte_mbuf *tx_burst[MAX_TRAFIC_BURST];\n \n+uint64_t (*do_measure)(struct lcore_conf *conf,\n+\t\t       struct rte_mbuf *pkts_burst[],\n+\t\t       uint64_t total_pkts);\n+\n+static uint64_t\n+measure_rxtx(struct lcore_conf *conf,\n+\t     struct rte_mbuf *pkts_burst[],\n+\t     uint64_t total_pkts)\n+{\n+\tunsigned i, portid, nb_rx, nb_tx;\n+\tuint64_t prev_tsc, cur_tsc;\n+\n+\tprev_tsc = rte_rdtsc();\n+\n+\twhile (likely(!stop)) {\n+\t\tfor (i = 0; i < conf->nb_ports; i++) {\n+\t\t\tportid = conf->portlist[i];\n+\t\t\tnb_rx = rte_eth_rx_burst((uint8_t) portid, 0,\n+\t\t\t\t\t\t pkts_burst, MAX_PKT_BURST);\n+\t\t\tif (unlikely(nb_rx == 0)) {\n+\t\t\t\tidle++;\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\n+\t\t\tcount += nb_rx;\n+\t\t\tnb_tx = rte_eth_tx_burst(portid, 0, pkts_burst, nb_rx);\n+\t\t\tif (unlikely(nb_tx < nb_rx)) {\n+\t\t\t\tdrop += (nb_rx - nb_tx);\n+\t\t\t\tdo {\n+\t\t\t\t\trte_pktmbuf_free(pkts_burst[nb_tx]);\n+\t\t\t\t} while (++nb_tx < nb_rx);\n+\t\t\t}\n+\t\t}\n+\t\tif (unlikely(count >= total_pkts))\n+\t\t\tbreak;\n+\t}\n+\n+\tcur_tsc = rte_rdtsc();\n+\n+\treturn cur_tsc - prev_tsc;\n+}\n+\n+static uint64_t\n+measure_rxonly(struct lcore_conf *conf,\n+\t       struct rte_mbuf *pkts_burst[],\n+\t       uint64_t total_pkts)\n+{\n+\tunsigned i, portid, nb_rx, nb_tx;\n+\tuint64_t diff_tsc, cur_tsc;\n+\n+\tdiff_tsc = 0;\n+\twhile (likely(!stop)) {\n+\t\tfor (i = 0; i < conf->nb_ports; i++) {\n+\t\t\tportid = conf->portlist[i];\n+\n+\t\t\tcur_tsc = rte_rdtsc();\n+\t\t\tnb_rx = rte_eth_rx_burst((uint8_t) portid, 0,\n+\t\t\t\t\t\t pkts_burst, MAX_PKT_BURST);\n+\t\t\tif (unlikely(nb_rx == 0)) {\n+\t\t\t\tidle++;\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tdiff_tsc += rte_rdtsc() - cur_tsc;\n+\n+\t\t\tcount += nb_rx;\n+\t\t\tnb_tx = rte_eth_tx_burst(portid, 0, pkts_burst, nb_rx);\n+\t\t\tif (unlikely(nb_tx < nb_rx)) {\n+\t\t\t\tdrop += (nb_rx - nb_tx);\n+\t\t\t\tdo {\n+\t\t\t\t\trte_pktmbuf_free(pkts_burst[nb_tx]);\n+\t\t\t\t} while (++nb_tx < nb_rx);\n+\t\t\t}\n+\t\t}\n+\t\tif (unlikely(count >= total_pkts))\n+\t\t\tbreak;\n+\t}\n+\n+\treturn diff_tsc;\n+}\n+\n+static uint64_t\n+measure_txonly(struct lcore_conf *conf,\n+\t       struct rte_mbuf *pkts_burst[],\n+\t       uint64_t total_pkts)\n+{\n+\tunsigned i, portid, nb_rx, nb_tx;\n+\tuint64_t diff_tsc, cur_tsc;\n+\n+\tprintf(\"do tx measure\\n\");\n+\tdiff_tsc = 0;\n+\twhile (likely(!stop)) {\n+\t\tfor (i = 0; i < conf->nb_ports; i++) {\n+\t\t\tportid = conf->portlist[i];\n+\t\t\tnb_rx = rte_eth_rx_burst((uint8_t) portid, 0,\n+\t\t\t\t\t\t pkts_burst, MAX_PKT_BURST);\n+\t\t\tif (unlikely(nb_rx == 0)) {\n+\t\t\t\tidle++;\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\n+\t\t\tcount += nb_rx;\n+\n+\t\t\tcur_tsc = rte_rdtsc();\n+\t\t\tnb_tx = rte_eth_tx_burst(portid, 0, pkts_burst, nb_rx);\n+\t\t\tif (unlikely(nb_tx < nb_rx)) {\n+\t\t\t\tdrop += (nb_rx - nb_tx);\n+\t\t\t\tdo {\n+\t\t\t\t\trte_pktmbuf_free(pkts_burst[nb_tx]);\n+\t\t\t\t} while (++nb_tx < nb_rx);\n+\t\t\t}\n+\t\t\tdiff_tsc += rte_rdtsc() - cur_tsc;\n+\t\t}\n+\t\tif (unlikely(count >= total_pkts))\n+\t\t\tbreak;\n+\t}\n+\n+\treturn diff_tsc;\n+}\n+\n /* main processing loop */\n static int\n main_loop(__rte_unused void *args)\n@@ -375,8 +494,8 @@ main_loop(__rte_unused void *args)\n \tunsigned lcore_id;\n \tunsigned i, portid, nb_rx = 0, nb_tx = 0;\n \tstruct lcore_conf *conf;\n-\tuint64_t prev_tsc, cur_tsc;\n \tint pkt_per_port;\n+\tuint64_t diff_tsc;\n \tuint64_t packets_per_second, total_packets;\n \n \tlcore_id = rte_lcore_id();\n@@ -410,32 +529,7 @@ main_loop(__rte_unused void *args)\n \tprintf(\"Test will stop after at least %\"PRIu64\" packets received\\n\",\n \t\t+ total_packets);\n \n-\tprev_tsc = rte_rdtsc();\n-\n-\twhile (likely(!stop)) {\n-\t\tfor (i = 0; i < conf->nb_ports; i++) {\n-\t\t\tportid = conf->portlist[i];\n-\t\t\tnb_rx = rte_eth_rx_burst((uint8_t) portid, 0,\n-\t\t\t\t\t\t pkts_burst, MAX_PKT_BURST);\n-\t\t\tif (unlikely(nb_rx == 0)) {\n-\t\t\t\tidle++;\n-\t\t\t\tcontinue;\n-\t\t\t}\n-\n-\t\t\tcount += nb_rx;\n-\t\t\tnb_tx = rte_eth_tx_burst(portid, 0, pkts_burst, nb_rx);\n-\t\t\tif (unlikely(nb_tx < nb_rx)) {\n-\t\t\t\tdrop += (nb_rx - nb_tx);\n-\t\t\t\tdo {\n-\t\t\t\t\trte_pktmbuf_free(pkts_burst[nb_tx]);\n-\t\t\t\t} while (++nb_tx < nb_rx);\n-\t\t\t}\n-\t\t}\n-\t\tif (unlikely(count >= total_packets))\n-\t\t\tbreak;\n-\t}\n-\n-\tcur_tsc = rte_rdtsc();\n+\tdiff_tsc = do_measure(conf, pkts_burst, total_packets);\n \n \tfor (i = 0; i < conf->nb_ports; i++) {\n \t\tportid = conf->portlist[i];\n@@ -455,7 +549,7 @@ main_loop(__rte_unused void *args)\n \t\treturn -1;\n \n \tprintf(\"%lu packet, %lu drop, %lu idle\\n\", count, drop, idle);\n-\tprintf(\"Result: %ld cycles per packet\\n\", (cur_tsc - prev_tsc) / count);\n+\tprintf(\"Result: %ld cycles per packet\\n\", diff_tsc / count);\n \n \treturn 0;\n }\n@@ -559,6 +653,10 @@ test_pmd_perf(void)\n \n \tinit_traffic(mbufpool[socketid], tx_burst, MAX_TRAFIC_BURST);\n \n+\t/* do both rxtx by default */\n+\tif (NULL == do_measure)\n+\t\tdo_measure = measure_rxtx;\n+\n \trte_eal_remote_launch(main_loop, NULL, slave_id);\n \tif (rte_eal_wait_lcore(slave_id) < 0)\n \t\treturn -1;\n@@ -577,7 +675,7 @@ test_pmd_perf(void)\n int\n test_set_rxtx_conf(cmdline_fixed_string_t mode)\n {\n-\tprintf(\"mode is %s\\n\", mode);\n+\tprintf(\"mode switch to %s\\n\", mode);\n \n \tif (!strcmp(mode, \"vector\")) {\n \t\t/* vector rx, tx */\n@@ -618,3 +716,22 @@ test_set_rxtx_conf(cmdline_fixed_string_t mode)\n \n \treturn -1;\n }\n+\n+int\n+test_set_rxtx_anchor(cmdline_fixed_string_t type)\n+{\n+\tprintf(\"type switch to %s\\n\", type);\n+\n+\tif (!strcmp(type, \"rxtx\")) {\n+\t\tdo_measure = measure_rxtx;\n+\t\treturn 0;\n+\t} else if (!strcmp(type, \"rxonly\")) {\n+\t\tdo_measure = measure_rxonly;\n+\t\treturn 0;\n+\t} else if (!strcmp(type, \"txonly\")) {\n+\t\tdo_measure = measure_txonly;\n+\t\treturn 0;\n+\t}\n+\n+\treturn -1;\n+}\n",
    "prefixes": [
        "dpdk-dev",
        "2/5"
    ]
}