get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 102788,
    "url": "https://patches.dpdk.org/api/patches/102788/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20211025142712.1273-5-david.marchand@redhat.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": "<20211025142712.1273-5-david.marchand@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20211025142712.1273-5-david.marchand@redhat.com",
    "date": "2021-10-25T14:27:07",
    "name": "[v8,4/9] alarm: remove direct access to interrupt handle",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "4722d4b619edfd993e1b876bd3bf93fdeef58dbd",
    "submitter": {
        "id": 1173,
        "url": "https://patches.dpdk.org/api/people/1173/?format=api",
        "name": "David Marchand",
        "email": "david.marchand@redhat.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/20211025142712.1273-5-david.marchand@redhat.com/mbox/",
    "series": [
        {
            "id": 19959,
            "url": "https://patches.dpdk.org/api/series/19959/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=19959",
            "date": "2021-10-25T14:27:03",
            "name": "make rte_intr_handle internal",
            "version": 8,
            "mbox": "https://patches.dpdk.org/series/19959/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/102788/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/102788/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 BE860A0C4E;\n\tMon, 25 Oct 2021 16:28:07 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 322C541162;\n\tMon, 25 Oct 2021 16:27:57 +0200 (CEST)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [216.205.24.124])\n by mails.dpdk.org (Postfix) with ESMTP id 576DE4115D\n for <dev@dpdk.org>; Mon, 25 Oct 2021 16:27:55 +0200 (CEST)",
            "from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id\n us-mta-201-4n-5PkJONq23p2K1AwxDUA-1; Mon, 25 Oct 2021 10:27:53 -0400",
            "from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com\n [10.5.11.23])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0BD641006AC0;\n Mon, 25 Oct 2021 14:27:52 +0000 (UTC)",
            "from dmarchan.remote.csb (unknown [10.40.192.64])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 9257A19C79;\n Mon, 25 Oct 2021 14:27:49 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1635172074;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=7uI1L+21t4apiM/wLsZG9Gt7P6yDBLJirdzMMNw3PYc=;\n b=cLCAQqS4QoNdoLsFymoG6clr8duTMakar/e0QgGp7DFB0awv6feJ7VaDhDZarYayViLj1d\n 1W+dQPcm/AwdPJKVbNKVH28FPVmr2/RXan3jTBD2ZUzYZcJIy8Q8LIg4fMn9nvG7POGH/C\n pMpWrWtHcIDu93ngucAqw9TwOWHBpMw=",
        "X-MC-Unique": "4n-5PkJONq23p2K1AwxDUA-1",
        "From": "David Marchand <david.marchand@redhat.com>",
        "To": "hkalra@marvell.com,\n\tdev@dpdk.org",
        "Cc": "dmitry.kozliuk@gmail.com, rasland@nvidia.com, thomas@monjalon.net,\n Bruce Richardson <bruce.richardson@intel.com>",
        "Date": "Mon, 25 Oct 2021 16:27:07 +0200",
        "Message-Id": "<20211025142712.1273-5-david.marchand@redhat.com>",
        "In-Reply-To": "<20211025142712.1273-1-david.marchand@redhat.com>",
        "References": "<20211022204934.132186-1-hkalra@marvell.com>\n <20211025142712.1273-1-david.marchand@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 2.84 on 10.5.11.23",
        "Authentication-Results": "relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain; charset=\"US-ASCII\"",
        "Subject": "[dpdk-dev] [PATCH v8 4/9] alarm: remove direct access to interrupt\n handle",
        "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": "From: Harman Kalra <hkalra@marvell.com>\n\nRemoving direct access to interrupt handle structure fields,\nrather use respective get set APIs for the same.\nMaking changes to all the libraries access the interrupt handle fields.\n\nImplementing alarm cleanup routine, where the memory allocated\nfor interrupt instance can be freed.\n\nSigned-off-by: Harman Kalra <hkalra@marvell.com>\nSigned-off-by: David Marchand <david.marchand@redhat.com>\n---\nChanges since v6:\n- removed unused interrupt handle in FreeBSD alarm code,\n\nChanges since v5:\n- split from patch4,\n- merged patch6,\n- renamed rte_eal_alarm_fini as rte_eal_alarm_cleanup,\n\n---\n lib/eal/common/eal_private.h | 10 ++++++++++\n lib/eal/freebsd/eal.c        |  1 +\n lib/eal/freebsd/eal_alarm.c  | 35 +++++++++++++++++++++++++++++------\n lib/eal/linux/eal.c          |  1 +\n lib/eal/linux/eal_alarm.c    | 32 +++++++++++++++++++++++++-------\n 5 files changed, 66 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h\nindex 86dab1f057..36bcc0b5a4 100644\n--- a/lib/eal/common/eal_private.h\n+++ b/lib/eal/common/eal_private.h\n@@ -163,6 +163,16 @@ int rte_eal_intr_init(void);\n  */\n int rte_eal_alarm_init(void);\n \n+/**\n+ * Alarm mechanism cleanup.\n+ *\n+ * This function is private to EAL.\n+ *\n+ * @return\n+ *  0 on success, negative on error\n+ */\n+void rte_eal_alarm_cleanup(void);\n+\n /**\n  * Function is to check if the kernel module(like, vfio, vfio_iommu_type1,\n  * etc.) loaded.\ndiff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c\nindex 56a60f13e9..9935356ed4 100644\n--- a/lib/eal/freebsd/eal.c\n+++ b/lib/eal/freebsd/eal.c\n@@ -975,6 +975,7 @@ rte_eal_cleanup(void)\n \trte_mp_channel_cleanup();\n \t/* after this point, any DPDK pointers will become dangling */\n \trte_eal_memory_detach();\n+\trte_eal_alarm_cleanup();\n \trte_trace_save();\n \teal_trace_fini();\n \teal_cleanup_config(internal_conf);\ndiff --git a/lib/eal/freebsd/eal_alarm.c b/lib/eal/freebsd/eal_alarm.c\nindex c38b2e04f8..1023c32937 100644\n--- a/lib/eal/freebsd/eal_alarm.c\n+++ b/lib/eal/freebsd/eal_alarm.c\n@@ -32,7 +32,6 @@\n \n struct alarm_entry {\n \tLIST_ENTRY(alarm_entry) next;\n-\tstruct rte_intr_handle handle;\n \tstruct timespec time;\n \trte_eal_alarm_callback cb_fn;\n \tvoid *cb_arg;\n@@ -43,22 +42,46 @@ struct alarm_entry {\n static LIST_HEAD(alarm_list, alarm_entry) alarm_list = LIST_HEAD_INITIALIZER();\n static rte_spinlock_t alarm_list_lk = RTE_SPINLOCK_INITIALIZER;\n \n-static struct rte_intr_handle intr_handle = {.fd = -1 };\n+static struct rte_intr_handle *intr_handle;\n static void eal_alarm_callback(void *arg);\n \n+void\n+rte_eal_alarm_cleanup(void)\n+{\n+\trte_intr_instance_free(intr_handle);\n+}\n+\n int\n rte_eal_alarm_init(void)\n {\n-\tintr_handle.type = RTE_INTR_HANDLE_ALARM;\n+\tint fd;\n+\n+\tintr_handle = rte_intr_instance_alloc(RTE_INTR_INSTANCE_F_PRIVATE);\n+\tif (intr_handle == NULL) {\n+\t\tRTE_LOG(ERR, EAL, \"Fail to allocate intr_handle\\n\");\n+\t\tgoto error;\n+\t}\n+\n+\tif (rte_intr_type_set(intr_handle, RTE_INTR_HANDLE_ALARM))\n+\t\tgoto error;\n+\n+\tif (rte_intr_fd_set(intr_handle, -1))\n+\t\tgoto error;\n \n \t/* on FreeBSD, timers don't use fd's, and their identifiers are stored\n \t * in separate namespace from fd's, so using any value is OK. however,\n \t * EAL interrupts handler expects fd's to be unique, so use an actual fd\n \t * to guarantee unique timer identifier.\n \t */\n-\tintr_handle.fd = open(\"/dev/zero\", O_RDONLY);\n+\tfd = open(\"/dev/zero\", O_RDONLY);\n+\n+\tif (rte_intr_fd_set(intr_handle, fd))\n+\t\tgoto error;\n \n \treturn 0;\n+error:\n+\trte_intr_instance_free(intr_handle);\n+\treturn -1;\n }\n \n static inline int\n@@ -118,7 +141,7 @@ unregister_current_callback(void)\n \t\tap = LIST_FIRST(&alarm_list);\n \n \t\tdo {\n-\t\t\tret = rte_intr_callback_unregister(&intr_handle,\n+\t\t\tret = rte_intr_callback_unregister(intr_handle,\n \t\t\t\teal_alarm_callback, &ap->time);\n \t\t} while (ret == -EAGAIN);\n \t}\n@@ -136,7 +159,7 @@ register_first_callback(void)\n \t\tap = LIST_FIRST(&alarm_list);\n \n \t\t/* register a new callback */\n-\t\tret = rte_intr_callback_register(&intr_handle,\n+\t\tret = rte_intr_callback_register(intr_handle,\n \t\t\t\teal_alarm_callback, &ap->time);\n \t}\n \treturn ret;\ndiff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c\nindex 0d0fc66668..81fdebc6a0 100644\n--- a/lib/eal/linux/eal.c\n+++ b/lib/eal/linux/eal.c\n@@ -1368,6 +1368,7 @@ rte_eal_cleanup(void)\n \trte_mp_channel_cleanup();\n \t/* after this point, any DPDK pointers will become dangling */\n \trte_eal_memory_detach();\n+\trte_eal_alarm_cleanup();\n \trte_trace_save();\n \teal_trace_fini();\n \teal_cleanup_config(internal_conf);\ndiff --git a/lib/eal/linux/eal_alarm.c b/lib/eal/linux/eal_alarm.c\nindex 3252c6fa59..3b5e894595 100644\n--- a/lib/eal/linux/eal_alarm.c\n+++ b/lib/eal/linux/eal_alarm.c\n@@ -54,22 +54,40 @@ struct alarm_entry {\n static LIST_HEAD(alarm_list, alarm_entry) alarm_list = LIST_HEAD_INITIALIZER();\n static rte_spinlock_t alarm_list_lk = RTE_SPINLOCK_INITIALIZER;\n \n-static struct rte_intr_handle intr_handle = {.fd = -1 };\n+static struct rte_intr_handle *intr_handle;\n static int handler_registered = 0;\n static void eal_alarm_callback(void *arg);\n \n+void\n+rte_eal_alarm_cleanup(void)\n+{\n+\trte_intr_instance_free(intr_handle);\n+}\n+\n int\n rte_eal_alarm_init(void)\n {\n-\tintr_handle.type = RTE_INTR_HANDLE_ALARM;\n+\n+\tintr_handle = rte_intr_instance_alloc(RTE_INTR_INSTANCE_F_PRIVATE);\n+\tif (intr_handle == NULL) {\n+\t\tRTE_LOG(ERR, EAL, \"Fail to allocate intr_handle\\n\");\n+\t\tgoto error;\n+\t}\n+\n+\tif (rte_intr_type_set(intr_handle, RTE_INTR_HANDLE_ALARM))\n+\t\tgoto error;\n+\n \t/* create a timerfd file descriptor */\n-\tintr_handle.fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK);\n-\tif (intr_handle.fd == -1)\n+\tif (rte_intr_fd_set(intr_handle,\n+\t\t\ttimerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK)))\n \t\tgoto error;\n \n+\tif (rte_intr_fd_get(intr_handle) == -1)\n+\t\tgoto error;\n \treturn 0;\n \n error:\n+\trte_intr_instance_free(intr_handle);\n \trte_errno = errno;\n \treturn -1;\n }\n@@ -109,7 +127,7 @@ eal_alarm_callback(void *arg __rte_unused)\n \n \t\tatime.it_value.tv_sec -= now.tv_sec;\n \t\tatime.it_value.tv_nsec -= now.tv_nsec;\n-\t\ttimerfd_settime(intr_handle.fd, 0, &atime, NULL);\n+\t\ttimerfd_settime(rte_intr_fd_get(intr_handle), 0, &atime, NULL);\n \t}\n \trte_spinlock_unlock(&alarm_list_lk);\n }\n@@ -140,7 +158,7 @@ rte_eal_alarm_set(uint64_t us, rte_eal_alarm_callback cb_fn, void *cb_arg)\n \trte_spinlock_lock(&alarm_list_lk);\n \tif (!handler_registered) {\n \t\t/* registration can fail, callback can be registered later */\n-\t\tif (rte_intr_callback_register(&intr_handle,\n+\t\tif (rte_intr_callback_register(intr_handle,\n \t\t\t\teal_alarm_callback, NULL) == 0)\n \t\t\thandler_registered = 1;\n \t}\n@@ -170,7 +188,7 @@ rte_eal_alarm_set(uint64_t us, rte_eal_alarm_callback cb_fn, void *cb_arg)\n \t\t\t\t.tv_nsec = (us % US_PER_S) * NS_PER_US,\n \t\t\t},\n \t\t};\n-\t\tret |= timerfd_settime(intr_handle.fd, 0, &alarm_time, NULL);\n+\t\tret |= timerfd_settime(rte_intr_fd_get(intr_handle), 0, &alarm_time, NULL);\n \t}\n \trte_spinlock_unlock(&alarm_list_lk);\n \n",
    "prefixes": [
        "v8",
        "4/9"
    ]
}