Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/64260/?format=api
http://patches.dpdk.org/api/patches/64260/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1578381843-110954-3-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": "<1578381843-110954-3-git-send-email-suanmingm@mellanox.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1578381843-110954-3-git-send-email-suanmingm@mellanox.com", "date": "2020-01-07T07:24:02", "name": "[v2,2/2] net/mlx5: add IPv4/IPv6 DSCP rewrite action", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "1ca2cda8dbc72a99141ea7a9122c6c33233c9329", "submitter": { "id": 1358, "url": "http://patches.dpdk.org/api/people/1358/?format=api", "name": "Suanming Mou", "email": "suanmingm@mellanox.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/1578381843-110954-3-git-send-email-suanmingm@mellanox.com/mbox/", "series": [ { "id": 7999, "url": "http://patches.dpdk.org/api/series/7999/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=7999", "date": "2020-01-07T07:24:00", "name": "add IPv4/IPv6 DSCP rewrite action", "version": 2, "mbox": "http://patches.dpdk.org/series/7999/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/64260/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/64260/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 40F8FA04F6;\n\tTue, 7 Jan 2020 08:24:26 +0100 (CET)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 020811D6D3;\n\tTue, 7 Jan 2020 08:24:14 +0100 (CET)", "from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130])\n by dpdk.org (Postfix) with ESMTP id E9F391D94B\n for <dev@dpdk.org>; Tue, 7 Jan 2020 08:24:09 +0100 (CET)" ], "From": "Suanming Mou <suanmingm@mellanox.com>", "To": "Matan Azrad <matan@mellanox.com>, Shahaf Shuler <shahafs@mellanox.com>,\n Viacheslav Ovsiienko <viacheslavo@mellanox.com>", "Cc": "dev@dpdk.org,\n\trasland@mellanox.com", "Date": "Tue, 7 Jan 2020 09:24:02 +0200", "Message-Id": "<1578381843-110954-3-git-send-email-suanmingm@mellanox.com>", "X-Mailer": "git-send-email 1.8.3.1", "In-Reply-To": "<1578381843-110954-1-git-send-email-suanmingm@mellanox.com>", "References": "<1577945052-39548-1-git-send-email-suanmingm@mellanox.com>\n <1578381843-110954-1-git-send-email-suanmingm@mellanox.com>", "Subject": "[dpdk-dev] [PATCH v2 2/2] net/mlx5: add IPv4/IPv6 DSCP rewrite\n\taction", "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": "This commit add the IPv4/IPv6 DSCP rewrite actions to the PMD code.\n\nSupported actions:\nRTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP\nRTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP\n\nSigned-off-by: Suanming Mou <suanmingm@mellanox.com>\n---\n drivers/net/mlx5/mlx5_flow.h | 6 +-\n drivers/net/mlx5/mlx5_flow_dv.c | 184 ++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 189 insertions(+), 1 deletion(-)", "diff": "diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h\nindex 27d82ac..e42c98a 100644\n--- a/drivers/net/mlx5/mlx5_flow.h\n+++ b/drivers/net/mlx5/mlx5_flow.h\n@@ -196,6 +196,8 @@ enum mlx5_feature_name {\n #define MLX5_FLOW_ACTION_MARK_EXT (1ull << 33)\n #define MLX5_FLOW_ACTION_SET_META (1ull << 34)\n #define MLX5_FLOW_ACTION_METER (1ull << 35)\n+#define MLX5_FLOW_ACTION_SET_IPV4_DSCP (1ull << 36)\n+#define MLX5_FLOW_ACTION_SET_IPV6_DSCP (1ull << 37)\n \n #define MLX5_FLOW_FATE_ACTIONS \\\n \t(MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | \\\n@@ -232,7 +234,9 @@ enum mlx5_feature_name {\n \t\t\t\t MLX5_FLOW_ACTION_OF_SET_VLAN_VID | \\\n \t\t\t\t MLX5_FLOW_ACTION_SET_TAG | \\\n \t\t\t\t MLX5_FLOW_ACTION_MARK_EXT | \\\n-\t\t\t\t MLX5_FLOW_ACTION_SET_META)\n+\t\t\t\t MLX5_FLOW_ACTION_SET_META | \\\n+\t\t\t\t MLX5_FLOW_ACTION_SET_IPV4_DSCP | \\\n+\t\t\t\t MLX5_FLOW_ACTION_SET_IPV6_DSCP)\n \n #define MLX5_FLOW_VLAN_ACTIONS (MLX5_FLOW_ACTION_OF_POP_VLAN | \\\n \t\t\t\tMLX5_FLOW_ACTION_OF_PUSH_VLAN)\ndiff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c\nindex 4c16281..685fceb 100644\n--- a/drivers/net/mlx5/mlx5_flow_dv.c\n+++ b/drivers/net/mlx5/mlx5_flow_dv.c\n@@ -157,6 +157,7 @@ struct field_modify_info modify_vlan_out_first_vid[] = {\n };\n \n struct field_modify_info modify_ipv4[] = {\n+\t{1, 1, MLX5_MODI_OUT_IP_DSCP},\n \t{1, 8, MLX5_MODI_OUT_IPV4_TTL},\n \t{4, 12, MLX5_MODI_OUT_SIPV4},\n \t{4, 16, MLX5_MODI_OUT_DIPV4},\n@@ -164,6 +165,7 @@ struct field_modify_info modify_ipv4[] = {\n };\n \n struct field_modify_info modify_ipv6[] = {\n+\t{1, 0, MLX5_MODI_OUT_IP_DSCP},\n \t{1, 7, MLX5_MODI_OUT_IPV6_HOPLIMIT},\n \t{4, 8, MLX5_MODI_OUT_SIPV6_127_96},\n \t{4, 12, MLX5_MODI_OUT_SIPV6_95_64},\n@@ -1191,6 +1193,82 @@ struct field_modify_info modify_tcp[] = {\n }\n \n /**\n+ * Convert modify-header set IPv4 DSCP action to DV specification.\n+ *\n+ * @param[in,out] resource\n+ * Pointer to the modify-header resource.\n+ * @param[in] action\n+ * Pointer to action specification.\n+ * @param[out] error\n+ * Pointer to the error structure.\n+ *\n+ * @return\n+ * 0 on success, a negative errno value otherwise and rte_errno is set.\n+ */\n+static int\n+flow_dv_convert_action_modify_ipv4_dscp\n+\t\t\t(struct mlx5_flow_dv_modify_hdr_resource *resource,\n+\t\t\t const struct rte_flow_action *action,\n+\t\t\t struct rte_flow_error *error)\n+{\n+\tconst struct rte_flow_action_set_dscp *conf =\n+\t\t(const struct rte_flow_action_set_dscp *)(action->conf);\n+\tstruct rte_flow_item item = { .type = RTE_FLOW_ITEM_TYPE_IPV4 };\n+\tstruct rte_flow_item_ipv4 ipv4;\n+\tstruct rte_flow_item_ipv4 ipv4_mask;\n+\n+\tmemset(&ipv4, 0, sizeof(ipv4));\n+\tmemset(&ipv4_mask, 0, sizeof(ipv4_mask));\n+\tipv4.hdr.type_of_service = conf->dscp;\n+\tipv4_mask.hdr.type_of_service = RTE_IPV4_HDR_DSCP_MASK >> 2;\n+\titem.spec = &ipv4;\n+\titem.mask = &ipv4_mask;\n+\treturn flow_dv_convert_modify_action(&item, modify_ipv4, NULL, resource,\n+\t\t\t\t\t MLX5_MODIFICATION_TYPE_SET, error);\n+}\n+\n+/**\n+ * Convert modify-header set IPv6 DSCP action to DV specification.\n+ *\n+ * @param[in,out] resource\n+ * Pointer to the modify-header resource.\n+ * @param[in] action\n+ * Pointer to action specification.\n+ * @param[out] error\n+ * Pointer to the error structure.\n+ *\n+ * @return\n+ * 0 on success, a negative errno value otherwise and rte_errno is set.\n+ */\n+static int\n+flow_dv_convert_action_modify_ipv6_dscp\n+\t\t\t(struct mlx5_flow_dv_modify_hdr_resource *resource,\n+\t\t\t const struct rte_flow_action *action,\n+\t\t\t struct rte_flow_error *error)\n+{\n+\tconst struct rte_flow_action_set_dscp *conf =\n+\t\t(const struct rte_flow_action_set_dscp *)(action->conf);\n+\tstruct rte_flow_item item = { .type = RTE_FLOW_ITEM_TYPE_IPV6 };\n+\tstruct rte_flow_item_ipv6 ipv6;\n+\tstruct rte_flow_item_ipv6 ipv6_mask;\n+\n+\tmemset(&ipv6, 0, sizeof(ipv6));\n+\tmemset(&ipv6_mask, 0, sizeof(ipv6_mask));\n+\t/*\n+\t * Even though the DSCP bits offset of IPv6 is not byte aligned,\n+\t * rdma-core only accept the DSCP bits byte aligned start from\n+\t * bit 0 to 5 as to be compatible with IPv4. No need to shift the\n+\t * bits in IPv6 case as rdma-core requires byte aligned value.\n+\t */\n+\tipv6.hdr.vtc_flow = conf->dscp;\n+\tipv6_mask.hdr.vtc_flow = RTE_IPV6_HDR_DSCP_MASK >> 22;\n+\titem.spec = &ipv6;\n+\titem.mask = &ipv6_mask;\n+\treturn flow_dv_convert_modify_action(&item, modify_ipv6, NULL, resource,\n+\t\t\t\t\t MLX5_MODIFICATION_TYPE_SET, error);\n+}\n+\n+/**\n * Validate MARK item.\n *\n * @param[in] dev\n@@ -3433,6 +3511,74 @@ struct field_modify_info modify_tcp[] = {\n }\n \n /**\n+ * Validate the modify-header IPv4 DSCP actions.\n+ *\n+ * @param[in] action_flags\n+ * Holds the actions detected until now.\n+ * @param[in] action\n+ * Pointer to the modify action.\n+ * @param[in] item_flags\n+ * Holds the items detected.\n+ * @param[out] error\n+ * Pointer to error structure.\n+ *\n+ * @return\n+ * 0 on success, a negative errno value otherwise and rte_errno is set.\n+ */\n+static int\n+flow_dv_validate_action_modify_ipv4_dscp(const uint64_t action_flags,\n+\t\t\t\t\t const struct rte_flow_action *action,\n+\t\t\t\t\t const uint64_t item_flags,\n+\t\t\t\t\t struct rte_flow_error *error)\n+{\n+\tint ret = 0;\n+\n+\tret = flow_dv_validate_action_modify_hdr(action_flags, action, error);\n+\tif (!ret) {\n+\t\tif (!(item_flags & MLX5_FLOW_LAYER_L3_IPV4))\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 \"no ipv4 item in pattern\");\n+\t}\n+\treturn ret;\n+}\n+\n+/**\n+ * Validate the modify-header IPv6 DSCP actions.\n+ *\n+ * @param[in] action_flags\n+ * Holds the actions detected until now.\n+ * @param[in] action\n+ * Pointer to the modify action.\n+ * @param[in] item_flags\n+ * Holds the items detected.\n+ * @param[out] error\n+ * Pointer to error structure.\n+ *\n+ * @return\n+ * 0 on success, a negative errno value otherwise and rte_errno is set.\n+ */\n+static int\n+flow_dv_validate_action_modify_ipv6_dscp(const uint64_t action_flags,\n+\t\t\t\t\t const struct rte_flow_action *action,\n+\t\t\t\t\t const uint64_t item_flags,\n+\t\t\t\t\t struct rte_flow_error *error)\n+{\n+\tint ret = 0;\n+\n+\tret = flow_dv_validate_action_modify_hdr(action_flags, action, error);\n+\tif (!ret) {\n+\t\tif (!(item_flags & MLX5_FLOW_LAYER_L3_IPV6))\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 \"no ipv6 item in pattern\");\n+\t}\n+\treturn ret;\n+}\n+\n+/**\n * Find existing modify-header resource or create and register a new one.\n *\n * @param dev[in, out]\n@@ -4806,6 +4952,32 @@ struct field_modify_info modify_tcp[] = {\n \t\t\taction_flags |= MLX5_FLOW_ACTION_METER;\n \t\t\t++actions_n;\n \t\t\tbreak;\n+\t\tcase RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP:\n+\t\t\tret = flow_dv_validate_action_modify_ipv4_dscp\n+\t\t\t\t\t\t\t (action_flags,\n+\t\t\t\t\t\t\t actions,\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\t/* Count all modify-header actions as one action. */\n+\t\t\tif (!(action_flags & MLX5_FLOW_MODIFY_HDR_ACTIONS))\n+\t\t\t\t++actions_n;\n+\t\t\taction_flags |= MLX5_FLOW_ACTION_SET_IPV4_DSCP;\n+\t\t\tbreak;\n+\t\tcase RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP:\n+\t\t\tret = flow_dv_validate_action_modify_ipv6_dscp\n+\t\t\t\t\t\t\t\t(action_flags,\n+\t\t\t\t\t\t\t\t actions,\n+\t\t\t\t\t\t\t\t item_flags,\n+\t\t\t\t\t\t\t\t error);\n+\t\t\tif (ret < 0)\n+\t\t\t\treturn ret;\n+\t\t\t/* Count all modify-header actions as one action. */\n+\t\t\tif (!(action_flags & MLX5_FLOW_MODIFY_HDR_ACTIONS))\n+\t\t\t\t++actions_n;\n+\t\t\taction_flags |= MLX5_FLOW_ACTION_SET_IPV6_DSCP;\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@@ -7101,6 +7273,18 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t\tflow->meter->mfts->meter_action;\n \t\t\taction_flags |= MLX5_FLOW_ACTION_METER;\n \t\t\tbreak;\n+\t\tcase RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP:\n+\t\t\tif (flow_dv_convert_action_modify_ipv4_dscp(&mhdr_res,\n+\t\t\t\t\t\t\t actions, error))\n+\t\t\t\treturn -rte_errno;\n+\t\t\taction_flags |= MLX5_FLOW_ACTION_SET_IPV4_DSCP;\n+\t\t\tbreak;\n+\t\tcase RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP:\n+\t\t\tif (flow_dv_convert_action_modify_ipv6_dscp(&mhdr_res,\n+\t\t\t\t\t\t\t actions, error))\n+\t\t\t\treturn -rte_errno;\n+\t\t\taction_flags |= MLX5_FLOW_ACTION_SET_IPV6_DSCP;\n+\t\t\tbreak;\n \t\tcase RTE_FLOW_ACTION_TYPE_END:\n \t\t\tactions_end = true;\n \t\t\tif (mhdr_res.actions_num) {\n", "prefixes": [ "v2", "2/2" ] }{ "id": 64260, "url": "