get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 74503,
    "url": "https://patches.dpdk.org/api/patches/74503/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200720143829.46280-1-harry.van.haaren@intel.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": "<20200720143829.46280-1-harry.van.haaren@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200720143829.46280-1-harry.van.haaren@intel.com",
    "date": "2020-07-20T14:38:28",
    "name": "[v2,1/2] service: add API to retrieve service core active",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "98c0591941e653b55aa5ef1560fd96be863f93e2",
    "submitter": {
        "id": 317,
        "url": "https://patches.dpdk.org/api/people/317/?format=api",
        "name": "Van Haaren, Harry",
        "email": "harry.van.haaren@intel.com"
    },
    "delegate": {
        "id": 24651,
        "url": "https://patches.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20200720143829.46280-1-harry.van.haaren@intel.com/mbox/",
    "series": [
        {
            "id": 11175,
            "url": "https://patches.dpdk.org/api/series/11175/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=11175",
            "date": "2020-07-20T14:38:28",
            "name": "[v2,1/2] service: add API to retrieve service core active",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/11175/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/74503/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/74503/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 34A25A0527;\n\tMon, 20 Jul 2020 16:37:32 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id CA1FD1BFBC;\n\tMon, 20 Jul 2020 16:37:30 +0200 (CEST)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n by dpdk.org (Postfix) with ESMTP id 8045CA69\n for <dev@dpdk.org>; Mon, 20 Jul 2020 16:37:28 +0200 (CEST)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 20 Jul 2020 07:37:27 -0700",
            "from silpixa00399779.ir.intel.com (HELO\n silpixa00399779.ger.corp.intel.com) ([10.237.222.209])\n by FMSMGA003.fm.intel.com with ESMTP; 20 Jul 2020 07:37:25 -0700"
        ],
        "IronPort-SDR": [
            "\n pqAQhn3uFbZ0KlRlYN0EsNGjLtnlsNszhVvJ7Cr9UqYxqc8fWJcDAqGH7pGU0IFZtqQdq2Rvjr\n 0JhiRGcGNddw==",
            "\n G2D3vNlKKh9MEawzBOv78OfjzjomdsJtG3ovzfr8N6lWTloJLQ4pZLn7k4BIy0DtUCluufjevS\n VYMRvJPY66VQ=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9687\"; a=\"138012118\"",
            "E=Sophos;i=\"5.75,375,1589266800\"; d=\"scan'208\";a=\"138012118\"",
            "E=Sophos;i=\"5.75,375,1589266800\"; d=\"scan'208\";a=\"326075383\""
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Harry van Haaren <harry.van.haaren@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "david.marchand@redhat.com, igor.romanov@oktetlabs.ru,\n honnappa.nagarahalli@arm.com, ferruh.yigit@intel.com, nd@arm.com,\n aconole@redhat.com, l.wojciechow@partner.samsung.com,\n Harry van Haaren <harry.van.haaren@intel.com>",
        "Date": "Mon, 20 Jul 2020 15:38:28 +0100",
        "Message-Id": "<20200720143829.46280-1-harry.van.haaren@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20200720120938.34660-1-harry.van.haaren@intel.com>",
        "References": "<20200720120938.34660-1-harry.van.haaren@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 1/2] service: add API to retrieve service core\n\tactive",
        "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://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": "This commit adds a new experimental API which allows the user\nto retrieve the active state of an lcore. Knowing when the service\nlcore is completed its polling loop can be useful to applications\nto avoid race conditions when e.g. finalizing statistics.\n\nThe service thread itself now has a variable to indicate if its\nthread is active. When zero the service thread has completed its\nservice, and has returned from the service_runner_func() function.\n\nSuggested-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>\nSigned-off-by: Harry van Haaren <harry.van.haaren@intel.com>\n\n---\n\nThanks for feedback Lukasz, please have a look and see if this was\nwhat you were expecting?\n\nHonnappa/Phil, are the __atomic_load/store's correct?\n\n---\n lib/librte_eal/common/rte_service.c  | 14 ++++++++++++++\n lib/librte_eal/include/rte_service.h |  9 +++++++++\n lib/librte_eal/rte_eal_version.map   |  1 +\n 3 files changed, 24 insertions(+)",
    "diff": "diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c\nindex 6a0e0ff65..4c276b006 100644\n--- a/lib/librte_eal/common/rte_service.c\n+++ b/lib/librte_eal/common/rte_service.c\n@@ -65,6 +65,7 @@ struct core_state {\n \t/* map of services IDs are run on this core */\n \tuint64_t service_mask;\n \tuint8_t runstate; /* running or stopped */\n+\tuint8_t thread_active; /* indicates when thread is in service_run() */\n \tuint8_t is_service_core; /* set if core is currently a service core */\n \tuint8_t service_active_on_lcore[RTE_SERVICE_NUM_MAX];\n \tuint64_t loops;\n@@ -457,6 +458,8 @@ service_runner_func(void *arg)\n \tconst int lcore = rte_lcore_id();\n \tstruct core_state *cs = &lcore_states[lcore];\n \n+\t__atomic_store_n(&cs->thread_active, 1, __ATOMIC_RELAXED);\n+\n \t/* runstate act as the guard variable. Use load-acquire\n \t * memory order here to synchronize with store-release\n \t * in runstate update functions.\n@@ -475,9 +478,20 @@ service_runner_func(void *arg)\n \t\tcs->loops++;\n \t}\n \n+\t__atomic_store_n(&cs->thread_active, 0, __ATOMIC_RELAXED);\n \treturn 0;\n }\n \n+int32_t\n+rte_service_lcore_active(uint32_t lcore)\n+{\n+\tif (lcore >= RTE_MAX_LCORE || !lcore_states[lcore].is_service_core)\n+\t\treturn -EINVAL;\n+\n+\treturn __atomic_load_n(&lcore_states[lcore].thread_active,\n+\t\t\t       __ATOMIC_RELAXED);\n+}\n+\n int32_t\n rte_service_lcore_count(void)\n {\ndiff --git a/lib/librte_eal/include/rte_service.h b/lib/librte_eal/include/rte_service.h\nindex e2d0a6dd3..f7134b5c0 100644\n--- a/lib/librte_eal/include/rte_service.h\n+++ b/lib/librte_eal/include/rte_service.h\n@@ -261,6 +261,15 @@ int32_t rte_service_lcore_start(uint32_t lcore_id);\n  */\n int32_t rte_service_lcore_stop(uint32_t lcore_id);\n \n+/**\n+ * Reports if a service lcore is currently running.\n+ * @retval 0 Service thread is not active, and has been returned to EAL.\n+ * @retval 1 Service thread is in the service core polling loop.\n+ * @retval -EINVAL Invalid *lcore_id* provided.\n+ */\n+__rte_experimental\n+int32_t rte_service_lcore_active(uint32_t lcore_id);\n+\n /**\n  * Adds lcore to the list of service cores.\n  *\ndiff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map\nindex bf0c17c23..d53d5d5b9 100644\n--- a/lib/librte_eal/rte_eal_version.map\n+++ b/lib/librte_eal/rte_eal_version.map\n@@ -401,6 +401,7 @@ EXPERIMENTAL {\n \trte_lcore_dump;\n \trte_lcore_iterate;\n \trte_mp_disable;\n+\trte_service_lcore_active;\n \trte_thread_register;\n \trte_thread_unregister;\n };\n",
    "prefixes": [
        "v2",
        "1/2"
    ]
}