Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/97198/?format=api
https://patches.dpdk.org/api/patches/97198/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210823054952.15001-4-joyce.kong@arm.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": "<20210823054952.15001-4-joyce.kong@arm.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20210823054952.15001-4-joyce.kong@arm.com", "date": "2021-08-23T05:49:47", "name": "[v2,3/8] examples/kni: use compiler atomics for status sync", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "61fac2a2fb524fd1193e057c87157bd21955234f", "submitter": { "id": 970, "url": "https://patches.dpdk.org/api/people/970/?format=api", "name": "Joyce Kong", "email": "joyce.kong@arm.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/20210823054952.15001-4-joyce.kong@arm.com/mbox/", "series": [ { "id": 18395, "url": "https://patches.dpdk.org/api/series/18395/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=18395", "date": "2021-08-23T05:49:44", "name": "use compiler atomic builtins for examples", "version": 2, "mbox": "https://patches.dpdk.org/series/18395/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/97198/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/97198/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 9608FA0C56;\n\tMon, 23 Aug 2021 07:50:34 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id F066B40687;\n\tMon, 23 Aug 2021 07:50:24 +0200 (CEST)", "from foss.arm.com (foss.arm.com [217.140.110.172])\n by mails.dpdk.org (Postfix) with ESMTP id 5DD8541151\n for <dev@dpdk.org>; Mon, 23 Aug 2021 07:50:23 +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 DB0511FB;\n Sun, 22 Aug 2021 22:50:22 -0700 (PDT)", "from net-arm-n1sdp.shanghai.arm.com (net-arm-n1sdp.shanghai.arm.com\n [10.169.208.222])\n by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 88B583F5A1;\n Sun, 22 Aug 2021 22:50:20 -0700 (PDT)" ], "From": "Joyce Kong <joyce.kong@arm.com>", "To": "Ferruh Yigit <ferruh.yigit@intel.com>", "Cc": "dev@dpdk.org, thomas@monjalon.net, david.marchand@redhat.com,\n honnappa.nagarahalli@arm.com, ruifeng.wang@arm.com, nd@arm.com", "Date": "Mon, 23 Aug 2021 00:49:47 -0500", "Message-Id": "<20210823054952.15001-4-joyce.kong@arm.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20210823054952.15001-1-joyce.kong@arm.com>", "References": "<20210823054952.15001-1-joyce.kong@arm.com>", "Subject": "[dpdk-dev] [PATCH v2 3/8] examples/kni: use compiler atomics for\n status sync", "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", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Convert rte_atomic usages to compiler atomic builit-ins\nfor kni_stop and kni_pause sync.\n\nSigned-off-by: Joyce Kong <joyce.kong@arm.com>\nReviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>\n---\n examples/kni/main.c | 27 +++++++++++++--------------\n 1 file changed, 13 insertions(+), 14 deletions(-)", "diff": "diff --git a/examples/kni/main.c b/examples/kni/main.c\nindex beabb3c848..ad1f569e18 100644\n--- a/examples/kni/main.c\n+++ b/examples/kni/main.c\n@@ -27,7 +27,6 @@\n #include <rte_eal.h>\n #include <rte_per_lcore.h>\n #include <rte_launch.h>\n-#include <rte_atomic.h>\n #include <rte_lcore.h>\n #include <rte_branch_prediction.h>\n #include <rte_interrupts.h>\n@@ -131,8 +130,8 @@ static int kni_change_mtu(uint16_t port_id, unsigned int new_mtu);\n static int kni_config_network_interface(uint16_t port_id, uint8_t if_up);\n static int kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[]);\n \n-static rte_atomic32_t kni_stop = RTE_ATOMIC32_INIT(0);\n-static rte_atomic32_t kni_pause = RTE_ATOMIC32_INIT(0);\n+static uint32_t kni_stop;\n+static uint32_t kni_pause;\n \n /* Print out statistics on packets handled */\n static void\n@@ -185,7 +184,7 @@ signal_handler(int signum)\n \tif (signum == SIGRTMIN || signum == SIGINT || signum == SIGTERM) {\n \t\tprintf(\"\\nSIGRTMIN/SIGINT/SIGTERM received. \"\n \t\t\t\"KNI processing stopping.\\n\");\n-\t\trte_atomic32_inc(&kni_stop);\n+\t\t__atomic_fetch_add(&kni_stop, 1, __ATOMIC_RELAXED);\n \t\treturn;\n }\n }\n@@ -311,8 +310,8 @@ main_loop(__rte_unused void *arg)\n \t\t\t\t\tkni_port_params_array[i]->lcore_rx,\n \t\t\t\t\tkni_port_params_array[i]->port_id);\n \t\twhile (1) {\n-\t\t\tf_stop = rte_atomic32_read(&kni_stop);\n-\t\t\tf_pause = rte_atomic32_read(&kni_pause);\n+\t\t\tf_stop = __atomic_load_n(&kni_stop, __ATOMIC_RELAXED);\n+\t\t\tf_pause = __atomic_load_n(&kni_pause, __ATOMIC_RELAXED);\n \t\t\tif (f_stop)\n \t\t\t\tbreak;\n \t\t\tif (f_pause)\n@@ -324,8 +323,8 @@ main_loop(__rte_unused void *arg)\n \t\t\t\t\tkni_port_params_array[i]->lcore_tx,\n \t\t\t\t\tkni_port_params_array[i]->port_id);\n \t\twhile (1) {\n-\t\t\tf_stop = rte_atomic32_read(&kni_stop);\n-\t\t\tf_pause = rte_atomic32_read(&kni_pause);\n+\t\t\tf_stop = __atomic_load_n(&kni_stop, __ATOMIC_RELAXED);\n+\t\t\tf_pause = __atomic_load_n(&kni_pause, __ATOMIC_RELAXED);\n \t\t\tif (f_stop)\n \t\t\t\tbreak;\n \t\t\tif (f_pause)\n@@ -856,9 +855,9 @@ kni_change_mtu(uint16_t port_id, unsigned int new_mtu)\n {\n \tint ret;\n \n-\trte_atomic32_inc(&kni_pause);\n+\t__atomic_fetch_add(&kni_pause, 1, __ATOMIC_RELAXED);\n \tret = kni_change_mtu_(port_id, new_mtu);\n-\trte_atomic32_dec(&kni_pause);\n+\t__atomic_fetch_sub(&kni_pause, 1, __ATOMIC_RELAXED);\n \n \treturn ret;\n }\n@@ -877,14 +876,14 @@ kni_config_network_interface(uint16_t port_id, uint8_t if_up)\n \tRTE_LOG(INFO, APP, \"Configure network interface of %d %s\\n\",\n \t\t\t\t\tport_id, if_up ? \"up\" : \"down\");\n \n-\trte_atomic32_inc(&kni_pause);\n+\t__atomic_fetch_add(&kni_pause, 1, __ATOMIC_RELAXED);\n \n \tif (if_up != 0) { /* Configure network interface up */\n \t\tret = rte_eth_dev_stop(port_id);\n \t\tif (ret != 0) {\n \t\t\tRTE_LOG(ERR, APP, \"Failed to stop port %d: %s\\n\",\n \t\t\t\tport_id, rte_strerror(-ret));\n-\t\t\trte_atomic32_dec(&kni_pause);\n+\t\t\t__atomic_fetch_sub(&kni_pause, 1, __ATOMIC_RELAXED);\n \t\t\treturn ret;\n \t\t}\n \t\tret = rte_eth_dev_start(port_id);\n@@ -893,12 +892,12 @@ kni_config_network_interface(uint16_t port_id, uint8_t if_up)\n \t\tif (ret != 0) {\n \t\t\tRTE_LOG(ERR, APP, \"Failed to stop port %d: %s\\n\",\n \t\t\t\tport_id, rte_strerror(-ret));\n-\t\t\trte_atomic32_dec(&kni_pause);\n+\t\t\t__atomic_fetch_sub(&kni_pause, 1, __ATOMIC_RELAXED);\n \t\t\treturn ret;\n \t\t}\n \t}\n \n-\trte_atomic32_dec(&kni_pause);\n+\t__atomic_fetch_sub(&kni_pause, 1, __ATOMIC_RELAXED);\n \n \tif (ret < 0)\n \t\tRTE_LOG(ERR, APP, \"Failed to start port %d\\n\", port_id);\n", "prefixes": [ "v2", "3/8" ] }{ "id": 97198, "url": "