get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 80435,
    "url": "http://patches.dpdk.org/api/patches/80435/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1602577050-178398-8-git-send-email-jiaweiw@nvidia.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": "<1602577050-178398-8-git-send-email-jiaweiw@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1602577050-178398-8-git-send-email-jiaweiw@nvidia.com",
    "date": "2020-10-13T08:17:27",
    "name": "[v2,07/10] net/mlx5: update validation for mirroring flow",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "065cbf448c960a3010d9158f76a9a255062345e5",
    "submitter": {
        "id": 1939,
        "url": "http://patches.dpdk.org/api/people/1939/?format=api",
        "name": "Jiawei Wang",
        "email": "jiaweiw@nvidia.com"
    },
    "delegate": {
        "id": 3268,
        "url": "http://patches.dpdk.org/api/users/3268/?format=api",
        "username": "rasland",
        "first_name": "Raslan",
        "last_name": "Darawsheh",
        "email": "rasland@nvidia.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1602577050-178398-8-git-send-email-jiaweiw@nvidia.com/mbox/",
    "series": [
        {
            "id": 12904,
            "url": "http://patches.dpdk.org/api/series/12904/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=12904",
            "date": "2020-10-13T08:17:23",
            "name": "Add sampling and mirroring support in MLX5 PMD",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/12904/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/80435/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/80435/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id B6A0BA04B6;\n\tTue, 13 Oct 2020 10:18:48 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 131E01DA57;\n\tTue, 13 Oct 2020 10:17:43 +0200 (CEST)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by dpdk.org (Postfix) with ESMTP id 593481DA46\n for <dev@dpdk.org>; Tue, 13 Oct 2020 10:17:35 +0200 (CEST)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n jiaweiw@nvidia.com) with SMTP; 13 Oct 2020 11:17:30 +0300",
            "from nvidia.com (gen-l-vrt-280.mtl.labs.mlnx [10.237.45.1])\n by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 09D8HU0b022749;\n Tue, 13 Oct 2020 11:17:30 +0300"
        ],
        "From": "Jiawei Wang <jiaweiw@nvidia.com>",
        "To": "orika@nvidia.com, viacheslavo@nvidia.com, matan@nvidia.com,\n thomas@monjalon.net",
        "Cc": "dev@dpdk.org, rasland@nvidia.com, asafp@nvidia.com",
        "Date": "Tue, 13 Oct 2020 11:17:27 +0300",
        "Message-Id": "<1602577050-178398-8-git-send-email-jiaweiw@nvidia.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1602577050-178398-1-git-send-email-jiaweiw@nvidia.com>",
        "References": "<1602251436-269694-1-git-send-email-jiaweiw@nvidia.com>\n <1602577050-178398-1-git-send-email-jiaweiw@nvidia.com>",
        "Subject": "[dpdk-dev] [PATCH v2 07/10] net/mlx5: update validation for\n\tmirroring 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 <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": "Mirroring flow using sample action with ratio is 1, and it doesn't\nsupport jump action with the same one flow.\n\nSample action must have destination actions like port or queue for\nmirroring, and don't need split function as sampling flow.\n\nSigned-off-by: Jiawei Wang <jiaweiw@nvidia.com>\nAcked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>\n---\n drivers/net/mlx5/mlx5_flow.c    | 26 +++++++++++++-\n drivers/net/mlx5/mlx5_flow_dv.c | 78 ++++++++++++++++++++++++++++++++++++++---\n 2 files changed, 99 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c\nindex 49eb648..b2d1cee 100644\n--- a/drivers/net/mlx5/mlx5_flow.c\n+++ b/drivers/net/mlx5/mlx5_flow.c\n@@ -4245,6 +4245,8 @@ struct mlx5_flow_tunnel_info {\n  *\n  * @param[in] actions\n  *   Pointer to the list of actions.\n+ * @param[in] attr\n+ *   Flow rule attributes.\n  * @param[in] action\n  *   The action to be check if exist.\n  * @param[out] match_action_pos\n@@ -4258,10 +4260,15 @@ struct mlx5_flow_tunnel_info {\n  */\n static int\n flow_check_match_action(const struct rte_flow_action actions[],\n+\t\t\tconst struct rte_flow_attr *attr,\n \t\t\tenum rte_flow_action_type action,\n \t\t\tint *match_action_pos, int *qrss_action_pos)\n {\n+\tconst struct rte_flow_action_sample *sample;\n \tint actions_n = 0;\n+\tint jump_flag = 0;\n+\tuint32_t ratio = 0;\n+\tint sub_type = 0;\n \tint flag = 0;\n \n \t*match_action_pos = -1;\n@@ -4274,8 +4281,25 @@ struct mlx5_flow_tunnel_info {\n \t\tif (actions->type == RTE_FLOW_ACTION_TYPE_QUEUE ||\n \t\t    actions->type == RTE_FLOW_ACTION_TYPE_RSS)\n \t\t\t*qrss_action_pos = actions_n;\n+\t\tif (actions->type == RTE_FLOW_ACTION_TYPE_JUMP)\n+\t\t\tjump_flag = 1;\n+\t\tif (actions->type == RTE_FLOW_ACTION_TYPE_SAMPLE) {\n+\t\t\tsample = actions->conf;\n+\t\t\tratio = sample->ratio;\n+\t\t\tsub_type = ((const struct rte_flow_action *)\n+\t\t\t\t\t(sample->actions))->type;\n+\t\t}\n \t\tactions_n++;\n \t}\n+\tif (flag && action == RTE_FLOW_ACTION_TYPE_SAMPLE && attr->transfer) {\n+\t\tif (ratio == 1) {\n+\t\t\t/* JUMP Action not support for Mirroring;\n+\t\t\t * Mirroring support multi-destination;\n+\t\t\t */\n+\t\t\tif (!jump_flag && sub_type != RTE_FLOW_ACTION_TYPE_END)\n+\t\t\t\tflag = 0;\n+\t\t}\n+\t}\n \t/* Count RTE_FLOW_ACTION_TYPE_END. */\n \treturn flag ? actions_n + 1 : 0;\n }\n@@ -4827,7 +4851,7 @@ struct mlx5_flow_tunnel_info {\n \tint ret = 0;\n \n \tif (priv->sampler_en)\n-\t\tactions_n = flow_check_match_action(actions,\n+\t\tactions_n = flow_check_match_action(actions, attr,\n \t\t\t\t\tRTE_FLOW_ACTION_TYPE_SAMPLE,\n \t\t\t\t\t&sample_action_pos, &qrss_action_pos);\n \tif (actions_n) {\ndiff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c\nindex 56fdd8d..157c465 100644\n--- a/drivers/net/mlx5/mlx5_flow_dv.c\n+++ b/drivers/net/mlx5/mlx5_flow_dv.c\n@@ -3374,6 +3374,8 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t\t\t    (dev, &res, dev_flow, error);\n }\n \n+static int fdb_mirror;\n+\n /**\n  * Validate the modify-header actions.\n  *\n@@ -3401,6 +3403,12 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION, NULL,\n \t\t\t\t\t  \"can't have encap action before\"\n \t\t\t\t\t  \" modify action\");\n+\tif ((action_flags & MLX5_FLOW_ACTION_SAMPLE) && fdb_mirror)\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 support sample action before\"\n+\t\t\t\t\t  \" modify action for E-Switch\"\n+\t\t\t\t\t  \" mirroring\");\n \treturn 0;\n }\n \n@@ -3724,6 +3732,12 @@ struct field_modify_info modify_tcp[] = {\n \t\treturn rte_flow_error_set(error, ENOTSUP,\n \t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION, NULL,\n \t\t\t\t\t  \"jump with meter not support\");\n+\tif ((action_flags & MLX5_FLOW_ACTION_SAMPLE) && fdb_mirror)\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  \"E-Switch mirroring can't support\"\n+\t\t\t\t\t  \" Sample action and jump action in\"\n+\t\t\t\t\t  \" same flow now\");\n \tif (!action->conf)\n \t\treturn rte_flow_error_set(error, EINVAL,\n \t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION_CONF,\n@@ -4074,8 +4088,10 @@ struct field_modify_info modify_tcp[] = {\n \tconst struct rte_flow_action_sample *sample = action->conf;\n \tconst struct rte_flow_action *act;\n \tuint64_t sub_action_flags = 0;\n+\tuint16_t queue_index = 0xFFFF;\n \tint actions_n = 0;\n \tint ret;\n+\tfdb_mirror = 0;\n \n \tif (!sample)\n \t\treturn rte_flow_error_set(error, EINVAL,\n@@ -4119,6 +4135,8 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t\t\t\t\t      attr, error);\n \t\t\tif (ret < 0)\n \t\t\t\treturn ret;\n+\t\t\tqueue_index = ((const struct rte_flow_action_queue *)\n+\t\t\t\t\t\t\t(act->conf))->index;\n \t\t\tsub_action_flags |= MLX5_FLOW_ACTION_QUEUE;\n \t\t\t++actions_n;\n \t\t\tbreak;\n@@ -4142,6 +4160,25 @@ struct field_modify_info modify_tcp[] = {\n \t\t\tsub_action_flags |= MLX5_FLOW_ACTION_COUNT;\n \t\t\t++actions_n;\n \t\t\tbreak;\n+\t\tcase RTE_FLOW_ACTION_TYPE_PORT_ID:\n+\t\t\tret = flow_dv_validate_action_port_id(dev,\n+\t\t\t\t\t\t\t      sub_action_flags,\n+\t\t\t\t\t\t\t      act,\n+\t\t\t\t\t\t\t      attr,\n+\t\t\t\t\t\t\t      error);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n+\t\t\tsub_action_flags |= MLX5_FLOW_ACTION_PORT_ID;\n+\t\t\t++actions_n;\n+\t\t\tbreak;\n+\t\tcase RTE_FLOW_ACTION_TYPE_RAW_ENCAP:\n+\t\t\tret = flow_dv_validate_action_raw_encap_decap\n+\t\t\t\t(dev, NULL, act->conf, attr, &sub_action_flags,\n+\t\t\t\t &actions_n, error);\n+\t\t\tif (ret < 0)\n+\t\t\t\treturn ret;\n+\t\t\t++actions_n;\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@@ -4165,10 +4202,43 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t\t\t  \"or E-Switch\");\n \t} else if (sample->actions->type != RTE_FLOW_ACTION_TYPE_END) {\n \t\tMLX5_ASSERT(attr->transfer);\n-\t\treturn rte_flow_error_set(error, ENOTSUP,\n-\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION, NULL,\n-\t\t\t\t\t  \"E-Switch doesn't support any \"\n-\t\t\t\t\t  \"optional action for sampling\");\n+\t\tif (sample->ratio > 1)\n+\t\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION,\n+\t\t\t\t\t\t  NULL,\n+\t\t\t\t\t\t  \"E-Switch doesn't support \"\n+\t\t\t\t\t\t  \"any optional action \"\n+\t\t\t\t\t\t  \"for sampling\");\n+\t\tfdb_mirror = 1;\n+\t\tif (sub_action_flags & MLX5_FLOW_ACTION_QUEUE)\n+\t\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION,\n+\t\t\t\t\t\t  NULL,\n+\t\t\t\t\t\t  \"unsupported action QUEUE\");\n+\t\tif (!(sub_action_flags & MLX5_FLOW_ACTION_PORT_ID))\n+\t\t\treturn rte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION,\n+\t\t\t\t\t\t  NULL,\n+\t\t\t\t\t\t  \"E-Switch must has a dest \"\n+\t\t\t\t\t\t  \"port for mirroring\");\n+\t}\n+\t/* Continue validation for Xcap actions.*/\n+\tif ((sub_action_flags & MLX5_FLOW_XCAP_ACTIONS) &&\n+\t    (queue_index == 0xFFFF ||\n+\t     mlx5_rxq_get_type(dev, queue_index) != MLX5_RXQ_TYPE_HAIRPIN)) {\n+\t\tif ((sub_action_flags & MLX5_FLOW_XCAP_ACTIONS) ==\n+\t\t     MLX5_FLOW_XCAP_ACTIONS)\n+\t\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION,\n+\t\t\t\t\t\t  NULL, \"encap and decap \"\n+\t\t\t\t\t\t  \"combination aren't \"\n+\t\t\t\t\t\t  \"supported\");\n+\t\tif (!attr->transfer && attr->ingress && (sub_action_flags &\n+\t\t\t\t\t\t\tMLX5_FLOW_ACTION_ENCAP))\n+\t\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION,\n+\t\t\t\t\t\t  NULL, \"encap is not supported\"\n+\t\t\t\t\t\t  \" for ingress traffic\");\n \t}\n \treturn 0;\n }\n",
    "prefixes": [
        "v2",
        "07/10"
    ]
}