get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 87348,
    "url": "https://patches.dpdk.org/api/patches/87348/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1611675476-149119-1-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": "<1611675476-149119-1-git-send-email-jiaweiw@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1611675476-149119-1-git-send-email-jiaweiw@nvidia.com",
    "date": "2021-01-26T15:37:56",
    "name": "net/mlx5: fix count actions query in sample flow",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "c3913a364c9719991bf0bc5230a2805f57479f87",
    "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/1611675476-149119-1-git-send-email-jiaweiw@nvidia.com/mbox/",
    "series": [
        {
            "id": 14957,
            "url": "https://patches.dpdk.org/api/series/14957/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=14957",
            "date": "2021-01-26T15:37:56",
            "name": "net/mlx5: fix count actions query in sample flow",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/14957/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/87348/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/87348/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 8A3E7A052A;\n\tTue, 26 Jan 2021 16:37:59 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id EB04D140D34;\n\tTue, 26 Jan 2021 16:37:58 +0100 (CET)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by mails.dpdk.org (Postfix) with ESMTP id 703C1140CD6\n for <dev@dpdk.org>; Tue, 26 Jan 2021 16:37:57 +0100 (CET)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n jiaweiw@nvidia.com) with SMTP; 26 Jan 2021 17:37:56 +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 10QFbus2020173;\n Tue, 26 Jan 2021 17:37:56 +0200"
        ],
        "From": "Jiawei Wang <jiaweiw@nvidia.com>",
        "To": "viacheslavo@nvidia.com, orika@nvidia.com, thomas@monjalon.net,\n ferruh.yigit@intel.com",
        "Cc": "dev@dpdk.org, stable@dpdk.org",
        "Date": "Tue, 26 Jan 2021 17:37:56 +0200",
        "Message-Id": "<1611675476-149119-1-git-send-email-jiaweiw@nvidia.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "Subject": "[dpdk-dev] [PATCH] net/mlx5: fix count actions query in sample flow",
        "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": "If the count action was presented in sample actions list, MLX5 PMD\ncreated the counter resource and saved the index of counter in the\nsample resource only, the counter index of flow was not updated.\n\nThis patch removes the counter index in the sampler resource and\nsaves it into the flow, and adds the checking to make sure only one\ncount be created once per flow, it's used for all sample sub flows.\n\nFixes: 0756228b2704 (\"net/mlx5: update translate function for sample action\")\nCc: stable@dpdk.org\n\nSigned-off-by: Jiawei Wang <jiaweiw@nvidia.com>\nAcked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>\n---\n drivers/net/mlx5/mlx5_flow.h    |  1 -\n drivers/net/mlx5/mlx5_flow_dv.c | 62 +++++++++++++++++++++++++----------------\n 2 files changed, 38 insertions(+), 25 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h\nindex 2178a04..389e2c2 100644\n--- a/drivers/net/mlx5/mlx5_flow.h\n+++ b/drivers/net/mlx5/mlx5_flow.h\n@@ -578,7 +578,6 @@ struct mlx5_flow_sub_actions_list {\n struct mlx5_flow_sub_actions_idx {\n \tuint32_t rix_hrxq; /**< Hash Rx queue object index. */\n \tuint32_t rix_tag; /**< Index to the tag action. */\n-\tuint32_t cnt;\n \tuint32_t rix_port_id_action; /**< Index to port ID action resource. */\n \tuint32_t rix_encap_decap; /**< Index to encap/decap resource. */\n \tuint32_t rix_jump; /**< Index to the jump action resource. */\ndiff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c\nindex 1a0c0be..7c04fdb 100644\n--- a/drivers/net/mlx5/mlx5_flow_dv.c\n+++ b/drivers/net/mlx5/mlx5_flow_dv.c\n@@ -2612,6 +2612,8 @@ struct field_modify_info modify_tcp[] = {\n  *\n  * @param[in] dev\n  *   Pointer to rte_eth_dev structure.\n+ * @param[in] action_flags\n+ *   Holds the actions detected until now.\n  * @param[out] error\n  *   Pointer to error structure.\n  *\n@@ -2620,10 +2622,15 @@ struct field_modify_info modify_tcp[] = {\n  */\n static int\n flow_dv_validate_action_count(struct rte_eth_dev *dev,\n+\t\t\t      uint64_t action_flags,\n \t\t\t      struct rte_flow_error *error)\n {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n \n+\tif (action_flags & MLX5_FLOW_ACTION_COUNT)\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  \"duplicate count actions set\");\n \tif (!priv->config.devx)\n \t\tgoto notsup_err;\n #ifdef HAVE_IBV_FLOW_DEVX_COUNTERS\n@@ -4395,7 +4402,7 @@ struct mlx5_hlist_entry *\n /**\n  * Validate the sample action.\n  *\n- * @param[in] action_flags\n+ * @param[in, out] action_flags\n  *   Holds the actions detected until now.\n  * @param[in] action\n  *   Pointer to the sample action.\n@@ -4416,7 +4423,7 @@ struct mlx5_hlist_entry *\n  *   0 on success, a negative errno value otherwise and rte_errno is set.\n  */\n static int\n-flow_dv_validate_action_sample(uint64_t action_flags,\n+flow_dv_validate_action_sample(uint64_t *action_flags,\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@@ -4447,17 +4454,17 @@ struct mlx5_hlist_entry *\n \t\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n \t\t\t\t\t  NULL,\n \t\t\t\t\t  \"sample action not supported\");\n-\tif (action_flags & MLX5_FLOW_ACTION_SAMPLE)\n+\tif (*action_flags & MLX5_FLOW_ACTION_SAMPLE)\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  \"Multiple sample actions not \"\n \t\t\t\t\t  \"supported\");\n-\tif (action_flags & MLX5_FLOW_ACTION_METER)\n+\tif (*action_flags & MLX5_FLOW_ACTION_METER)\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  \"wrong action order, meter should \"\n \t\t\t\t\t  \"be after sample action\");\n-\tif (action_flags & MLX5_FLOW_ACTION_JUMP)\n+\tif (*action_flags & MLX5_FLOW_ACTION_JUMP)\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  \"wrong action order, jump should \"\n@@ -4517,10 +4524,18 @@ struct mlx5_hlist_entry *\n \t\t\t++actions_n;\n \t\t\tbreak;\n \t\tcase RTE_FLOW_ACTION_TYPE_COUNT:\n-\t\t\tret = flow_dv_validate_action_count(dev, error);\n+\t\t\tif (*action_flags & MLX5_FLOW_ACTION_COUNT)\n+\t\t\t\treturn rte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t\tRTE_FLOW_ERROR_TYPE_ACTION,\n+\t\t\t\t\t\taction,\n+\t\t\t\t\t\t\"duplicate count action set\");\n+\t\t\tret = flow_dv_validate_action_count(dev,\n+\t\t\t\t\t\t\t    sub_action_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\tsub_action_flags |= MLX5_FLOW_ACTION_COUNT;\n+\t\t\t*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@@ -5848,7 +5863,8 @@ struct mlx5_hlist_entry *\n \t\t\t++actions_n;\n \t\t\tbreak;\n \t\tcase RTE_FLOW_ACTION_TYPE_COUNT:\n-\t\t\tret = flow_dv_validate_action_count(dev, error);\n+\t\t\tret = flow_dv_validate_action_count(dev, action_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\taction_flags |= MLX5_FLOW_ACTION_COUNT;\n@@ -6148,7 +6164,7 @@ struct mlx5_hlist_entry *\n \t\t\trw_act_num += MLX5_ACT_NUM_SET_DSCP;\n \t\t\tbreak;\n \t\tcase RTE_FLOW_ACTION_TYPE_SAMPLE:\n-\t\t\tret = flow_dv_validate_action_sample(action_flags,\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@@ -9064,10 +9080,6 @@ struct mlx5_hlist_entry *\n \t\tflow_dv_tag_release(dev, act_res->rix_tag);\n \t\tact_res->rix_tag = 0;\n \t}\n-\tif (act_res->cnt) {\n-\t\tflow_dv_counter_free(dev, act_res->cnt);\n-\t\tact_res->cnt = 0;\n-\t}\n \tif (act_res->rix_jump) {\n \t\tflow_dv_jump_tbl_resource_release(dev, act_res->rix_jump);\n \t\tact_res->rix_jump = 0;\n@@ -9468,6 +9480,7 @@ struct mlx5_cache_entry *\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+\tstruct rte_flow *flow = dev_flow->flow;\n \tstruct mlx5_flow_rss_desc *rss_desc;\n \tuint64_t action_flags = 0;\n \n@@ -9578,21 +9591,22 @@ struct mlx5_cache_entry *\n \t\t}\n \t\tcase RTE_FLOW_ACTION_TYPE_COUNT:\n \t\t{\n-\t\t\tuint32_t counter;\n-\n-\t\t\tcounter = flow_dv_translate_create_counter(dev,\n-\t\t\t\t\tdev_flow, sub_actions->conf, 0);\n-\t\t\tif (!counter)\n-\t\t\t\treturn rte_flow_error_set\n+\t\t\tif (!flow->counter) {\n+\t\t\t\tflow->counter =\n+\t\t\t\t\tflow_dv_translate_create_counter(dev,\n+\t\t\t\t\t\tdev_flow, sub_actions->conf,\n+\t\t\t\t\t\t0);\n+\t\t\t\tif (!flow->counter)\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\t RTE_FLOW_ERROR_TYPE_ACTION,\n-\t\t\t\t\t\t NULL,\n-\t\t\t\t\t\t \"cannot create counter\"\n-\t\t\t\t\t\t \" object.\");\n-\t\t\tsample_idx->cnt = counter;\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 counter\"\n+\t\t\t\t\t\t\" object.\");\n+\t\t\t}\n \t\t\tsample_act->dr_cnt_action =\n \t\t\t\t  (flow_dv_counter_get_by_idx(dev,\n-\t\t\t\t  counter, NULL))->action;\n+\t\t\t\t  flow->counter, NULL))->action;\n \t\t\tsample_actions[sample_act->actions_num++] =\n \t\t\t\t\t\tsample_act->dr_cnt_action;\n \t\t\taction_flags |= MLX5_FLOW_ACTION_COUNT;\n",
    "prefixes": []
}