get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 77005,
    "url": "http://patches.dpdk.org/api/patches/77005/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1599634114-148013-10-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": "<1599634114-148013-10-git-send-email-jiaweiw@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1599634114-148013-10-git-send-email-jiaweiw@nvidia.com",
    "date": "2020-09-09T06:48:31",
    "name": "[v6,09/12] net/mlx5: update validation for mirroring flow",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "3a269c30b850501411840618b0dd2e3eaab9225b",
    "submitter": {
        "id": 1939,
        "url": "http://patches.dpdk.org/api/people/1939/?format=api",
        "name": "Jiawei Wang",
        "email": "jiaweiw@nvidia.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1599634114-148013-10-git-send-email-jiaweiw@nvidia.com/mbox/",
    "series": [
        {
            "id": 12045,
            "url": "http://patches.dpdk.org/api/series/12045/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=12045",
            "date": "2020-09-09T06:48:29",
            "name": "support the flow-based traffic sampling",
            "version": 6,
            "mbox": "http://patches.dpdk.org/series/12045/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/77005/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/77005/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 3D93AA04B1;\n\tWed,  9 Sep 2020 08:49:45 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 918041C128;\n\tWed,  9 Sep 2020 08:48:47 +0200 (CEST)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by dpdk.org (Postfix) with ESMTP id 9D0CC1C0CC\n for <dev@dpdk.org>; Wed,  9 Sep 2020 08:48:36 +0200 (CEST)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n jiaweiw@nvidia.com) with SMTP; 9 Sep 2020 09:48:34 +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 0896mYG4029471;\n Wed, 9 Sep 2020 09:48:34 +0300"
        ],
        "From": "Jiawei Wang <jiaweiw@nvidia.com>",
        "To": "orika@nvidia.com, viacheslavo@nvidia.com, matan@nvidia.com,\n thomas@monjalon.net, ferruh.yigit@intel.com, marko.kovacevic@intel.com,\n arybchenko@solarflare.com",
        "Cc": "dev@dpdk.org, rasland@nvidia.com, ian.stokes@intel.com, fbl@redhat.com,\n asafp@nvidia.com",
        "Date": "Wed,  9 Sep 2020 09:48:31 +0300",
        "Message-Id": "<1599634114-148013-10-git-send-email-jiaweiw@nvidia.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1599634114-148013-1-git-send-email-jiaweiw@nvidia.com>",
        "References": "<1598540492-406340-1-git-send-email-jiaweiw@nvidia.com>\n <1599634114-148013-1-git-send-email-jiaweiw@nvidia.com>",
        "Subject": "[dpdk-dev] [PATCH v6 09/12] 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>\n---\n drivers/net/mlx5/mlx5_flow.c    | 26 +++++++++++++++--\n drivers/net/mlx5/mlx5_flow_dv.c | 62 ++++++++++++++++++++++++++++++++++++++---\n 2 files changed, 82 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c\nindex ce03210..61104a8 100644\n--- a/drivers/net/mlx5/mlx5_flow.c\n+++ b/drivers/net/mlx5/mlx5_flow.c\n@@ -3936,16 +3936,38 @@ struct mlx5_flow_tunnel_info {\n  */\n static int\n flow_check_match_action(const struct rte_flow_action actions[],\n-\t\t\t\t\tenum rte_flow_action_type action)\n+\t\t\tconst struct rte_flow_attr *attr,\n+\t\t\tenum rte_flow_action_type action)\n {\n+\tconst struct rte_flow_action_sample *sample;\n \tint actions_n = 0;\n+\tint jump_flag = 0;\n \tint flag = 0;\n+\tuint32_t ratio = 0;\n+\tint sub_type = 0;\n \n \tfor (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {\n \t\tif (actions->type == action)\n \t\t\tflag = 1;\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@@ -4460,7 +4482,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 \tif (actions_n) {\n \t\t/* The prefix actions must includes sample, tag, end. */\ndiff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c\nindex 2241e36..19ad9fc 100644\n--- a/drivers/net/mlx5/mlx5_flow_dv.c\n+++ b/drivers/net/mlx5/mlx5_flow_dv.c\n@@ -4024,6 +4024,7 @@ 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 \n@@ -4063,6 +4064,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@@ -4086,6 +4089,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@@ -4108,10 +4130,42 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t\t\t  \"Sample Only support Ingress \"\n \t\t\t\t\t  \"or E-Switch\");\n \t} else if (sample->actions->type != RTE_FLOW_ACTION_TYPE_END) {\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\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": [
        "v6",
        "09/12"
    ]
}