get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1333,
    "url": "https://patches.dpdk.org/api/patches/1333/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/a875a94021448514bfbcf1409e4303cde50882f3.1416318389.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": "<a875a94021448514bfbcf1409e4303cde50882f3.1416318389.git.e_zhumabekov@sts.kz>",
    "list_archive_url": "https://inbox.dpdk.org/dev/a875a94021448514bfbcf1409e4303cde50882f3.1416318389.git.e_zhumabekov@sts.kz",
    "date": "2014-11-18T14:03:40",
    "name": "[dpdk-dev,v4,3/5] hash: add fallback to software CRC32 implementation",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "c949195a5c9f505e0169138073d6e256eeff3598",
    "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/a875a94021448514bfbcf1409e4303cde50882f3.1416318389.git.e_zhumabekov@sts.kz/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/1333/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/1333/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 338007F74;\n\tTue, 18 Nov 2014 14:52:55 +0100 (CET)",
            "from mgw.gov.kz (mgw.gov.kz [89.218.88.242])\n\tby dpdk.org (Postfix) with ESMTP id 33BA47F30\n\tfor <dev@dpdk.org>; Tue, 18 Nov 2014 14:52:54 +0100 (CET)",
            "from mgw.gov.kz (mx.ctsat.kz [178.89.4.95])\n\tby mgw.gov.kz  with ESMTP id sAIE3Dbj014333-sAIE3Dbl014333\n\t(version=TLSv1.0 cipher=AES128-SHA bits=128 verify=NO);\n\tTue, 18 Nov 2014 20:03:13 +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\tTue, 18 Nov 2014 20:03:02 +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\tTue, 18 Nov 2014 20:03:24 +0600"
        ],
        "From": "Yerden Zhumabekov <e_zhumabekov@sts.kz>",
        "To": "<dev@dpdk.org>",
        "Date": "Tue, 18 Nov 2014 20:03:40 +0600",
        "Message-ID": "<a875a94021448514bfbcf1409e4303cde50882f3.1416318389.git.e_zhumabekov@sts.kz>",
        "X-Mailer": "git-send-email 1.7.9.5",
        "In-Reply-To": "<cover.1416318389.git.e_zhumabekov@sts.kz>",
        "References": "<1409724351-23786-1-git-send-email-e_zhumabekov@sts.kz>\n\t<cover.1416318389.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 v4 3/5] 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.\n\nAdded rte_hash_crc_set_alg() function to detect and set CRC32\nimplementation if necessary. SSE4.2 is allowed by default. If it's\nnot available, fall back to sw implementation.\n\nBest available algorithm is detected upon application startup\nthrough the constructor function rte_hash_crc_try_sse442().\n\nSigned-off-by: Yerden Zhumabekov <e_zhumabekov@sts.kz>\n---\n lib/librte_hash/rte_hash_crc.h |   53 ++++++++++++++++++++++++++++++++++++++--\n 1 file changed, 51 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h\nindex 15f687a..332ed99 100644\n--- a/lib/librte_hash/rte_hash_crc.h\n+++ b/lib/librte_hash/rte_hash_crc.h\n@@ -45,7 +45,11 @@ extern \"C\" {\n #endif\n \n #include <stdint.h>\n+#ifdef RTE_MACHINE_CPUFLAG_SSE4_2\n #include <nmmintrin.h>\n+#endif\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@@ -363,8 +367,41 @@ crc32c_2words(uint64_t data, uint32_t init_val)\n \treturn crc;\n }\n \n+enum crc32_alg_t {\n+\tCRC32_SW = 0,\n+\tCRC32_SSE42\n+};\n+\n+static enum crc32_alg_t crc32_alg;\n+\n+/**\n+ * Allow or disallow use of SSE4.2 instrinsics for CRC32 hash\n+ * calculation.\n+ *\n+ * @param flag\n+ *   unsigned integer flag\n+ *   - (CRC32_SW) Don't use SSE4.2 intrinsics\n+ *   - (CRC32_SSE42) Use SSE4.2 intrinsics if available, set by default\n+ */\n+static inline void\n+rte_hash_crc_set_alg(enum crc32_alg_t alg)\n+{\n+\tint sse42_supp = rte_cpu_get_flag_enabled(RTE_CPUFLAG_SSE4_2);\n+\tenum crc32_alg_t alg_supp = sse42_supp ? CRC32_SSE42 : CRC32_SW;\n+\tcrc32_alg = (alg == CRC32_SSE42) ? alg_supp : CRC32_SW;\n+}\n+\n+/* Best available algorithm is detected via CPUID instruction */\n+static inline void __attribute__((constructor))\n+rte_hash_crc_try_sse42(void)\n+{\n+\trte_hash_crc_set_alg(CRC32_SSE42);\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@@ -376,11 +413,18 @@ crc32c_2words(uint64_t data, uint32_t init_val)\n static inline uint32_t\n rte_hash_crc_4byte(uint32_t data, uint32_t init_val)\n {\n-\treturn _mm_crc32_u32(init_val, data);\n+#ifdef RTE_MACHINE_CPUFLAG_SSE4_2\n+\tif (likely(crc32_alg == CRC32_SSE42))\n+\t\treturn _mm_crc32_u32(init_val, data);\n+#endif\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@@ -392,7 +436,12 @@ 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 _mm_crc32_u64(init_val, data);\n+#ifdef RTE_MACHINE_CPUFLAG_SSE4_2\n+\tif (likely(crc32_alg == CRC32_SSE42))\n+\t\treturn _mm_crc32_u64(init_val, data);\n+#endif\n+\n+\treturn crc32c_2words(data, init_val);\n }\n \n /**\n",
    "prefixes": [
        "dpdk-dev",
        "v4",
        "3/5"
    ]
}