get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 115670,
    "url": "https://patches.dpdk.org/api/patches/115670/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1661899911-13086-6-git-send-email-longli@linuxonhyperv.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": "<1661899911-13086-6-git-send-email-longli@linuxonhyperv.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1661899911-13086-6-git-send-email-longli@linuxonhyperv.com",
    "date": "2022-08-30T22:51:38",
    "name": "[v6,05/18] net/mana: add function for device removal interrupts",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "f09485ab6633b0a1b9de77377ba188e220e36ae0",
    "submitter": {
        "id": 1784,
        "url": "https://patches.dpdk.org/api/people/1784/?format=api",
        "name": "Long Li",
        "email": "longli@linuxonhyperv.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1661899911-13086-6-git-send-email-longli@linuxonhyperv.com/mbox/",
    "series": [
        {
            "id": 24471,
            "url": "https://patches.dpdk.org/api/series/24471/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=24471",
            "date": "2022-08-30T22:51:33",
            "name": "Introduce Microsoft Azure Network Adatper (MANA) PMD",
            "version": 6,
            "mbox": "https://patches.dpdk.org/series/24471/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/115670/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/115670/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 1DEE9A00C5;\n\tWed, 31 Aug 2022 00:52:31 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id B053142B6E;\n\tWed, 31 Aug 2022 00:52:01 +0200 (CEST)",
            "from linux.microsoft.com (linux.microsoft.com [13.77.154.182])\n by mails.dpdk.org (Postfix) with ESMTP id C59374282B\n for <dev@dpdk.org>; Wed, 31 Aug 2022 00:51:59 +0200 (CEST)",
            "by linux.microsoft.com (Postfix, from userid 1004)\n id 061412045E25; Tue, 30 Aug 2022 15:51:59 -0700 (PDT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 linux.microsoft.com 061412045E25",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com;\n s=default; t=1661899919;\n bh=STytvbKU9IdsCznaPoUSIRZOxXrRevMrUgT9pQJ4rWM=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:From;\n b=OkgyyiL8veWXqJnwkEEfil5Mk0qkufNZgg7/TgB5erbi8rhMEnYsRvEhsyHQEVtY5\n e6FWANjlepEJjxF8ZDQ/b2UZeLhj07MurPW8wFGl2fg7Lkk9Nl1PQeeJZprTjN6eXy\n qe8SbG1zZmjXU7n86SWxmd7IouHIHGnJzdngCato=",
        "From": "longli@linuxonhyperv.com",
        "To": "Ferruh Yigit <ferruh.yigit@xilinx.com>",
        "Cc": "dev@dpdk.org, Ajay Sharma <sharmaajay@microsoft.com>,\n Stephen Hemminger <sthemmin@microsoft.com>, Long Li <longli@microsoft.com>",
        "Subject": "[Patch v6 05/18] net/mana: add function for device removal interrupts",
        "Date": "Tue, 30 Aug 2022 15:51:38 -0700",
        "Message-Id": "<1661899911-13086-6-git-send-email-longli@linuxonhyperv.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1661899911-13086-1-git-send-email-longli@linuxonhyperv.com>",
        "References": "<1661899911-13086-1-git-send-email-longli@linuxonhyperv.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>",
        "Reply-To": "longli@microsoft.com",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "From: Long Li <longli@microsoft.com>\n\nMANA supports PCI hot plug events. Add this interrupt to DPDK core so its\nparent PMD can detect device removal during Azure servicing or live\nmigration.\n\nSigned-off-by: Long Li <longli@microsoft.com>\n---\n doc/guides/nics/features/mana.ini |  1 +\n drivers/net/mana/mana.c           | 97 +++++++++++++++++++++++++++++++\n drivers/net/mana/mana.h           |  1 +\n 3 files changed, 99 insertions(+)",
    "diff": "diff --git a/doc/guides/nics/features/mana.ini b/doc/guides/nics/features/mana.ini\nindex 62554b0a0a..8043e11f99 100644\n--- a/doc/guides/nics/features/mana.ini\n+++ b/doc/guides/nics/features/mana.ini\n@@ -7,5 +7,6 @@\n Link status          = P\n Linux                = Y\n Multiprocess aware   = Y\n+Removal event        = Y\n Usage doc            = Y\n x86-64               = Y\ndiff --git a/drivers/net/mana/mana.c b/drivers/net/mana/mana.c\nindex b77d0c29b0..c9591035ac 100644\n--- a/drivers/net/mana/mana.c\n+++ b/drivers/net/mana/mana.c\n@@ -95,12 +95,18 @@ static int mana_dev_configure(struct rte_eth_dev *dev)\n \treturn 0;\n }\n \n+static int mana_intr_uninstall(struct mana_priv *priv);\n+\n static int\n mana_dev_close(struct rte_eth_dev *dev)\n {\n \tstruct mana_priv *priv = dev->data->dev_private;\n \tint ret;\n \n+\tret = mana_intr_uninstall(priv);\n+\tif (ret)\n+\t\treturn ret;\n+\n \tret = ibv_close_device(priv->ib_ctx);\n \tif (ret) {\n \t\tret = errno;\n@@ -327,6 +333,90 @@ static int mana_ibv_device_to_pci_addr(const struct ibv_device *device,\n \treturn 0;\n }\n \n+static void mana_intr_handler(void *arg)\n+{\n+\tstruct mana_priv *priv = arg;\n+\tstruct ibv_context *ctx = priv->ib_ctx;\n+\tstruct ibv_async_event event;\n+\n+\t/* Read and ack all messages from IB device */\n+\twhile (true) {\n+\t\tif (ibv_get_async_event(ctx, &event))\n+\t\t\tbreak;\n+\n+\t\tif (event.event_type == IBV_EVENT_DEVICE_FATAL) {\n+\t\t\tstruct rte_eth_dev *dev;\n+\n+\t\t\tdev = &rte_eth_devices[priv->port_id];\n+\t\t\tif (dev->data->dev_conf.intr_conf.rmv)\n+\t\t\t\trte_eth_dev_callback_process(dev,\n+\t\t\t\t\tRTE_ETH_EVENT_INTR_RMV, NULL);\n+\t\t}\n+\n+\t\tibv_ack_async_event(&event);\n+\t}\n+}\n+\n+static int mana_intr_uninstall(struct mana_priv *priv)\n+{\n+\tint ret;\n+\n+\tret = rte_intr_callback_unregister(priv->intr_handle,\n+\t\t\t\t\t   mana_intr_handler, priv);\n+\tif (ret <= 0) {\n+\t\tDRV_LOG(ERR, \"Failed to unregister intr callback ret %d\", ret);\n+\t\treturn ret;\n+\t}\n+\n+\trte_intr_instance_free(priv->intr_handle);\n+\n+\treturn 0;\n+}\n+\n+static int mana_intr_install(struct mana_priv *priv)\n+{\n+\tint ret, flags;\n+\tstruct ibv_context *ctx = priv->ib_ctx;\n+\n+\tpriv->intr_handle = rte_intr_instance_alloc(RTE_INTR_INSTANCE_F_SHARED);\n+\tif (!priv->intr_handle) {\n+\t\tDRV_LOG(ERR, \"Failed to allocate intr_handle\");\n+\t\trte_errno = ENOMEM;\n+\t\treturn -ENOMEM;\n+\t}\n+\n+\trte_intr_fd_set(priv->intr_handle, -1);\n+\n+\tflags = fcntl(ctx->async_fd, F_GETFL);\n+\tret = fcntl(ctx->async_fd, F_SETFL, flags | O_NONBLOCK);\n+\tif (ret) {\n+\t\tDRV_LOG(ERR, \"Failed to change async_fd to NONBLOCK\");\n+\t\tgoto free_intr;\n+\t}\n+\n+\trte_intr_fd_set(priv->intr_handle, ctx->async_fd);\n+\trte_intr_type_set(priv->intr_handle, RTE_INTR_HANDLE_EXT);\n+\n+\tret = rte_intr_callback_register(priv->intr_handle,\n+\t\t\t\t\t mana_intr_handler, priv);\n+\tif (ret) {\n+\t\tDRV_LOG(ERR, \"Failed to register intr callback\");\n+\t\trte_intr_fd_set(priv->intr_handle, -1);\n+\t\tgoto restore_fd;\n+\t}\n+\n+\treturn 0;\n+\n+restore_fd:\n+\tfcntl(ctx->async_fd, F_SETFL, flags);\n+\n+free_intr:\n+\trte_intr_instance_free(priv->intr_handle);\n+\tpriv->intr_handle = NULL;\n+\n+\treturn ret;\n+}\n+\n static int mana_proc_priv_init(struct rte_eth_dev *dev)\n {\n \tstruct mana_process_priv *priv;\n@@ -640,6 +730,13 @@ static int mana_pci_probe_mac(struct rte_pci_driver *pci_drv __rte_unused,\n \t\t\t\tname, priv->max_rx_queues, priv->max_rx_desc,\n \t\t\t\tpriv->max_send_sge);\n \n+\t\t\t/* Create async interrupt handler */\n+\t\t\tret = mana_intr_install(priv);\n+\t\t\tif (ret) {\n+\t\t\t\tDRV_LOG(ERR, \"Failed to install intr handler\");\n+\t\t\t\tgoto failed;\n+\t\t\t}\n+\n \t\t\trte_spinlock_lock(&mana_shared_data->lock);\n \t\t\tmana_shared_data->primary_cnt++;\n \t\t\trte_spinlock_unlock(&mana_shared_data->lock);\ndiff --git a/drivers/net/mana/mana.h b/drivers/net/mana/mana.h\nindex c433940022..f97eed2e81 100644\n--- a/drivers/net/mana/mana.h\n+++ b/drivers/net/mana/mana.h\n@@ -72,6 +72,7 @@ struct mana_priv {\n \tuint8_t ind_table_key[40];\n \tstruct ibv_qp *rwq_qp;\n \tvoid *db_page;\n+\tstruct rte_intr_handle *intr_handle;\n \tint max_rx_queues;\n \tint max_tx_queues;\n \tint max_rx_desc;\n",
    "prefixes": [
        "v6",
        "05/18"
    ]
}