get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 128631,
    "url": "http://patches.dpdk.org/api/patches/128631/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230613154013.2648333-1-vfialko@marvell.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": "<20230613154013.2648333-1-vfialko@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230613154013.2648333-1-vfialko@marvell.com",
    "date": "2023-06-13T15:40:13",
    "name": "[v2] bitmap: add scan from offset function",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "bbdc19724dd8029fa6fbb1744b72170fa756753d",
    "submitter": {
        "id": 2390,
        "url": "http://patches.dpdk.org/api/people/2390/?format=api",
        "name": "Volodymyr Fialko",
        "email": "vfialko@marvell.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20230613154013.2648333-1-vfialko@marvell.com/mbox/",
    "series": [
        {
            "id": 28490,
            "url": "http://patches.dpdk.org/api/series/28490/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=28490",
            "date": "2023-06-13T15:40:13",
            "name": "[v2] bitmap: add scan from offset function",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/28490/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/128631/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/128631/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 426C442CA5;\n\tTue, 13 Jun 2023 17:41:05 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 1ACDA40C35;\n\tTue, 13 Jun 2023 17:41:05 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174])\n by mails.dpdk.org (Postfix) with ESMTP id E65DB40A8A\n for <dev@dpdk.org>; Tue, 13 Jun 2023 17:41:03 +0200 (CEST)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id\n 35DBUNX6031900; Tue, 13 Jun 2023 08:41:03 -0700",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3r6qn2h1fp-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Tue, 13 Jun 2023 08:41:02 -0700",
            "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48;\n Tue, 13 Jun 2023 08:41:01 -0700",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend\n Transport; Tue, 13 Jun 2023 08:41:01 -0700",
            "from cavium-DT10.. (unknown [10.28.34.39])\n by maili.marvell.com (Postfix) with ESMTP id 570183F7041;\n Tue, 13 Jun 2023 08:40:59 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-transfer-encoding : content-type; s=pfpt0220;\n bh=BjhEX2Tv7AQzH7MxdSfFWzsQZw6i9gx1qlQqjRUoCZE=;\n b=T/JDJJRBSu10d9/EADs3c2zJ3gxUu5cnmteOh+lbYck9bDdvBppVmvEpFK5nYUby6DLR\n L9D0Q9HWZ8syaO/JW+7pRa5eYZIH+D3VC+QI91XEpoWpzOLnSvuoihdNlIhbPfc7UIpY\n qaCeHMTj8NqUGULBfK4Elc2q9autFCvKnzFjOJkrRCwACNGKcp80VfdC3kzz2PImTQ/0\n OiS2cmMfo02OIi8SO+9IWOCcX4QFsaRMY7TIiztvaxUef+DJP1aZsM4HLIF0hOVjkkqr\n NplIzhhThJ5bvNkXJ0GMdosdi3hNOoKAkhLD318mGszQQYya5WU2qtJEhpeZxy/+l4O4 Jw==",
        "From": "Volodymyr Fialko <vfialko@marvell.com>",
        "To": "<dev@dpdk.org>, <cristian.dumitrescu@intel.com>",
        "CC": "<jerinj@marvell.com>, <anoobj@marvell.com>, <thomas@monjalon.net>,\n Volodymyr Fialko <vfialko@marvell.com>",
        "Subject": "[PATCH v2] bitmap: add scan from offset function",
        "Date": "Tue, 13 Jun 2023 17:40:13 +0200",
        "Message-ID": "<20230613154013.2648333-1-vfialko@marvell.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20230414083943.270651-1-vfialko@marvell.com>",
        "References": "<20230414083943.270651-1-vfialko@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-ORIG-GUID": "QDTVyALzDelDdsxNaSgZWcR3T1yhHy-n",
        "X-Proofpoint-GUID": "QDTVyALzDelDdsxNaSgZWcR3T1yhHy-n",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26\n definitions=2023-06-13_18,2023-06-12_02,2023-05-22_02",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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"
    },
    "content": "Currently, in the case when we search for a bit set after a particular\nvalue, the bitmap has to be scanned from the beginning and\nrte_bitmap_scan() has to be called multiple times until we hit the value.\n\nAdd a new rte_bitmap_scan_from_offset() function to initialize scan\nstate at the given offset and perform scan, this will allow getting\nthe next set bit after certain offset within one scan call.\n\nSigned-off-by: Volodymyr Fialko <vfialko@marvell.com>\n---\n app/test/test_bitmap.c       | 33 ++++++++++++++++++++-\n lib/eal/include/rte_bitmap.h | 56 ++++++++++++++++++++++++++++++++++++\n 2 files changed, 88 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/app/test/test_bitmap.c b/app/test/test_bitmap.c\nindex e9c61590ae..9e38087408 100644\n--- a/app/test/test_bitmap.c\n+++ b/app/test/test_bitmap.c\n@@ -18,8 +18,8 @@ test_bitmap_scan_operations(struct rte_bitmap *bmp)\n {\n \tuint64_t slab1_magic = 0xBADC0FFEEBADF00D;\n \tuint64_t slab2_magic = 0xFEEDDEADDEADF00D;\n+\tint i, nb_clear, nb_set, next_cl;\n \tuint32_t pos = 0, start_pos;\n-\tint i, nb_clear, nb_set;\n \tuint64_t out_slab = 0;\n \n \trte_bitmap_reset(bmp);\n@@ -71,6 +71,37 @@ test_bitmap_scan_operations(struct rte_bitmap *bmp)\n \t\treturn TEST_FAILED;\n \t}\n \n+\t/* Scan with offset check. */\n+\tif (!rte_bitmap_scan_from_offset(bmp, RTE_BITMAP_SLAB_BIT_SIZE, &pos, &out_slab)) {\n+\t\tprintf(\"Failed to get slab from bitmap with scan from offset.\\n\");\n+\t\treturn TEST_FAILED;\n+\t}\n+\n+\tif (slab2_magic != out_slab) {\n+\t\tprintf(\"Scan from offset operation failed.\\n\");\n+\t\treturn TEST_FAILED;\n+\t}\n+\n+\t/* Scan with offset wrap around check. */\n+\tif (!rte_bitmap_scan_from_offset(bmp, 2 * RTE_BITMAP_SLAB_BIT_SIZE, &pos, &out_slab)) {\n+\t\tprintf(\"Failed to get slab from bitmap with scan from offset.\\n\");\n+\t\treturn TEST_FAILED;\n+\t}\n+\n+\tif (slab1_magic != out_slab) {\n+\t\tprintf(\"Scan from offset with wrap around operation failed.\\n\");\n+\t\treturn TEST_FAILED;\n+\t}\n+\n+\t/* Test scan when the bit set is on a next cline */\n+\trte_bitmap_reset(bmp);\n+\tnext_cl = RTE_MIN(RTE_BITMAP_CL_BIT_SIZE, MAX_BITS);\n+\trte_bitmap_set(bmp, next_cl);\n+\tif (!rte_bitmap_scan_from_offset(bmp, 0, &pos, &out_slab)) {\n+\t\tprintf(\"Failed to get slab from next cache line from bitmap.\\n\");\n+\t\treturn TEST_FAILED;\n+\t}\n+\n \t/* Test scan when a cline is half full */\n \trte_bitmap_reset(bmp);\n \tfor (i = 0; i < MAX_BITS; i++)\ndiff --git a/lib/eal/include/rte_bitmap.h b/lib/eal/include/rte_bitmap.h\nindex 27ee3d18a4..624365b9c5 100644\n--- a/lib/eal/include/rte_bitmap.h\n+++ b/lib/eal/include/rte_bitmap.h\n@@ -137,6 +137,30 @@ __rte_bitmap_scan_init(struct rte_bitmap *bmp)\n \tbmp->go2 = 0;\n }\n \n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Bitmap initialize internal scan pointers at the given position for the scan function.\n+ *\n+ * @param bmp\n+ *   Handle to bitmap instance\n+ * @param pos\n+ *   Bit position to start scan\n+ */\n+__rte_experimental\n+static inline void\n+__rte_bitmap_scan_init_at(struct rte_bitmap *bmp, uint32_t pos)\n+{\n+\tuint64_t *slab1;\n+\n+\tbmp->index1 = pos >> (RTE_BITMAP_SLAB_BIT_SIZE_LOG2 + RTE_BITMAP_CL_BIT_SIZE_LOG2);\n+\tbmp->offset1 = (pos >> RTE_BITMAP_CL_BIT_SIZE_LOG2) & RTE_BITMAP_SLAB_BIT_MASK;\n+\tbmp->index2 = pos >> RTE_BITMAP_SLAB_BIT_SIZE_LOG2;\n+\tslab1 = bmp->array1 + bmp->index1;\n+\tbmp->go2 = *slab1 & (1llu << bmp->offset1);\n+}\n+\n /**\n  * Bitmap memory footprint calculation\n  *\n@@ -591,6 +615,38 @@ rte_bitmap_scan(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab)\n \treturn 0;\n }\n \n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Bitmap scan from the given offset.\n+ * Function will reset internal scan state to start scanning from the offset\n+ * position.\n+ * @see rte_bitmap_scan()\n+ *\n+ * @param bmp\n+ *   Handle to bitmap instance\n+ * @param offset\n+ *   Bit offset to start scan\n+ * @param pos\n+ *   When function call returns 1, pos contains the position of the next set\n+ *   bit, otherwise not modified\n+ * @param slab\n+ *   When function call returns 1, slab contains the value of the entire 64-bit\n+ *   slab where the bit indicated by pos is located.\n+ *   When function call returns 0, slab is not modified.\n+ * @return\n+ *   0 if there is no bit set in the bitmap, 1 otherwise\n+ */\n+__rte_experimental\n+static inline int\n+rte_bitmap_scan_from_offset(struct rte_bitmap *bmp, uint32_t offset,\n+\t\t\t    uint32_t *pos, uint64_t *slab)\n+{\n+\t__rte_bitmap_scan_init_at(bmp, offset);\n+\treturn rte_bitmap_scan(bmp, pos, slab);\n+}\n+\n #ifdef __cplusplus\n }\n #endif\n",
    "prefixes": [
        "v2"
    ]
}