Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/35103/?format=api
http://patches.dpdk.org/api/patches/35103/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180209202003.28546-2-3chas3@gmail.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": "<20180209202003.28546-2-3chas3@gmail.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20180209202003.28546-2-3chas3@gmail.com", "date": "2018-02-09T20:20:03", "name": "[dpdk-dev,2/2] lib: fix bitmap scanning", "commit_ref": null, "pull_url": null, "state": "rejected", "archived": true, "hash": "77ac3c53bc13ff497f3681adb7042aa522e7ec00", "submitter": { "id": 341, "url": "http://patches.dpdk.org/api/people/341/?format=api", "name": "Chas Williams", "email": "3chas3@gmail.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/20180209202003.28546-2-3chas3@gmail.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/35103/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/35103/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id D40F71B89C;\n\tFri, 9 Feb 2018 21:20:14 +0100 (CET)", "from mail-qt0-f194.google.com (mail-qt0-f194.google.com\n\t[209.85.216.194]) by dpdk.org (Postfix) with ESMTP id AFEFC1B899\n\tfor <dev@dpdk.org>; Fri, 9 Feb 2018 21:20:12 +0100 (CET)", "by mail-qt0-f194.google.com with SMTP id s27so12104524qts.4\n\tfor <dev@dpdk.org>; Fri, 09 Feb 2018 12:20:12 -0800 (PST)", "from monolith.home (pool-173-79-224-159.washdc.fios.verizon.net.\n\t[173.79.224.159]) by smtp.gmail.com with ESMTPSA id\n\tl36sm2421598qte.55.2018.02.09.12.20.10\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 09 Feb 2018 12:20:11 -0800 (PST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=AlNSv44moF7Y5J048E0DdHCnfdknckp/yQqQTNQRVqc=;\n\tb=JAjt2HO5aFYEuGWzscWOoAmMG5Iqzdo7IYQcDoqyJSZk7upzVVBag+hacbgu7870qg\n\tMleEAG6PdgTsOHKu3xSR7yG/TXg7+jxyIMc6P+4muTJyG8Z+vKLqwN6Yp9hhWM9AHT3O\n\tq6zT0oUFl1mWPabnn1MlBT66Myez2vkv1hUnCE/woW9l/DCH6lTSmpY2cnBpbwghXA2Y\n\t1ZTgxKGtqtC/ZHrS/1bRpTeZIPp3mbhI08wE+D0aGWZzG3JX3qDbwqad3FITUKdSrZYY\n\tUsqUh88qs51659KXYuWgbzb2vzserd9ZmqmnUH48ae+BEZFPoWElNUuMyFdE26lUC8px\n\tx7/g==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=AlNSv44moF7Y5J048E0DdHCnfdknckp/yQqQTNQRVqc=;\n\tb=n1c6o97osntdzkoAkk4EH3xklYp7BtaMEkYW997/kptYlN0mvFY41q2Psgj+hCT7qI\n\tmSsvVtL0JX3eUo0EAsBZY4oBg7+VYTFSodFsz7Nov4AFVYhTxlNN6Ic2t11Htzf4n1o7\n\t18vJ+4jL65Y67kIrA6QrkFo6unuUf1JBcG/1sCpaChfNlHbKAH2SP5Ce9eoeqY1tB4BJ\n\t8VsKe+wy4qhSfsNF5Rpin1IV4TlH79IXMfTSxMK1F7DW0J//Bw7NJMWLG5TM73iVaeCT\n\tkR9nnEGiNjDRlayIXsnc9R0fbkedqTy5dQZZNj09JEqj1zqUzRZkKo9yvfyjfsd7oXSA\n\t7B+g==", "X-Gm-Message-State": "APf1xPBKb1eeJkBLLFip0lwsBq+6rrtVEi7T6wLuHjSnDNZfUcVDc2K9\n\th9TI/0QvZZlLSoRpEBDXLA9kIQ==", "X-Google-Smtp-Source": "AH8x227h1BR/nKOdj8CgC86QLlxDzsTdLhX4Kz9DTtYz84BS6ZKZfQGtXxB5Hc/DB9whL+dwccC2fw==", "X-Received": "by 10.200.51.229 with SMTP id d34mr6384605qtb.338.1518207611898; \n\tFri, 09 Feb 2018 12:20:11 -0800 (PST)", "From": "Chas Williams <3chas3@gmail.com>", "To": "dev@dpdk.org", "Cc": "cristian.dumitrescu@intel.com, \"Charles (Chas) Williams\" <chas3@att.com>", "Date": "Fri, 9 Feb 2018 15:20:03 -0500", "Message-Id": "<20180209202003.28546-2-3chas3@gmail.com>", "X-Mailer": "git-send-email 2.9.5", "In-Reply-To": "<20180209202003.28546-1-3chas3@gmail.com>", "References": "<20180209202003.28546-1-3chas3@gmail.com>", "Subject": "[dpdk-dev] [PATCH 2/2] lib: fix bitmap scanning", "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://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": "<https://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": "From: \"Charles (Chas) Williams\" <chas3@att.com>\n\nindex2 is used inconsistently, both as an array offset and as a bit\noffset. Fix usage to be consistent as a bit offset. Additonally,\noffset1 needs to be shifted with the size of the array1 slab entries,\nnot the cache line sizes. __rte_bitmap_scan_read() needs to examine\nthe current array2 slab bit by bit to find the next set bit.\n\nThe unit tests for rte_bitmap_scan() aren't correct. If a slab isn't\nempty, there is no reason to expect rte_bitmap_scan() to advance to\nthe next slab. Change the slab magic values so that rte_bitmap_scan()\nwill advance on reading a bit from each slab and verify it is the bit\nposition we expect.\n\nFixes: de3cfa2c9823a (\"sched: initial import\")\n\nSigned-off-by: Chas Williams <chas3@att.com>\n---\n lib/librte_eal/common/include/rte_bitmap.h | 31 +++++++++++++++---------------\n test/test/test_bitmap.c | 12 ++++++------\n 2 files changed, 22 insertions(+), 21 deletions(-)", "diff": "diff --git a/lib/librte_eal/common/include/rte_bitmap.h b/lib/librte_eal/common/include/rte_bitmap.h\nindex 7d4935f..27084d9 100644\n--- a/lib/librte_eal/common/include/rte_bitmap.h\n+++ b/lib/librte_eal/common/include/rte_bitmap.h\n@@ -94,7 +94,8 @@ __rte_bitmap_mask1_get(struct rte_bitmap *bmp)\n static inline void\n __rte_bitmap_index2_set(struct rte_bitmap *bmp)\n {\n-\tbmp->index2 = (((bmp->index1 << RTE_BITMAP_SLAB_BIT_SIZE_LOG2) + bmp->offset1) << RTE_BITMAP_CL_SLAB_SIZE_LOG2);\n+\tbmp->index2 = ((bmp->index1 << RTE_BITMAP_SLAB_BIT_SIZE_LOG2) +\n+\t\t bmp->offset1) << RTE_BITMAP_SLAB_BIT_SIZE_LOG2;\n }\n \n #if RTE_BITMAP_OPTIMIZATIONS\n@@ -172,7 +173,6 @@ __rte_bitmap_scan_init(struct rte_bitmap *bmp)\n \tbmp->index1 = bmp->array1_size - 1;\n \tbmp->offset1 = RTE_BITMAP_SLAB_BIT_SIZE - 1;\n \t__rte_bitmap_index2_set(bmp);\n-\tbmp->index2 += RTE_BITMAP_CL_SLAB_SIZE;\n \n \tbmp->go2 = 0;\n }\n@@ -338,7 +338,8 @@ rte_bitmap_set(struct rte_bitmap *bmp, uint32_t pos)\n \tindex2 = pos >> RTE_BITMAP_SLAB_BIT_SIZE_LOG2;\n \toffset2 = pos & RTE_BITMAP_SLAB_BIT_MASK;\n \tindex1 = pos >> (RTE_BITMAP_SLAB_BIT_SIZE_LOG2 + RTE_BITMAP_CL_BIT_SIZE_LOG2);\n-\toffset1 = (pos >> RTE_BITMAP_CL_BIT_SIZE_LOG2) & RTE_BITMAP_SLAB_BIT_MASK;\n+\toffset1 = (pos >> RTE_BITMAP_SLAB_BIT_SIZE_LOG2) &\n+\t\t\t\t\t\tRTE_BITMAP_SLAB_BIT_MASK;\n \tslab2 = bmp->array2 + index2;\n \tslab1 = bmp->array1 + index1;\n \n@@ -365,7 +366,8 @@ rte_bitmap_set_slab(struct rte_bitmap *bmp, uint32_t pos, uint64_t slab)\n \t/* Set bits in array2 slab and set bit in array1 slab */\n \tindex2 = pos >> RTE_BITMAP_SLAB_BIT_SIZE_LOG2;\n \tindex1 = pos >> (RTE_BITMAP_SLAB_BIT_SIZE_LOG2 + RTE_BITMAP_CL_BIT_SIZE_LOG2);\n-\toffset1 = (pos >> RTE_BITMAP_CL_BIT_SIZE_LOG2) & RTE_BITMAP_SLAB_BIT_MASK;\n+\toffset1 = (pos >> RTE_BITMAP_SLAB_BIT_SIZE_LOG2) &\n+\t\t\t\t\t\tRTE_BITMAP_SLAB_BIT_MASK;\n \tslab2 = bmp->array2 + index2;\n \tslab1 = bmp->array1 + index1;\n \n@@ -422,7 +424,8 @@ rte_bitmap_clear(struct rte_bitmap *bmp, uint32_t pos)\n \n \t/* The array2 cache line is all-zeros, so clear bit in array1 slab */\n \tindex1 = pos >> (RTE_BITMAP_SLAB_BIT_SIZE_LOG2 + RTE_BITMAP_CL_BIT_SIZE_LOG2);\n-\toffset1 = (pos >> RTE_BITMAP_CL_BIT_SIZE_LOG2) & RTE_BITMAP_SLAB_BIT_MASK;\n+\toffset1 = (pos >> RTE_BITMAP_SLAB_BIT_SIZE_LOG2) &\n+\t\t\t\t\t\tRTE_BITMAP_SLAB_BIT_MASK;\n \tslab1 = bmp->array1 + index1;\n \t*slab1 &= ~(1lu << offset1);\n \n@@ -471,15 +474,14 @@ __rte_bitmap_scan_read(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab)\n {\n \tuint64_t *slab2;\n \n-\tslab2 = bmp->array2 + bmp->index2;\n-\tfor ( ; bmp->go2 ; bmp->index2 ++, slab2 ++, bmp->go2 = bmp->index2 & RTE_BITMAP_CL_SLAB_MASK) {\n-\t\tif (*slab2) {\n-\t\t\t*pos = bmp->index2 << RTE_BITMAP_SLAB_BIT_SIZE_LOG2;\n-\t\t\t*slab = *slab2;\n+\tslab2 = bmp->array2 + (bmp->index2 >> RTE_BITMAP_SLAB_BIT_SIZE_LOG2);\n+\tfor ( ; bmp->go2 ; bmp->index2++,\n+\t\t\t bmp->go2 = bmp->index2 & RTE_BITMAP_SLAB_BIT_MASK) {\n+\t\tuint32_t offset2 = bmp->index2 & RTE_BITMAP_SLAB_BIT_MASK;\n \n-\t\t\tbmp->index2 ++;\n-\t\t\tslab2 ++;\n-\t\t\tbmp->go2 = bmp->index2 & RTE_BITMAP_CL_SLAB_MASK;\n+\t\tif (*slab2 & (1lu << offset2)) {\n+\t\t\t*pos = bmp->index2++;\n+\t\t\t*slab = *slab2;\n \t\t\treturn 1;\n \t\t}\n \t}\n@@ -518,8 +520,7 @@ rte_bitmap_scan(struct rte_bitmap *bmp, uint32_t *pos, uint64_t *slab)\n \t/* Look for non-empty array2 line */\n \tif (__rte_bitmap_scan_search(bmp)) {\n \t\t__rte_bitmap_scan_read_init(bmp);\n-\t\t__rte_bitmap_scan_read(bmp, pos, slab);\n-\t\treturn 1;\n+\t\treturn __rte_bitmap_scan_read(bmp, pos, slab);\n \t}\n \n \t/* Empty bitmap */\ndiff --git a/test/test/test_bitmap.c b/test/test/test_bitmap.c\nindex f498c02..ffbbc02 100644\n--- a/test/test/test_bitmap.c\n+++ b/test/test/test_bitmap.c\n@@ -17,8 +17,8 @@ static int\n test_bitmap_scan_operations(struct rte_bitmap *bmp)\n {\n \tuint32_t pos = 0;\n-\tuint64_t slab1_magic = 0xBADC0FFEEBADF00D;\n-\tuint64_t slab2_magic = 0xFEEDDEADDEADF00D;\n+\tuint64_t slab1_magic = 0x80; /* pos = 7 */\n+\tuint64_t slab2_magic = 0x08; /* pos = 67 */\n \tuint64_t out_slab = 0;\n \n \trte_bitmap_reset(bmp);\n@@ -26,7 +26,7 @@ test_bitmap_scan_operations(struct rte_bitmap *bmp)\n \trte_bitmap_set_slab(bmp, pos, slab1_magic);\n \trte_bitmap_set_slab(bmp, pos + RTE_BITMAP_SLAB_BIT_SIZE, slab2_magic);\n \n-\tif (!rte_bitmap_scan(bmp, &pos, &out_slab)) {\n+\tif (!rte_bitmap_scan(bmp, &pos, &out_slab) || pos != 7) {\n \t\tprintf(\"Failed to get slab from bitmap.\\n\");\n \t\treturn TEST_FAILED;\n \t}\n@@ -36,7 +36,7 @@ test_bitmap_scan_operations(struct rte_bitmap *bmp)\n \t\treturn TEST_FAILED;\n \t}\n \n-\tif (!rte_bitmap_scan(bmp, &pos, &out_slab)) {\n+\tif (!rte_bitmap_scan(bmp, &pos, &out_slab) || pos != 67) {\n \t\tprintf(\"Failed to get slab from bitmap.\\n\");\n \t\treturn TEST_FAILED;\n \t}\n@@ -47,7 +47,7 @@ test_bitmap_scan_operations(struct rte_bitmap *bmp)\n \t}\n \n \t/* Wrap around */\n-\tif (!rte_bitmap_scan(bmp, &pos, &out_slab)) {\n+\tif (!rte_bitmap_scan(bmp, &pos, &out_slab) || pos != 7) {\n \t\tprintf(\"Failed to get slab from bitmap.\\n\");\n \t\treturn TEST_FAILED;\n \t}\n@@ -60,7 +60,7 @@ test_bitmap_scan_operations(struct rte_bitmap *bmp)\n \t/* Scan reset check. */\n \t__rte_bitmap_scan_init(bmp);\n \n-\tif (!rte_bitmap_scan(bmp, &pos, &out_slab)) {\n+\tif (!rte_bitmap_scan(bmp, &pos, &out_slab) || pos != 7) {\n \t\tprintf(\"Failed to get slab from bitmap.\\n\");\n \t\treturn TEST_FAILED;\n \t}\n", "prefixes": [ "dpdk-dev", "2/2" ] }{ "id": 35103, "url": "