get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 62620,
    "url": "http://patches.dpdk.org/api/patches/62620/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20191106211835.56946-1-drc@linux.vnet.ibm.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<20191106211835.56946-1-drc@linux.vnet.ibm.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20191106211835.56946-1-drc@linux.vnet.ibm.com",
    "date": "2019-11-06T21:18:35",
    "name": "[v6] app/test: add tests for atomic exchanges",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "4d66db7a1f50784c7acfd677d038f3f121ebc11f",
    "submitter": {
        "id": 1256,
        "url": "http://patches.dpdk.org/api/people/1256/?format=api",
        "name": "David Christensen",
        "email": "drc@linux.vnet.ibm.com"
    },
    "delegate": {
        "id": 24651,
        "url": "http://patches.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20191106211835.56946-1-drc@linux.vnet.ibm.com/mbox/",
    "series": [
        {
            "id": 7305,
            "url": "http://patches.dpdk.org/api/series/7305/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=7305",
            "date": "2019-11-06T21:18:35",
            "name": "[v6] app/test: add tests for atomic exchanges",
            "version": 6,
            "mbox": "http://patches.dpdk.org/series/7305/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/62620/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/62620/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 0B74FA04AE;\n\tWed,  6 Nov 2019 22:18:42 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 34E011E94B;\n\tWed,  6 Nov 2019 22:18:41 +0100 (CET)",
            "from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com\n [148.163.158.5]) by dpdk.org (Postfix) with ESMTP id 07D521E947\n for <dev@dpdk.org>; Wed,  6 Nov 2019 22:18:39 +0100 (CET)",
            "from pps.filterd (m0098419.ppops.net [127.0.0.1])\n by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id\n xA6LCkx6039232 for <dev@dpdk.org>; Wed, 6 Nov 2019 16:18:38 -0500",
            "from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com\n [169.63.121.186])\n by mx0b-001b2d01.pphosted.com with ESMTP id 2w41wtrjqn-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Wed, 06 Nov 2019 16:18:37 -0500",
            "from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1])\n by ppma03wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id xA6LFXaF002045\n for <dev@dpdk.org>; Wed, 6 Nov 2019 21:18:37 GMT",
            "from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com\n [9.57.198.29]) by ppma03wdc.us.ibm.com with ESMTP id 2w41uj9xyh-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Wed, 06 Nov 2019 21:18:37 +0000",
            "from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com\n [9.57.199.109])\n by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n xA6LIaG051380570\n (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n Wed, 6 Nov 2019 21:18:37 GMT",
            "from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id DD87B112064;\n Wed,  6 Nov 2019 21:18:36 +0000 (GMT)",
            "from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id D0541112063;\n Wed,  6 Nov 2019 21:18:36 +0000 (GMT)",
            "from localhost.localdomain (unknown [9.114.224.51])\n by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP;\n Wed,  6 Nov 2019 21:18:36 +0000 (GMT)"
        ],
        "From": "David Christensen <drc@linux.vnet.ibm.com>",
        "To": "dev@dpdk.org",
        "Cc": "David Christensen <drc@linux.vnet.ibm.com>",
        "Date": "Wed,  6 Nov 2019 13:18:35 -0800",
        "Message-Id": "<20191106211835.56946-1-drc@linux.vnet.ibm.com>",
        "X-Mailer": "git-send-email 2.18.1",
        "In-Reply-To": "<20191106195724.129445-1-drc@linux.vnet.ibm.com>",
        "References": "<20191106195724.129445-1-drc@linux.vnet.ibm.com>",
        "X-TM-AS-GCONF": "00",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:, ,\n definitions=2019-11-06_07:, , signatures=0",
        "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n priorityscore=1501\n malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0\n clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0\n mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx\n scancount=1 engine=8.0.1-1910280000 definitions=main-1911060208",
        "Subject": "[dpdk-dev] [PATCH v6] app/test: add tests for atomic exchanges",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "The test works by creating a token comprised of random data\nand a CRC8 value, using the rte_atomicXX_exchange to exchange\nthe new token for a previously generated token, and then\nverifying that the exchanged data is intact (i.e. the CRC8\nis still correct for the data).\n\nSigned-off-by: David Christensen <drc@linux.vnet.ibm.com>\n---\nv6:\n* Fixed build error on x86/ARM systems\n\nv5:\n* Rebase to master\n* Removed comment reference to the number of sub-tests\n* Rename rte_u16/32/64_t typedefs to test16/32/64_t\n\nv4:\n* Fix build error due to use of variable initialization\n  in \"for\" statement.\n\nv3:\n* Actually fixed build issue on all platforms caused by\n  misspelling of rte_atomic64_inc\n\nv2:\n* Fixed build issue on all platforms caused by misspelling\n  of rte_atomic64_inc\n---\n app/test/test_atomic.c | 175 ++++++++++++++++++++++++++++++++++++++++-\n 1 file changed, 171 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/app/test/test_atomic.c b/app/test/test_atomic.c\nindex 2df950694..de3030d22 100644\n--- a/app/test/test_atomic.c\n+++ b/app/test/test_atomic.c\n@@ -6,6 +6,7 @@\n #include <stdio.h>\n #include <stdint.h>\n #include <unistd.h>\n+#include <inttypes.h>\n #include <sys/queue.h>\n \n #include <rte_memory.h>\n@@ -14,6 +15,8 @@\n #include <rte_atomic.h>\n #include <rte_eal.h>\n #include <rte_lcore.h>\n+#include <rte_random.h>\n+#include <rte_hash_crc.h>\n \n #include \"test.h\"\n \n@@ -21,7 +24,7 @@\n  * Atomic Variables\n  * ================\n  *\n- * - The main test function performs four subtests. The first test\n+ * - The main test function performs several subtests. The first\n  *   checks that the usual inc/dec/add/sub functions are working\n  *   correctly:\n  *\n@@ -34,7 +37,7 @@\n  *   - The function checks that once all lcores finish their function,\n  *     the value of the atomic variables are still the same.\n  *\n- * - The second test verifies the behavior of \"test and set\" functions.\n+ * - Test \"test and set\" functions.\n  *\n  *   - Initialize 16-bit, 32-bit and 64-bit atomic variables to zero.\n  *\n@@ -48,7 +51,7 @@\n  *   - The main function checks that the atomic counter was incremented\n  *     twice only (one for 16-bit, one for 32-bit and one for 64-bit values).\n  *\n- * - Test \"add/sub and return\"\n+ * - Test \"add/sub and return\" functions\n  *\n  *   - Initialize 16-bit, 32-bit and 64-bit atomic variables to zero.\n  *\n@@ -78,6 +81,20 @@\n  *\n  *   - At the end of the test, the *count128* first 64-bit value and\n  *     second 64-bit value differ by the total iterations.\n+ *\n+ * - Test \"atomic exchange\" functions\n+ *\n+ *   - Create a 64 bit token that can be tested for data integrity\n+ *\n+ *   - Invoke ``test_atomic_exchange`` on each lcore.  Before doing\n+ *     anything else, the cores wait for a synchronization event.\n+ *     Each core then does the follwoing for N iterations:\n+ *\n+ *       Generate a new token with a data integrity check\n+ *       Exchange the new token for previously generated token\n+ *       Increment a counter if a corrupt token was received\n+ *\n+ *   - At the end of the test, the number of corrupted tokens must be 0.\n  */\n \n #define NUM_ATOMIC_TYPES 3\n@@ -305,6 +322,125 @@ test_atomic128_cmp_exchange(__attribute__((unused)) void *arg)\n }\n #endif\n \n+/*\n+ * Helper definitions/variables/functions for\n+ * atomic exchange tests\n+ */\n+typedef union {\n+\tuint16_t u16;\n+\tuint8_t  u8[2];\n+} test16_t;\n+\n+typedef union {\n+\tuint32_t u32;\n+\tuint16_t u16[2];\n+\tuint8_t  u8[4];\n+} test32_t;\n+\n+typedef union {\n+\tuint64_t u64;\n+\tuint32_t u32[2];\n+\tuint16_t u16[4];\n+\tuint8_t  u8[8];\n+} test64_t;\n+\n+const uint8_t CRC8_POLY = 0x91;\n+uint8_t crc8_table[256];\n+\n+volatile uint16_t token16;\n+volatile uint32_t token32;\n+volatile uint64_t token64;\n+\n+static void\n+build_crc8_table(void)\n+{\n+\tuint8_t val;\n+\tint i, j;\n+\n+\tfor (i = 0; i < 256; i++) {\n+\t\tval = i;\n+\t\tfor (j = 0; j < 8; j++) {\n+\t\t\tif (val & 1)\n+\t\t\t\tval ^= CRC8_POLY;\n+\t\t\tval >>= 1;\n+\t\t}\n+\t\tcrc8_table[i] = val;\n+\t}\n+}\n+\n+static uint8_t\n+get_crc8(uint8_t *message, int length)\n+{\n+\tuint8_t crc = 0;\n+\tint i;\n+\n+\tfor (i = 0; i < length; i++)\n+\t\tcrc = crc8_table[crc ^ message[i]];\n+\treturn crc;\n+}\n+\n+/*\n+ * The atomic exchange test sets up a token in memory and\n+ * then spins up multiple lcores whose job is to generate\n+ * new tokens, exchange that new token for the old one held\n+ * in memory, and then verify that the old token is still\n+ * valid (i.e. the exchange did not corrupt the token).\n+ *\n+ * A token is made up of random data and 8 bits of crc\n+ * covering that random data.  The following is an example\n+ * of a 64bit token.\n+ *\n+ * +------------+------------+\n+ * | 63      56 | 55       0 |\n+ * +------------+------------+\n+ * |    CRC8    |    Data    |\n+ * +------------+------------+\n+ */\n+static int\n+test_atomic_exchange(__attribute__((unused)) void *arg)\n+{\n+\tint i;\n+\ttest16_t nt16, ot16; /* new token, old token */\n+\ttest32_t nt32, ot32;\n+\ttest64_t nt64, ot64;\n+\n+\t/* Wait until all of the other threads have been dispatched */\n+\twhile (rte_atomic32_read(&synchro) == 0)\n+\t\t;\n+\n+\t/*\n+\t * Let the battle begin! Every thread attempts to steal the current\n+\t * token with an atomic exchange operation and install its own newly\n+\t * generated token. If the old token is valid (i.e. it has the\n+\t * appropriate crc32 hash for the data) then the test iteration has\n+\t * passed.  If the token is invalid, increment the counter.\n+\t */\n+\tfor (i = 0; i < N; i++) {\n+\n+\t\t/* Test 64bit Atomic Exchange */\n+\t\tnt64.u64 = rte_rand();\n+\t\tnt64.u8[7] = get_crc8(&nt64.u8[0], sizeof(nt64) - 1);\n+\t\tot64.u64 = rte_atomic64_exchange(&token64, nt64.u64);\n+\t\tif (ot64.u8[7] != get_crc8(&ot64.u8[0], sizeof(ot64) - 1))\n+\t\t\trte_atomic64_inc(&count);\n+\n+\t\t/* Test 32bit Atomic Exchange */\n+\t\tnt32.u32 = (uint32_t)rte_rand();\n+\t\tnt32.u8[3] = get_crc8(&nt32.u8[0], sizeof(nt32) - 1);\n+\t\tot32.u32 = rte_atomic32_exchange(&token32, nt32.u32);\n+\t\tif (ot32.u8[3] != get_crc8(&ot32.u8[0], sizeof(ot32) - 1))\n+\t\t\trte_atomic64_inc(&count);\n+\n+\t\t/* Test 16bit Atomic Exchange */\n+\t\tnt16.u16 = (uint16_t)rte_rand();\n+\t\tnt16.u8[1] = get_crc8(&nt16.u8[0], sizeof(nt16) - 1);\n+\t\tot16.u16 = rte_atomic16_exchange(&token16, nt16.u16);\n+\t\tif (ot16.u8[1] != get_crc8(&ot16.u8[0], sizeof(ot16) - 1))\n+\t\t\trte_atomic64_inc(&count);\n+\t}\n+\n+\treturn 0;\n+}\n static int\n test_atomic(void)\n {\n@@ -461,7 +597,38 @@ test_atomic(void)\n \t}\n #endif\n \n+\t/*\n+\t * Test 16/32/64bit atomic exchange.\n+\t */\n+\ttest64_t t;\n+\n+\tprintf(\"exchange test\\n\");\n+\n+\trte_atomic32_clear(&synchro);\n+\trte_atomic64_clear(&count);\n+\n+\t/* Generate the CRC8 lookup table */\n+\tbuild_crc8_table();\n+\n+\t/* Create the initial tokens used by the test */\n+\tt.u64 = rte_rand();\n+\ttoken16 = (get_crc8(&t.u8[0], sizeof(token16) - 1) << 8)\n+\t\t| (t.u16[0] & 0x00ff);\n+\ttoken32 = ((uint32_t)get_crc8(&t.u8[0], sizeof(token32) - 1) << 24)\n+\t\t| (t.u32[0] & 0x00ffffff);\n+\ttoken64 = ((uint64_t)get_crc8(&t.u8[0], sizeof(token64) - 1) << 56)\n+\t\t| (t.u64 & 0x00ffffffffffffff);\n+\n+\trte_eal_mp_remote_launch(test_atomic_exchange, NULL, SKIP_MASTER);\n+\trte_atomic32_set(&synchro, 1);\n+\trte_eal_mp_wait_lcore();\n+\trte_atomic32_clear(&synchro);\n+\n+\tif (rte_atomic64_read(&count) > 0) {\n+\t\tprintf(\"Atomic exchange test failed\\n\");\n+\t\treturn -1;\n+\t}\n+\n \treturn 0;\n }\n-\n REGISTER_TEST_COMMAND(atomic_autotest, test_atomic);\n",
    "prefixes": [
        "v6"
    ]
}