get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 68556,
    "url": "https://patches.dpdk.org/api/patches/68556/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200415141529.2057898-1-thomas@monjalon.net/",
    "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": "<20200415141529.2057898-1-thomas@monjalon.net>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200415141529.2057898-1-thomas@monjalon.net",
    "date": "2020-04-15T14:15:29",
    "name": "[v4] bitmap: add init with all bits set",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "31bc3411c206a6c5773ac6d1196394aeb9038cbb",
    "submitter": {
        "id": 685,
        "url": "https://patches.dpdk.org/api/people/685/?format=api",
        "name": "Thomas Monjalon",
        "email": "thomas@monjalon.net"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20200415141529.2057898-1-thomas@monjalon.net/mbox/",
    "series": [
        {
            "id": 9396,
            "url": "https://patches.dpdk.org/api/series/9396/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=9396",
            "date": "2020-04-15T14:15:29",
            "name": "[v4] bitmap: add init with all bits set",
            "version": 4,
            "mbox": "https://patches.dpdk.org/series/9396/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/68556/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/68556/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 74B04A0563;\n\tWed, 15 Apr 2020 16:15:39 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 326141D732;\n\tWed, 15 Apr 2020 16:15:38 +0200 (CEST)",
            "from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com\n [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id BD92C1D72E\n for <dev@dpdk.org>; Wed, 15 Apr 2020 16:15:35 +0200 (CEST)",
            "from compute7.internal (compute7.nyi.internal [10.202.2.47])\n by mailout.nyi.internal (Postfix) with ESMTP id F02D45C0160;\n Wed, 15 Apr 2020 10:15:34 -0400 (EDT)",
            "from mailfrontend2 ([10.202.2.163])\n by compute7.internal (MEProxy); Wed, 15 Apr 2020 10:15:34 -0400",
            "from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184])\n by mail.messagingengine.com (Postfix) with ESMTPA id C2E503060064;\n Wed, 15 Apr 2020 10:15:33 -0400 (EDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=\n from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding; s=mesmtp; bh=LIZ95jBORk\n UUaZ2E72t4mqXajEvtM4j1Eqf1gbgNCL8=; b=VUVdltfKZ90JGwYebFwVRoWOWu\n DpMmiZmlMrGeOxpbV7FBx9rP5Bx+CT4TLv83zfW8VotUer//VF4RcXcf72X36QA0\n Hdlzq4ou4gJrVAo7cpJfm/Y57I1mAJbAc13XAtwgl0DBp+dsyE9i3or12z+shj5w\n fpYxlKIfxVgtv17Xs=",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n messagingengine.com; h=cc:content-transfer-encoding:date:from\n :in-reply-to:message-id:mime-version:references:subject:to\n :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=\n fm2; bh=LIZ95jBORkUUaZ2E72t4mqXajEvtM4j1Eqf1gbgNCL8=; b=zaHumyTh\n Obs8I6Uvzj/CaovWSwobwBBuP/QH9oM+2gkhKJRWRv3F0GDKmbuUWUNsvoFKzlGq\n Gz0Gtvzt07tqKtWd9MxR6q6VeldliAMUyYF9/uPNDHLQwxcXI5p6iMdLuCcdMuSJ\n RAmjusJZZRu1GPfoD6YDtizUy6Ec+KXMyfYMtmHC1HQfyArkDZOqPBa3Zi3Y4ciy\n u7W++bu2pDQbLNvQ9xpScShw4TLNV4PjabrFo5vwDzN0HOjHfH9zMh1vLhxUHYk/\n 8Vfil6/U1jWRgz9RcCr6Wh0FeglokBiStzuxkGT9Ttb6YF8t1jbJ5liDQykN2CdV\n 9hRp5TsoykfJtg=="
        ],
        "X-ME-Sender": "<xms:BheXXiYFj2DWrxme0GtJSAcpk_iCw0B8zqf-5WAGVnwyd-BtjbVQQg>",
        "X-ME-Proxy-Cause": "\n gggruggvucftvghtrhhoucdtuddrgeduhedrfeefgdeifecutefuodetggdotefrodftvf\n curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu\n uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc\n fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs\n ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph\n epjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr\n rghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth",
        "X-ME-Proxy": "<xmx:BheXXqUKGlxx67OUgtgdChEcxo1YLC4ahQqBY_VuglEIdSTKB_JYAg>\n <xmx:BheXXhP2QgSDnGiGBGEkAqybQmhvagYFLq3JXb4aryKQHD1tLcwMAg>\n <xmx:BheXXkaOvV4I_izR049K97QGHdvyKVrNg2-7GMu_N24AdWZ1GeH4Zg>\n <xmx:BheXXhiQ5SMqnuwFLMJLrUctr-My40H38FncJiSBYhe6gjw1_lmOfA>",
        "From": "Thomas Monjalon <thomas@monjalon.net>",
        "To": "dev@dpdk.org",
        "Cc": "amo@semihalf.com, Suanming Mou <suanmingm@mellanox.com>,\n Cristian Dumitrescu <cristian.dumitrescu@intel.com>",
        "Date": "Wed, 15 Apr 2020 16:15:29 +0200",
        "Message-Id": "<20200415141529.2057898-1-thomas@monjalon.net>",
        "X-Mailer": "git-send-email 2.26.0",
        "In-Reply-To": "<1583828479-204084-1-git-send-email-suanmingm@mellanox.com>",
        "References": "<1583828479-204084-1-git-send-email-suanmingm@mellanox.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v4] bitmap: add init with all bits set",
        "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": "From: Suanming Mou <suanmingm@mellanox.com>\n\nCurrently, in the case to use bitmap as resource allocator, after\nbitmap creation, all the bitmap bits should be set to indicate the\nbit available. Every time when allocate one bit, search for the set\nbits and clear it to make it in use.\n\nAdd a new rte_bitmap_init_with_all_set() function to have a quick\nfill up the bitmap bits.\n\nComparing with the case create the bitmap as empty and set the bitmap\none by one, the new function costs less cycles.\n\nSigned-off-by: Suanming Mou <suanmingm@mellanox.com>\nAcked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\n---\n\nv4:\n- add experimental tags and comments\n- move functions near original init function\n- squash test patch\n- use \"init\" word in title\n\nv3 updates:\n1. Implement individual rte_bitmap_init_with_all_set() function.\n2. Add new function to clear the overhead bits.\n\nv2 updates:\n1. Split the common part to __rte_bitmap_init().\n2. Set the slab bits more customized.\n\n---\n app/test/test_bitmap.c              | 57 ++++++++++++++++++-\n lib/librte_eal/include/rte_bitmap.h | 85 +++++++++++++++++++++++++++++\n 2 files changed, 141 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/app/test/test_bitmap.c b/app/test/test_bitmap.c\nindex 95c5184882..a8204d329f 100644\n--- a/app/test/test_bitmap.c\n+++ b/app/test/test_bitmap.c\n@@ -146,7 +146,7 @@ test_bitmap_set_get_clear(struct rte_bitmap *bmp)\n }\n \n static int\n-test_bitmap(void)\n+test_bitmap_all_clear(void)\n {\n \tvoid *mem;\n \tuint32_t bmp_size;\n@@ -182,4 +182,59 @@ test_bitmap(void)\n \treturn TEST_SUCCESS;\n }\n \n+static int\n+test_bitmap_all_set(void)\n+{\n+\tvoid *mem;\n+\tuint32_t i;\n+\tuint64_t slab;\n+\tuint32_t pos;\n+\tuint32_t bmp_size;\n+\tstruct rte_bitmap *bmp;\n+\n+\tbmp_size =\n+\t\trte_bitmap_get_memory_footprint(MAX_BITS);\n+\n+\tmem = rte_zmalloc(\"test_bmap\", bmp_size, RTE_CACHE_LINE_SIZE);\n+\tif (mem == NULL) {\n+\t\tprintf(\"Failed to allocate memory for bitmap\\n\");\n+\t\treturn TEST_FAILED;\n+\t}\n+\n+\tbmp = rte_bitmap_init_with_all_set(MAX_BITS, mem, bmp_size);\n+\tif (bmp == NULL) {\n+\t\tprintf(\"Failed to init bitmap\\n\");\n+\t\treturn TEST_FAILED;\n+\t}\n+\n+\tfor (i = 0; i < MAX_BITS; i++) {\n+\t\tpos = slab = 0;\n+\t\tif (!rte_bitmap_scan(bmp, &pos, &slab)) {\n+\t\t\tprintf(\"Failed with init bitmap.\\n\");\n+\t\t\treturn TEST_FAILED;\n+\t\t}\n+\t\tpos += (slab ? __builtin_ctzll(slab) : 0);\n+\t\trte_bitmap_clear(bmp, pos);\n+\t}\n+\n+\tif (rte_bitmap_scan(bmp, &pos, &slab)) {\n+\t\tprintf(\"Too much bits set.\\n\");\n+\t\treturn TEST_FAILED;\n+\t}\n+\n+\trte_bitmap_free(bmp);\n+\trte_free(mem);\n+\n+\treturn TEST_SUCCESS;\n+\n+}\n+\n+static int\n+test_bitmap(void)\n+{\n+\tif (test_bitmap_all_clear() != TEST_SUCCESS)\n+\t\treturn TEST_FAILED;\n+\treturn test_bitmap_all_set();\n+}\n+\n REGISTER_TEST_COMMAND(bitmap_test, test_bitmap);\ndiff --git a/lib/librte_eal/include/rte_bitmap.h b/lib/librte_eal/include/rte_bitmap.h\nindex 6b846f251b..7c90ef333f 100644\n--- a/lib/librte_eal/include/rte_bitmap.h\n+++ b/lib/librte_eal/include/rte_bitmap.h\n@@ -203,6 +203,91 @@ rte_bitmap_init(uint32_t n_bits, uint8_t *mem, uint32_t mem_size)\n \treturn bmp;\n }\n \n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Bitmap clear slab overhead bits.\n+ *\n+ * @param slabs\n+ *   Slab array.\n+ * @param slab_size\n+ *   Number of 64-bit slabs in the slabs array.\n+ * @param pos\n+ *   The start bit position in the slabs to be cleared.\n+ */\n+__rte_experimental\n+static inline void\n+__rte_bitmap_clear_slab_overhead_bits(uint64_t *slabs, uint32_t slab_size,\n+\t\t\t\t      uint32_t pos)\n+{\n+\tuint32_t i;\n+\tuint32_t index = pos / RTE_BITMAP_SLAB_BIT_SIZE;\n+\tuint32_t offset = pos & RTE_BITMAP_SLAB_BIT_MASK;\n+\n+\tif (offset) {\n+\t\tfor (i = offset; i < RTE_BITMAP_SLAB_BIT_SIZE; i++)\n+\t\t\tslabs[index] &= ~(1llu << i);\n+\t\tindex++;\n+\t}\n+\tif (index < slab_size)\n+\t\tmemset(&slabs[index], 0, sizeof(slabs[0]) *\n+\t\t       (slab_size - index));\n+}\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Bitmap initialization with all bits set\n+ *\n+ * @param n_bits\n+ *   Number of pre-allocated bits in array2.\n+ * @param mem\n+ *   Base address of array1 and array2.\n+ * @param mem_size\n+ *   Minimum expected size of bitmap.\n+ * @return\n+ *   Handle to bitmap instance.\n+ */\n+__rte_experimental\n+static inline struct rte_bitmap *\n+rte_bitmap_init_with_all_set(uint32_t n_bits, uint8_t *mem, uint32_t mem_size)\n+{\n+\tstruct rte_bitmap *bmp;\n+\tuint32_t array1_byte_offset, array1_slabs;\n+\tuint32_t array2_byte_offset, array2_slabs;\n+\tuint32_t size;\n+\n+\t/* Check input arguments */\n+\tif (!n_bits || !mem || (((uintptr_t) mem) & RTE_CACHE_LINE_MASK))\n+\t\treturn NULL;\n+\n+\tsize = __rte_bitmap_get_memory_footprint(n_bits,\n+\t\t&array1_byte_offset, &array1_slabs,\n+\t\t&array2_byte_offset, &array2_slabs);\n+\tif (size < mem_size)\n+\t\treturn NULL;\n+\n+\t/* Setup bitmap */\n+\tbmp = (struct rte_bitmap *) mem;\n+\tbmp->array1 = (uint64_t *) &mem[array1_byte_offset];\n+\tbmp->array1_size = array1_slabs;\n+\tbmp->array2 = (uint64_t *) &mem[array2_byte_offset];\n+\tbmp->array2_size = array2_slabs;\n+\n+\t__rte_bitmap_scan_init(bmp);\n+\n+\tmemset(bmp->array1, 0xff, bmp->array1_size * sizeof(bmp->array1[0]));\n+\tmemset(bmp->array2, 0xff, bmp->array2_size * sizeof(bmp->array2[0]));\n+\t/* Clear overhead bits. */\n+\t__rte_bitmap_clear_slab_overhead_bits(bmp->array1, bmp->array1_size,\n+\t\t\tbmp->array2_size >> RTE_BITMAP_CL_SLAB_SIZE_LOG2);\n+\t__rte_bitmap_clear_slab_overhead_bits(bmp->array2, bmp->array2_size,\n+\t\t\tn_bits);\n+\treturn bmp;\n+}\n+\n /**\n  * Bitmap free\n  *\n",
    "prefixes": [
        "v4"
    ]
}