Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/62727/?format=api
http://patches.dpdk.org/api/patches/62727/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1573184965-49691-19-git-send-email-suanmingm@mellanox.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": "<1573184965-49691-19-git-send-email-suanmingm@mellanox.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1573184965-49691-19-git-send-email-suanmingm@mellanox.com", "date": "2019-11-08T03:49:24", "name": "[v2,18/19] net/mlx5: share tag between meter and metadata", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "bc646a4cf05d6250dd45acca269627700e1cdde0", "submitter": { "id": 1358, "url": "http://patches.dpdk.org/api/people/1358/?format=api", "name": "Suanming Mou", "email": "suanmingm@mellanox.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/1573184965-49691-19-git-send-email-suanmingm@mellanox.com/mbox/", "series": [ { "id": 7343, "url": "http://patches.dpdk.org/api/series/7343/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=7343", "date": "2019-11-08T03:49:07", "name": "net/mlx5: support meter", "version": 2, "mbox": "http://patches.dpdk.org/series/7343/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/62727/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/62727/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 80C3DA04AB;\n\tFri, 8 Nov 2019 04:51:46 +0100 (CET)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 6E86A1C025;\n\tFri, 8 Nov 2019 04:50:03 +0100 (CET)", "from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130])\n by dpdk.org (Postfix) with ESMTP id 7CE821BF63\n for <dev@dpdk.org>; Fri, 8 Nov 2019 04:49:33 +0100 (CET)" ], "From": "Suanming Mou <suanmingm@mellanox.com>", "To": "viacheslavo@mellanox.com,\n\tmatan@mellanox.com", "Cc": "orika@mellanox.com,\n\trasland@mellanox.com,\n\tdev@dpdk.org", "Date": "Fri, 8 Nov 2019 05:49:24 +0200", "Message-Id": "<1573184965-49691-19-git-send-email-suanmingm@mellanox.com>", "X-Mailer": "git-send-email 1.8.3.1", "In-Reply-To": "<1573184965-49691-1-git-send-email-suanmingm@mellanox.com>", "References": "<1573053090-179521-1-git-send-email-suanmingm@mellanox.com>\n <1573184965-49691-1-git-send-email-suanmingm@mellanox.com>", "Subject": "[dpdk-dev] [PATCH v2 18/19] net/mlx5: share tag between meter and\n\tmetadata", "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": "In the meter flow split, metadata flow will be as the sub flow of meter\nsuffix flow. In meter suffix flow, there is already a unique id tag\nexist as for the meter prefix and suffix flow match.\n\nMake metadata feature and meter both share the unique id tag for match.\n\nSigned-off-by: Suanming Mou <suanmingm@mellanox.com>\n---\n drivers/net/mlx5/mlx5_flow.c | 150 +++++++++++++++++++++++--------------------\n drivers/net/mlx5/mlx5_flow.h | 6 +-\n 2 files changed, 85 insertions(+), 71 deletions(-)", "diff": "diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c\nindex da3e47a..092f7b4 100644\n--- a/drivers/net/mlx5/mlx5_flow.c\n+++ b/drivers/net/mlx5/mlx5_flow.c\n@@ -2328,27 +2328,6 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,\n \t\t\tflow_qrss_free_id(dev, dev_flow->qrss_id);\n }\n \n-/**\n- * Release meter prefix suffix flow match id.\n- *\n- * @param dev\n- * Pointer to Ethernet device.\n- * @param flow\n- * Flow to release id's from.\n- */\n-static void\n-flow_meter_split_id_release(struct rte_eth_dev *dev,\n-\t\t\t struct rte_flow *flow)\n-{\n-\tstruct mlx5_flow *dev_flow;\n-\tstruct mlx5_priv *priv = dev->data->dev_private;\n-\n-\tLIST_FOREACH(dev_flow, &flow->dev_flows, next)\n-\t\tif (dev_flow->qrss_id)\n-\t\t\tmlx5_flow_id_release(priv->sh->flow_id_pool,\n-\t\t\t\t\t dev_flow->mtr_flow_id);\n-}\n-\n static int\n flow_null_validate(struct rte_eth_dev *dev __rte_unused,\n \t\t const struct rte_flow_attr *attr __rte_unused,\n@@ -2639,7 +2618,6 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,\n \tenum mlx5_flow_drv_type type = flow->drv_type;\n \n \tflow_mreg_split_qrss_release(dev, flow);\n-\tflow_meter_split_id_release(dev, flow);\n \tassert(type > MLX5_FLOW_TYPE_MIN && type < MLX5_FLOW_TYPE_MAX);\n \tfops = flow_get_drv_ops(type);\n \tfops->destroy(dev, flow);\n@@ -3473,7 +3451,6 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,\n \t\t struct rte_flow_action actions_sfx[],\n \t\t struct rte_flow_action actions_pre[])\n {\n-\tstruct mlx5_priv *priv = dev->data->dev_private;\n \tstruct rte_flow_action *tag_action;\n \tstruct mlx5_rte_flow_action_set_tag *set_tag;\n \tstruct rte_flow_error error;\n@@ -3538,7 +3515,10 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,\n \t/* Set the tag. */\n \tset_tag = (void *)actions_pre;\n \tset_tag->id = mlx5_flow_get_reg_id(dev, MLX5_MTR_SFX, 0, &error);\n-\tmlx5_flow_id_get(priv->sh->flow_id_pool, &tag_id);\n+\t/*\n+\t * Get the id from the qrss_pool to make qrss share the id with meter.\n+\t */\n+\ttag_id = flow_qrss_get_id(dev);\n \tset_tag->data = rte_cpu_to_be_32(tag_id);\n \ttag_action->conf = set_tag;\n \treturn tag_id;\n@@ -3595,7 +3575,7 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,\n \tstruct mlx5_rte_flow_action_set_tag *set_tag;\n \tstruct rte_flow_action_jump *jump;\n \tconst int qrss_idx = qrss - actions;\n-\tuint32_t flow_id;\n+\tuint32_t flow_id = 0;\n \tint ret = 0;\n \n \t/*\n@@ -3605,43 +3585,50 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,\n \t * As a result, there will be one more action.\n \t */\n \t++actions_n;\n+\tmemcpy(split_actions, actions, sizeof(*split_actions) * actions_n);\n+\tset_tag = (void *)(split_actions + actions_n);\n \t/*\n-\t * Allocate the new subflow ID. This one is unique within\n-\t * device and not shared with representors. Otherwise,\n-\t * we would have to resolve multi-thread access synch\n-\t * issue. Each flow on the shared device is appended\n-\t * with source vport identifier, so the resulting\n-\t * flows will be unique in the shared (by master and\n-\t * representors) domain even if they have coinciding\n-\t * IDs.\n+\t * If tag action is not set to void(it means we are not the meter\n+\t * suffix flow), add the tag action. Since meter suffix flow already\n+\t * has the tag added.\n \t */\n-\tflow_id = flow_qrss_get_id(dev);\n-\tif (!flow_id)\n-\t\treturn rte_flow_error_set(error, ENOMEM,\n-\t\t\t\t\t RTE_FLOW_ERROR_TYPE_ACTION,\n-\t\t\t\t\t NULL, \"can't allocate id \"\n-\t\t\t\t\t \"for split Q/RSS subflow\");\n-\t/* Internal SET_TAG action to set flow ID. */\n-\tset_tag = (void *)(split_actions + actions_n);\n-\t*set_tag = (struct mlx5_rte_flow_action_set_tag){\n-\t\t.data = flow_id,\n-\t};\n-\tret = mlx5_flow_get_reg_id(dev, MLX5_COPY_MARK, 0, error);\n-\tif (ret < 0)\n-\t\treturn ret;\n-\tset_tag->id = ret;\n+\tif (split_actions[qrss_idx].type != RTE_FLOW_ACTION_TYPE_VOID) {\n+\t\t/*\n+\t\t * Allocate the new subflow ID. This one is unique within\n+\t\t * device and not shared with representors. Otherwise,\n+\t\t * we would have to resolve multi-thread access synch\n+\t\t * issue. Each flow on the shared device is appended\n+\t\t * with source vport identifier, so the resulting\n+\t\t * flows will be unique in the shared (by master and\n+\t\t * representors) domain even if they have coinciding\n+\t\t * IDs.\n+\t\t */\n+\t\tflow_id = flow_qrss_get_id(dev);\n+\t\tif (!flow_id)\n+\t\t\treturn rte_flow_error_set(error, ENOMEM,\n+\t\t\t\t\t\t RTE_FLOW_ERROR_TYPE_ACTION,\n+\t\t\t\t\t\t NULL, \"can't allocate id \"\n+\t\t\t\t\t\t \"for split Q/RSS subflow\");\n+\t\t/* Internal SET_TAG action to set flow ID. */\n+\t\t*set_tag = (struct mlx5_rte_flow_action_set_tag){\n+\t\t\t.data = flow_id,\n+\t\t};\n+\t\tret = mlx5_flow_get_reg_id(dev, MLX5_COPY_MARK, 0, error);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tset_tag->id = ret;\n+\t\t/* Construct new actions array. */\n+\t\t/* Replace QUEUE/RSS action. */\n+\t\tsplit_actions[qrss_idx] = (struct rte_flow_action){\n+\t\t\t.type = MLX5_RTE_FLOW_ACTION_TYPE_TAG,\n+\t\t\t.conf = set_tag,\n+\t\t};\n+\t}\n \t/* JUMP action to jump to mreg copy table (CP_TBL). */\n \tjump = (void *)(set_tag + 1);\n \t*jump = (struct rte_flow_action_jump){\n \t\t.group = MLX5_FLOW_MREG_CP_TABLE_GROUP,\n \t};\n-\t/* Construct new actions array. */\n-\tmemcpy(split_actions, actions, sizeof(*split_actions) * actions_n);\n-\t/* Replace QUEUE/RSS action. */\n-\tsplit_actions[qrss_idx] = (struct rte_flow_action){\n-\t\t.type = MLX5_RTE_FLOW_ACTION_TYPE_TAG,\n-\t\t.conf = set_tag,\n-\t};\n \tsplit_actions[actions_n - 2] = (struct rte_flow_action){\n \t\t.type = RTE_FLOW_ACTION_TYPE_JUMP,\n \t\t.conf = jump,\n@@ -3742,6 +3729,7 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,\n \tstruct rte_flow_action *ext_actions = NULL;\n \tstruct mlx5_flow *dev_flow = NULL;\n \tuint32_t qrss_id = 0;\n+\tint mtr_sfx = 0;\n \tsize_t act_size;\n \tint actions_n;\n \tint ret;\n@@ -3772,6 +3760,10 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,\n \t\t}\n \t}\n \tif (qrss) {\n+\t\t/* Check if it is in meter suffix table. */\n+\t\tmtr_sfx = attr->group == (attr->transfer ?\n+\t\t\t (MLX5_FLOW_TABLE_LEVEL_SUFFIX - 1) :\n+\t\t\t MLX5_FLOW_TABLE_LEVEL_SUFFIX);\n \t\t/*\n \t\t * Q/RSS action on NIC Rx should be split in order to pass by\n \t\t * the mreg copy table (RX_CP_TBL) and then it jumps to the\n@@ -3787,6 +3779,16 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,\n \t\t\t\t\t\t NULL, \"no memory to split \"\n \t\t\t\t\t\t \"metadata flow\");\n \t\t/*\n+\t\t * If we are the suffix flow of meter, tag already exist.\n+\t\t * Set the tag action to void.\n+\t\t */\n+\t\tif (mtr_sfx)\n+\t\t\text_actions[qrss - actions].type =\n+\t\t\t\t\t\tRTE_FLOW_ACTION_TYPE_VOID;\n+\t\telse\n+\t\t\text_actions[qrss - actions].type =\n+\t\t\t\t\t\tMLX5_RTE_FLOW_ACTION_TYPE_TAG;\n+\t\t/*\n \t\t * Create the new actions list with removed Q/RSS action\n \t\t * and appended set tag and jump to register copy table\n \t\t * (RX_CP_TBL). We should preallocate unique tag ID here\n@@ -3794,7 +3796,7 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,\n \t\t */\n \t\tqrss_id = flow_mreg_split_qrss_prep(dev, ext_actions, actions,\n \t\t\t\t\t\t qrss, actions_n, error);\n-\t\tif (!qrss_id) {\n+\t\tif (!mtr_sfx && !qrss_id) {\n \t\t\tret = -rte_errno;\n \t\t\tgoto exit;\n \t\t}\n@@ -3824,7 +3826,7 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,\n \tif (ret < 0)\n \t\tgoto exit;\n \tassert(dev_flow);\n-\tif (qrss_id) {\n+\tif (qrss) {\n \t\tconst struct rte_flow_attr q_attr = {\n \t\t\t.group = MLX5_FLOW_MREG_ACT_TABLE_GROUP,\n \t\t\t.ingress = 1,\n@@ -3855,22 +3857,32 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,\n \t\t\t},\n \t\t};\n \t\tuint64_t hash_fields = dev_flow->hash_fields;\n+\t\tdev_flow = NULL;\n \t\t/*\n-\t\t * Put unique id in prefix flow due to it is destroyed after\n-\t\t * prefix flow and id will be freed after there is no actual\n-\t\t * flows with this id and identifier reallocation becomes\n-\t\t * possible (for example, for other flows in other threads).\n+\t\t * Configure the tag action only if we are not the meter sub\n+\t\t * flow. Since tag is already marked in the meter suffix sub\n+\t\t * flow.\n \t\t */\n-\t\tdev_flow->qrss_id = qrss_id;\n-\t\tqrss_id = 0;\n-\t\tdev_flow = NULL;\n-\t\tret = mlx5_flow_get_reg_id(dev, MLX5_COPY_MARK, 0, error);\n-\t\tif (ret < 0)\n-\t\t\tgoto exit;\n-\t\tq_tag_spec.id = ret;\n+\t\tif (qrss_id) {\n+\t\t\t/*\n+\t\t\t * Put unique id in prefix flow due to it is destroyed\n+\t\t\t * after prefix flow and id will be freed after there\n+\t\t\t * is no actual flows with this id and identifier\n+\t\t\t * reallocation becomes possible (for example, for\n+\t\t\t * other flows in other threads).\n+\t\t\t */\n+\t\t\tdev_flow->qrss_id = qrss_id;\n+\t\t\tqrss_id = 0;\n+\t\t\tret = mlx5_flow_get_reg_id(dev, MLX5_COPY_MARK, 0,\n+\t\t\t\t\t\t error);\n+\t\t\tif (ret < 0)\n+\t\t\t\tgoto exit;\n+\t\t\tq_tag_spec.id = ret;\n+\t\t}\n \t\t/* Add suffix subflow to execute Q/RSS. */\n \t\tret = flow_create_split_inner(dev, flow, &dev_flow,\n-\t\t\t\t\t &q_attr, q_items, q_actions,\n+\t\t\t\t\t &q_attr, mtr_sfx ? items :\n+\t\t\t\t\t q_items, q_actions,\n \t\t\t\t\t external, error);\n \t\tif (ret < 0)\n \t\t\tgoto exit;\ndiff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h\nindex 42b4c76..bbce63d 100644\n--- a/drivers/net/mlx5/mlx5_flow.h\n+++ b/drivers/net/mlx5/mlx5_flow.h\n@@ -520,8 +520,10 @@ struct mlx5_flow {\n #endif\n \t\tstruct mlx5_flow_verbs verbs;\n \t};\n-\tuint32_t qrss_id; /**< Uniqie Q/RSS suffix subflow tag. */\n-\tuint32_t mtr_flow_id; /**< Unique meter match flow id. */\n+\tunion {\n+\t\tuint32_t qrss_id; /**< Uniqie Q/RSS suffix subflow tag. */\n+\t\tuint32_t mtr_flow_id; /**< Unique meter match flow id. */\n+\t};\n \tbool external; /**< true if the flow is created external to PMD. */\n };\n \n", "prefixes": [ "v2", "18/19" ] }{ "id": 62727, "url": "