get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1361,
    "url": "https://patches.dpdk.org/api/patches/1361/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/3e8c67c58253f65e2378121ca671a0dc6d7c4c1c.1416459284.git.e_zhumabekov@sts.kz/",
    "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": "<3e8c67c58253f65e2378121ca671a0dc6d7c4c1c.1416459284.git.e_zhumabekov@sts.kz>",
    "list_archive_url": "https://inbox.dpdk.org/dev/3e8c67c58253f65e2378121ca671a0dc6d7c4c1c.1416459284.git.e_zhumabekov@sts.kz",
    "date": "2014-11-20T05:17:44",
    "name": "[dpdk-dev,v5,5/7] hash: add fallback to software CRC32 implementation",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "65c49dc455477ab3c8883a157dac3a2538883c19",
    "submitter": {
        "id": 36,
        "url": "https://patches.dpdk.org/api/people/36/?format=api",
        "name": "Yerden Zhumabekov",
        "email": "e_zhumabekov@sts.kz"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/3e8c67c58253f65e2378121ca671a0dc6d7c4c1c.1416459284.git.e_zhumabekov@sts.kz/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/1361/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/1361/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 4C4917F68;\n\tThu, 20 Nov 2014 06:07:47 +0100 (CET)",
            "from mgw.gov.kz (mgw.gov.kz [89.218.88.242])\n\tby dpdk.org (Postfix) with ESMTP id 7E1187F60\n\tfor <dev@dpdk.org>; Thu, 20 Nov 2014 06:07:44 +0100 (CET)",
            "from mgw.gov.kz (mx.ctsat.kz [178.89.4.95])\n\tby mgw.gov.kz  with ESMTP id sAK5I2UQ000627-sAK5I2US000627\n\t(version=TLSv1.0 cipher=AES128-SHA bits=128 verify=NO);\n\tThu, 20 Nov 2014 11:18:04 +0600",
            "from EXCASHUB2.rgp.local (192.168.40.53) by EdgeForefront.rgp.local\n\t(192.168.40.59) with Microsoft SMTP Server (TLS) id 14.2.247.3;\n\tThu, 20 Nov 2014 11:17:49 +0600",
            "from r220.rgp.local (192.168.59.10) by excashub2.rgp.local\n\t(192.168.40.48) with Microsoft SMTP Server (TLS) id 14.2.247.3;\n\tThu, 20 Nov 2014 11:18:00 +0600"
        ],
        "From": "Yerden Zhumabekov <e_zhumabekov@sts.kz>",
        "To": "<dev@dpdk.org>",
        "Date": "Thu, 20 Nov 2014 11:17:44 +0600",
        "Message-ID": "<3e8c67c58253f65e2378121ca671a0dc6d7c4c1c.1416459284.git.e_zhumabekov@sts.kz>",
        "X-Mailer": "git-send-email 1.7.9.5",
        "In-Reply-To": "<cover.1416459284.git.e_zhumabekov@sts.kz>",
        "References": "<1409724351-23786-1-git-send-email-e_zhumabekov@sts.kz>\n\t<cover.1416459284.git.e_zhumabekov@sts.kz>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[192.168.59.10]",
        "X-FEAS-SYSTEM-WL": "e_zhumabekov@sts.kz",
        "Subject": "[dpdk-dev] [PATCH v5 5/7] hash: add fallback to software CRC32\n\timplementation",
        "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": "Initially, SSE4.2 support is detected via CPUID instruction via\nthe constructor function.\n\nAdded rte_hash_crc_set_alg() function to detect and set CRC32\nimplementation if necessary. SSE4.2 is allowed by default.\n\nrte_hash_crc_*byte() functions reworked so they choose available\nCRC32 implementation in the runtime.\n\nSigned-off-by: Yerden Zhumabekov <e_zhumabekov@sts.kz>\n---\n lib/librte_hash/rte_hash_crc.h |   61 ++++++++++++++++++++++++++++++++++++++--\n 1 file changed, 59 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h\nindex 2c8ec99..469b4f5 100644\n--- a/lib/librte_hash/rte_hash_crc.h\n+++ b/lib/librte_hash/rte_hash_crc.h\n@@ -45,6 +45,8 @@ extern \"C\" {\n #endif\n \n #include <stdint.h>\n+#include <rte_cpuflags.h>\n+#include <rte_branch_prediction.h>\n \n /* Lookup tables for software implementation of CRC32C */\n static uint32_t crc32c_tables[8][256] = {{\n@@ -396,8 +398,52 @@ crc32c_sse42_u64_mimic(uint64_t data, uint64_t init_val)\n \treturn init_val;\n }\n \n+#define CRC32_SW            (1U << 0)\n+#define CRC32_SSE42         (1U << 1)\n+#define CRC32_x64           (1U << 2)\n+#define CRC32_SSE42_x64     (CRC32_x64|CRC32_SSE42)\n+\n+static uint8_t crc32_alg = CRC32_SW;\n+\n+/**\n+ * Allow or disallow use of SSE4.2 instrinsics for CRC32 hash\n+ * calculation.\n+ *\n+ * @param flag\n+ *   An OR of following flags:\n+ *   - (CRC32_SW) Don't use SSE4.2 intrinsics\n+ *   - (CRC32_SSE42) Use SSE4.2 intrinsics if available\n+ *   - (CRC32_SSE42_x64) Use 64-bit SSE4.2 intrinsic if available (default)\n+ *\n+ */\n+static inline void\n+rte_hash_crc_set_alg(uint8_t alg)\n+{\n+\tswitch (alg) {\n+\tcase CRC32_SSE42_x64:\n+\t\tif (! rte_cpu_get_flag_enabled(RTE_CPUFLAG_EM64T))\n+\t\t\talg = CRC32_SSE42;\n+\tcase CRC32_SSE42:\n+\t\tif (! rte_cpu_get_flag_enabled(RTE_CPUFLAG_SSE4_2))\n+\t\t\talg = CRC32_SW;\n+\tcase CRC32_SW:\n+\t\tcrc32_alg = alg;\n+\tdefault:\n+\t\tbreak;\n+\t}\n+}\n+\n+/* Setting the best available algorithm */\n+static inline void __attribute__((constructor))\n+rte_hash_crc_init_alg(void)\n+{\n+\trte_hash_crc_set_alg(CRC32_SSE42_x64);\n+}\n+\n /**\n  * Use single crc32 instruction to perform a hash on a 4 byte value.\n+ * Fall back to software crc32 implementation in case SSE4.2 is\n+ * not supported\n  *\n  * @param data\n  *   Data to perform hash on.\n@@ -409,11 +455,16 @@ crc32c_sse42_u64_mimic(uint64_t data, uint64_t init_val)\n static inline uint32_t\n rte_hash_crc_4byte(uint32_t data, uint32_t init_val)\n {\n-\treturn crc32c_sse42_u32(data, init_val);\n+\tif (likely(crc32_alg & CRC32_SSE42))\n+\t\treturn crc32c_sse42_u32(data, init_val);\n+\n+\treturn crc32c_1word(data, init_val);\n }\n \n /**\n  * Use single crc32 instruction to perform a hash on a 8 byte value.\n+ * Fall back to software crc32 implementation in case SSE4.2 is\n+ * not supported\n  *\n  * @param data\n  *   Data to perform hash on.\n@@ -425,7 +476,13 @@ rte_hash_crc_4byte(uint32_t data, uint32_t init_val)\n static inline uint32_t\n rte_hash_crc_8byte(uint64_t data, uint32_t init_val)\n {\n-\treturn crc32c_sse42_u64(data, init_val);\n+\tif (likely(crc32_alg == CRC32_SSE42_x64))\n+\t\treturn crc32c_sse42_u64(data, init_val);\n+\n+\tif (likely(crc32_alg & CRC32_SSE42))\n+\t\treturn crc32c_sse42_u64_mimic(data, init_val);\n+\n+\treturn crc32c_2words(data, init_val);\n }\n \n /**\n",
    "prefixes": [
        "dpdk-dev",
        "v5",
        "5/7"
    ]
}