get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 46214,
    "url": "http://patchwork.dpdk.org/api/patches/46214/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1538922308-9516-4-git-send-email-dekelp@mellanox.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<1538922308-9516-4-git-send-email-dekelp@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1538922308-9516-4-git-send-email-dekelp@mellanox.com",
    "date": "2018-10-07T14:25:07",
    "name": "[v2,3/4] net/mlx5: add L2 and L3 encap to Direct Verbs flow",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "39cea8e454814a930f799e20ff8b2ecc80aa55b4",
    "submitter": {
        "id": 1082,
        "url": "http://patchwork.dpdk.org/api/people/1082/?format=api",
        "name": "Dekel Peled",
        "email": "dekelp@mellanox.com"
    },
    "delegate": {
        "id": 6624,
        "url": "http://patchwork.dpdk.org/api/users/6624/?format=api",
        "username": "shahafs",
        "first_name": "Shahaf",
        "last_name": "Shuler",
        "email": "shahafs@mellanox.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1538922308-9516-4-git-send-email-dekelp@mellanox.com/mbox/",
    "series": [
        {
            "id": 1740,
            "url": "http://patchwork.dpdk.org/api/series/1740/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=1740",
            "date": "2018-10-07T14:25:07",
            "name": null,
            "version": 2,
            "mbox": "http://patchwork.dpdk.org/series/1740/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/46214/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/46214/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 3C7DF4C80;\n\tSun,  7 Oct 2018 16:27:14 +0200 (CEST)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n\tby dpdk.org (Postfix) with ESMTP id 4DA683977\n\tfor <dev@dpdk.org>; Sun,  7 Oct 2018 16:27:12 +0200 (CEST)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n\tdekelp@mellanox.com)\n\twith ESMTPS (AES256-SHA encrypted); 7 Oct 2018 16:31:57 +0200",
            "from mtl-vdi-280.wap.labs.mlnx. (mtl-vdi-280.wap.labs.mlnx\n\t[10.128.130.87])\n\tby labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w97ER1DJ031642;\n\tSun, 7 Oct 2018 17:27:11 +0300"
        ],
        "From": "Dekel Peled <dekelp@mellanox.com>",
        "To": "yskoh@mellanox.com, shahafs@mellanox.com",
        "Cc": "dev@dpdk.org, orika@mellanox.com",
        "Date": "Sun,  7 Oct 2018 17:25:07 +0300",
        "Message-Id": "<1538922308-9516-4-git-send-email-dekelp@mellanox.com>",
        "X-Mailer": "git-send-email 1.7.1",
        "In-Reply-To": "<1538059845-35896-1-git-send-email-dekelp@mellanox.com>",
        "References": "<1538059845-35896-1-git-send-email-dekelp@mellanox.com>",
        "Subject": "[dpdk-dev] [PATCH v2 3/4] net/mlx5: add L2 and L3 encap to Direct\n\tVerbs flow",
        "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": "This patch adds support for Direct Verbs encap operations, L2 and L3.\n\nSigned-off-by: Dekel Peled <dekelp@mellanox.com>\n---\n drivers/net/mlx5/mlx5_flow_dv.c | 226 +++++++++++++++++++++++++++++++++++++++-\n 1 file changed, 222 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c\nindex 80e7b24..221c76a 100644\n--- a/drivers/net/mlx5/mlx5_flow_dv.c\n+++ b/drivers/net/mlx5/mlx5_flow_dv.c\n@@ -84,6 +84,167 @@\n }\n \n /**\n+ * Validate the tunnel encap action.\n+ *\n+ * @param[in] action_flags\n+ *   holds the actions detected until now.\n+ * @param[in] action\n+ *   Pointer to the encap action.\n+ * @param[in] attr\n+ *   Pointer to flow attributes\n+ * @param[out] error\n+ *   Pointer to error structure.\n+ *\n+ * @return\n+ *   0 on success, a negative errno value otherwise and rte_ernno is set.\n+ */\n+static int\n+flow_dv_validate_action_tunnel_encap(uint64_t action_flags,\n+\t\t\t\t     const struct rte_flow_action *action,\n+\t\t\t\t     const struct rte_flow_attr *attr,\n+\t\t\t\t     struct rte_flow_error *error)\n+{\n+\tconst struct rte_flow_action_tunnel_encap *tunnel_encap = action->conf;\n+\n+\tif (!tunnel_encap || !(tunnel_encap->buf))\n+\t\treturn rte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION, action,\n+\t\t\t\t\t  \"configuration cannot be null\");\n+\tif (action_flags & MLX5_FLOW_ACTION_DROP)\n+\t\treturn rte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION, NULL,\n+\t\t\t\t\t  \"can't drop and encap in same flow\");\n+\tif (action_flags & (MLX5_FLOW_ACTION_TUNNEL_ENCAP |\n+\t\t\t    MLX5_FLOW_ACTION_TUNNEL_ENCAP_L3))\n+\t\treturn rte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION, NULL,\n+\t\t\t\t\t  \"can't have 2 encap actions in same\"\n+\t\t\t\t\t  \" flow\");\n+\tif (attr->ingress)\n+\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\t\tRTE_FLOW_ERROR_TYPE_ATTR_INGRESS, NULL,\n+\t\t\t\t\t\"encap action not supported for \"\n+\t\t\t\t\t\"ingress\");\n+\treturn 0;\n+}\n+\n+/**\n+ * Validate the tunnel encap L3 action\n+ *\n+ * @param[in] action_flags\n+ *   holds the actions detected until now.\n+ * @param[in] action\n+ *   Pointer to the encap action.\n+ * @param[in] attr\n+ *   Pointer to flow attributes\n+ * @param[out] error\n+ *   Pointer to error structure.\n+ *\n+ * @return\n+ *   0 on success, a negative errno value otherwise and rte_ernno is set.\n+ */\n+static int\n+flow_dv_validate_action_tunnel_encap_l3(uint64_t action_flags,\n+\t\t\t\t\tconst struct rte_flow_action *action,\n+\t\t\t\t\tconst struct rte_flow_attr *attr,\n+\t\t\t\t\tstruct rte_flow_error *error)\n+{\n+\tconst struct rte_flow_action_tunnel_encap_l3 *tunnel_encap_l3 =\n+\t\t\taction->conf;\n+\n+\tif (!tunnel_encap_l3 || !(tunnel_encap_l3->buf))\n+\t\treturn rte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION, action,\n+\t\t\t\t\t  \"configuration cannot be null\");\n+\tif (action_flags & MLX5_FLOW_ACTION_DROP)\n+\t\treturn rte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION, NULL,\n+\t\t\t\t\t  \"can't drop and encap in same flow\");\n+\tif (action_flags & (MLX5_FLOW_ACTION_TUNNEL_ENCAP |\n+\t\t\t    MLX5_FLOW_ACTION_TUNNEL_ENCAP_L3))\n+\t\treturn rte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION, NULL,\n+\t\t\t\t\t  \"can't have 2 encap actions in same\"\n+\t\t\t\t\t  \" flow\");\n+\tif (attr->ingress)\n+\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ATTR_INGRESS,\n+\t\t\t\t\t  NULL,\n+\t\t\t\t\t  \"encap action not supported for \"\n+\t\t\t\t\t  \"ingress\");\n+\treturn 0;\n+}\n+\n+/**\n+ * Convert encap action to DV specification.\n+ *\n+ * @param[in] action\n+ *   Pointer to action structure.\n+ * @param[in] dev\n+ *   Pointer to rte_eth_dev structure.\n+ * @param[out] error\n+ *   Pointer to the error structure.\n+ *\n+ * @return\n+ *   Pointer to action on success, NULL otherwise and rte_errno is set.\n+ */\n+static struct ibv_flow_action *\n+flow_dv_create_encap(const struct rte_flow_action *action,\n+\t\t     struct rte_eth_dev *dev,\n+\t\t     struct rte_flow_error *error)\n+{\n+\tstruct ibv_flow_action *encap_verb = NULL;\n+\tconst struct rte_flow_action_tunnel_encap *encap_data;\n+\tstruct priv *priv = dev->data->dev_private;\n+\n+\tencap_data = (const struct rte_flow_action_tunnel_encap *)action->conf;\n+\tencap_verb = mlx5_glue->dv_create_flow_action_packet_reformat\n+\t\t(priv->ctx, encap_data->size,\n+\t\t encap_data->size ? encap_data->buf : NULL,\n+\t\t MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL,\n+\t\t MLX5DV_FLOW_TABLE_TYPE_NIC_TX);\n+\tif (!encap_verb)\n+\t\trte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,\n+\t\t\t\t   NULL, \"cannot create encap action\");\n+\treturn encap_verb;\n+}\n+\n+/**\n+ * Convert encap L3 action to DV specification.\n+ *\n+ * @param[in] action\n+ *   Pointer to action structure.\n+ * @param[in] dev\n+ *   Pointer to rte_eth_dev structure.\n+ * @param[out] error\n+ *   Pointer to the error structure.\n+ *\n+ * @return\n+ *   Pointer to action on success, NULL otherwise and rte_errno is set.\n+ */\n+static struct ibv_flow_action *\n+flow_dv_create_encap_l3(const struct rte_flow_action *action,\n+\t\t\tstruct rte_eth_dev *dev,\n+\t\t\tstruct rte_flow_error *error)\n+{\n+\tstruct ibv_flow_action *encap_l3_verb = NULL;\n+\tconst struct rte_flow_action_tunnel_encap_l3 *encap_l3_data;\n+\tstruct priv *priv = dev->data->dev_private;\n+\n+\tencap_l3_data =\n+\t\t(const struct rte_flow_action_tunnel_encap_l3 *)action->conf;\n+\tencap_l3_verb = mlx5_glue->dv_create_flow_action_packet_reformat\n+\t\t(priv->ctx, encap_l3_data->size,\n+\t\t encap_l3_data->size ? encap_l3_data->buf : NULL,\n+\t\t MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL,\n+\t\t MLX5DV_FLOW_TABLE_TYPE_NIC_TX);\n+\tif (!encap_l3_verb)\n+\t\trte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,\n+\t\t\t\t   NULL, \"cannot create encap L3 action\");\n+\treturn encap_l3_verb;\n+}\n+\n+/**\n  * Verify the @p attributes will be correctly understood by the NIC and store\n  * them in the @p flow if everything is correct.\n  *\n@@ -330,6 +491,20 @@\n \t\t\taction_flags |= MLX5_FLOW_ACTION_COUNT;\n \t\t\t++actions_n;\n \t\t\tbreak;\n+\t\tcase RTE_FLOW_ACTION_TYPE_TUNNEL_ENCAP:\n+\t\t\tret = flow_dv_validate_action_tunnel_encap\n+\t\t\t\t(action_flags, actions, attr, error);\n+\t\t\tif (ret < 0)\n+\t\t\t\treturn ret;\n+\t\t\taction_flags |= MLX5_FLOW_ACTION_TUNNEL_ENCAP;\n+\t\t\tbreak;\n+\t\tcase RTE_FLOW_ACTION_TYPE_TUNNEL_ENCAP_L3:\n+\t\t\tret = flow_dv_validate_action_tunnel_encap_l3\n+\t\t\t\t(action_flags, actions, attr, error);\n+\t\t\tif (ret < 0)\n+\t\t\t\treturn ret;\n+\t\t\taction_flags |= MLX5_FLOW_ACTION_TUNNEL_ENCAP_L3;\n+\t\t\tbreak;\n \t\tdefault:\n \t\t\treturn rte_flow_error_set(error, ENOTSUP,\n \t\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION,\n@@ -1042,10 +1217,19 @@\n  *   Flow action to translate.\n  * @param[in, out] dev_flow\n  *   Pointer to the mlx5_flow.\n+ * @param[in] dev\n+ *   Pointer to rte_eth_dev structure.\n+ * @param[out] error\n+ *   Pointer to the error structure.\n+ *\n+ * @return\n+ *   0 on success, a negative errno value otherwise and rte_ernno is set.\n  */\n-static void\n+static int\n flow_dv_create_action(const struct rte_flow_action *action,\n-\t\t      struct mlx5_flow *dev_flow)\n+\t\t      struct mlx5_flow *dev_flow,\n+\t\t      struct rte_eth_dev *dev,\n+\t\t      struct rte_flow_error *error)\n {\n \tconst struct rte_flow_action_queue *queue;\n \tconst struct rte_flow_action_rss *rss;\n@@ -1092,10 +1276,35 @@\n \t\t/* Added to array only in apply since we need the QP */\n \t\tflow->actions |= MLX5_FLOW_ACTION_RSS;\n \t\tbreak;\n+\tcase RTE_FLOW_ACTION_TYPE_TUNNEL_ENCAP:\n+\t\tdev_flow->dv.actions[actions_n].type =\n+\t\t\tMLX5DV_FLOW_ACTION_IBV_FLOW_ACTION;\n+\t\tdev_flow->dv.actions[actions_n].action =\n+\t\t\tflow_dv_create_encap(action, dev, error);\n+\t\tif (!(dev_flow->dv.actions[actions_n].action))\n+\t\t\treturn -rte_errno;\n+\t\tdev_flow->dv.encap_verb =\n+\t\t\tdev_flow->dv.actions[actions_n].action;\n+\t\tflow->actions |= MLX5_FLOW_ACTION_TUNNEL_ENCAP;\n+\t\tactions_n++;\n+\t\tbreak;\n+\tcase RTE_FLOW_ACTION_TYPE_TUNNEL_ENCAP_L3:\n+\t\tdev_flow->dv.actions[actions_n].type =\n+\t\t\tMLX5DV_FLOW_ACTION_IBV_FLOW_ACTION;\n+\t\tdev_flow->dv.actions[actions_n].action =\n+\t\t\tflow_dv_create_encap_l3(action, dev, error);\n+\t\tif (!(dev_flow->dv.actions[actions_n].action))\n+\t\t\treturn -rte_errno;\n+\t\tdev_flow->dv.encap_verb =\n+\t\t\tdev_flow->dv.actions[actions_n].action;\n+\t\tflow->actions |= MLX5_FLOW_ACTION_TUNNEL_ENCAP_L3;\n+\t\tactions_n++;\n+\t\tbreak;\n \tdefault:\n \t\tbreak;\n \t}\n \tdev_flow->dv.actions_n = actions_n;\n+\treturn 0;\n }\n \n static uint32_t matcher_zero[MLX5_ST_SZ_DW(fte_match_param)] = { 0 };\n@@ -1259,8 +1468,10 @@\n \tmatcher.egress = attr->egress;\n \tif (flow_dv_matcher_register(dev, &matcher, dev_flow, error))\n \t\treturn -rte_errno;\n-\tfor (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++)\n-\t\tflow_dv_create_action(actions, dev_flow);\n+\tfor (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {\n+\t\tif (flow_dv_create_action(actions, dev_flow, dev, error))\n+\t\t\treturn -rte_errno;\n+\t}\n \treturn 0;\n }\n \n@@ -1444,6 +1655,13 @@\n \t\tLIST_REMOVE(dev_flow, next);\n \t\tif (dev_flow->dv.matcher)\n \t\t\tflow_dv_matcher_release(dev, dev_flow->dv.matcher);\n+\n+\t\tif (dev_flow->dv.encap_verb) {\n+\t\t\tclaim_zero(mlx5_glue->destroy_flow_action\n+\t\t\t\t\t\t(dev_flow->dv.encap_verb));\n+\t\t\tdev_flow->dv.encap_verb = NULL;\n+\t\t}\n+\n \t\trte_free(dev_flow);\n \t}\n }\n",
    "prefixes": [
        "v2",
        "3/4"
    ]
}