get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 86552,
    "url": "https://patches.dpdk.org/api/patches/86552/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1610609088-204833-4-git-send-email-jiaweiw@nvidia.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<1610609088-204833-4-git-send-email-jiaweiw@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1610609088-204833-4-git-send-email-jiaweiw@nvidia.com",
    "date": "2021-01-14T07:24:47",
    "name": "[v3,3/4] net/mlx5: handle the RSS action in the sample",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "27d62fe232c83adafdb09c72b624fe6fd5c11d3e",
    "submitter": {
        "id": 1939,
        "url": "https://patches.dpdk.org/api/people/1939/?format=api",
        "name": "Jiawei Wang",
        "email": "jiaweiw@nvidia.com"
    },
    "delegate": {
        "id": 3268,
        "url": "https://patches.dpdk.org/api/users/3268/?format=api",
        "username": "rasland",
        "first_name": "Raslan",
        "last_name": "Darawsheh",
        "email": "rasland@nvidia.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1610609088-204833-4-git-send-email-jiaweiw@nvidia.com/mbox/",
    "series": [
        {
            "id": 14722,
            "url": "https://patches.dpdk.org/api/series/14722/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=14722",
            "date": "2021-01-14T07:24:47",
            "name": "Add RSS action support in the sample sub-actions list",
            "version": 3,
            "mbox": "https://patches.dpdk.org/series/14722/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/86552/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/86552/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 54B3AA0A02;\n\tThu, 14 Jan 2021 08:25:01 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 32BAB140F9E;\n\tThu, 14 Jan 2021 08:24:57 +0100 (CET)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by mails.dpdk.org (Postfix) with ESMTP id 9F5AB140F99\n for <dev@dpdk.org>; Thu, 14 Jan 2021 08:24:54 +0100 (CET)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n jiaweiw@nvidia.com) with SMTP; 14 Jan 2021 09:24:48 +0200",
            "from nvidia.com (gen-l-vrt-281.mtl.labs.mlnx [10.237.44.1])\n by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 10E7OmcX001294;\n Thu, 14 Jan 2021 09:24:48 +0200"
        ],
        "From": "Jiawei Wang <jiaweiw@nvidia.com>",
        "To": "ferruh.yigit@intel.com, viacheslavo@nvidia.com, matan@nvidia.com,\n orika@nvidia.com",
        "Cc": "dev@dpdk.org, rasland@nvidia.com",
        "Date": "Thu, 14 Jan 2021 09:24:47 +0200",
        "Message-Id": "<1610609088-204833-4-git-send-email-jiaweiw@nvidia.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1610609088-204833-1-git-send-email-jiaweiw@nvidia.com>",
        "References": "<1610445689-389472-1-git-send-email-jiaweiw@nvidia.com>\n <1610609088-204833-1-git-send-email-jiaweiw@nvidia.com>",
        "Subject": "[dpdk-dev] [PATCH v3 3/4] net/mlx5: handle the RSS action in the\n sample",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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": "PMD validates the rss action in the sample sub-actions list,\nthen translates into rdma-core action and it will be used for sample\npath destination.\n\nIf the RSS action is in both sample sub-actions list and original flow,\nthe rss level and rss type in the sample sub-actions list should be\nconsistent with the original flow list, since the expanding items\nfor RSS should be the same for both actions.\n\nSigned-off-by: Jiawei Wang <jiaweiw@nvidia.com>\nAcked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>\n---\n drivers/net/mlx5/mlx5_flow.c    |  18 +++-\n drivers/net/mlx5/mlx5_flow_dv.c | 226 +++++++++++++++++++++++++++-------------\n 2 files changed, 171 insertions(+), 73 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c\nindex 0670447..96a7e0d 100644\n--- a/drivers/net/mlx5/mlx5_flow.c\n+++ b/drivers/net/mlx5/mlx5_flow.c\n@@ -3174,16 +3174,28 @@ struct mlx5_flow_tunnel_info {\n static const struct rte_flow_action_rss*\n flow_get_rss_action(const struct rte_flow_action actions[])\n {\n+\tconst struct rte_flow_action_rss *rss = NULL;\n+\n \tfor (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {\n \t\tswitch (actions->type) {\n \t\tcase RTE_FLOW_ACTION_TYPE_RSS:\n-\t\t\treturn (const struct rte_flow_action_rss *)\n-\t\t\t       actions->conf;\n+\t\t\trss = actions->conf;\n+\t\t\tbreak;\n+\t\tcase RTE_FLOW_ACTION_TYPE_SAMPLE:\n+\t\t{\n+\t\t\tconst struct rte_flow_action_sample *sample =\n+\t\t\t\t\t\t\t\tactions->conf;\n+\t\t\tconst struct rte_flow_action *act = sample->actions;\n+\t\t\tfor (; act->type != RTE_FLOW_ACTION_TYPE_END; act++)\n+\t\t\t\tif (act->type == RTE_FLOW_ACTION_TYPE_RSS)\n+\t\t\t\t\trss = act->conf;\n+\t\t\tbreak;\n+\t\t}\n \t\tdefault:\n \t\t\tbreak;\n \t\t}\n \t}\n-\treturn NULL;\n+\treturn rss;\n }\n \n /**\ndiff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c\nindex e4736ee..3fa15cf 100644\n--- a/drivers/net/mlx5/mlx5_flow_dv.c\n+++ b/drivers/net/mlx5/mlx5_flow_dv.c\n@@ -4344,6 +4344,10 @@ struct mlx5_hlist_entry *\n  *   Attributes of flow that includes this action.\n  * @param[in] item_flags\n  *   Holds the items detected.\n+ * @param[in] rss\n+ *   Pointer to the RSS action.\n+ * @param[out] sample_rss\n+ *   Pointer to the RSS action in sample action list.\n  * @param[out] error\n  *   Pointer to error structure.\n  *\n@@ -4355,7 +4359,9 @@ struct mlx5_hlist_entry *\n \t\t\t       const struct rte_flow_action *action,\n \t\t\t       struct rte_eth_dev *dev,\n \t\t\t       const struct rte_flow_attr *attr,\n-\t\t\t       const uint64_t item_flags,\n+\t\t\t       uint64_t item_flags,\n+\t\t\t       const struct rte_flow_action_rss *rss,\n+\t\t\t       const struct rte_flow_action_rss **sample_rss,\n \t\t\t       struct rte_flow_error *error)\n {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n@@ -4415,6 +4421,28 @@ struct mlx5_hlist_entry *\n \t\t\tsub_action_flags |= MLX5_FLOW_ACTION_QUEUE;\n \t\t\t++actions_n;\n \t\t\tbreak;\n+\t\tcase RTE_FLOW_ACTION_TYPE_RSS:\n+\t\t\t*sample_rss = act->conf;\n+\t\t\tret = mlx5_flow_validate_action_rss(act,\n+\t\t\t\t\t\t\t    sub_action_flags,\n+\t\t\t\t\t\t\t    dev, attr,\n+\t\t\t\t\t\t\t    item_flags,\n+\t\t\t\t\t\t\t    error);\n+\t\t\tif (ret < 0)\n+\t\t\t\treturn ret;\n+\t\t\tif (rss && *sample_rss &&\n+\t\t\t    ((*sample_rss)->level != rss->level ||\n+\t\t\t    (*sample_rss)->types != rss->types))\n+\t\t\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\t\tRTE_FLOW_ERROR_TYPE_ACTION,\n+\t\t\t\t\tNULL,\n+\t\t\t\t\t\"Can't use the different RSS types \"\n+\t\t\t\t\t\"or level in the same flow\");\n+\t\t\tif (*sample_rss != NULL && (*sample_rss)->queue_num)\n+\t\t\t\tqueue_index = (*sample_rss)->queue[0];\n+\t\t\tsub_action_flags |= MLX5_FLOW_ACTION_RSS;\n+\t\t\t++actions_n;\n+\t\t\tbreak;\n \t\tcase RTE_FLOW_ACTION_TYPE_MARK:\n \t\t\tret = flow_dv_validate_action_mark(dev, act,\n \t\t\t\t\t\t\t   sub_action_flags,\n@@ -4463,7 +4491,8 @@ struct mlx5_hlist_entry *\n \t\t}\n \t}\n \tif (attr->ingress && !attr->transfer) {\n-\t\tif (!(sub_action_flags & MLX5_FLOW_ACTION_QUEUE))\n+\t\tif (!(sub_action_flags & (MLX5_FLOW_ACTION_QUEUE |\n+\t\t\t\t\t  MLX5_FLOW_ACTION_RSS)))\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@@ -4490,6 +4519,11 @@ struct mlx5_hlist_entry *\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_RSS)\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@@ -5240,7 +5274,8 @@ struct mlx5_hlist_entry *\n \tconst struct rte_flow_item *gre_item = NULL;\n \tconst struct rte_flow_action_raw_decap *decap;\n \tconst struct rte_flow_action_raw_encap *encap;\n-\tconst struct rte_flow_action_rss *rss;\n+\tconst struct rte_flow_action_rss *rss = NULL;\n+\tconst struct rte_flow_action_rss *sample_rss = NULL;\n \tconst struct rte_flow_item_tcp nic_tcp_mask = {\n \t\t.hdr = {\n \t\t\t.tcp_flags = 0xFF,\n@@ -5709,6 +5744,14 @@ struct mlx5_hlist_entry *\n \t\t\t\t\t\t\t    error);\n \t\t\tif (ret < 0)\n \t\t\t\treturn ret;\n+\t\t\tif (rss && sample_rss &&\n+\t\t\t    (sample_rss->level != rss->level ||\n+\t\t\t    sample_rss->types != rss->types))\n+\t\t\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\t\tRTE_FLOW_ERROR_TYPE_ACTION,\n+\t\t\t\t\tNULL,\n+\t\t\t\t\t\"Can't use the different RSS types \"\n+\t\t\t\t\t\"or level in the same flow\");\n \t\t\tif (rss != NULL && rss->queue_num)\n \t\t\t\tqueue_index = rss->queue[0];\n \t\t\taction_flags |= MLX5_FLOW_ACTION_RSS;\n@@ -6027,6 +6070,7 @@ struct mlx5_hlist_entry *\n \t\t\tret = flow_dv_validate_action_sample(action_flags,\n \t\t\t\t\t\t\t     actions, dev,\n \t\t\t\t\t\t\t     attr, item_flags,\n+\t\t\t\t\t\t\t     rss, &sample_rss,\n \t\t\t\t\t\t\t     error);\n \t\t\tif (ret < 0)\n \t\t\t\treturn ret;\n@@ -9053,7 +9097,7 @@ struct mlx5_cache_entry *\n  * @param[in] dev\n  *   Pointer to rte_eth_dev structure.\n  * @param[in] action\n- *   Pointer to action structure.\n+ *   Pointer to sample action structure.\n  * @param[in, out] dev_flow\n  *   Pointer to the mlx5_flow.\n  * @param[in] attr\n@@ -9072,7 +9116,7 @@ struct mlx5_cache_entry *\n  */\n static int\n flow_dv_translate_action_sample(struct rte_eth_dev *dev,\n-\t\t\t\tconst struct rte_flow_action *action,\n+\t\t\t\tconst struct rte_flow_action_sample *action,\n \t\t\t\tstruct mlx5_flow *dev_flow,\n \t\t\t\tconst struct rte_flow_attr *attr,\n \t\t\t\tuint32_t *num_of_dest,\n@@ -9081,9 +9125,7 @@ struct mlx5_cache_entry *\n \t\t\t\tstruct rte_flow_error *error)\n {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n-\tconst struct rte_flow_action_sample *sample_action;\n \tconst struct rte_flow_action *sub_actions;\n-\tconst struct rte_flow_action_queue *queue;\n \tstruct mlx5_flow_sub_actions_list *sample_act;\n \tstruct mlx5_flow_sub_actions_idx *sample_idx;\n \tstruct mlx5_flow_workspace *wks = mlx5_flow_get_thread_workspace();\n@@ -9094,9 +9136,8 @@ struct mlx5_cache_entry *\n \trss_desc = &wks->rss_desc;\n \tsample_act = &res->sample_act;\n \tsample_idx = &res->sample_idx;\n-\tsample_action = (const struct rte_flow_action_sample *)action->conf;\n-\tres->ratio = sample_action->ratio;\n-\tsub_actions = sample_action->actions;\n+\tres->ratio = action->ratio;\n+\tsub_actions = action->actions;\n \tfor (; sub_actions->type != RTE_FLOW_ACTION_TYPE_END; sub_actions++) {\n \t\tint type = sub_actions->type;\n \t\tuint32_t pre_rix = 0;\n@@ -9104,6 +9145,7 @@ struct mlx5_cache_entry *\n \t\tswitch (type) {\n \t\tcase RTE_FLOW_ACTION_TYPE_QUEUE:\n \t\t{\n+\t\t\tconst struct rte_flow_action_queue *queue;\n \t\t\tstruct mlx5_hrxq *hrxq;\n \t\t\tuint32_t hrxq_idx;\n \n@@ -9130,6 +9172,45 @@ struct mlx5_cache_entry *\n \t\t\t\t\tMLX5_FLOW_FATE_QUEUE;\n \t\t\tbreak;\n \t\t}\n+\t\tcase RTE_FLOW_ACTION_TYPE_RSS:\n+\t\t{\n+\t\t\tstruct mlx5_hrxq *hrxq;\n+\t\t\tuint32_t hrxq_idx;\n+\t\t\tconst struct rte_flow_action_rss *rss;\n+\t\t\tconst uint8_t *rss_key;\n+\n+\t\t\trss = sub_actions->conf;\n+\t\t\tmemcpy(rss_desc->queue, rss->queue,\n+\t\t\t       rss->queue_num * sizeof(uint16_t));\n+\t\t\trss_desc->queue_num = rss->queue_num;\n+\t\t\t/* NULL RSS key indicates default RSS key. */\n+\t\t\trss_key = !rss->key ? rss_hash_default_key : rss->key;\n+\t\t\tmemcpy(rss_desc->key, rss_key, MLX5_RSS_HASH_KEY_LEN);\n+\t\t\t/*\n+\t\t\t * rss->level and rss.types should be set in advance\n+\t\t\t * when expanding items for RSS.\n+\t\t\t */\n+\t\t\tflow_dv_hashfields_set(dev_flow, rss_desc);\n+\t\t\thrxq = flow_dv_hrxq_prepare(dev, dev_flow,\n+\t\t\t\t\t\t    rss_desc, &hrxq_idx);\n+\t\t\tif (!hrxq)\n+\t\t\t\treturn rte_flow_error_set\n+\t\t\t\t\t(error, rte_errno,\n+\t\t\t\t\t RTE_FLOW_ERROR_TYPE_ACTION,\n+\t\t\t\t\t NULL,\n+\t\t\t\t\t \"cannot create fate queue\");\n+\t\t\tsample_act->dr_queue_action = hrxq->action;\n+\t\t\tsample_idx->rix_hrxq = hrxq_idx;\n+\t\t\tsample_actions[sample_act->actions_num++] =\n+\t\t\t\t\t\thrxq->action;\n+\t\t\t(*num_of_dest)++;\n+\t\t\taction_flags |= MLX5_FLOW_ACTION_RSS;\n+\t\t\tif (action_flags & MLX5_FLOW_ACTION_MARK)\n+\t\t\t\tdev_flow->handle->rix_hrxq = hrxq_idx;\n+\t\t\tdev_flow->handle->fate_action =\n+\t\t\t\t\tMLX5_FLOW_FATE_QUEUE;\n+\t\t\tbreak;\n+\t\t}\n \t\tcase RTE_FLOW_ACTION_TYPE_MARK:\n \t\t{\n \t\t\tuint32_t tag_be = mlx5_flow_mark_set\n@@ -9694,6 +9775,7 @@ struct mlx5_cache_entry *\n \tstruct mlx5_flow_dv_dest_array_resource mdest_res;\n \tstruct mlx5_flow_dv_sample_resource sample_res;\n \tvoid *sample_actions[MLX5_DV_MAX_NUMBER_OF_ACTIONS] = {0};\n+\tconst struct rte_flow_action_sample *sample = NULL;\n \tstruct mlx5_flow_sub_actions_list *sample_act;\n \tuint32_t sample_act_pos = UINT32_MAX;\n \tuint32_t num_of_dest = 0;\n@@ -10235,15 +10317,8 @@ struct mlx5_cache_entry *\n \t\t\tbreak;\n \t\tcase RTE_FLOW_ACTION_TYPE_SAMPLE:\n \t\t\tsample_act_pos = actions_n;\n-\t\t\tret = flow_dv_translate_action_sample(dev,\n-\t\t\t\t\t\t\t      actions,\n-\t\t\t\t\t\t\t      dev_flow, attr,\n-\t\t\t\t\t\t\t      &num_of_dest,\n-\t\t\t\t\t\t\t      sample_actions,\n-\t\t\t\t\t\t\t      &sample_res,\n-\t\t\t\t\t\t\t      error);\n-\t\t\tif (ret < 0)\n-\t\t\t\treturn ret;\n+\t\t\tsample = (const struct rte_flow_action_sample *)\n+\t\t\t\t action->conf;\n \t\t\tactions_n++;\n \t\t\taction_flags |= MLX5_FLOW_ACTION_SAMPLE;\n \t\t\t/* put encap action into group if work with port id */\n@@ -10279,30 +10354,6 @@ struct mlx5_cache_entry *\n \t\t\t\t\t  flow->counter, NULL))->action;\n \t\t\t\tactions_n++;\n \t\t\t}\n-\t\t\tif (action_flags & MLX5_FLOW_ACTION_SAMPLE) {\n-\t\t\t\tret = flow_dv_create_action_sample(dev,\n-\t\t\t\t\t\t\t  dev_flow,\n-\t\t\t\t\t\t\t  num_of_dest,\n-\t\t\t\t\t\t\t  &sample_res,\n-\t\t\t\t\t\t\t  &mdest_res,\n-\t\t\t\t\t\t\t  sample_actions,\n-\t\t\t\t\t\t\t  action_flags,\n-\t\t\t\t\t\t\t  error);\n-\t\t\t\tif (ret < 0)\n-\t\t\t\t\treturn rte_flow_error_set\n-\t\t\t\t\t\t(error, rte_errno,\n-\t\t\t\t\t\tRTE_FLOW_ERROR_TYPE_ACTION,\n-\t\t\t\t\t\tNULL,\n-\t\t\t\t\t\t\"cannot create sample action\");\n-\t\t\t\tif (num_of_dest > 1) {\n-\t\t\t\t\tdev_flow->dv.actions[sample_act_pos] =\n-\t\t\t\t\tdev_flow->dv.dest_array_res->action;\n-\t\t\t\t} else {\n-\t\t\t\t\tdev_flow->dv.actions[sample_act_pos] =\n-\t\t\t\t\tdev_flow->dv.sample_res->verbs_action;\n-\t\t\t\t}\n-\t\t\t}\n-\t\t\tbreak;\n \t\tdefault:\n \t\t\tbreak;\n \t\t}\n@@ -10310,33 +10361,6 @@ struct mlx5_cache_entry *\n \t\t    modify_action_position == UINT32_MAX)\n \t\t\tmodify_action_position = actions_n++;\n \t}\n-\t/*\n-\t * For multiple destination (sample action with ratio=1), the encap\n-\t * action and port id action will be combined into group action.\n-\t * So need remove the original these actions in the flow and only\n-\t * use the sample action instead of.\n-\t */\n-\tif (num_of_dest > 1 && sample_act->dr_port_id_action) {\n-\t\tint i;\n-\t\tvoid *temp_actions[MLX5_DV_MAX_NUMBER_OF_ACTIONS] = {0};\n-\n-\t\tfor (i = 0; i < actions_n; i++) {\n-\t\t\tif ((sample_act->dr_encap_action &&\n-\t\t\t\tsample_act->dr_encap_action ==\n-\t\t\t\tdev_flow->dv.actions[i]) ||\n-\t\t\t\t(sample_act->dr_port_id_action &&\n-\t\t\t\tsample_act->dr_port_id_action ==\n-\t\t\t\tdev_flow->dv.actions[i]))\n-\t\t\t\tcontinue;\n-\t\t\ttemp_actions[tmp_actions_n++] = dev_flow->dv.actions[i];\n-\t\t}\n-\t\tmemcpy((void *)dev_flow->dv.actions,\n-\t\t\t\t(void *)temp_actions,\n-\t\t\t\ttmp_actions_n * sizeof(void *));\n-\t\tactions_n = tmp_actions_n;\n-\t}\n-\tdev_flow->dv.actions_n = actions_n;\n-\tdev_flow->act_flags = action_flags;\n \tfor (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) {\n \t\tint tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);\n \t\tint item_type = items->type;\n@@ -10588,6 +10612,68 @@ struct mlx5_cache_entry *\n \thandle->layers |= item_flags;\n \tif (action_flags & MLX5_FLOW_ACTION_RSS)\n \t\tflow_dv_hashfields_set(dev_flow, rss_desc);\n+\t/* If has RSS action in the sample action, the Sample/Mirror resource\n+\t * should be registered after the hash filed be update.\n+\t */\n+\tif (action_flags & MLX5_FLOW_ACTION_SAMPLE) {\n+\t\tret = flow_dv_translate_action_sample(dev,\n+\t\t\t\t\t\t      sample,\n+\t\t\t\t\t\t      dev_flow, attr,\n+\t\t\t\t\t\t      &num_of_dest,\n+\t\t\t\t\t\t      sample_actions,\n+\t\t\t\t\t\t      &sample_res,\n+\t\t\t\t\t\t      error);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tret = flow_dv_create_action_sample(dev,\n+\t\t\t\t\t\t   dev_flow,\n+\t\t\t\t\t\t   num_of_dest,\n+\t\t\t\t\t\t   &sample_res,\n+\t\t\t\t\t\t   &mdest_res,\n+\t\t\t\t\t\t   sample_actions,\n+\t\t\t\t\t\t   action_flags,\n+\t\t\t\t\t\t   error);\n+\t\tif (ret < 0)\n+\t\t\treturn rte_flow_error_set\n+\t\t\t\t\t\t(error, rte_errno,\n+\t\t\t\t\t\tRTE_FLOW_ERROR_TYPE_ACTION,\n+\t\t\t\t\t\tNULL,\n+\t\t\t\t\t\t\"cannot create sample action\");\n+\t\tif (num_of_dest > 1) {\n+\t\t\tdev_flow->dv.actions[sample_act_pos] =\n+\t\t\tdev_flow->dv.dest_array_res->action;\n+\t\t} else {\n+\t\t\tdev_flow->dv.actions[sample_act_pos] =\n+\t\t\tdev_flow->dv.sample_res->verbs_action;\n+\t\t}\n+\t}\n+\t/*\n+\t * For multiple destination (sample action with ratio=1), the encap\n+\t * action and port id action will be combined into group action.\n+\t * So need remove the original these actions in the flow and only\n+\t * use the sample action instead of.\n+\t */\n+\tif (num_of_dest > 1 && sample_act->dr_port_id_action) {\n+\t\tint i;\n+\t\tvoid *temp_actions[MLX5_DV_MAX_NUMBER_OF_ACTIONS] = {0};\n+\n+\t\tfor (i = 0; i < actions_n; i++) {\n+\t\t\tif ((sample_act->dr_encap_action &&\n+\t\t\t\tsample_act->dr_encap_action ==\n+\t\t\t\tdev_flow->dv.actions[i]) ||\n+\t\t\t\t(sample_act->dr_port_id_action &&\n+\t\t\t\tsample_act->dr_port_id_action ==\n+\t\t\t\tdev_flow->dv.actions[i]))\n+\t\t\t\tcontinue;\n+\t\t\ttemp_actions[tmp_actions_n++] = dev_flow->dv.actions[i];\n+\t\t}\n+\t\tmemcpy((void *)dev_flow->dv.actions,\n+\t\t\t\t(void *)temp_actions,\n+\t\t\t\ttmp_actions_n * sizeof(void *));\n+\t\tactions_n = tmp_actions_n;\n+\t}\n+\tdev_flow->dv.actions_n = actions_n;\n+\tdev_flow->act_flags = action_flags;\n \t/* Register matcher. */\n \tmatcher.crc = rte_raw_cksum((const void *)matcher.mask.buf,\n \t\t\t\t    matcher.mask.size);\n",
    "prefixes": [
        "v3",
        "3/4"
    ]
}