Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/52764/?format=api
http://patches.dpdk.org/api/patches/52764/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1555276357-4892-5-git-send-email-orika@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": "<1555276357-4892-5-git-send-email-orika@mellanox.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1555276357-4892-5-git-send-email-orika@mellanox.com", "date": "2019-04-14T21:12:32", "name": "[4/9] net/mlx5: add validation for Direct Rule E-Switch", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "4e2cde76ecae73b022ddb5ce341c1b207c9613eb", "submitter": { "id": 795, "url": "http://patches.dpdk.org/api/people/795/?format=api", "name": "Ori Kam", "email": "orika@mellanox.com" }, "delegate": { "id": 6624, "url": "http://patches.dpdk.org/api/users/6624/?format=api", "username": "shahafs", "first_name": "Shahaf", "last_name": "Shuler", "email": "shahafs@mellanox.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1555276357-4892-5-git-send-email-orika@mellanox.com/mbox/", "series": [ { "id": 4308, "url": "http://patches.dpdk.org/api/series/4308/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4308", "date": "2019-04-14T21:12:28", "name": "net/mlx5: add Direct Verbs E-Switch support", "version": 1, "mbox": "http://patches.dpdk.org/series/4308/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/52764/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/52764/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id B77795F0D;\n\tSun, 14 Apr 2019 23:13:19 +0200 (CEST)", "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n\tby dpdk.org (Postfix) with ESMTP id C87C45B34\n\tfor <dev@dpdk.org>; Sun, 14 Apr 2019 23:13:08 +0200 (CEST)", "from Internal Mail-Server by MTLPINE1 (envelope-from\n\torika@mellanox.com)\n\twith ESMTPS (AES256-SHA encrypted); 15 Apr 2019 00:13:02 +0300", "from pegasus03.mtr.labs.mlnx (pegasus03.mtr.labs.mlnx\n\t[10.210.16.124])\n\tby labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x3ELD10o027116;\n\tMon, 15 Apr 2019 00:13:02 +0300" ], "From": "Ori Kam <orika@mellanox.com>", "To": "yskoh@mellanox.com, shahafs@mellanox.com, matan@mellanox.com,\n\tviacheslavo@mellanox.com, motih@mellanox.com", "Cc": "dev@dpdk.org, orika@mellanox.com", "Date": "Sun, 14 Apr 2019 21:12:32 +0000", "Message-Id": "<1555276357-4892-5-git-send-email-orika@mellanox.com>", "X-Mailer": "git-send-email 1.8.3.1", "In-Reply-To": "<1555276357-4892-1-git-send-email-orika@mellanox.com>", "References": "<1555276357-4892-1-git-send-email-orika@mellanox.com>", "Subject": "[dpdk-dev] [PATCH 4/9] net/mlx5: add validation for Direct Rule\n\tE-Switch", "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Add validation logic for E-Switch using Direct Rules.\n\nSigned-off-by: Ori Kam <orika@mellanox.com>\n---\n drivers/net/mlx5/mlx5.h | 2 +\n drivers/net/mlx5/mlx5_ethdev.c | 39 +++++++\n drivers/net/mlx5/mlx5_flow.h | 5 +\n drivers/net/mlx5/mlx5_flow_dv.c | 252 ++++++++++++++++++++++++++++++++++++++--\n 4 files changed, 287 insertions(+), 11 deletions(-)", "diff": "diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h\nindex 33a4127..8d63575 100644\n--- a/drivers/net/mlx5/mlx5.h\n+++ b/drivers/net/mlx5/mlx5.h\n@@ -412,6 +412,8 @@ int mlx5_ibv_device_to_pci_addr(const struct ibv_device *device,\n unsigned int mlx5_dev_to_port_id(const struct rte_device *dev,\n \t\t\t\t uint16_t *port_list,\n \t\t\t\t unsigned int port_list_n);\n+int mlx5_port_to_eswitch_info(uint16_t port, uint16_t *es_domain_id,\n+\t\t\t uint16_t *es_port_id);\n int mlx5_sysfs_switch_info(unsigned int ifindex,\n \t\t\t struct mlx5_switch_info *info);\n bool mlx5_translate_port_name(const char *port_name_in,\ndiff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c\nindex 3992918..c821772 100644\n--- a/drivers/net/mlx5/mlx5_ethdev.c\n+++ b/drivers/net/mlx5/mlx5_ethdev.c\n@@ -1376,6 +1376,45 @@ int mlx5_fw_version_get(struct rte_eth_dev *dev, char *fw_ver, size_t fw_size)\n }\n \n /**\n+ * Get the e-switch domain id this port belongs to.\n+ *\n+ * @param[in] port\n+ * Device port id.\n+ * @param[out] es_domain_id\n+ * e-switch domain id.\n+ * @param[out] es_port_id\n+ * The port id of the port in the switch.\n+ *\n+ * @return\n+ * 0 on success, Negative error otherwise.\n+ */\n+int\n+mlx5_port_to_eswitch_info(uint16_t port,\n+\t\t\t uint16_t *es_domain_id, uint16_t *es_port_id)\n+{\n+\tstruct rte_eth_dev *dev;\n+\tstruct mlx5_priv *priv;\n+\n+\tif (port >= RTE_MAX_ETHPORTS)\n+\t\treturn -EINVAL;\n+\tdev = &rte_eth_devices[port];\n+\tif (dev == NULL)\n+\t\treturn -ENODEV;\n+\tif (!dev->device ||\n+\t !dev->device->driver ||\n+\t strcmp(dev->device->driver->name, MLX5_DRIVER_NAME))\n+\t\treturn -EINVAL;\n+\tpriv = dev->data->dev_private;\n+\tif (!(priv->representor || priv->master))\n+\t\treturn -EINVAL;\n+\tif (es_domain_id)\n+\t\t*es_domain_id = priv->domain_id;\n+\tif (es_port_id)\n+\t\t*es_port_id = priv->vport_id;\n+\treturn 0;\n+}\n+\n+/**\n * Get switch information associated with network interface.\n *\n * @param ifindex\ndiff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h\nindex 9f47fd4..85954c2 100644\n--- a/drivers/net/mlx5/mlx5_flow.h\n+++ b/drivers/net/mlx5/mlx5_flow.h\n@@ -48,6 +48,7 @@\n \n /* General pattern items bits. */\n #define MLX5_FLOW_ITEM_METADATA (1u << 16)\n+#define MLX5_FLOW_ITEM_PORT_ID (1u << 17)\n \n /* Outer Masks. */\n #define MLX5_FLOW_LAYER_OUTER_L3 \\\n@@ -118,6 +119,10 @@\n \t(MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | \\\n \t MLX5_FLOW_ACTION_RSS | MLX5_FLOW_ACTION_JUMP)\n \n+#define MLX5_FLOW_FATE_ESWITCH_ACTIONS \\\n+\t(MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_PORT_ID | \\\n+\t MLX5_FLOW_ACTION_JUMP)\n+\n #define MLX5_FLOW_ENCAP_ACTIONS\t(MLX5_FLOW_ACTION_VXLAN_ENCAP | \\\n \t\t\t\t MLX5_FLOW_ACTION_NVGRE_ENCAP | \\\n \t\t\t\t MLX5_FLOW_ACTION_RAW_ENCAP)\ndiff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c\nindex 7b582f0..fedc6cb 100644\n--- a/drivers/net/mlx5/mlx5_flow_dv.c\n+++ b/drivers/net/mlx5/mlx5_flow_dv.c\n@@ -613,6 +613,92 @@ struct field_modify_info modify_tcp[] = {\n }\n \n /**\n+ * Validate vport item.\n+ *\n+ * @param[in] dev\n+ * Pointer to the rte_eth_dev structure.\n+ * @param[in] item\n+ * Item specification.\n+ * @param[in] attr\n+ * Attributes of flow that includes this item.\n+ * @param[in] item_flags\n+ * Bit-fields that holds the items detected until now.\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_item_port_id(struct rte_eth_dev *dev,\n+\t\t\t const struct rte_flow_item *item,\n+\t\t\t const struct rte_flow_attr *attr,\n+\t\t\t uint64_t item_flags,\n+\t\t\t struct rte_flow_error *error)\n+{\n+\tconst struct rte_flow_item_port_id *spec = item->spec;\n+\tconst struct rte_flow_item_port_id *mask = item->mask;\n+\tconst struct rte_flow_item_port_id switch_mask = {\n+\t\t\t.id = 0xffffffff,\n+\t};\n+\tuint16_t esw_domain_id;\n+\tuint16_t item_port_esw_domain_id;\n+\tuint16_t item_port_esw_port_id;\n+\tuint16_t port;\n+\tint ret;\n+\n+\tif (!attr->transfer)\n+\t\treturn rte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t RTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\t\t\t NULL,\n+\t\t\t\t\t \"match on port id is valid for\"\n+\t\t\t\t\t \" eswitch only\");\n+\tif (item_flags & MLX5_FLOW_ITEM_PORT_ID)\n+\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\t\t RTE_FLOW_ERROR_TYPE_ITEM, item,\n+\t\t\t\t\t \"multiple source vport are not\"\n+\t\t\t\t\t \" supported\");\n+\tif (!mask)\n+\t\tmask = &switch_mask;\n+\tif (mask->id && mask->id != 0xffffffff)\n+\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\t\t RTE_FLOW_ERROR_TYPE_ITEM_MASK,\n+\t\t\t\t\t mask,\n+\t\t\t\t\t \"no support for partial mask on\"\n+\t\t\t\t\t \" \\\"id\\\" field\");\n+\tret = mlx5_flow_item_acceptable\n+\t\t\t\t(item, (const uint8_t *)mask,\n+\t\t\t\t (const uint8_t *)&rte_flow_item_port_id_mask,\n+\t\t\t\t sizeof(struct rte_flow_item_port_id),\n+\t\t\t\t error);\n+\tif (ret)\n+\t\treturn ret;\n+\tif (!spec)\n+\t\treturn 0;\n+\tport = mask->id ? spec->id : 0;\n+\tret = mlx5_port_to_eswitch_info(port, &item_port_esw_domain_id,\n+\t\t\t\t\t&item_port_esw_port_id);\n+\tif (ret)\n+\t\treturn rte_flow_error_set(error, -ret,\n+\t\t\t\t\t RTE_FLOW_ERROR_TYPE_ITEM_SPEC, spec,\n+\t\t\t\t\t \"failed to obtain eswitch info for\"\n+\t\t\t\t\t \" port\");\n+\tret = mlx5_port_to_eswitch_info(dev->data->port_id,\n+\t\t\t\t\t&esw_domain_id, NULL);\n+\tif (ret < 0)\n+\t\treturn rte_flow_error_set(error, -ret,\n+\t\t\t\t\t RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\t\t\t NULL,\n+\t\t\t\t\t \"failed to obtain eswitch info\");\n+\tif (item_port_esw_domain_id != esw_domain_id)\n+\t\treturn rte_flow_error_set(error, -ret,\n+\t\t\t\t\t RTE_FLOW_ERROR_TYPE_ITEM_SPEC, spec,\n+\t\t\t\t\t \"cannot match on a port from a\"\n+\t\t\t\t\t \" different eswitch\");\n+\treturn 0;\n+}\n+\n+/**\n * Validate count action.\n *\n * @param[in] dev\n@@ -622,6 +708,7 @@ struct field_modify_info modify_tcp[] = {\n *\n * @return\n * 0 on success, a negative errno value otherwise and rte_errno is set.\n+ * w\n */\n static int\n flow_dv_validate_action_count(struct rte_eth_dev *dev,\n@@ -676,7 +763,7 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t\t\t RTE_FLOW_ERROR_TYPE_ACTION, NULL,\n \t\t\t\t\t \"can only have a single encap or\"\n \t\t\t\t\t \" decap action in a flow\");\n-\tif (attr->ingress)\n+\tif (!attr->transfer && attr->ingress)\n \t\treturn rte_flow_error_set(error, ENOTSUP,\n \t\t\t\t\t RTE_FLOW_ERROR_TYPE_ATTR_INGRESS,\n \t\t\t\t\t NULL,\n@@ -761,7 +848,8 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t\t\t \"can only have a single encap\"\n \t\t\t\t\t \" action in a flow\");\n \t/* encap without preceding decap is not supported for ingress */\n-\tif (attr->ingress && !(action_flags & MLX5_FLOW_ACTION_RAW_DECAP))\n+\tif (!attr->transfer && attr->ingress &&\n+\t !(action_flags & MLX5_FLOW_ACTION_RAW_DECAP))\n \t\treturn rte_flow_error_set(error, ENOTSUP,\n \t\t\t\t\t RTE_FLOW_ERROR_TYPE_ATTR_INGRESS,\n \t\t\t\t\t NULL,\n@@ -1561,6 +1649,77 @@ struct field_modify_info modify_tcp[] = {\n \treturn 0;\n }\n \n+/*\n+ * Validate the port_id action.\n+ *\n+ * @param[in] dev\n+ * Pointer to rte_eth_dev structure.\n+ * @param[in] action_flags\n+ * Bit-fields that holds the actions detected until now.\n+ * @param[in] action\n+ * Port_id RTE action structure.\n+ * @param[in] attr\n+ * Attributes of flow that includes this action.\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_port_id(struct rte_eth_dev *dev,\n+\t\t\t\tuint64_t action_flags,\n+\t\t\t\tconst struct rte_flow_action *action,\n+\t\t\t\tconst struct rte_flow_attr *attr,\n+\t\t\t\tstruct rte_flow_error *error)\n+{\n+\tconst struct rte_flow_action_port_id *port_id;\n+\tuint16_t port;\n+\tuint16_t esw_domain_id;\n+\tuint16_t act_port_domain_id;\n+\tint ret;\n+\n+\tif (!attr->transfer)\n+\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\t\t RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\t\t\t NULL,\n+\t\t\t\t\t \"port id action is valid in transfer\"\n+\t\t\t\t\t \" mode only\");\n+\tif (!action || !action->conf)\n+\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\t\t RTE_FLOW_ERROR_TYPE_ACTION_CONF,\n+\t\t\t\t\t NULL,\n+\t\t\t\t\t \"port id action parameters must be\"\n+\t\t\t\t\t \" specified\");\n+\tif (action_flags & (MLX5_FLOW_FATE_ACTIONS |\n+\t\t\t MLX5_FLOW_FATE_ESWITCH_ACTIONS))\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 \"can have only one fate actions in\"\n+\t\t\t\t\t \" a flow\");\n+\tret = mlx5_port_to_eswitch_info(dev->data->port_id,\n+\t\t\t\t\t&esw_domain_id, NULL);\n+\tif (ret < 0)\n+\t\treturn rte_flow_error_set(error, -ret,\n+\t\t\t\t\t RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\t\t\t NULL,\n+\t\t\t\t\t \"failed to obtain eswitch info\");\n+\tport_id = action->conf;\n+\tport = port_id->original ? dev->data->port_id : port_id->id;\n+\tret = mlx5_port_to_eswitch_info(port, &act_port_domain_id, NULL);\n+\tif (ret)\n+\t\treturn rte_flow_error_set\n+\t\t\t\t(error, -ret,\n+\t\t\t\t RTE_FLOW_ERROR_TYPE_ACTION_CONF, port_id,\n+\t\t\t\t \"failed to obtain eswitch port-id for port\");\n+\tif (act_port_domain_id != esw_domain_id)\n+\t\treturn rte_flow_error_set\n+\t\t\t\t(error, -ret,\n+\t\t\t\t RTE_FLOW_ERROR_TYPE_ACTION, NULL,\n+\t\t\t\t \"port does not belong to\"\n+\t\t\t\t \" eswitch being configured\");\n+\treturn 0;\n+}\n \n /**\n * Find existing modify-header resource or create and register a new one.\n@@ -1759,11 +1918,34 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t\t\t RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY,\n \t\t\t\t\t NULL,\n \t\t\t\t\t \"priority out of range\");\n-\tif (attributes->transfer)\n-\t\treturn rte_flow_error_set(error, ENOTSUP,\n-\t\t\t\t\t RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER,\n-\t\t\t\t\t NULL,\n-\t\t\t\t\t \"transfer is not supported\");\n+\tif (attributes->transfer) {\n+\t\tif (!priv->config.dv_eswitch_en)\n+\t\t\treturn rte_flow_error_set\n+\t\t\t\t\t\t(error, ENOTSUP,\n+\t\t\t\t\t\tRTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\t\t\t\tNULL,\n+\t\t\t\t\t\t\"eswitch dr is not supported\");\n+\t\tif (!(priv->representor || priv->master))\n+\t\t\treturn rte_flow_error_set\n+\t\t\t\t\t(error, EINVAL,\n+\t\t\t\t\t RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\t\t\t NULL,\n+\t\t\t\t\t \"eswitch configurationd can only be\"\n+\t\t\t\t\t \" done by a master or a representor\"\n+\t\t\t\t\t \" device\");\n+\t\tif (attributes->egress)\n+\t\t\treturn rte_flow_error_set\n+\t\t\t\t\t(error, ENOTSUP,\n+\t\t\t\t\t RTE_FLOW_ERROR_TYPE_ATTR_EGRESS,\n+\t\t\t\t\t attributes, \"egress is not supported\");\n+\t\tif (attributes->group >= MLX5_MAX_TABLES_FDB)\n+\t\t\treturn rte_flow_error_set\n+\t\t\t\t (error, EINVAL,\n+\t\t\t\t\tRTE_FLOW_ERROR_TYPE_ATTR_TRANSFER,\n+\t\t\t\t\tNULL,\n+\t\t\t\t\t\"group must be smaller than \"\n+\t\t\t\t\tRTE_STR(MLX5_MAX_FDB_TABLES));\n+\t}\n \tif (!(attributes->egress ^ attributes->ingress))\n \t\treturn rte_flow_error_set(error, ENOTSUP,\n \t\t\t\t\t RTE_FLOW_ERROR_TYPE_ATTR, NULL,\n@@ -1812,6 +1994,13 @@ struct field_modify_info modify_tcp[] = {\n \t\tswitch (items->type) {\n \t\tcase RTE_FLOW_ITEM_TYPE_VOID:\n \t\t\tbreak;\n+\t\tcase RTE_FLOW_ITEM_TYPE_PORT_ID:\n+\t\t\tret = flow_dv_validate_item_port_id\n+\t\t\t\t\t(dev, items, attr, item_flags, error);\n+\t\t\tif (ret < 0)\n+\t\t\t\treturn ret;\n+\t\t\titem_flags |= MLX5_FLOW_ITEM_PORT_ID;\n+\t\t\tbreak;\n \t\tcase RTE_FLOW_ITEM_TYPE_ETH:\n \t\t\tret = mlx5_flow_validate_item_eth(items, item_flags,\n \t\t\t\t\t\t\t error);\n@@ -1943,6 +2132,17 @@ struct field_modify_info modify_tcp[] = {\n \t\tswitch (actions->type) {\n \t\tcase RTE_FLOW_ACTION_TYPE_VOID:\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 action_flags,\n+\t\t\t\t\t\t\t actions,\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\taction_flags |= MLX5_FLOW_ACTION_PORT_ID;\n+\t\t\t++actions_n;\n+\t\t\tbreak;\n \t\tcase RTE_FLOW_ACTION_TYPE_FLAG:\n \t\t\tret = mlx5_flow_validate_action_flag(action_flags,\n \t\t\t\t\t\t\t attr, error);\n@@ -2133,10 +2333,40 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t\t\t\t \"action not supported\");\n \t\t}\n \t}\n-\tif (!(action_flags & MLX5_FLOW_FATE_ACTIONS) && attr->ingress)\n-\t\treturn rte_flow_error_set(error, EINVAL,\n-\t\t\t\t\t RTE_FLOW_ERROR_TYPE_ACTION, actions,\n-\t\t\t\t\t \"no fate action is found\");\n+\t/* Eswitch has few restrictions on using items and actions */\n+\tif (attr->transfer) {\n+\t\tif (action_flags & MLX5_FLOW_ACTION_FLAG)\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 FLAG\");\n+\t\tif (action_flags & MLX5_FLOW_ACTION_MARK)\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 MARK\");\n+\t\tif (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 (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 RSS\");\n+\t\tif (!(action_flags & MLX5_FLOW_FATE_ESWITCH_ACTIONS))\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 actions,\n+\t\t\t\t\t\t \"no fate action is found\");\n+\t} else {\n+\t\tif (!(action_flags & MLX5_FLOW_FATE_ACTIONS) && attr->ingress)\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 actions,\n+\t\t\t\t\t\t \"no fate action is found\");\n+\t}\n \treturn 0;\n }\n \n", "prefixes": [ "4/9" ] }{ "id": 52764, "url": "