Show a patch.

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

{
    "id": 73418,
    "url": "https://patches.dpdk.org/api/patches/73418/",
    "web_url": "https://patches.dpdk.org/patch/73418/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<1594116633-14554-1-git-send-email-phil.yang@arm.com>",
    "date": "2020-07-07T10:10:33",
    "name": "[v2] mbuf: use C11 atomics for refcnt operations",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "c1301ce79f1bc64a33ba8714573a1dfdce5df413",
    "submitter": {
        "id": 833,
        "url": "https://patches.dpdk.org/api/people/833/",
        "name": "Phil Yang",
        "email": "phil.yang@arm.com"
    },
    "delegate": {
        "id": 24651,
        "url": "https://patches.dpdk.org/api/users/24651/",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "https://patches.dpdk.org/patch/73418/mbox/",
    "series": [
        {
            "id": 10845,
            "url": "https://patches.dpdk.org/api/series/10845/",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=10845",
            "date": "2020-07-07T10:10:33",
            "name": "[v2] mbuf: use C11 atomics for refcnt operations",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/10845/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/73418/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/73418/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "In-Reply-To": "<1591871178-12542-1-git-send-email-phil.yang@arm.com>",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Mailer": "git-send-email 2.7.4",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id D882AA00BE;\n\tTue,  7 Jul 2020 12:10:56 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 17FAE1DD83;\n\tTue,  7 Jul 2020 12:10:56 +0200 (CEST)",
            "from foss.arm.com (foss.arm.com [217.140.110.172])\n by dpdk.org (Postfix) with ESMTP id 824C21D567\n for <dev@dpdk.org>; Tue,  7 Jul 2020 12:10:54 +0200 (CEST)",
            "from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])\n by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E901BC0A;\n Tue,  7 Jul 2020 03:10:53 -0700 (PDT)",
            "from phil-VirtualBox.shanghai.arm.com\n (phil-VirtualBox.shanghai.arm.com [10.169.109.153])\n by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8CF7C3F71E;\n Tue,  7 Jul 2020 03:10:51 -0700 (PDT)"
        ],
        "References": "<1591871178-12542-1-git-send-email-phil.yang@arm.com>",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "X-BeenThere": "dev@dpdk.org",
        "Message-Id": "<1594116633-14554-1-git-send-email-phil.yang@arm.com>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Precedence": "list",
        "From": "Phil Yang <phil.yang@arm.com>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@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>",
        "To": "david.marchand@redhat.com,\n\tdev@dpdk.org",
        "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>",
        "Date": "Tue,  7 Jul 2020 18:10:33 +0800",
        "Cc": "drc@linux.vnet.ibm.com, Honnappa.Nagarahalli@arm.com,\n olivier.matz@6wind.com, ruifeng.wang@arm.com, nd@arm.com",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH v2] mbuf: use C11 atomics for refcnt operations"
    },
    "content": "Use C11 atomics with explicit ordering instead of rte_atomic ops which\nenforce unnecessary barriers on aarch64.\n\nSigned-off-by: Phil Yang <phil.yang@arm.com>\nReviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>\n---\nv2:\nFix ABI issue: revert the rte_mbuf_ext_shared_info struct refcnt field\nto refcnt_atomic.\n\n lib/librte_mbuf/rte_mbuf.c      |  1 -\n lib/librte_mbuf/rte_mbuf.h      | 19 ++++++++++---------\n lib/librte_mbuf/rte_mbuf_core.h | 11 +++--------\n 3 files changed, 13 insertions(+), 18 deletions(-)",
    "diff": "diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c\nindex ae91ae2..8a456e5 100644\n--- a/lib/librte_mbuf/rte_mbuf.c\n+++ b/lib/librte_mbuf/rte_mbuf.c\n@@ -22,7 +22,6 @@\n #include <rte_eal.h>\n #include <rte_per_lcore.h>\n #include <rte_lcore.h>\n-#include <rte_atomic.h>\n #include <rte_branch_prediction.h>\n #include <rte_mempool.h>\n #include <rte_mbuf.h>\ndiff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h\nindex f8e492e..4a7a98c 100644\n--- a/lib/librte_mbuf/rte_mbuf.h\n+++ b/lib/librte_mbuf/rte_mbuf.h\n@@ -37,7 +37,6 @@\n #include <rte_config.h>\n #include <rte_mempool.h>\n #include <rte_memory.h>\n-#include <rte_atomic.h>\n #include <rte_prefetch.h>\n #include <rte_branch_prediction.h>\n #include <rte_byteorder.h>\n@@ -365,7 +364,7 @@ rte_pktmbuf_priv_flags(struct rte_mempool *mp)\n static inline uint16_t\n rte_mbuf_refcnt_read(const struct rte_mbuf *m)\n {\n-\treturn (uint16_t)(rte_atomic16_read(&m->refcnt_atomic));\n+\treturn __atomic_load_n(&m->refcnt, __ATOMIC_RELAXED);\n }\n \n /**\n@@ -378,14 +377,15 @@ rte_mbuf_refcnt_read(const struct rte_mbuf *m)\n static inline void\n rte_mbuf_refcnt_set(struct rte_mbuf *m, uint16_t new_value)\n {\n-\trte_atomic16_set(&m->refcnt_atomic, (int16_t)new_value);\n+\t__atomic_store_n(&m->refcnt, new_value, __ATOMIC_RELAXED);\n }\n \n /* internal */\n static inline uint16_t\n __rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value)\n {\n-\treturn (uint16_t)(rte_atomic16_add_return(&m->refcnt_atomic, value));\n+\treturn (uint16_t)(__atomic_add_fetch((int16_t *)&m->refcnt, value,\n+\t\t\t\t\t__ATOMIC_ACQ_REL));\n }\n \n /**\n@@ -466,7 +466,7 @@ rte_mbuf_refcnt_set(struct rte_mbuf *m, uint16_t new_value)\n static inline uint16_t\n rte_mbuf_ext_refcnt_read(const struct rte_mbuf_ext_shared_info *shinfo)\n {\n-\treturn (uint16_t)(rte_atomic16_read(&shinfo->refcnt_atomic));\n+\treturn __atomic_load_n(&shinfo->refcnt_atomic, __ATOMIC_RELAXED);\n }\n \n /**\n@@ -481,7 +481,7 @@ static inline void\n rte_mbuf_ext_refcnt_set(struct rte_mbuf_ext_shared_info *shinfo,\n \tuint16_t new_value)\n {\n-\trte_atomic16_set(&shinfo->refcnt_atomic, (int16_t)new_value);\n+\t__atomic_store_n(&shinfo->refcnt_atomic, new_value, __ATOMIC_RELAXED);\n }\n \n /**\n@@ -505,7 +505,8 @@ rte_mbuf_ext_refcnt_update(struct rte_mbuf_ext_shared_info *shinfo,\n \t\treturn (uint16_t)value;\n \t}\n \n-\treturn (uint16_t)rte_atomic16_add_return(&shinfo->refcnt_atomic, value);\n+\treturn (uint16_t)(__atomic_add_fetch((int16_t *)&shinfo->refcnt_atomic,\n+\t\t\t\t\t    value, __ATOMIC_ACQ_REL));\n }\n \n /** Mbuf prefetch */\n@@ -1304,8 +1305,8 @@ static inline int __rte_pktmbuf_pinned_extbuf_decref(struct rte_mbuf *m)\n \t * Direct usage of add primitive to avoid\n \t * duplication of comparing with one.\n \t */\n-\tif (likely(rte_atomic16_add_return\n-\t\t\t(&shinfo->refcnt_atomic, -1)))\n+\tif (likely(__atomic_add_fetch((int *)&shinfo->refcnt_atomic, -1,\n+\t\t\t\t     __ATOMIC_ACQ_REL)))\n \t\treturn 1;\n \n \t/* Reinitialize counter before mbuf freeing. */\ndiff --git a/lib/librte_mbuf/rte_mbuf_core.h b/lib/librte_mbuf/rte_mbuf_core.h\nindex 16600f1..806313a 100644\n--- a/lib/librte_mbuf/rte_mbuf_core.h\n+++ b/lib/librte_mbuf/rte_mbuf_core.h\n@@ -18,7 +18,6 @@\n \n #include <stdint.h>\n #include <rte_compat.h>\n-#include <generic/rte_atomic.h>\n \n #ifdef __cplusplus\n extern \"C\" {\n@@ -495,12 +494,8 @@ struct rte_mbuf {\n \t * or non-atomic) is controlled by the CONFIG_RTE_MBUF_REFCNT_ATOMIC\n \t * config option.\n \t */\n-\tRTE_STD_C11\n-\tunion {\n-\t\trte_atomic16_t refcnt_atomic; /**< Atomically accessed refcnt */\n-\t\t/** Non-atomically accessed refcnt */\n-\t\tuint16_t refcnt;\n-\t};\n+\tuint16_t refcnt;\n+\n \tuint16_t nb_segs;         /**< Number of segments. */\n \n \t/** Input port (16 bits to support more than 256 virtual ports).\n@@ -679,7 +674,7 @@ typedef void (*rte_mbuf_extbuf_free_callback_t)(void *addr, void *opaque);\n struct rte_mbuf_ext_shared_info {\n \trte_mbuf_extbuf_free_callback_t free_cb; /**< Free callback function */\n \tvoid *fcb_opaque;                        /**< Free callback argument */\n-\trte_atomic16_t refcnt_atomic;        /**< Atomically accessed refcnt */\n+\tuint16_t refcnt_atomic;              /**< Atomically accessed refcnt */\n };\n \n /**< Maximum number of nb_segs allowed. */\n",
    "prefixes": [
        "v2"
    ]
}