get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 52301,
    "url": "http://patches.dpdk.org/api/patches/52301/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1554383065-11151-2-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": "<1554383065-11151-2-git-send-email-viacheslavo@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1554383065-11151-2-git-send-email-viacheslavo@mellanox.com",
    "date": "2019-04-04T13:04:24",
    "name": "[v2,1/2] net/mlx5: add Direct Rules flow data alloc/free routines",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "e69227b1919b3ee5c01b861053b5883f59135e1d",
    "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/1554383065-11151-2-git-send-email-viacheslavo@mellanox.com/mbox/",
    "series": [
        {
            "id": 4119,
            "url": "http://patches.dpdk.org/api/series/4119/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4119",
            "date": "2019-04-04T13:04:23",
            "name": "support Direct Rules flows over shared IB context",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/4119/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/52301/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/52301/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 075281B44B;\n\tThu,  4 Apr 2019 15:05:56 +0200 (CEST)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n\tby dpdk.org (Postfix) with ESMTP id B991D1B44B\n\tfor <dev@dpdk.org>; Thu,  4 Apr 2019 15:05:54 +0200 (CEST)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n\tviacheslavo@mellanox.com)\n\twith ESMTPS (AES256-SHA encrypted); 4 Apr 2019 16:05:52 +0300",
            "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 x34D5mBk027457;\n\tThu, 4 Apr 2019 16:05:52 +0300"
        ],
        "From": "Viacheslav Ovsiienko <viacheslavo@mellanox.com>",
        "To": "dev@dpdk.org",
        "Cc": "shahafs@mellanox.com",
        "Date": "Thu,  4 Apr 2019 13:04:24 +0000",
        "Message-Id": "<1554383065-11151-2-git-send-email-viacheslavo@mellanox.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1554383065-11151-1-git-send-email-viacheslavo@mellanox.com>",
        "References": "<1554186157-29455-1-git-send-email-viacheslavo@mellanox.com>\n\t<1554383065-11151-1-git-send-email-viacheslavo@mellanox.com>",
        "Subject": "[dpdk-dev] [PATCH v2 1/2] net/mlx5: add Direct Rules flow data\n\talloc/free 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 going to share the Direct Rules and Direct Verbs flow\ndevice data structures between master and representors in the\nE-Switch configurations over multiport IB device.\n\nThe code of initializing and destroying these data is\nmoved to dedicated routines, this is just a preparation\nstep for actual data sharing.\n\nSigned-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>\n---\n drivers/net/mlx5/mlx5.c | 117 +++++++++++++++++++++++++++++++++++++++++-------\n drivers/net/mlx5/mlx5.h |   4 ++\n 2 files changed, 106 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c\nindex 65aa9cf..62cba00 100644\n--- a/drivers/net/mlx5/mlx5.c\n+++ b/drivers/net/mlx5/mlx5.c\n@@ -303,6 +303,101 @@ struct mlx5_dev_spawn_data {\n }\n \n /**\n+ * Initialize DR related data within private structure.\n+ * Routine checks the reference counter and does actual\n+ * resources creation/iniialization only if counter is zero.\n+ *\n+ * @param[in] priv\n+ *   Pointer to the private device data structure.\n+ *\n+ * @return\n+ *   Zero on success, positive error code otherwise.\n+ */\n+static int\n+mlx5_alloc_shared_dr(struct mlx5_priv *priv)\n+{\n+#ifdef HAVE_MLX5DV_DR\n+\tstruct mlx5_ibv_shared *sh = priv->sh;\n+\tint err = 0;\n+\tvoid *ns;\n+\n+\tassert(sh);\n+\tif (sh->dv_refcnt) {\n+\t\t/* Shared DV/DR structures is already initialized. */\n+\t\tsh->dv_refcnt++;\n+\t\tpriv->dr_shared = 1;\n+\t\treturn 0;\n+\t}\n+\t/* Reference counter is zero, we should initialize structures. */\n+\tns = mlx5dv_dr_create_ns(sh->ctx, MLX5DV_DR_NS_DOMAIN_INGRESS_BYPASS);\n+\tif (!ns) {\n+\t\tDRV_LOG(ERR, \"ingress mlx5dv_dr_create_ns failed\");\n+\t\terr = errno;\n+\t\tgoto error;\n+\t}\n+\tpriv->rx_ns = ns;\n+\tns = mlx5dv_dr_create_ns(sh->ctx, MLX5DV_DR_NS_DOMAIN_EGRESS_BYPASS);\n+\tif (!ns) {\n+\t\tDRV_LOG(ERR, \"egress mlx5dv_dr_create_ns failed\");\n+\t\terr = errno;\n+\t\tgoto error;\n+\t}\n+\tpriv->tx_ns = ns;\n+\tsh->dv_refcnt++;\n+\tpriv->dr_shared = 1;\n+\treturn 0;\n+\n+error:\n+       /* Rollback the created objects. */\n+\tif (priv->rx_ns) {\n+\t\tmlx5dv_dr_destroy_ns(priv->rx_ns);\n+\t\tpriv->rx_ns = NULL;\n+\t}\n+\tif (priv->tx_ns) {\n+\t\tmlx5dv_dr_destroy_ns(priv->tx_ns);\n+\t\tpriv->tx_ns = NULL;\n+\t}\n+\treturn err;\n+#else\n+\t(void)priv;\n+\treturn 0;\n+#endif\n+}\n+\n+/**\n+ * Destroy DR related data within private structure.\n+ *\n+ * @param[in] priv\n+ *   Pointer to the private device data structure.\n+ */\n+static void\n+mlx5_free_shared_dr(struct mlx5_priv *priv)\n+{\n+#ifdef HAVE_MLX5DV_DR\n+\tstruct mlx5_ibv_shared *sh;\n+\n+\tif (!priv->dr_shared)\n+\t\treturn;\n+\tpriv->dr_shared = 0;\n+\tsh = priv->sh;\n+\tassert(sh);\n+\tassert(sh->dv_refcnt);\n+\tif (sh->dv_refcnt && --sh->dv_refcnt)\n+\t\treturn;\n+\tif (priv->rx_ns) {\n+\t\tmlx5dv_dr_destroy_ns(priv->rx_ns);\n+\t\tpriv->rx_ns = NULL;\n+\t}\n+\tif (priv->tx_ns) {\n+\t\tmlx5dv_dr_destroy_ns(priv->tx_ns);\n+\t\tpriv->tx_ns = NULL;\n+\t}\n+#else\n+\t(void)priv;\n+#endif\n+}\n+\n+/**\n  * Initialize shared data between primary and secondary process.\n  *\n  * A memzone is reserved by primary process and secondary processes attach to\n@@ -495,6 +590,7 @@ struct mlx5_dev_spawn_data {\n \tmlx5_mprq_free_mp(dev);\n \tmlx5_mr_release(dev);\n \tassert(priv->sh);\n+\tmlx5_free_shared_dr(priv);\n \tif (priv->sh)\n \t\tmlx5_free_shared_ibctx(priv->sh);\n \tpriv->sh = NULL;\n@@ -1483,22 +1579,11 @@ struct mlx5_dev_spawn_data {\n \t\t\tpriv->tcf_context = NULL;\n \t\t}\n \t}\n-#ifdef HAVE_MLX5DV_DR\n-\t\tpriv->rx_ns = mlx5dv_dr_create_ns\n-\t\t\t(sh->ctx, MLX5DV_DR_NS_DOMAIN_INGRESS_BYPASS);\n-\t\tif (priv->rx_ns == NULL) {\n-\t\t\tDRV_LOG(ERR, \"mlx5dv_dr_create_ns failed\");\n-\t\t\terr = errno;\n-\t\t\tgoto error;\n-\t\t}\n-\t\tpriv->tx_ns = mlx5dv_dr_create_ns(sh->ctx,\n-\t\t\t\t\t MLX5DV_DR_NS_DOMAIN_EGRESS_BYPASS);\n-\t\tif (priv->tx_ns == NULL) {\n-\t\t\tDRV_LOG(ERR, \"mlx5dv_dr_create_ns failed\");\n-\t\t\terr = errno;\n+\tif (config.dv_flow_en) {\n+\t\terr = mlx5_alloc_shared_dr(priv);\n+\t\tif (err)\n \t\t\tgoto error;\n-\t\t}\n-#endif\n+\t}\n \tTAILQ_INIT(&priv->flows);\n \tTAILQ_INIT(&priv->ctrl_flows);\n \t/* Hint libmlx5 to use PMD allocator for data plane resources */\n@@ -1550,6 +1635,8 @@ struct mlx5_dev_spawn_data {\n \treturn eth_dev;\n error:\n \tif (priv) {\n+\t\tif (priv->sh)\n+\t\t\tmlx5_free_shared_dr(priv);\n \t\tif (priv->nl_socket_route >= 0)\n \t\t\tclose(priv->nl_socket_route);\n \t\tif (priv->nl_socket_rdma >= 0)\ndiff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h\nindex 5a7597e..a6f6ef4 100644\n--- a/drivers/net/mlx5/mlx5.h\n+++ b/drivers/net/mlx5/mlx5.h\n@@ -253,6 +253,9 @@ 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+\t/* Shared DV/DR flow data section. */\n+\tuint32_t dv_refcnt; /* DV/DR data reference counter. */\n+\t/* Shared interrupt handler section. */\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@@ -284,6 +287,7 @@ struct mlx5_priv {\n \tunsigned int isolated:1; /* Whether isolated mode is enabled. */\n \tunsigned int representor:1; /* Device is a port representor. */\n \tunsigned int master:1; /* Device is a E-Switch master. */\n+\tunsigned int dr_shared:1; /* DV/DR data is shared. */\n \tuint16_t domain_id; /* Switch domain identifier. */\n \tuint16_t vport_id; /* Associated VF vport index (if any). */\n \tint32_t representor_id; /* Port representor identifier. */\n",
    "prefixes": [
        "v2",
        "1/2"
    ]
}