get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 19848,
    "url": "http://patchwork.dpdk.org/api/patches/19848/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1484903933-127190-3-git-send-email-david.hunt@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": "<1484903933-127190-3-git-send-email-david.hunt@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1484903933-127190-3-git-send-email-david.hunt@intel.com",
    "date": "2017-01-20T09:18:49",
    "name": "[dpdk-dev,v5,2/6] lib: add distributor vector flow matching",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "1033d1f73083ef88fd6e4cfeedb709c3b94603b3",
    "submitter": {
        "id": 342,
        "url": "http://patchwork.dpdk.org/api/people/342/?format=api",
        "name": "Hunt, David",
        "email": "david.hunt@intel.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1484903933-127190-3-git-send-email-david.hunt@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.dpdk.org/api/patches/19848/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/19848/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 881A45320;\n\tFri, 20 Jan 2017 17:18:09 +0100 (CET)",
            "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n\tby dpdk.org (Postfix) with ESMTP id 49BDA2B9B\n\tfor <dev@dpdk.org>; Fri, 20 Jan 2017 17:17:56 +0100 (CET)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby orsmga104.jf.intel.com with ESMTP; 20 Jan 2017 08:17:55 -0800",
            "from silpixa00397515.ir.intel.com (HELO\n\tsilpixa00397515.ger.corp.intel.com) ([10.237.223.14])\n\tby FMSMGA003.fm.intel.com with ESMTP; 20 Jan 2017 08:17:54 -0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.33,259,1477983600\"; d=\"scan'208\";a=\"811316099\"",
        "From": "David Hunt <david.hunt@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "bruce.richardson@intel.com,\n\tDavid Hunt <david.hunt@intel.com>",
        "Date": "Fri, 20 Jan 2017 09:18:49 +0000",
        "Message-Id": "<1484903933-127190-3-git-send-email-david.hunt@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1484903933-127190-1-git-send-email-david.hunt@intel.com>",
        "References": "<1483948248-91364-2-git-send-email-david.hunt@intel.com>\n\t<1484903933-127190-1-git-send-email-david.hunt@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v5 2/6] lib: add distributor vector flow matching",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <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>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Signed-off-by: David Hunt <david.hunt@intel.com>\n---\n lib/librte_distributor/Makefile                    |   7 ++\n lib/librte_distributor/rte_distributor_burst.c     |  12 ++-\n lib/librte_distributor/rte_distributor_burst.h     |   6 +-\n .../rte_distributor_match_generic.c                |  43 ++++++++\n lib/librte_distributor/rte_distributor_match_sse.c | 113 +++++++++++++++++++++\n lib/librte_distributor/rte_distributor_priv.h      |  15 ++-\n 6 files changed, 191 insertions(+), 5 deletions(-)\n create mode 100644 lib/librte_distributor/rte_distributor_match_generic.c\n create mode 100644 lib/librte_distributor/rte_distributor_match_sse.c",
    "diff": "diff --git a/lib/librte_distributor/Makefile b/lib/librte_distributor/Makefile\nindex 2acc54d..4baaa0c 100644\n--- a/lib/librte_distributor/Makefile\n+++ b/lib/librte_distributor/Makefile\n@@ -44,6 +44,13 @@ LIBABIVER := 1\n # all source are stored in SRCS-y\n SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) := rte_distributor.c\n SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += rte_distributor_burst.c\n+ifeq ($(CONFIG_RTE_ARCH_X86),y)\n+SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += rte_distributor_match_sse.c\n+CFLAGS_rte_distributor_match_sse.o += -msse4.2\n+else\n+SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += rte_distributor_match_generic.c\n+endif\n+\n \n # install this header file\n SYMLINK-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR)-include := rte_distributor.h\ndiff --git a/lib/librte_distributor/rte_distributor_burst.c b/lib/librte_distributor/rte_distributor_burst.c\nindex 2cbf635..a629c73 100644\n--- a/lib/librte_distributor/rte_distributor_burst.c\n+++ b/lib/librte_distributor/rte_distributor_burst.c\n@@ -190,7 +190,7 @@ store_return(uintptr_t oldbuf, struct rte_distributor_burst *d,\n  * backlog). This will then allow us to pin those packets to the relevant\n  * workers to give us our atomic flow pinning.\n  */\n-static inline void\n+void\n find_match_scalar(struct rte_distributor_burst *d,\n \t\t\tuint16_t *data_ptr,\n \t\t\tuint16_t *output_ptr)\n@@ -351,6 +351,9 @@ rte_distributor_process_burst(struct rte_distributor_burst *d,\n \t\t}\n \n \t\tswitch (d->dist_match_fn) {\n+\t\tcase RTE_DIST_MATCH_VECTOR:\n+\t\t\tfind_match_vec(d, &flows[0], &matches[0]);\n+\t\t\tbreak;\n \t\tdefault:\n \t\t\tfind_match_scalar(d, &flows[0], &matches[0]);\n \t\t}\n@@ -543,7 +546,12 @@ rte_distributor_create_burst(const char *name,\n \tsnprintf(d->name, sizeof(d->name), \"%s\", name);\n \td->num_workers = num_workers;\n \n-\td->dist_match_fn = RTE_DIST_MATCH_SCALAR;\n+#if defined(RTE_ARCH_X86)\n+\tif (rte_cpu_get_flag_enabled(RTE_CPUFLAG_SSE4_2)) {\n+\t\td->dist_match_fn = RTE_DIST_MATCH_VECTOR;\n+\t} else\n+#endif\n+\t\td->dist_match_fn = RTE_DIST_MATCH_SCALAR;\n \n \t/*\n \t * Set up the backog tags so they're pointing at the second cache\ndiff --git a/lib/librte_distributor/rte_distributor_burst.h b/lib/librte_distributor/rte_distributor_burst.h\nindex 0b65518..b0b41ec 100644\n--- a/lib/librte_distributor/rte_distributor_burst.h\n+++ b/lib/librte_distributor/rte_distributor_burst.h\n@@ -192,8 +192,10 @@ rte_distributor_get_pkt_burst(struct rte_distributor_burst *d,\n  * @param worker_id\n  *   The worker instance number to use - must be less that num_workers passed\n  *   at distributor creation time.\n- * @param mbuf\n- *   The previous packet being processed by the worker\n+ * @param oldpkt\n+ *   The previous packets being processed by the worker\n+ * @param num\n+ *   The number of packets in the oldpkt array\n  */\n int\n rte_distributor_return_pkt_burst(struct rte_distributor_burst *d,\ndiff --git a/lib/librte_distributor/rte_distributor_match_generic.c b/lib/librte_distributor/rte_distributor_match_generic.c\nnew file mode 100644\nindex 0000000..6a1ff7f\n--- /dev/null\n+++ b/lib/librte_distributor/rte_distributor_match_generic.c\n@@ -0,0 +1,43 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2017 Intel Corporation. All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#include <rte_mbuf.h>\n+#include \"rte_distributor_priv.h\"\n+#include \"rte_distributor_burst.h\"\n+\n+void\n+find_match_vec(struct rte_distributor_burst *d,\n+\t\t\tuint16_t *data_ptr,\n+\t\t\tuint16_t *output_ptr)\n+{\n+\tfind_match_scalar(d, data_ptr, output_ptr);\n+}\ndiff --git a/lib/librte_distributor/rte_distributor_match_sse.c b/lib/librte_distributor/rte_distributor_match_sse.c\nnew file mode 100644\nindex 0000000..383f12e\n--- /dev/null\n+++ b/lib/librte_distributor/rte_distributor_match_sse.c\n@@ -0,0 +1,113 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2017 Intel Corporation. All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#include <rte_mbuf.h>\n+#include \"rte_distributor_priv.h\"\n+#include \"rte_distributor_burst.h\"\n+#include \"smmintrin.h\"\n+\n+\n+void\n+find_match_vec(struct rte_distributor_burst *d,\n+\t\t\tuint16_t *data_ptr,\n+\t\t\tuint16_t *output_ptr)\n+{\n+\t/* Setup */\n+\t__m128i incoming_fids;\n+\t__m128i inflight_fids;\n+\t__m128i preflight_fids;\n+\t__m128i wkr;\n+\t__m128i mask1;\n+\t__m128i mask2;\n+\t__m128i output;\n+\tstruct rte_distributor_backlog *bl;\n+\tuint16_t i;\n+\n+\t/*\n+\t * Function overview:\n+\t * 2. Loop through all worker ID's\n+\t *  2a. Load the current inflights for that worker into an xmm reg\n+\t *  2b. Load the current backlog for that worker into an xmm reg\n+\t *  2c. use cmpestrm to intersect flow_ids with backlog and inflights\n+\t *  2d. Add any matches to the output\n+\t * 3. Write the output xmm (matching worker ids).\n+\t */\n+\n+\n+\toutput = _mm_set1_epi16(0);\n+\tincoming_fids = _mm_load_si128((__m128i *)data_ptr);\n+\n+\tfor (i = 0; i < d->num_workers; i++) {\n+\t\tbl = &d->backlog[i];\n+\n+\t\tinflight_fids =\n+\t\t\t_mm_load_si128((__m128i *)&(d->in_flight_tags[i]));\n+\t\tpreflight_fids =\n+\t\t\t_mm_load_si128((__m128i *)(bl->tags));\n+\n+\t\t/*\n+\t\t * Any incoming_fid that exists anywhere in inflight_fids will\n+\t\t * have 0xffff in same position of the mask as the incoming fid\n+\t\t * Example (shortened to bytes for brevity):\n+\t\t * incoming_fids   0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08\n+\t\t * inflight_fids   0x03 0x05 0x07 0x00 0x00 0x00 0x00 0x00\n+\t\t * mask            0x00 0x00 0xff 0x00 0xff 0x00 0xff 0x00\n+\t\t */\n+\n+\t\tmask1 = _mm_cmpestrm(inflight_fids, 8, incoming_fids, 8,\n+\t\t\t_SIDD_UWORD_OPS |\n+\t\t\t_SIDD_CMP_EQUAL_ANY |\n+\t\t\t_SIDD_UNIT_MASK);\n+\t\tmask2 = _mm_cmpestrm(preflight_fids, 8, incoming_fids, 8,\n+\t\t\t_SIDD_UWORD_OPS |\n+\t\t\t_SIDD_CMP_EQUAL_ANY |\n+\t\t\t_SIDD_UNIT_MASK);\n+\n+\t\tmask1 = _mm_or_si128(mask1, mask2);\n+\t\t/*\n+\t\t * Now mask contains 0xffff where there's a match.\n+\t\t * Next we need to store the worker_id in the relevant position\n+\t\t * in the output.\n+\t\t */\n+\n+\t\twkr = _mm_set1_epi16(i+1);\n+\t\tmask1 = _mm_and_si128(mask1, wkr);\n+\t\toutput = _mm_or_si128(mask1, output);\n+\t}\n+\n+\t/*\n+\t * At this stage, the output 128-bit contains 8 16-bit values, with\n+\t * each non-zero value containing the worker ID on which the\n+\t * corresponding flow is pinned to.\n+\t */\n+\t_mm_store_si128((__m128i *)output_ptr, output);\n+}\ndiff --git a/lib/librte_distributor/rte_distributor_priv.h b/lib/librte_distributor/rte_distributor_priv.h\nindex ae48d86..1d73d92 100644\n--- a/lib/librte_distributor/rte_distributor_priv.h\n+++ b/lib/librte_distributor/rte_distributor_priv.h\n@@ -33,6 +33,8 @@\n #ifndef _RTE_DIST_PRIV_H_\n #define _RTE_DIST_PRIV_H_\n \n+#include <rte_vect.h>\n+\n /**\n  * @file\n  * RTE distributor\n@@ -70,7 +72,7 @@ extern \"C\" {\n /**\n  * Maximum number of workers allowed.\n  * Be aware of increasing the limit, becaus it is limited by how we track\n- * in-flight tags. See @in_flight_bitmask and @rte_distributor_process\n+ * in-flight tags. See in_flight_bitmask and rte_distributor_process\n  */\n #define RTE_DISTRIB_MAX_WORKERS 64\n \n@@ -155,6 +157,7 @@ struct rte_distributor {\n /* All different signature compare functions */\n enum rte_distributor_match_function {\n \tRTE_DIST_MATCH_SCALAR = 0,\n+\tRTE_DIST_MATCH_VECTOR,\n \tRTE_DIST_NUM_MATCH_FNS\n };\n \n@@ -182,6 +185,16 @@ struct rte_distributor_burst {\n \tenum rte_distributor_match_function dist_match_fn;\n };\n \n+void\n+find_match_scalar(struct rte_distributor_burst *d,\n+\t\t\tuint16_t *data_ptr,\n+\t\t\tuint16_t *output_ptr);\n+\n+void\n+find_match_vec(struct rte_distributor_burst *d,\n+\t\t\tuint16_t *data_ptr,\n+\t\t\tuint16_t *output_ptr);\n+\n #ifdef __cplusplus\n }\n #endif\n",
    "prefixes": [
        "dpdk-dev",
        "v5",
        "2/6"
    ]
}