Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/102779/?format=api
http://patches.dpdk.org/api/patches/102779/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20211025133456.26850-6-david.marchand@redhat.com/", "project": { "id": 1, "url": "http://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": "<20211025133456.26850-6-david.marchand@redhat.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20211025133456.26850-6-david.marchand@redhat.com", "date": "2021-10-25T13:34:51", "name": "[v7,5/9] lib: remove direct access to interrupt handle", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "2a1ce9babb63516d0c56e0657a002d9ee9055b80", "submitter": { "id": 1173, "url": "http://patches.dpdk.org/api/people/1173/?format=api", "name": "David Marchand", "email": "david.marchand@redhat.com" }, "delegate": { "id": 24651, "url": "http://patches.dpdk.org/api/users/24651/?format=api", "username": "dmarchand", "first_name": "David", "last_name": "Marchand", "email": "david.marchand@redhat.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20211025133456.26850-6-david.marchand@redhat.com/mbox/", "series": [ { "id": 19958, "url": "http://patches.dpdk.org/api/series/19958/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=19958", "date": "2021-10-25T13:34:46", "name": "make rte_intr_handle internal", "version": 7, "mbox": "http://patches.dpdk.org/series/19958/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/102779/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/102779/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 AC3B6A0C4C;\n\tMon, 25 Oct 2021 15:36:50 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 973F5410DA;\n\tMon, 25 Oct 2021 15:36:50 +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 9D1CD4003E\n for <dev@dpdk.org>; Mon, 25 Oct 2021 15:36:49 +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-447-YW0-Nq3EODWgmL_8y8pa7A-1; Mon, 25 Oct 2021 09:36:45 -0400", "from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com\n [10.5.11.14])\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 1E62F1017968;\n Mon, 25 Oct 2021 13:36:44 +0000 (UTC)", "from dmarchan.remote.csb (unknown [10.40.192.64])\n by smtp.corp.redhat.com (Postfix) with ESMTP id DD3531816A;\n Mon, 25 Oct 2021 13:36:40 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1635169009;\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=ES5o9uCJPeBu9WZAavGOVU/hn4iMtMhvMkBYYz2/G1A=;\n b=SrcGyZvhTTAy9GWh6Fs+2rOfeydltdNI++Ag/UpvXMTBFVGBUN3PODTI72HiWu82mmgJ2C\n LTzh4/CkzfQqliXiaQGLXZUIHoIEY9rQBS4sp3lWEnX0k7aqHIKvqd5gYHpYiWmTlgSszd\n 3zYsdE/TNYp45HxqHz5yWkAQRwBtPLM=", "X-MC-Unique": "YW0-Nq3EODWgmL_8y8pa7A-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 Nicolas Chautru <nicolas.chautru@intel.com>,\n Ferruh Yigit <ferruh.yigit@intel.com>,\n Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>", "Date": "Mon, 25 Oct 2021 15:34:51 +0200", "Message-Id": "<20211025133456.26850-6-david.marchand@redhat.com>", "In-Reply-To": "<20211025133456.26850-1-david.marchand@redhat.com>", "References": "<20211022204934.132186-1-hkalra@marvell.com>\n <20211025133456.26850-1-david.marchand@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.14", "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 v7 5/9] lib: 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\nSigned-off-by: Harman Kalra <hkalra@marvell.com>\nSigned-off-by: David Marchand <david.marchand@redhat.com>\n---\nChanges since v5:\n- split from patch4,\n\n---\n lib/bbdev/rte_bbdev.c | 4 +--\n lib/eal/linux/eal_dev.c | 57 ++++++++++++++++++++++++-----------------\n lib/ethdev/rte_ethdev.c | 14 +++++-----\n 3 files changed, 43 insertions(+), 32 deletions(-)", "diff": "diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c\nindex defddcfc28..b86c5fdcc0 100644\n--- a/lib/bbdev/rte_bbdev.c\n+++ b/lib/bbdev/rte_bbdev.c\n@@ -1094,7 +1094,7 @@ rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,\n \tVALID_QUEUE_OR_RET_ERR(queue_id, dev);\n \n \tintr_handle = dev->intr_handle;\n-\tif (!intr_handle || !intr_handle->intr_vec) {\n+\tif (intr_handle == NULL) {\n \t\trte_bbdev_log(ERR, \"Device %u intr handle unset\\n\", dev_id);\n \t\treturn -ENOTSUP;\n \t}\n@@ -1105,7 +1105,7 @@ rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,\n \t\treturn -ENOTSUP;\n \t}\n \n-\tvec = intr_handle->intr_vec[queue_id];\n+\tvec = rte_intr_vec_list_index_get(intr_handle, queue_id);\n \tret = rte_intr_rx_ctl(intr_handle, epfd, op, vec, data);\n \tif (ret && (ret != -EEXIST)) {\n \t\trte_bbdev_log(ERR,\ndiff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c\nindex 3b905e18f5..06820a3666 100644\n--- a/lib/eal/linux/eal_dev.c\n+++ b/lib/eal/linux/eal_dev.c\n@@ -23,10 +23,7 @@\n \n #include \"eal_private.h\"\n \n-static struct rte_intr_handle intr_handle = {\n-\t.type = RTE_INTR_HANDLE_DEV_EVENT,\n-\t.fd = -1,\n-};\n+static struct rte_intr_handle *intr_handle;\n static rte_rwlock_t monitor_lock = RTE_RWLOCK_INITIALIZER;\n static uint32_t monitor_refcount;\n static bool hotplug_handle;\n@@ -109,12 +106,11 @@ static int\n dev_uev_socket_fd_create(void)\n {\n \tstruct sockaddr_nl addr;\n-\tint ret;\n+\tint ret, fd;\n \n-\tintr_handle.fd = socket(PF_NETLINK, SOCK_RAW | SOCK_CLOEXEC |\n-\t\t\tSOCK_NONBLOCK,\n-\t\t\tNETLINK_KOBJECT_UEVENT);\n-\tif (intr_handle.fd < 0) {\n+\tfd = socket(PF_NETLINK, SOCK_RAW | SOCK_CLOEXEC | SOCK_NONBLOCK,\n+\t\t NETLINK_KOBJECT_UEVENT);\n+\tif (fd < 0) {\n \t\tRTE_LOG(ERR, EAL, \"create uevent fd failed.\\n\");\n \t\treturn -1;\n \t}\n@@ -124,16 +120,19 @@ dev_uev_socket_fd_create(void)\n \taddr.nl_pid = 0;\n \taddr.nl_groups = 0xffffffff;\n \n-\tret = bind(intr_handle.fd, (struct sockaddr *) &addr, sizeof(addr));\n+\tret = bind(fd, (struct sockaddr *) &addr, sizeof(addr));\n \tif (ret < 0) {\n \t\tRTE_LOG(ERR, EAL, \"Failed to bind uevent socket.\\n\");\n \t\tgoto err;\n \t}\n \n+\tif (rte_intr_fd_set(intr_handle, fd))\n+\t\tgoto err;\n+\n \treturn 0;\n err:\n-\tclose(intr_handle.fd);\n-\tintr_handle.fd = -1;\n+\tclose(fd);\n+\tfd = -1;\n \treturn ret;\n }\n \n@@ -217,9 +216,9 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length)\n static void\n dev_delayed_unregister(void *param)\n {\n-\trte_intr_callback_unregister(&intr_handle, dev_uev_handler, param);\n-\tclose(intr_handle.fd);\n-\tintr_handle.fd = -1;\n+\trte_intr_callback_unregister(intr_handle, dev_uev_handler, param);\n+\tclose(rte_intr_fd_get(intr_handle));\n+\trte_intr_fd_set(intr_handle, -1);\n }\n \n static void\n@@ -235,7 +234,8 @@ dev_uev_handler(__rte_unused void *param)\n \tmemset(&uevent, 0, sizeof(struct rte_dev_event));\n \tmemset(buf, 0, EAL_UEV_MSG_LEN);\n \n-\tret = recv(intr_handle.fd, buf, EAL_UEV_MSG_LEN, MSG_DONTWAIT);\n+\tret = recv(rte_intr_fd_get(intr_handle), buf, EAL_UEV_MSG_LEN,\n+\t\t MSG_DONTWAIT);\n \tif (ret < 0 && errno == EAGAIN)\n \t\treturn;\n \telse if (ret <= 0) {\n@@ -311,24 +311,35 @@ rte_dev_event_monitor_start(void)\n \t\tgoto exit;\n \t}\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 exit;\n+\t}\n+\n+\tif (rte_intr_type_set(intr_handle, RTE_INTR_HANDLE_DEV_EVENT))\n+\t\tgoto exit;\n+\n+\tif (rte_intr_fd_set(intr_handle, -1))\n+\t\tgoto exit;\n+\n \tret = dev_uev_socket_fd_create();\n \tif (ret) {\n \t\tRTE_LOG(ERR, EAL, \"error create device event fd.\\n\");\n \t\tgoto exit;\n \t}\n \n-\tret = rte_intr_callback_register(&intr_handle, dev_uev_handler, NULL);\n+\tret = rte_intr_callback_register(intr_handle, dev_uev_handler, NULL);\n \n \tif (ret) {\n-\t\tRTE_LOG(ERR, EAL, \"fail to register uevent callback.\\n\");\n-\t\tclose(intr_handle.fd);\n-\t\tintr_handle.fd = -1;\n+\t\tclose(rte_intr_fd_get(intr_handle));\n \t\tgoto exit;\n \t}\n \n \tmonitor_refcount++;\n \n exit:\n+\trte_intr_instance_free(intr_handle);\n \trte_rwlock_write_unlock(&monitor_lock);\n \treturn ret;\n }\n@@ -350,15 +361,15 @@ rte_dev_event_monitor_stop(void)\n \t\tgoto exit;\n \t}\n \n-\tret = rte_intr_callback_unregister(&intr_handle, dev_uev_handler,\n+\tret = rte_intr_callback_unregister(intr_handle, dev_uev_handler,\n \t\t\t\t\t (void *)-1);\n \tif (ret < 0) {\n \t\tRTE_LOG(ERR, EAL, \"fail to unregister uevent callback.\\n\");\n \t\tgoto exit;\n \t}\n \n-\tclose(intr_handle.fd);\n-\tintr_handle.fd = -1;\n+\tclose(rte_intr_fd_get(intr_handle));\n+\trte_intr_instance_free(intr_handle);\n \n \tmonitor_refcount--;\n \ndiff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c\nindex 74de29c2e0..7db84b12d0 100644\n--- a/lib/ethdev/rte_ethdev.c\n+++ b/lib/ethdev/rte_ethdev.c\n@@ -4819,13 +4819,13 @@ rte_eth_dev_rx_intr_ctl(uint16_t port_id, int epfd, int op, void *data)\n \t}\n \n \tintr_handle = dev->intr_handle;\n-\tif (!intr_handle->intr_vec) {\n+\tif (rte_intr_vec_list_index_get(intr_handle, 0) < 0) {\n \t\tRTE_ETHDEV_LOG(ERR, \"Rx Intr vector unset\\n\");\n \t\treturn -EPERM;\n \t}\n \n \tfor (qid = 0; qid < dev->data->nb_rx_queues; qid++) {\n-\t\tvec = intr_handle->intr_vec[qid];\n+\t\tvec = rte_intr_vec_list_index_get(intr_handle, qid);\n \t\trc = rte_intr_rx_ctl(intr_handle, epfd, op, vec, data);\n \t\tif (rc && rc != -EEXIST) {\n \t\t\tRTE_ETHDEV_LOG(ERR,\n@@ -4860,15 +4860,15 @@ rte_eth_dev_rx_intr_ctl_q_get_fd(uint16_t port_id, uint16_t queue_id)\n \t}\n \n \tintr_handle = dev->intr_handle;\n-\tif (!intr_handle->intr_vec) {\n+\tif (rte_intr_vec_list_index_get(intr_handle, 0) < 0) {\n \t\tRTE_ETHDEV_LOG(ERR, \"Rx Intr vector unset\\n\");\n \t\treturn -1;\n \t}\n \n-\tvec = intr_handle->intr_vec[queue_id];\n+\tvec = rte_intr_vec_list_index_get(intr_handle, queue_id);\n \tefd_idx = (vec >= RTE_INTR_VEC_RXTX_OFFSET) ?\n \t\t(vec - RTE_INTR_VEC_RXTX_OFFSET) : vec;\n-\tfd = intr_handle->efds[efd_idx];\n+\tfd = rte_intr_efds_index_get(intr_handle, efd_idx);\n \n \treturn fd;\n }\n@@ -5046,12 +5046,12 @@ rte_eth_dev_rx_intr_ctl_q(uint16_t port_id, uint16_t queue_id,\n \t}\n \n \tintr_handle = dev->intr_handle;\n-\tif (!intr_handle->intr_vec) {\n+\tif (rte_intr_vec_list_index_get(intr_handle, 0) < 0) {\n \t\tRTE_ETHDEV_LOG(ERR, \"Rx Intr vector unset\\n\");\n \t\treturn -EPERM;\n \t}\n \n-\tvec = intr_handle->intr_vec[queue_id];\n+\tvec = rte_intr_vec_list_index_get(intr_handle, queue_id);\n \trc = rte_intr_rx_ctl(intr_handle, epfd, op, vec, data);\n \tif (rc && rc != -EEXIST) {\n \t\tRTE_ETHDEV_LOG(ERR,\n", "prefixes": [ "v7", "5/9" ] }{ "id": 102779, "url": "