get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 51736,
    "url": "http://patches.dpdk.org/api/patches/51736/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1553614522-12151-12-git-send-email-viacheslavo@mellanox.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": "<1553614522-12151-12-git-send-email-viacheslavo@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1553614522-12151-12-git-send-email-viacheslavo@mellanox.com",
    "date": "2019-03-26T15:35:20",
    "name": "[v3,11/13] net/mlx5: update install/uninstall int handler routines",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ca80406783755f3e13b49dc0ead21deac9828b71",
    "submitter": {
        "id": 1102,
        "url": "http://patches.dpdk.org/api/people/1102/?format=api",
        "name": "Slava Ovsiienko",
        "email": "viacheslavo@mellanox.com"
    },
    "delegate": {
        "id": 6624,
        "url": "http://patches.dpdk.org/api/users/6624/?format=api",
        "username": "shahafs",
        "first_name": "Shahaf",
        "last_name": "Shuler",
        "email": "shahafs@mellanox.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1553614522-12151-12-git-send-email-viacheslavo@mellanox.com/mbox/",
    "series": [
        {
            "id": 3928,
            "url": "http://patches.dpdk.org/api/series/3928/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=3928",
            "date": "2019-03-26T15:35:11",
            "name": "net/mlx5: add support for multiport IB devices",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/3928/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/51736/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/51736/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id D0FE11B137;\n\tTue, 26 Mar 2019 16:36:31 +0100 (CET)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n\tby dpdk.org (Postfix) with ESMTP id 83D681B13C\n\tfor <dev@dpdk.org>; Tue, 26 Mar 2019 16:36:05 +0100 (CET)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n\tviacheslavo@mellanox.com)\n\twith ESMTPS (AES256-SHA encrypted); 26 Mar 2019 17:36:02 +0200",
            "from pegasus12.mtr.labs.mlnx. (pegasus12.mtr.labs.mlnx\n\t[10.210.17.40])\n\tby labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x2QFa1wY019637;\n\tTue, 26 Mar 2019 17:36:02 +0200"
        ],
        "From": "Viacheslav Ovsiienko <viacheslavo@mellanox.com>",
        "To": "dev@dpdk.org",
        "Cc": "shahafs@mellanox.com",
        "Date": "Tue, 26 Mar 2019 15:35:20 +0000",
        "Message-Id": "<1553614522-12151-12-git-send-email-viacheslavo@mellanox.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1553614522-12151-1-git-send-email-viacheslavo@mellanox.com>",
        "References": "<1553533414-9911-1-git-send-email-viacheslavo@mellanox.com>\n\t<1553614522-12151-1-git-send-email-viacheslavo@mellanox.com>",
        "Subject": "[dpdk-dev] [PATCH v3 11/13] net/mlx5: update install/uninstall int\n\thandler routines",
        "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "We are implementing the support for multport Infiniband device\nwithj representors attached to these multiple ports. Asynchronous\ndevice event notifications (link status change, removal event, etc.)\nshould be shared between ports. We are going to implement shared\nevent handler and this patch introduces appropriate device\nstructure changes and updated event handler install and uninstall\nroutines.\n\nSigned-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>\nAcked-by: Shahaf Shuler <shahafs@mellanox.com>\n---\n drivers/net/mlx5/mlx5.c        |  19 ++++++-\n drivers/net/mlx5/mlx5.h        |   3 +-\n drivers/net/mlx5/mlx5_ethdev.c | 118 ++++++++++++++++++++++++++++++++---------\n 3 files changed, 112 insertions(+), 28 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c\nindex 8f35546..0c81fda 100644\n--- a/drivers/net/mlx5/mlx5.c\n+++ b/drivers/net/mlx5/mlx5.c\n@@ -166,6 +166,7 @@ struct mlx5_dev_spawn_data {\n {\n \tstruct mlx5_ibv_shared *sh;\n \tint err = 0;\n+\tuint32_t i;\n \n \tassert(spawn);\n \t/* Secondary process should not create the shared context. */\n@@ -215,6 +216,14 @@ struct mlx5_dev_spawn_data {\n \t\tsizeof(sh->ibdev_name));\n \tstrncpy(sh->ibdev_path, sh->ctx->device->ibdev_path,\n \t\tsizeof(sh->ibdev_path));\n+\tpthread_mutex_init(&sh->intr_mutex, NULL);\n+\t/*\n+\t * Setting port_id to max unallowed value means\n+\t * there is no interrupt subhandler installed for\n+\t * the given port index i.\n+\t */\n+\tfor (i = 0; i < sh->max_port; i++)\n+\t\tsh->port[i].ih_port_id = RTE_MAX_ETHPORTS;\n \tsh->pd = mlx5_glue->alloc_pd(sh->ctx);\n \tif (sh->pd == NULL) {\n \t\tDRV_LOG(ERR, \"PD allocation failure\");\n@@ -269,6 +278,15 @@ struct mlx5_dev_spawn_data {\n \tif (--sh->refcnt)\n \t\tgoto exit;\n \tLIST_REMOVE(sh, next);\n+\t/*\n+\t *  Ensure there is no async event handler installed.\n+\t *  Only primary process handles async device events.\n+\t **/\n+\tassert(!sh->intr_cnt);\n+\tif (sh->intr_cnt)\n+\t\trte_intr_callback_unregister\n+\t\t\t(&sh->intr_handle, mlx5_dev_interrupt_handler, sh);\n+\tpthread_mutex_destroy(&sh->intr_mutex);\n \tif (sh->pd)\n \t\tclaim_zero(mlx5_glue->dealloc_pd(sh->pd));\n \tif (sh->ctx)\n@@ -278,7 +296,6 @@ struct mlx5_dev_spawn_data {\n \tpthread_mutex_unlock(&mlx5_ibv_list_mutex);\n }\n \n-\n /**\n  * Prepare shared data between primary and secondary process.\n  */\ndiff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h\nindex 573629a..23f3e34 100644\n--- a/drivers/net/mlx5/mlx5.h\n+++ b/drivers/net/mlx5/mlx5.h\n@@ -222,6 +222,8 @@ struct mlx5_ibv_shared {\n \tchar ibdev_name[IBV_SYSFS_NAME_MAX]; /* IB device name. */\n \tchar ibdev_path[IBV_SYSFS_PATH_MAX]; /* IB device path for secondary */\n \tstruct ibv_device_attr_ex device_attr; /* Device properties. */\n+\tpthread_mutex_t intr_mutex; /* Interrupt config mutex. */\n+\tuint32_t intr_cnt; /* Interrupt handler reference counter. */\n \tstruct rte_intr_handle intr_handle; /* Interrupt handler for device. */\n \tstruct mlx5_ibv_shared_port port[]; /* per device port data array. */\n };\n@@ -252,7 +254,6 @@ struct mlx5_priv {\n \tstruct mlx5_txq_data *(*txqs)[]; /* TX queues. */\n \tstruct rte_mempool *mprq_mp; /* Mempool for Multi-Packet RQ. */\n \tstruct rte_eth_rss_conf rss_conf; /* RSS configuration. */\n-\tstruct rte_intr_handle intr_handle; /* Interrupt handler. */\n \tunsigned int (*reta_idx)[]; /* RETA index table. */\n \tunsigned int reta_idx_n; /* RETA index size. */\n \tstruct mlx5_drop drop_queue; /* Flow drop queues. */\ndiff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c\nindex 2ad3231..0e588da 100644\n--- a/drivers/net/mlx5/mlx5_ethdev.c\n+++ b/drivers/net/mlx5/mlx5_ethdev.c\n@@ -1109,6 +1109,96 @@ int mlx5_fw_version_get(struct rte_eth_dev *dev, char *fw_ver, size_t fw_size)\n }\n \n /**\n+ * Uninstall shared asynchronous device events handler.\n+ * This function is implemeted to support event sharing\n+ * between multiple ports of single IB device.\n+ *\n+ * @param dev\n+ *   Pointer to Ethernet device.\n+ */\n+static void\n+mlx5_dev_shared_handler_uninstall(struct rte_eth_dev *dev)\n+{\n+\tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_ibv_shared *sh = priv->sh;\n+\n+\tif (rte_eal_process_type() != RTE_PROC_PRIMARY)\n+\t\treturn;\n+\tpthread_mutex_lock(&sh->intr_mutex);\n+\tassert(priv->ibv_port);\n+\tassert(priv->ibv_port <= sh->max_port);\n+\tassert(dev->data->port_id < RTE_MAX_ETHPORTS);\n+\tif (sh->port[priv->ibv_port - 1].ih_port_id >= RTE_MAX_ETHPORTS)\n+\t\tgoto exit;\n+\tassert(sh->port[priv->ibv_port - 1].port_id ==\n+\t\t\t\t\t(uint32_t)dev->data->port_id);\n+\tassert(sh->intr_cnt);\n+\tsh->port[priv->ibv_port - 1].ih_port_id = RTE_MAX_ETHPORTS;\n+\tif (!sh->intr_cnt || --sh->intr_cnt)\n+\t\tgoto exit;\n+\trte_intr_callback_unregister(&sh->intr_handle,\n+\t\t\t\t     mlx5_dev_interrupt_handler, sh);\n+\tsh->intr_handle.fd = 0;\n+\tsh->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN;\n+exit:\n+\tpthread_mutex_unlock(&sh->intr_mutex);\n+}\n+\n+/**\n+ * Install shared asyncronous device events handler.\n+ * This function is implemeted to support event sharing\n+ * between multiple ports of single IB device.\n+ *\n+ * @param dev\n+ *   Pointer to Ethernet device.\n+ */\n+static void\n+mlx5_dev_shared_handler_install(struct rte_eth_dev *dev)\n+{\n+\tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_ibv_shared *sh = priv->sh;\n+\tint ret;\n+\tint flags;\n+\n+\tif (rte_eal_process_type() != RTE_PROC_PRIMARY)\n+\t\treturn;\n+\tpthread_mutex_lock(&sh->intr_mutex);\n+\tassert(priv->ibv_port);\n+\tassert(priv->ibv_port <= sh->max_port);\n+\tassert(dev->data->port_id < RTE_MAX_ETHPORTS);\n+\tif (sh->port[priv->ibv_port - 1].ih_port_id < RTE_MAX_ETHPORTS) {\n+\t\t/* The handler is already installed for this port. */\n+\t\tassert(sh->intr_cnt);\n+\t\tgoto exit;\n+\t}\n+\tsh->port[priv->ibv_port - 1].ih_port_id = (uint32_t)dev->data->port_id;\n+\tif (sh->intr_cnt) {\n+\t\tsh->intr_cnt++;\n+\t\tgoto exit;\n+\t}\n+\t/* No shared handler installed. */\n+\tassert(sh->ctx->async_fd > 0);\n+\tflags = fcntl(sh->ctx->async_fd, F_GETFL);\n+\tret = fcntl(sh->ctx->async_fd, F_SETFL, flags | O_NONBLOCK);\n+\tif (ret) {\n+\t\tDRV_LOG(INFO, \"failed to change file descriptor\"\n+\t\t\t      \" async event queue\");\n+\t\t/* Indicate there will be no interrupts. */\n+\t\tdev->data->dev_conf.intr_conf.lsc = 0;\n+\t\tdev->data->dev_conf.intr_conf.rmv = 0;\n+\t\tsh->port[priv->ibv_port - 1].ih_port_id = RTE_MAX_ETHPORTS;\n+\t\tgoto exit;\n+\t}\n+\tsh->intr_handle.fd = sh->ctx->async_fd;\n+\tsh->intr_handle.type = RTE_INTR_HANDLE_EXT;\n+\trte_intr_callback_register(&sh->intr_handle,\n+\t\t\t\t   mlx5_dev_interrupt_handler, sh);\n+\tsh->intr_cnt++;\n+exit:\n+\tpthread_mutex_unlock(&sh->intr_mutex);\n+}\n+\n+/**\n  * Uninstall interrupt handler.\n  *\n  * @param dev\n@@ -1119,15 +1209,10 @@ int mlx5_fw_version_get(struct rte_eth_dev *dev, char *fw_ver, size_t fw_size)\n {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n \n-\tif (dev->data->dev_conf.intr_conf.lsc ||\n-\t    dev->data->dev_conf.intr_conf.rmv)\n-\t\trte_intr_callback_unregister(&priv->intr_handle,\n-\t\t\t\t\t     mlx5_dev_interrupt_handler, dev);\n+\tmlx5_dev_shared_handler_uninstall(dev);\n \tif (priv->primary_socket)\n \t\trte_intr_callback_unregister(&priv->intr_handle_socket,\n \t\t\t\t\t     mlx5_dev_handler_socket, dev);\n-\tpriv->intr_handle.fd = 0;\n-\tpriv->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN;\n \tpriv->intr_handle_socket.fd = 0;\n \tpriv->intr_handle_socket.type = RTE_INTR_HANDLE_UNKNOWN;\n }\n@@ -1142,28 +1227,9 @@ int mlx5_fw_version_get(struct rte_eth_dev *dev, char *fw_ver, size_t fw_size)\n mlx5_dev_interrupt_handler_install(struct rte_eth_dev *dev)\n {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n-\tstruct ibv_context *ctx = priv->sh->ctx;\n \tint ret;\n-\tint flags;\n \n-\tassert(ctx->async_fd > 0);\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(INFO,\n-\t\t\t\"port %u failed to change file descriptor async event\"\n-\t\t\t\" queue\",\n-\t\t\tdev->data->port_id);\n-\t\tdev->data->dev_conf.intr_conf.lsc = 0;\n-\t\tdev->data->dev_conf.intr_conf.rmv = 0;\n-\t}\n-\tif (dev->data->dev_conf.intr_conf.lsc ||\n-\t    dev->data->dev_conf.intr_conf.rmv) {\n-\t\tpriv->intr_handle.fd = ctx->async_fd;\n-\t\tpriv->intr_handle.type = RTE_INTR_HANDLE_EXT;\n-\t\trte_intr_callback_register(&priv->intr_handle,\n-\t\t\t\t\t   mlx5_dev_interrupt_handler, dev);\n-\t}\n+\tmlx5_dev_shared_handler_install(dev);\n \tret = mlx5_socket_init(dev);\n \tif (ret)\n \t\tDRV_LOG(ERR, \"port %u cannot initialise socket: %s\",\n",
    "prefixes": [
        "v3",
        "11/13"
    ]
}