get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 52139,
    "url": "http://patches.dpdk.org/api/patches/52139/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1554274796-23258-2-git-send-email-phil.yang@arm.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<1554274796-23258-2-git-send-email-phil.yang@arm.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1554274796-23258-2-git-send-email-phil.yang@arm.com",
    "date": "2019-04-03T06:59:54",
    "name": "[v3,1/3] packet_ordering: add statistics for each worker thread",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "8bc43d3f8b0a1e8233187b18ee4c4a3917dc0e44",
    "submitter": {
        "id": 833,
        "url": "http://patches.dpdk.org/api/people/833/?format=api",
        "name": "Phil Yang",
        "email": "phil.yang@arm.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1554274796-23258-2-git-send-email-phil.yang@arm.com/mbox/",
    "series": [
        {
            "id": 4074,
            "url": "http://patches.dpdk.org/api/series/4074/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4074",
            "date": "2019-04-03T06:59:53",
            "name": "example and test cases optimizations",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/4074/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/52139/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/52139/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 D7AF85F72;\n\tWed,  3 Apr 2019 09:02:51 +0200 (CEST)",
            "from foss.arm.com (foss.arm.com [217.140.101.70])\n\tby dpdk.org (Postfix) with ESMTP id 5E2E65B2C\n\tfor <dev@dpdk.org>; Wed,  3 Apr 2019 09:02:48 +0200 (CEST)",
            "from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249])\n\tby usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C41961596;\n\tWed,  3 Apr 2019 00:02:47 -0700 (PDT)",
            "from phil-VirtualBox.shanghai.arm.com (unknown [10.169.109.179])\n\tby usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id\n\t553B33F68F; Wed,  3 Apr 2019 00:02:46 -0700 (PDT)"
        ],
        "From": "Phil Yang <phil.yang@arm.com>",
        "To": "dev@dpdk.org,\n\tthomas@monjalon.net",
        "Cc": "david.hunt@intel.com, reshma.pattan@intel.com, gavin.hu@arm.com,\n\thonnappa.nagarahalli@arm.com, phil.yang@arm.com, nd@arm.com",
        "Date": "Wed,  3 Apr 2019 14:59:54 +0800",
        "Message-Id": "<1554274796-23258-2-git-send-email-phil.yang@arm.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1554274796-23258-1-git-send-email-phil.yang@arm.com>",
        "References": "<1546508946-12552-1-git-send-email-phil.yang@arm.com>\n\t<1554274796-23258-1-git-send-email-phil.yang@arm.com>",
        "Subject": "[dpdk-dev] [PATCH v3 1/3] packet_ordering: add statistics for each\n\tworker thread",
        "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "The current implementation using the '__sync' built-ins to synchronize\nstatistics within worker threads. The '__sync' built-ins functions are\nfull barriers which will affect the performance, so add a per worker\npackets statistics to remove the synchronisation between worker threads.\n\nSince the maximum core number can get to 256, so disable the per core\nstats print in default and add the --insight-worker option to enable it.\n\nFor example:\nsudo examples/packet_ordering/arm64-armv8a-linuxapp-gcc/packet_ordering \\\n-l 112-115 --socket-mem=1024,1024 -n 4 -- -p 0x03 --insight-worker\n\nRX thread stats:\n - Pkts rxd:                            226539223\n - Pkts enqd to workers ring:           226539223\n\nWorker thread stats on core [113]:\n - Pkts deqd from workers ring:         77557888\n - Pkts enqd to tx ring:                77557888\n - Pkts enq to tx failed:               0\n\nWorker thread stats on core [114]:\n - Pkts deqd from workers ring:         148981335\n - Pkts enqd to tx ring:                148981335\n - Pkts enq to tx failed:               0\n\nWorker thread stats:\n - Pkts deqd from workers ring:         226539223\n - Pkts enqd to tx ring:                226539223\n - Pkts enq to tx failed:               0\n\nTX stats:\n - Pkts deqd from tx ring:              226539223\n - Ro Pkts transmitted:                 226539168\n - Ro Pkts tx failed:                   0\n - Pkts transmitted w/o reorder:        0\n - Pkts tx failed w/o reorder:          0\n\nSuggested-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>\nSigned-off-by: Phil Yang <phil.yang@arm.com>\nReviewed-by: Gavin Hu <gavin.hu@arm.com>\n---\n doc/guides/sample_app_ug/packet_ordering.rst |  4 ++-\n examples/packet_ordering/main.c              | 50 +++++++++++++++++++++++++---\n 2 files changed, 48 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/doc/guides/sample_app_ug/packet_ordering.rst b/doc/guides/sample_app_ug/packet_ordering.rst\nindex 7cfcf3f..1c8ee5d 100644\n--- a/doc/guides/sample_app_ug/packet_ordering.rst\n+++ b/doc/guides/sample_app_ug/packet_ordering.rst\n@@ -43,7 +43,7 @@ The application execution command line is:\n \n .. code-block:: console\n \n-    ./test-pipeline [EAL options] -- -p PORTMASK [--disable-reorder]\n+    ./packet_ordering [EAL options] -- -p PORTMASK [--disable-reorder] [--insight-worker]\n \n The -c EAL CPU_COREMASK option has to contain at least 3 CPU cores.\n The first CPU core in the core mask is the master core and would be assigned to\n@@ -56,3 +56,5 @@ then the other pair from 2 to 3 and from 3 to 2, having [0,1] and [2,3] pairs.\n \n The disable-reorder long option does, as its name implies, disable the reordering\n of traffic, which should help evaluate reordering performance impact.\n+\n+The insight-worker long option enables output the packet statistics of each worker thread.\ndiff --git a/examples/packet_ordering/main.c b/examples/packet_ordering/main.c\nindex 149bfdd..8145074 100644\n--- a/examples/packet_ordering/main.c\n+++ b/examples/packet_ordering/main.c\n@@ -31,6 +31,7 @@\n \n unsigned int portmask;\n unsigned int disable_reorder;\n+unsigned int insight_worker;\n volatile uint8_t quit_signal;\n \n static struct rte_mempool *mbuf_pool;\n@@ -71,6 +72,14 @@ volatile struct app_stats {\n \t} tx __rte_cache_aligned;\n } app_stats;\n \n+/* per worker lcore stats */\n+struct wkr_stats_per {\n+\t\tuint64_t deq_pkts;\n+\t\tuint64_t enq_pkts;\n+\t\tuint64_t enq_failed_pkts;\n+} __rte_cache_aligned;\n+\n+static struct wkr_stats_per wkr_stats[RTE_MAX_LCORE] = {0};\n /**\n  * Get the last enabled lcore ID\n  *\n@@ -152,6 +161,7 @@ parse_args(int argc, char **argv)\n \tchar *prgname = argv[0];\n \tstatic struct option lgopts[] = {\n \t\t{\"disable-reorder\", 0, 0, 0},\n+\t\t{\"insight-worker\", 0, 0, 0},\n \t\t{NULL, 0, 0, 0}\n \t};\n \n@@ -175,6 +185,11 @@ parse_args(int argc, char **argv)\n \t\t\t\tprintf(\"reorder disabled\\n\");\n \t\t\t\tdisable_reorder = 1;\n \t\t\t}\n+\t\t\tif (!strcmp(lgopts[option_index].name,\n+\t\t\t\t\t\t\"insight-worker\")) {\n+\t\t\t\tprintf(\"print all worker statistics\\n\");\n+\t\t\t\tinsight_worker = 1;\n+\t\t\t}\n \t\t\tbreak;\n \t\tdefault:\n \t\t\tprint_usage(prgname);\n@@ -319,6 +334,11 @@ print_stats(void)\n {\n \tuint16_t i;\n \tstruct rte_eth_stats eth_stats;\n+\tunsigned int lcore_id, last_lcore_id, master_lcore_id, end_w_lcore_id;\n+\n+\tlast_lcore_id   = get_last_lcore_id();\n+\tmaster_lcore_id = rte_get_master_lcore();\n+\tend_w_lcore_id  = get_previous_lcore_id(last_lcore_id);\n \n \tprintf(\"\\nRX thread stats:\\n\");\n \tprintf(\" - Pkts rxd:\t\t\t\t%\"PRIu64\"\\n\",\n@@ -326,6 +346,26 @@ print_stats(void)\n \tprintf(\" - Pkts enqd to workers ring:\t\t%\"PRIu64\"\\n\",\n \t\t\t\t\t\tapp_stats.rx.enqueue_pkts);\n \n+\tfor (lcore_id = 0; lcore_id <= end_w_lcore_id; lcore_id++) {\n+\t\tif (insight_worker\n+\t\t\t&& rte_lcore_is_enabled(lcore_id)\n+\t\t\t&& lcore_id != master_lcore_id) {\n+\t\t\tprintf(\"\\nWorker thread stats on core [%u]:\\n\",\n+\t\t\t\t\tlcore_id);\n+\t\t\tprintf(\" - Pkts deqd from workers ring:\t\t%\"PRIu64\"\\n\",\n+\t\t\t\t\twkr_stats[lcore_id].deq_pkts);\n+\t\t\tprintf(\" - Pkts enqd to tx ring:\t\t%\"PRIu64\"\\n\",\n+\t\t\t\t\twkr_stats[lcore_id].enq_pkts);\n+\t\t\tprintf(\" - Pkts enq to tx failed:\t\t%\"PRIu64\"\\n\",\n+\t\t\t\t\twkr_stats[lcore_id].enq_failed_pkts);\n+\t\t}\n+\n+\t\tapp_stats.wkr.dequeue_pkts += wkr_stats[lcore_id].deq_pkts;\n+\t\tapp_stats.wkr.enqueue_pkts += wkr_stats[lcore_id].enq_pkts;\n+\t\tapp_stats.wkr.enqueue_failed_pkts +=\n+\t\t\twkr_stats[lcore_id].enq_failed_pkts;\n+\t}\n+\n \tprintf(\"\\nWorker thread stats:\\n\");\n \tprintf(\" - Pkts deqd from workers ring:\t\t%\"PRIu64\"\\n\",\n \t\t\t\t\t\tapp_stats.wkr.dequeue_pkts);\n@@ -432,13 +472,14 @@ worker_thread(void *args_ptr)\n \tstruct rte_mbuf *burst_buffer[MAX_PKTS_BURST] = { NULL };\n \tstruct rte_ring *ring_in, *ring_out;\n \tconst unsigned xor_val = (nb_ports > 1);\n+\tunsigned int core_id = rte_lcore_id();\n \n \targs = (struct worker_thread_args *) args_ptr;\n \tring_in  = args->ring_in;\n \tring_out = args->ring_out;\n \n \tRTE_LOG(INFO, REORDERAPP, \"%s() started on lcore %u\\n\", __func__,\n-\t\t\t\t\t\t\trte_lcore_id());\n+\t\t\t\t\t\t\tcore_id);\n \n \twhile (!quit_signal) {\n \n@@ -448,7 +489,7 @@ worker_thread(void *args_ptr)\n \t\tif (unlikely(burst_size == 0))\n \t\t\tcontinue;\n \n-\t\t__sync_fetch_and_add(&app_stats.wkr.dequeue_pkts, burst_size);\n+\t\twkr_stats[core_id].deq_pkts += burst_size;\n \n \t\t/* just do some operation on mbuf */\n \t\tfor (i = 0; i < burst_size;)\n@@ -457,11 +498,10 @@ worker_thread(void *args_ptr)\n \t\t/* enqueue the modified mbufs to workers_to_tx ring */\n \t\tret = rte_ring_enqueue_burst(ring_out, (void *)burst_buffer,\n \t\t\t\tburst_size, NULL);\n-\t\t__sync_fetch_and_add(&app_stats.wkr.enqueue_pkts, ret);\n+\t\twkr_stats[core_id].enq_pkts += ret;\n \t\tif (unlikely(ret < burst_size)) {\n \t\t\t/* Return the mbufs to their respective pool, dropping packets */\n-\t\t\t__sync_fetch_and_add(&app_stats.wkr.enqueue_failed_pkts,\n-\t\t\t\t\t(int)burst_size - ret);\n+\t\t\twkr_stats[core_id].enq_failed_pkts += burst_size - ret;\n \t\t\tpktmbuf_free_bulk(&burst_buffer[ret], burst_size - ret);\n \t\t}\n \t}\n",
    "prefixes": [
        "v3",
        "1/3"
    ]
}