get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 132674,
    "url": "http://patchwork.dpdk.org/api/patches/132674/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1697497745-20664-19-git-send-email-roretzla@linux.microsoft.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<1697497745-20664-19-git-send-email-roretzla@linux.microsoft.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1697497745-20664-19-git-send-email-roretzla@linux.microsoft.com",
    "date": "2023-10-16T23:09:02",
    "name": "[18/21] ethdev: use rte optional stdatomic API",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ad06b5b9fce7f0efa1164500d2a5f400bd087a7b",
    "submitter": {
        "id": 2077,
        "url": "http://patchwork.dpdk.org/api/people/2077/?format=api",
        "name": "Tyler Retzlaff",
        "email": "roretzla@linux.microsoft.com"
    },
    "delegate": {
        "id": 24651,
        "url": "http://patchwork.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1697497745-20664-19-git-send-email-roretzla@linux.microsoft.com/mbox/",
    "series": [
        {
            "id": 29858,
            "url": "http://patchwork.dpdk.org/api/series/29858/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=29858",
            "date": "2023-10-16T23:08:44",
            "name": "use rte optional stdatomic API",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/29858/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/132674/comments/",
    "check": "warning",
    "checks": "http://patchwork.dpdk.org/api/patches/132674/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 1BE2343183;\n\tTue, 17 Oct 2023 01:10:38 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 6229441153;\n\tTue, 17 Oct 2023 01:09:24 +0200 (CEST)",
            "from linux.microsoft.com (linux.microsoft.com [13.77.154.182])\n by mails.dpdk.org (Postfix) with ESMTP id 1FCE240E6E\n for <dev@dpdk.org>; Tue, 17 Oct 2023 01:09:09 +0200 (CEST)",
            "by linux.microsoft.com (Postfix, from userid 1086)\n id DAF7E20B74D2; Mon, 16 Oct 2023 16:09:07 -0700 (PDT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 linux.microsoft.com DAF7E20B74D2",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;\n s=default; t=1697497747;\n bh=/gksnEdt4PpTE4w2AdlgbdPcu7rzTWZznbvtvFUjcSs=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=qTsRjFriP21clX3fuc44O8hg+HM3P0M7NdZ38Tt/QIDs09VYmx09Vm6vMll3aPujZ\n TXMLBlawmwkYS0VdKGHeLW3QIRu0uV8yi0PW5Y4jVJNo9tH9dtBW48pRxc1xvpjRga\n 3hNCt5Uy/lIOFFTmPDDH23QdW6ya8Y4XhsHfVy3U=",
        "From": "Tyler Retzlaff <roretzla@linux.microsoft.com>",
        "To": "dev@dpdk.org",
        "Cc": "Akhil Goyal <gakhil@marvell.com>,\n Anatoly Burakov <anatoly.burakov@intel.com>,\n Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,\n Bruce Richardson <bruce.richardson@intel.com>,\n Chenbo Xia <chenbo.xia@intel.com>, Ciara Power <ciara.power@intel.com>,\n David Christensen <drc@linux.vnet.ibm.com>,\n David Hunt <david.hunt@intel.com>,\n Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,\n Dmitry Malloy <dmitrym@microsoft.com>,\n Elena Agostini <eagostini@nvidia.com>,\n Erik Gabriel Carrillo <erik.g.carrillo@intel.com>,\n Fan Zhang <fanzhang.oss@gmail.com>, Ferruh Yigit <ferruh.yigit@amd.com>,\n Harman Kalra <hkalra@marvell.com>,\n Harry van Haaren <harry.van.haaren@intel.com>,\n Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>,\n Jerin Jacob <jerinj@marvell.com>,\n Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>,\n Matan Azrad <matan@nvidia.com>,\n Maxime Coquelin <maxime.coquelin@redhat.com>,\n Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>,\n Nicolas Chautru <nicolas.chautru@intel.com>,\n Olivier Matz <olivier.matz@6wind.com>, Ori Kam <orika@nvidia.com>,\n Pallavi Kadam <pallavi.kadam@intel.com>,\n Pavan Nikhilesh <pbhagavatula@marvell.com>,\n Reshma Pattan <reshma.pattan@intel.com>,\n Sameh Gobriel <sameh.gobriel@intel.com>,\n Shijith Thotton <sthotton@marvell.com>,\n Sivaprasad Tummala <sivaprasad.tummala@amd.com>,\n Stephen Hemminger <stephen@networkplumber.org>,\n Suanming Mou <suanmingm@nvidia.com>, Sunil Kumar Kori <skori@marvell.com>,\n Thomas Monjalon <thomas@monjalon.net>,\n Viacheslav Ovsiienko <viacheslavo@nvidia.com>,\n Vladimir Medvedkin <vladimir.medvedkin@intel.com>,\n Yipeng Wang <yipeng1.wang@intel.com>,\n Tyler Retzlaff <roretzla@linux.microsoft.com>",
        "Subject": "[PATCH 18/21] ethdev: use rte optional stdatomic API",
        "Date": "Mon, 16 Oct 2023 16:09:02 -0700",
        "Message-Id": "<1697497745-20664-19-git-send-email-roretzla@linux.microsoft.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1697497745-20664-1-git-send-email-roretzla@linux.microsoft.com>",
        "References": "<1697497745-20664-1-git-send-email-roretzla@linux.microsoft.com>",
        "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": "Replace the use of gcc builtin __atomic_xxx intrinsics with\ncorresponding rte_atomic_xxx optional stdatomic API\n\nSigned-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>\n---\n lib/ethdev/ethdev_driver.h   | 16 ++++++++--------\n lib/ethdev/ethdev_private.c  |  6 +++---\n lib/ethdev/rte_ethdev.c      | 24 ++++++++++++------------\n lib/ethdev/rte_ethdev.h      | 16 ++++++++--------\n lib/ethdev/rte_ethdev_core.h |  2 +-\n 5 files changed, 32 insertions(+), 32 deletions(-)",
    "diff": "diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h\nindex deb23ad..b482cd1 100644\n--- a/lib/ethdev/ethdev_driver.h\n+++ b/lib/ethdev/ethdev_driver.h\n@@ -30,7 +30,7 @@\n  * queue on Rx and Tx.\n  */\n struct rte_eth_rxtx_callback {\n-\tstruct rte_eth_rxtx_callback *next;\n+\tRTE_ATOMIC(struct rte_eth_rxtx_callback *) next;\n \tunion{\n \t\trte_rx_callback_fn rx;\n \t\trte_tx_callback_fn tx;\n@@ -80,12 +80,12 @@ struct rte_eth_dev {\n \t * User-supplied functions called from rx_burst to post-process\n \t * received packets before passing them to the user\n \t */\n-\tstruct rte_eth_rxtx_callback *post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];\n+\tRTE_ATOMIC(struct rte_eth_rxtx_callback *) post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];\n \t/**\n \t * User-supplied functions called from tx_burst to pre-process\n \t * received packets before passing them to the driver for transmission\n \t */\n-\tstruct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];\n+\tRTE_ATOMIC(struct rte_eth_rxtx_callback *) pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];\n \n \tenum rte_eth_dev_state state; /**< Flag indicating the port state */\n \tvoid *security_ctx; /**< Context for security ops */\n@@ -1655,7 +1655,7 @@ int rte_eth_dev_callback_process(struct rte_eth_dev *dev,\n rte_eth_linkstatus_set(struct rte_eth_dev *dev,\n \t\t       const struct rte_eth_link *new_link)\n {\n-\tuint64_t *dev_link = (uint64_t *)&(dev->data->dev_link);\n+\tRTE_ATOMIC(uint64_t) *dev_link = (uint64_t __rte_atomic *)&(dev->data->dev_link);\n \tunion {\n \t\tuint64_t val64;\n \t\tstruct rte_eth_link link;\n@@ -1663,8 +1663,8 @@ int rte_eth_dev_callback_process(struct rte_eth_dev *dev,\n \n \tRTE_BUILD_BUG_ON(sizeof(*new_link) != sizeof(uint64_t));\n \n-\torig.val64 = __atomic_exchange_n(dev_link, *(const uint64_t *)new_link,\n-\t\t\t\t\t__ATOMIC_SEQ_CST);\n+\torig.val64 = rte_atomic_exchange_explicit(dev_link, *(const uint64_t *)new_link,\n+\t\t\t\t\trte_memory_order_seq_cst);\n \n \treturn (orig.link.link_status == new_link->link_status) ? -1 : 0;\n }\n@@ -1682,12 +1682,12 @@ int rte_eth_dev_callback_process(struct rte_eth_dev *dev,\n rte_eth_linkstatus_get(const struct rte_eth_dev *dev,\n \t\t       struct rte_eth_link *link)\n {\n-\tuint64_t *src = (uint64_t *)&(dev->data->dev_link);\n+\tRTE_ATOMIC(uint64_t) *src = (uint64_t __rte_atomic *)&(dev->data->dev_link);\n \tuint64_t *dst = (uint64_t *)link;\n \n \tRTE_BUILD_BUG_ON(sizeof(*link) != sizeof(uint64_t));\n \n-\t*dst = __atomic_load_n(src, __ATOMIC_SEQ_CST);\n+\t*dst = rte_atomic_load_explicit(src, rte_memory_order_seq_cst);\n }\n \n /**\ndiff --git a/lib/ethdev/ethdev_private.c b/lib/ethdev/ethdev_private.c\nindex 7cc7f28..82e2568 100644\n--- a/lib/ethdev/ethdev_private.c\n+++ b/lib/ethdev/ethdev_private.c\n@@ -245,7 +245,7 @@ struct dummy_queue {\n void\n eth_dev_fp_ops_reset(struct rte_eth_fp_ops *fpo)\n {\n-\tstatic void *dummy_data[RTE_MAX_QUEUES_PER_PORT];\n+\tstatic RTE_ATOMIC(void *) dummy_data[RTE_MAX_QUEUES_PER_PORT];\n \tuintptr_t port_id = fpo - rte_eth_fp_ops;\n \n \tper_port_queues[port_id].rx_warn_once = false;\n@@ -278,10 +278,10 @@ struct dummy_queue {\n \tfpo->recycle_rx_descriptors_refill = dev->recycle_rx_descriptors_refill;\n \n \tfpo->rxq.data = dev->data->rx_queues;\n-\tfpo->rxq.clbk = (void **)(uintptr_t)dev->post_rx_burst_cbs;\n+\tfpo->rxq.clbk = (void * __rte_atomic *)(uintptr_t)dev->post_rx_burst_cbs;\n \n \tfpo->txq.data = dev->data->tx_queues;\n-\tfpo->txq.clbk = (void **)(uintptr_t)dev->pre_tx_burst_cbs;\n+\tfpo->txq.clbk = (void * __rte_atomic *)(uintptr_t)dev->pre_tx_burst_cbs;\n }\n \n uint16_t\ndiff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c\nindex 9dabcb5..af23ac0 100644\n--- a/lib/ethdev/rte_ethdev.c\n+++ b/lib/ethdev/rte_ethdev.c\n@@ -5654,9 +5654,9 @@ int rte_eth_rx_avail_thresh_query(uint16_t port_id, uint16_t *queue_id,\n \t\t/* Stores to cb->fn and cb->param should complete before\n \t\t * cb is visible to data plane.\n \t\t */\n-\t\t__atomic_store_n(\n+\t\trte_atomic_store_explicit(\n \t\t\t&rte_eth_devices[port_id].post_rx_burst_cbs[queue_id],\n-\t\t\tcb, __ATOMIC_RELEASE);\n+\t\t\tcb, rte_memory_order_release);\n \n \t} else {\n \t\twhile (tail->next)\n@@ -5664,7 +5664,7 @@ int rte_eth_rx_avail_thresh_query(uint16_t port_id, uint16_t *queue_id,\n \t\t/* Stores to cb->fn and cb->param should complete before\n \t\t * cb is visible to data plane.\n \t\t */\n-\t\t__atomic_store_n(&tail->next, cb, __ATOMIC_RELEASE);\n+\t\trte_atomic_store_explicit(&tail->next, cb, rte_memory_order_release);\n \t}\n \trte_spinlock_unlock(&eth_dev_rx_cb_lock);\n \n@@ -5704,9 +5704,9 @@ int rte_eth_rx_avail_thresh_query(uint16_t port_id, uint16_t *queue_id,\n \t/* Stores to cb->fn, cb->param and cb->next should complete before\n \t * cb is visible to data plane threads.\n \t */\n-\t__atomic_store_n(\n+\trte_atomic_store_explicit(\n \t\t&rte_eth_devices[port_id].post_rx_burst_cbs[queue_id],\n-\t\tcb, __ATOMIC_RELEASE);\n+\t\tcb, rte_memory_order_release);\n \trte_spinlock_unlock(&eth_dev_rx_cb_lock);\n \n \trte_eth_trace_add_first_rx_callback(port_id, queue_id, fn, user_param,\n@@ -5757,9 +5757,9 @@ int rte_eth_rx_avail_thresh_query(uint16_t port_id, uint16_t *queue_id,\n \t\t/* Stores to cb->fn and cb->param should complete before\n \t\t * cb is visible to data plane.\n \t\t */\n-\t\t__atomic_store_n(\n+\t\trte_atomic_store_explicit(\n \t\t\t&rte_eth_devices[port_id].pre_tx_burst_cbs[queue_id],\n-\t\t\tcb, __ATOMIC_RELEASE);\n+\t\t\tcb, rte_memory_order_release);\n \n \t} else {\n \t\twhile (tail->next)\n@@ -5767,7 +5767,7 @@ int rte_eth_rx_avail_thresh_query(uint16_t port_id, uint16_t *queue_id,\n \t\t/* Stores to cb->fn and cb->param should complete before\n \t\t * cb is visible to data plane.\n \t\t */\n-\t\t__atomic_store_n(&tail->next, cb, __ATOMIC_RELEASE);\n+\t\trte_atomic_store_explicit(&tail->next, cb, rte_memory_order_release);\n \t}\n \trte_spinlock_unlock(&eth_dev_tx_cb_lock);\n \n@@ -5791,7 +5791,7 @@ int rte_eth_rx_avail_thresh_query(uint16_t port_id, uint16_t *queue_id,\n \n \tstruct rte_eth_dev *dev = &rte_eth_devices[port_id];\n \tstruct rte_eth_rxtx_callback *cb;\n-\tstruct rte_eth_rxtx_callback **prev_cb;\n+\tRTE_ATOMIC(struct rte_eth_rxtx_callback *) *prev_cb;\n \tint ret = -EINVAL;\n \n \trte_spinlock_lock(&eth_dev_rx_cb_lock);\n@@ -5800,7 +5800,7 @@ int rte_eth_rx_avail_thresh_query(uint16_t port_id, uint16_t *queue_id,\n \t\tcb = *prev_cb;\n \t\tif (cb == user_cb) {\n \t\t\t/* Remove the user cb from the callback list. */\n-\t\t\t__atomic_store_n(prev_cb, cb->next, __ATOMIC_RELAXED);\n+\t\t\trte_atomic_store_explicit(prev_cb, cb->next, rte_memory_order_relaxed);\n \t\t\tret = 0;\n \t\t\tbreak;\n \t\t}\n@@ -5828,7 +5828,7 @@ int rte_eth_rx_avail_thresh_query(uint16_t port_id, uint16_t *queue_id,\n \tstruct rte_eth_dev *dev = &rte_eth_devices[port_id];\n \tint ret = -EINVAL;\n \tstruct rte_eth_rxtx_callback *cb;\n-\tstruct rte_eth_rxtx_callback **prev_cb;\n+\tRTE_ATOMIC(struct rte_eth_rxtx_callback *) *prev_cb;\n \n \trte_spinlock_lock(&eth_dev_tx_cb_lock);\n \tprev_cb = &dev->pre_tx_burst_cbs[queue_id];\n@@ -5836,7 +5836,7 @@ int rte_eth_rx_avail_thresh_query(uint16_t port_id, uint16_t *queue_id,\n \t\tcb = *prev_cb;\n \t\tif (cb == user_cb) {\n \t\t\t/* Remove the user cb from the callback list. */\n-\t\t\t__atomic_store_n(prev_cb, cb->next, __ATOMIC_RELAXED);\n+\t\t\trte_atomic_store_explicit(prev_cb, cb->next, rte_memory_order_relaxed);\n \t\t\tret = 0;\n \t\t\tbreak;\n \t\t}\ndiff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h\nindex f949dfc..ec48b24 100644\n--- a/lib/ethdev/rte_ethdev.h\n+++ b/lib/ethdev/rte_ethdev.h\n@@ -6018,14 +6018,14 @@ uint16_t rte_eth_call_rx_callbacks(uint16_t port_id, uint16_t queue_id,\n \t{\n \t\tvoid *cb;\n \n-\t\t/* __ATOMIC_RELEASE memory order was used when the\n+\t\t/* rte_memory_order_release memory order was used when the\n \t\t * call back was inserted into the list.\n \t\t * Since there is a clear dependency between loading\n-\t\t * cb and cb->fn/cb->next, __ATOMIC_ACQUIRE memory order is\n+\t\t * cb and cb->fn/cb->next, rte_memory_order_acquire memory order is\n \t\t * not required.\n \t\t */\n-\t\tcb = __atomic_load_n((void **)&p->rxq.clbk[queue_id],\n-\t\t\t\t__ATOMIC_RELAXED);\n+\t\tcb = rte_atomic_load_explicit(&p->rxq.clbk[queue_id],\n+\t\t\t\trte_memory_order_relaxed);\n \t\tif (unlikely(cb != NULL))\n \t\t\tnb_rx = rte_eth_call_rx_callbacks(port_id, queue_id,\n \t\t\t\t\trx_pkts, nb_rx, nb_pkts, cb);\n@@ -6355,14 +6355,14 @@ uint16_t rte_eth_call_tx_callbacks(uint16_t port_id, uint16_t queue_id,\n \t{\n \t\tvoid *cb;\n \n-\t\t/* __ATOMIC_RELEASE memory order was used when the\n+\t\t/* rte_memory_order_release memory order was used when the\n \t\t * call back was inserted into the list.\n \t\t * Since there is a clear dependency between loading\n-\t\t * cb and cb->fn/cb->next, __ATOMIC_ACQUIRE memory order is\n+\t\t * cb and cb->fn/cb->next, rte_memory_order_acquire memory order is\n \t\t * not required.\n \t\t */\n-\t\tcb = __atomic_load_n((void **)&p->txq.clbk[queue_id],\n-\t\t\t\t__ATOMIC_RELAXED);\n+\t\tcb = rte_atomic_load_explicit(&p->txq.clbk[queue_id],\n+\t\t\t\trte_memory_order_relaxed);\n \t\tif (unlikely(cb != NULL))\n \t\t\tnb_pkts = rte_eth_call_tx_callbacks(port_id, queue_id,\n \t\t\t\t\ttx_pkts, nb_pkts, cb);\ndiff --git a/lib/ethdev/rte_ethdev_core.h b/lib/ethdev/rte_ethdev_core.h\nindex 32f5f73..4bfaf79 100644\n--- a/lib/ethdev/rte_ethdev_core.h\n+++ b/lib/ethdev/rte_ethdev_core.h\n@@ -71,7 +71,7 @@ struct rte_ethdev_qdata {\n \t/** points to array of internal queue data pointers */\n \tvoid **data;\n \t/** points to array of queue callback data pointers */\n-\tvoid **clbk;\n+\tRTE_ATOMIC(void *) *clbk;\n };\n \n /**\n",
    "prefixes": [
        "18/21"
    ]
}