Show a patch.

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

{
    "id": 44563,
    "url": "http://patches.dpdk.org/api/patches/44563/",
    "web_url": "http://patches.dpdk.org/patch/44563/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<20180911080216.3017-9-mattias.ronnblom@ericsson.com>",
    "date": "2018-09-11T08:02:14",
    "name": "[v3,08/10] event/dsw: let DSW event device sort events on dequeue",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "2008e7e9e4e7a70af2f2d98f3011bcd4ad58ad2e",
    "submitter": {
        "id": 1077,
        "url": "http://patches.dpdk.org/api/people/1077/",
        "name": "Mattias Rönnblom",
        "email": "mattias.ronnblom@ericsson.com"
    },
    "delegate": {
        "id": 310,
        "url": "http://patches.dpdk.org/api/users/310/",
        "username": "jerin",
        "first_name": "Jerin",
        "last_name": "Jacob",
        "email": "jerin.jacob@caviumnetworks.com"
    },
    "mbox": "http://patches.dpdk.org/patch/44563/mbox/",
    "series": [
        {
            "id": 1264,
            "url": "http://patches.dpdk.org/api/series/1264/",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1264",
            "date": "2018-09-11T08:02:07",
            "name": "A Distributed Software Event Device",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/1264/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/44563/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/44563/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "In-Reply-To": "<20180911080216.3017-1-mattias.ronnblom@ericsson.com>",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Mailer": "git-send-email 2.17.1",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 4EA6A5A44;\n\tTue, 11 Sep 2018 10:03:27 +0200 (CEST)",
            "from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3])\n\tby dpdk.org (Postfix) with ESMTP id EB53B4CBB\n\tfor <dev@dpdk.org>; Tue, 11 Sep 2018 10:03:17 +0200 (CEST)",
            "from mail.lysator.liu.se (localhost [127.0.0.1])\n\tby mail.lysator.liu.se (Postfix) with ESMTP id AB9444007D\n\tfor <dev@dpdk.org>; Tue, 11 Sep 2018 10:03:17 +0200 (CEST)",
            "by mail.lysator.liu.se (Postfix, from userid 1004)\n\tid 941FF40012; Tue, 11 Sep 2018 10:03:17 +0200 (CEST)",
            "from isengard.friendlyfire.se\n\t(host-90-232-156-190.mobileonline.telia.com [90.232.156.190])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby mail.lysator.liu.se (Postfix) with ESMTPSA id EC0B640088;\n\tTue, 11 Sep 2018 10:03:13 +0200 (CEST)"
        ],
        "References": "<20180911080216.3017-1-mattias.ronnblom@ericsson.com>",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "MIME-Version": "1.0",
        "Message-Id": "<20180911080216.3017-9-mattias.ronnblom@ericsson.com>",
        "X-Virus-Scanned": "ClamAV using ClamSMTP",
        "Delivered-To": "patchwork@dpdk.org",
        "Content-Transfer-Encoding": "8bit",
        "From": "=?utf-8?q?Mattias_R=C3=B6nnblom?= <mattias.ronnblom@ericsson.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "Content-Type": "text/plain; charset=UTF-8",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@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>",
        "To": "jerin.jacob@caviumnetworks.com",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "X-Spam-Status": "No, score=-0.9 required=5.0 tests=ALL_TRUSTED,AWL\n\tautolearn=disabled version=3.4.1",
        "X-Spam-Level": "",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "X-Spam-Checker-Version": "SpamAssassin 3.4.1 (2015-04-28) on\n\tbernadotte.lysator.liu.se",
        "X-BeenThere": "dev@dpdk.org",
        "Date": "Tue, 11 Sep 2018 10:02:14 +0200",
        "Cc": "bruce.richardson@intel.com, dev@dpdk.org, =?utf-8?q?Mattias_R=C3=B6nnb?=\n\t=?utf-8?q?lom?= <mattias.ronnblom@ericsson.com>",
        "X-Spam-Score": "-0.9",
        "Subject": "[dpdk-dev] [PATCH v3 08/10] event/dsw: let DSW event device sort\n\tevents on dequeue"
    },
    "content": "With this patch, the DSW event device will (optionally) sort the event\nburst before giving it to the application. The sorting will primarily\nbe on queue id, and secondary on flow id.\n\nThe sorting is an attempt to optimize data and instruction cache usage\nfor the application, at the cost of additional event device overhead.\n\nSigned-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>\n---\n drivers/event/dsw/dsw_evdev.h | 11 ++++++++\n drivers/event/dsw/dsw_event.c | 23 +++++++++++++++++\n drivers/event/dsw/dsw_sort.h  | 48 +++++++++++++++++++++++++++++++++++\n 3 files changed, 82 insertions(+)\n create mode 100644 drivers/event/dsw/dsw_sort.h",
    "diff": "diff --git a/drivers/event/dsw/dsw_evdev.h b/drivers/event/dsw/dsw_evdev.h\nindex 783c418bf..f6f8f0454 100644\n--- a/drivers/event/dsw/dsw_evdev.h\n+++ b/drivers/event/dsw/dsw_evdev.h\n@@ -93,6 +93,17 @@\n  */\n #define DSW_CTL_IN_RING_SIZE ((DSW_MAX_PORTS-1)*4)\n \n+/* With DSW_SORT_DEQUEUED enabled, the scheduler will, at the point of\n+ * dequeue(), arrange events so that events with the same flow id on\n+ * the same queue forms a back-to-back \"burst\", and also so that such\n+ * bursts of different flow ids, but on the same queue, also come\n+ * consecutively. All this in an attempt to improve data and\n+ * instruction cache usage for the application, at the cost of a\n+ * scheduler overhead increase.\n+ */\n+\n+/* #define DSW_SORT_DEQUEUED */\n+\n struct dsw_queue_flow {\n \tuint8_t queue_id;\n \tuint16_t flow_hash;\ndiff --git a/drivers/event/dsw/dsw_event.c b/drivers/event/dsw/dsw_event.c\nindex f0347592d..a84b19c33 100644\n--- a/drivers/event/dsw/dsw_event.c\n+++ b/drivers/event/dsw/dsw_event.c\n@@ -4,6 +4,10 @@\n \n #include \"dsw_evdev.h\"\n \n+#ifdef DSW_SORT_DEQUEUED\n+#include \"dsw_sort.h\"\n+#endif\n+\n #include <stdbool.h>\n #include <string.h>\n \n@@ -1121,6 +1125,21 @@ dsw_port_record_seen_events(struct dsw_port *port, struct rte_event *events,\n \t\t\t\tDSW_MAX_EVENTS_RECORDED);\n }\n \n+#ifdef DSW_SORT_DEQUEUED\n+\n+#define DSW_EVENT_TO_INT(_event)\t\t\t\t\\\n+\t((int)((((_event)->queue_id)<<16)|((_event)->flow_id)))\n+\n+static inline int\n+dsw_cmp_event(const void *v_event_a, const void *v_event_b)\n+{\n+\tconst struct rte_event *event_a = v_event_a;\n+\tconst struct rte_event *event_b = v_event_b;\n+\n+\treturn DSW_EVENT_TO_INT(event_a) - DSW_EVENT_TO_INT(event_b);\n+}\n+#endif\n+\n static uint16_t\n dsw_port_dequeue_burst(struct dsw_port *port, struct rte_event *events,\n \t\t       uint16_t num)\n@@ -1191,5 +1210,9 @@ dsw_event_dequeue_burst(void *port, struct rte_event *events, uint16_t num,\n \t *\t0.\n \t */\n \n+#ifdef DSW_SORT_DEQUEUED\n+\tdsw_stable_sort(events, dequeued, sizeof(events[0]), dsw_cmp_event);\n+#endif\n+\n \treturn dequeued;\n }\ndiff --git a/drivers/event/dsw/dsw_sort.h b/drivers/event/dsw/dsw_sort.h\nnew file mode 100644\nindex 000000000..609767fdf\n--- /dev/null\n+++ b/drivers/event/dsw/dsw_sort.h\n@@ -0,0 +1,48 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2018 Ericsson AB\n+ */\n+\n+#ifndef _DSW_SORT_\n+#define _DSW_SORT_\n+\n+#include <string.h>\n+\n+#include <rte_common.h>\n+\n+#define DSW_ARY_ELEM_PTR(_ary, _idx, _elem_size)\t\\\n+\tRTE_PTR_ADD(_ary, (_idx) * (_elem_size))\n+\n+#define DSW_ARY_ELEM_SWAP(_ary, _a_idx, _b_idx, _elem_size)\t\t\\\n+\tdo {\t\t\t\t\t\t\t\t\\\n+\t\tchar tmp[_elem_size];\t\t\t\t\t\\\n+\t\tvoid *_a_ptr = DSW_ARY_ELEM_PTR(_ary, _a_idx, _elem_size); \\\n+\t\tvoid *_b_ptr = DSW_ARY_ELEM_PTR(_ary, _b_idx, _elem_size); \\\n+\t\tmemcpy(tmp, _a_ptr, _elem_size);\t\t\t\\\n+\t\tmemcpy(_a_ptr, _b_ptr, _elem_size);\t\t\t\\\n+\t\tmemcpy(_b_ptr, tmp, _elem_size);\t\t\t\\\n+\t} while (0)\n+\n+static inline void\n+dsw_insertion_sort(void *ary, uint16_t len, uint16_t elem_size,\n+\t\t   int (*cmp_fn)(const void *, const void *))\n+{\n+\tuint16_t i;\n+\n+\tfor (i = 1; i < len; i++) {\n+\t\tuint16_t j;\n+\t\tfor (j = i; j > 0 &&\n+\t\t\t     cmp_fn(DSW_ARY_ELEM_PTR(ary, j-1, elem_size),\n+\t\t\t\t    DSW_ARY_ELEM_PTR(ary, j, elem_size)) > 0;\n+\t\t     j--)\n+\t\t\tDSW_ARY_ELEM_SWAP(ary, j, j-1, elem_size);\n+\t}\n+}\n+\n+static inline void\n+dsw_stable_sort(void *ary, uint16_t len, uint16_t elem_size,\n+\t\tint (*cmp_fn)(const void *, const void *))\n+{\n+\tdsw_insertion_sort(ary, len, elem_size, cmp_fn);\n+}\n+\n+#endif\n",
    "prefixes": [
        "v3",
        "08/10"
    ]
}