get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 5620,
    "url": "https://patches.dpdk.org/api/patches/5620/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1434735073-27414-1-git-send-email-medvedkinv@gmail.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": "<1434735073-27414-1-git-send-email-medvedkinv@gmail.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1434735073-27414-1-git-send-email-medvedkinv@gmail.com",
    "date": "2015-06-19T17:31:13",
    "name": "[dpdk-dev,v5] Add toeplitz hash algorithm used by RSS",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "1534aa86a1b2e8c77c4544e765d2ff41f8f5e1d3",
    "submitter": {
        "id": 210,
        "url": "https://patches.dpdk.org/api/people/210/?format=api",
        "name": "Vladimir Medvedkin",
        "email": "medvedkinv@gmail.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1434735073-27414-1-git-send-email-medvedkinv@gmail.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/5620/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/5620/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 93957C822;\n\tFri, 19 Jun 2015 19:33:42 +0200 (CEST)",
            "from mailrelay1.rambler.ru (mailrelay1.rambler.ru [81.19.66.239])\n\tby dpdk.org (Postfix) with ESMTP id 3DB16C80C\n\tfor <dev@dpdk.org>; Fri, 19 Jun 2015 19:33:41 +0200 (CEST)",
            "from hst119.rambler.ru (unknown [10.201.1.2])\n\tby mailrelay1.rambler.ru (Postfix) with ESMTP id 3mCnKw5vVczJ5j;\n\tFri, 19 Jun 2015 20:33:40 +0300 (MSK)"
        ],
        "From": "Vladimir Medvedkin <medvedkinv@gmail.com>",
        "To": "dev@dpdk.org",
        "Date": "Fri, 19 Jun 2015 13:31:13 -0400",
        "Message-Id": "<1434735073-27414-1-git-send-email-medvedkinv@gmail.com>",
        "X-Mailer": "git-send-email 1.8.3.2",
        "In-Reply-To": "<1434725752-22847-1-git-send-email-medvedkinv@gmail.com>",
        "References": "<1434725752-22847-1-git-send-email-medvedkinv@gmail.com>",
        "X-Rcpt-To": "<medvedkinv@gmail.com>, <dev@dpdk.org>",
        "Subject": "[dpdk-dev] [PATCH v5] Add toeplitz hash algorithm used by RSS",
        "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>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Software implementation of the Toeplitz hash function used by RSS.\nCan be used either for packet distribution on single queue NIC\nor for simulating of RSS computation on specific NIC (for example\nafter GRE header decapsulating).\n\nv5 changes\n- Fix errors reported by checkpatch.pl\n\nv4 changes\n- Fix copyright\n- rename bswap_mask constant, add rte_ prefix\n- change rte_ipv[46]_tuple struct\n- change rte_thash_load_v6_addr prototype\n\nv3 changes\n- Rework API to be more generic\n- Add sctp_tag into tuple\n\nv2 changes\n- Add ipv6 support\n- Various style fixes\n\nSigned-off-by: Vladimir Medvedkin <medvedkinv@gmail.com>\n---\n lib/librte_hash/Makefile    |   1 +\n lib/librte_hash/rte_thash.h | 207 ++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 208 insertions(+)\n create mode 100644 lib/librte_hash/rte_thash.h",
    "diff": "diff --git a/lib/librte_hash/Makefile b/lib/librte_hash/Makefile\nindex 3696cb1..981230b 100644\n--- a/lib/librte_hash/Makefile\n+++ b/lib/librte_hash/Makefile\n@@ -49,6 +49,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_HASH) += rte_fbk_hash.c\n SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include := rte_hash.h\n SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include += rte_hash_crc.h\n SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include += rte_jhash.h\n+SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include += rte_thash.h\n SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include += rte_fbk_hash.h\n \n # this lib needs eal\ndiff --git a/lib/librte_hash/rte_thash.h b/lib/librte_hash/rte_thash.h\nnew file mode 100644\nindex 0000000..877bd50\n--- /dev/null\n+++ b/lib/librte_hash/rte_thash.h\n@@ -0,0 +1,207 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2015 Vladimir Medvedkin <medvedkinv@gmail.com>\n+ *   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+#ifndef _RTE_THASH_H\n+#define _RTE_THASH_H\n+\n+/**\n+ * @file\n+ *\n+ * toeplitz hash functions.\n+ */\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+/**\n+ * Software implementation of the Toeplitz hash function used by RSS.\n+ * Can be used either for packet distribution on single queue NIC\n+ * or for simulating of RSS computation on specific NIC (for example\n+ * after GRE header decapsulating)\n+ */\n+\n+#include <stdint.h>\n+#include <rte_byteorder.h>\n+#include <rte_vect.h>\n+#include <rte_ip.h>\n+\n+/* Byte swap mask used for converting IPv6 address\n+ * 4-byte chunks to CPU byte order\n+ */\n+static const __m128i rte_thash_ipv6_bswap_mask = {\n+\t\t0x0405060700010203, 0x0C0D0E0F08090A0B};\n+\n+#define RTE_THASH_V4_L3\t 2\t/*calculate hash of ipv4 header only*/\n+#define RTE_THASH_V4_L4\t 3\t/*calculate hash of ipv4 + transport headers*/\n+#define RTE_THASH_V6_L3\t 8\t/*calculate hash of ipv6 header only */\n+#define RTE_THASH_V6_L4\t 9\t/*calculate hash of ipv6 + transport headers */\n+\n+/**\n+ * IPv4 tuple\n+ * addreses and ports/sctp_tag have to be CPU byte order\n+ */\n+struct rte_ipv4_tuple {\n+\tuint32_t\tsrc_addr;\n+\tuint32_t\tdst_addr;\n+\tunion {\n+\t\tstruct {\n+\t\t\tuint16_t dport;\n+\t\t\tuint16_t sport;\n+\t\t};\n+\t\tuint32_t        sctp_tag;\n+\t};\n+};\n+\n+/**\n+ * IPv6 tuple\n+ * Addresses have to be filled by rte_thash_load_v6_addr()\n+ * ports/sctp_tag have to be CPU byte order\n+ */\n+struct rte_ipv6_tuple {\n+\tuint8_t\t\tsrc_addr[16];\n+\tuint8_t\t\tdst_addr[16];\n+\tunion {\n+\t\tstruct {\n+\t\t\tuint16_t dport;\n+\t\t\tuint16_t sport;\n+\t\t};\n+\t\tuint32_t        sctp_tag;\n+\t};\n+};\n+\n+union rte_thash_tuple {\n+\tstruct rte_ipv4_tuple\tv4;\n+\tstruct rte_ipv6_tuple\tv6;\n+} __aligned(size);\n+\n+/**\n+ * Prepare special converted key to use with rte_softrss_be()\n+ * @param orig\n+ *   pointer to original RSS key\n+ * @param targ\n+ *   pointer to target RSS key\n+ * @param len\n+ *   RSS key length\n+ */\n+static inline void\n+rte_convert_rss_key(const uint32_t *orig, uint32_t *targ, int len)\n+{\n+\tint i;\n+\n+\tfor (i = 0; i < (len >> 2); i++)\n+\t\ttarg[i] = rte_be_to_cpu_32(orig[i]);\n+}\n+\n+/**\n+ * Prepare and load IPv6 address\n+ * @param orig\n+ *   Pointer to ipv6 header of the original packet\n+ * @param targ\n+ *   Pointer to rte_ipv6_tuple structure\n+ */\n+static inline void\n+rte_thash_load_v6_addr(const struct ipv6_hdr *orig, union rte_thash_tuple *targ)\n+{\n+\t__m128i ipv6 = _mm_loadu_si128((const __m128i *)orig->src_addr);\n+\t*(__m128i *)targ->v6.src_addr =\n+\t\t\t_mm_shuffle_epi8(ipv6, rte_thash_ipv6_bswap_mask);\n+\tipv6 = _mm_loadu_si128((const __m128i *)orig->dst_addr);\n+\t*(__m128i *)targ->v6.dst_addr =\n+\t\t\t_mm_shuffle_epi8(ipv6, rte_thash_ipv6_bswap_mask);\n+}\n+\n+/**\n+ * Generic implementation. Can be used with original rss_key\n+ * @param input_tuple\n+ *   Pointer to input tuple\n+ * @param input_len\n+ *   Length of input_tuple in 4-bytes chunks\n+ * @param rss_key\n+ *   Pointer to RSS hash key.\n+ * @return\n+ *   Calculated hash value.\n+ */\n+static inline uint32_t\n+rte_softrss(uint32_t *input_tuple, uint32_t input_len,\n+\t\tconst uint8_t *rss_key)\n+{\n+\tuint32_t i, j, ret = 0;\n+\n+\tfor (j = 0; j < input_len; j++) {\n+\t\tfor (i = 0; i < 32; i++) {\n+\t\t\tif (input_tuple[j] & (1 << (31 - i))) {\n+\t\t\t\tret ^= rte_cpu_to_be_32(((const uint32_t *)rss_key)[j]) << i |\n+\t\t\t\t\t(uint32_t)((uint64_t)(rte_cpu_to_be_32(((const uint32_t *)rss_key)[j + 1])) >>\n+\t\t\t\t\t(32 - i));\n+\t\t\t}\n+\t\t}\n+\t}\n+\treturn ret;\n+}\n+\n+/**\n+ * Optimized implementation.\n+ * If you want the calculated hash value matches NIC RSS value\n+ * you have to use special converted key with rte_convert_rss_key() fn.\n+ * @param input_tuple\n+ *   Pointer to input tuple\n+ * @param input_len\n+ *   Length of input_tuple in 4-bytes chunks\n+ * @param *rss_key\n+ *   Pointer to RSS hash key.\n+ * @return\n+ *   Calculated hash value.\n+ */\n+static inline uint32_t\n+rte_softrss_be(uint32_t *input_tuple, uint32_t input_len,\n+\t\tconst uint8_t *rss_key)\n+{\n+\tuint32_t i, j, ret = 0;\n+\n+\tfor (j = 0; j < input_len; j++) {\n+\t\tfor (i = 0; i < 32; i++) {\n+\t\t\tif (input_tuple[j] & (1 << (31 - i))) {\n+\t\t\t\tret ^= ((const uint32_t *)rss_key)[j] << i |\n+\t\t\t\t\t(uint32_t)((uint64_t)(((const uint32_t *)rss_key)[j + 1]) >> (32 - i));\n+\t\t\t}\n+\t\t}\n+\t}\n+\treturn ret;\n+}\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* _RTE_THASH_H */\n",
    "prefixes": [
        "dpdk-dev",
        "v5"
    ]
}