Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/129210/?format=api
https://patches.dpdk.org/api/patches/129210/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20230703123909.328480-1-vfialko@marvell.com/", "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": "<20230703123909.328480-1-vfialko@marvell.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20230703123909.328480-1-vfialko@marvell.com", "date": "2023-07-03T12:39:08", "name": "[v5] bitmap: add scan from offset function", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "a01f7de37f0266590b5222da5889dc62f803f95d", "submitter": { "id": 2390, "url": "https://patches.dpdk.org/api/people/2390/?format=api", "name": "Volodymyr Fialko", "email": "vfialko@marvell.com" }, "delegate": { "id": 1, "url": "https://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20230703123909.328480-1-vfialko@marvell.com/mbox/", "series": [ { "id": 28785, "url": "https://patches.dpdk.org/api/series/28785/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=28785", "date": "2023-07-03T12:39:08", "name": "[v5] bitmap: add scan from offset function", "version": 5, "mbox": "https://patches.dpdk.org/series/28785/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/129210/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/129210/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 5B72B42DC2;\n\tMon, 3 Jul 2023 14:39:44 +0200 (CEST)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id D560840EF0;\n\tMon, 3 Jul 2023 14:39:43 +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 0150E40ED5\n for <dev@dpdk.org>; Mon, 3 Jul 2023 14:39:41 +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 363CPMaO021364; Mon, 3 Jul 2023 05:39:40 -0700", "from dc5-exch01.marvell.com ([199.233.59.181])\n by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3rjhgndjmc-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Mon, 03 Jul 2023 05:39:39 -0700", "from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48;\n Mon, 3 Jul 2023 05:39:37 -0700", "from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend\n Transport; Mon, 3 Jul 2023 05:39:37 -0700", "from cavium-DT10.. (unknown [10.28.34.39])\n by maili.marvell.com (Postfix) with ESMTP id E68D43F7040;\n Mon, 3 Jul 2023 05:39:35 -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=49uGlw5vNaKicpqT53OWtJWFpjNInQn+tPxBZVU9dM0=;\n b=IBPVQ3DLTEGnubwxT3qZsiP1lJbGbDH3YrJyAbdTnaxIMMj7e3EHp00/JF4HOV1A4n4m\n +hq7b4TvzC01JEJHGPIF5yQuc4+gDKzMQjXULwA0ha6qeiCW6EoHu4dtoJOfEXU+xWcG\n cFqIpROKkcNJkB9QcmLvwwdi/cwoBX6//zUGosPnXvwvobEHMPYbqkfNgHEkzuPEEI6m\n 0+6kPqg4F1jd4z7jNV/+7KrgbStuiuNm8M9DpcUOEiXjkHFLar78nsqzfME2U0F25j0P\n Tlh5MYi3Wv0FNAZLwpEvLEbzECvAjwvmC+UyPal3MLp7XHRfAnhcN9OLVGSf4pVkA17K cw==", "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 v5] bitmap: add scan from offset function", "Date": "Mon, 3 Jul 2023 14:39:08 +0200", "Message-ID": "<20230703123909.328480-1-vfialko@marvell.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20230703093130.198304-1-vfialko@marvell.com>", "References": "<20230703093130.198304-1-vfialko@marvell.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-Proofpoint-ORIG-GUID": "rJ8Ashg26aI1apCEsepFUsiCvEFZVVRR", "X-Proofpoint-GUID": "rJ8Ashg26aI1apCEsepFUsiCvEFZVVRR", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26\n definitions=2023-07-03_09,2023-06-30_01,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---\nv2:\n - added rte_bitmap_scan_from_offset\nv3:\n - added note for internal use only for init_at function\nv4:\n - marked init_at function as __rte_internal\nv5:\n - removed __rte_internal due to build errors\n\n app/test/test_bitmap.c | 33 +++++++++++++++++++++-\n lib/eal/include/rte_bitmap.h | 55 ++++++++++++++++++++++++++++++++++++\n 2 files changed, 87 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..cc14b1ed2e 100644\n--- a/lib/eal/include/rte_bitmap.h\n+++ b/lib/eal/include/rte_bitmap.h\n@@ -137,6 +137,29 @@ __rte_bitmap_scan_init(struct rte_bitmap *bmp)\n \tbmp->go2 = 0;\n }\n \n+/**\n+ * Bitmap initialize internal scan pointers at the given position for the scan function.\n+ *\n+ * Note: for private/internal use, for public:\n+ * @see rte_bitmap_scan_from_offset()\n+ *\n+ * @param bmp\n+ * Handle to bitmap instance\n+ * @param pos\n+ * Bit position to start scan\n+ */\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 +614,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": [ "v5" ] }{ "id": 129210, "url": "