Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/86835/?format=api
http://patchwork.dpdk.org/api/patches/86835/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20210118214026.12009-2-akozyrev@nvidia.com/", "project": { "id": 1, "url": "http://patchwork.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": "<20210118214026.12009-2-akozyrev@nvidia.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20210118214026.12009-2-akozyrev@nvidia.com", "date": "2021-01-18T21:40:25", "name": "[v9,1/2] ethdev: introduce generic modify rte flow action", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "d8e90d035dc94321f599481b72fae63b11165f0d", "submitter": { "id": 1873, "url": "http://patchwork.dpdk.org/api/people/1873/?format=api", "name": "Alexander Kozyrev", "email": "akozyrev@nvidia.com" }, "delegate": { "id": 319, "url": "http://patchwork.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20210118214026.12009-2-akozyrev@nvidia.com/mbox/", "series": [ { "id": 14821, "url": "http://patchwork.dpdk.org/api/series/14821/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=14821", "date": "2021-01-18T21:40:24", "name": "generic modify rte flow action support", "version": 9, "mbox": "http://patchwork.dpdk.org/series/14821/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/86835/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/86835/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 984DDA0A03;\n\tMon, 18 Jan 2021 22:40:36 +0100 (CET)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 365A6140EBF;\n\tMon, 18 Jan 2021 22:40:36 +0100 (CET)", "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by mails.dpdk.org (Postfix) with ESMTP id 94168140EBE\n for <dev@dpdk.org>; Mon, 18 Jan 2021 22:40:34 +0100 (CET)", "from Internal Mail-Server by MTLPINE1 (envelope-from\n akozyrev@nvidia.com) with SMTP; 18 Jan 2021 23:40:29 +0200", "from nvidia.com (pegasus02.mtr.labs.mlnx [10.210.16.122])\n by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 10ILeS5m008977;\n Mon, 18 Jan 2021 23:40:29 +0200" ], "From": "Alexander Kozyrev <akozyrev@nvidia.com>", "To": "dev@dpdk.org", "Cc": "viacheslavo@nvidia.com, orika@nvidia.com, thomas@monjalon.net,\n ferruh.yigit@intel.com, andrew.rybchenko@oktetlabs.ru,\n jerinjacobk@gmail.com, ajit.khaparde@broadcom.com", "Date": "Mon, 18 Jan 2021 21:40:25 +0000", "Message-Id": "<20210118214026.12009-2-akozyrev@nvidia.com>", "X-Mailer": "git-send-email 2.24.1", "In-Reply-To": "<20210118214026.12009-1-akozyrev@nvidia.com>", "References": "<20210118161825.31516-1-akozyrev@nvidia.com>\n <20210118214026.12009-1-akozyrev@nvidia.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH v9 1/2] ethdev: introduce generic modify rte flow\n action", "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": "Implement the generic modify flow API to allow manipulations on\nan arbitrary header field (as well as mark, metadata or tag) using\ndata from another field or a user-specified value.\nThis generic modify mechanism removes the necessity to implement\na separate RTE Flow action every time we need to modify a new packet\nfield in the future.\n\nSupported operation are:\n- set: copy data from source to destination.\n- add: integer addition, stores the result in destination.\n- sub: integer subtraction, stores the result in destination.\n\nThe field ID is used to specify the desired source/destination packet\nfield in order to simplify the API for various encapsulation models.\nSpecifying the packet field ID with the needed encapsulation level\nis able to quickly get a packet field for any inner packet header.\n\nAlternatively, the special ID (ITEM_START) can be used to point to\nthe very beginning of a packet. This ID in conjunction with the\noffset parameter provides great flexibility to copy/modify any part of\na packet as needed.\n\nThe number of bits to use from a source as well as the offset can be\nbe specified to allow a partial copy or dividing a big packet field\ninto multiple small fields (e.g. copying 128 bits of IPv6 to 4 tags).\n\nAn immediate value (or a pointer to it) can be specified instead of the\nlevel and the offset for the special FIELD_VALUE ID (or FIELD_POINTER).\nCan be used as a source only.\n\nSigned-off-by: Alexander Kozyrev <akozyrev@nvidia.com>\nAcked-by: Ori Kam <orika@nvidia.com>\nAcked-by: Thomas Monjalon <thomas@monjalon.net>\nAcked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>\n\n---\nv1: Initialy RTE_FLOW_ACTION_TYPE_COPY_ITEM\nv2: Renamed to RTE_FLOW_ACTION_TYPE_COPY_FIELD\nv3: Redesigned as RTE_FLOW_ACTION_TYPE_MODIFY_FIELD\nv4: Fixed typos in documentation, renamed mov operation to set\nv5: Added doxygen comments\nv6: Minor documentation edits.\n---\n doc/guides/prog_guide/rte_flow.rst | 66 ++++++++++++++++++\n doc/guides/rel_notes/release_21_02.rst | 8 +++\n lib/librte_ethdev/rte_flow.c | 2 +\n lib/librte_ethdev/rte_flow.h | 93 +++++++++++++++++++++++++-\n 4 files changed, 168 insertions(+), 1 deletion(-)", "diff": "diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst\nindex 86b3444803..0b8c243fe1 100644\n--- a/doc/guides/prog_guide/rte_flow.rst\n+++ b/doc/guides/prog_guide/rte_flow.rst\n@@ -2766,6 +2766,72 @@ The behaviour of the shared action defined by ``action`` argument of type\n | no properties |\n +---------------+\n \n+Action: ``MODIFY_FIELD``\n+^^^^^^^^^^^^^^^^^^^^^^^^\n+\n+Modify ``dst`` field according to ``op`` selected (set, addition,\n+subtraction) with ``width`` bits of data from ``src`` field.\n+\n+Any arbitrary header field (as well as mark, metadata or tag values)\n+can be used as both source and destination fields as set by ``field``.\n+The immediate value ``RTE_FLOW_FIELD_VALUE`` (or a pointer to it\n+``RTE_FLOW_FIELD_POINTER``) is allowed as a source only.\n+``RTE_FLOW_FIELD_START`` is used to point to the beginning of a packet.\n+\n+``op`` selects the operation to perform on a destination field.\n+- ``set`` copies the data from ``src`` field to ``dst`` field.\n+- ``add`` adds together ``dst`` and ``src`` and stores the result into ``dst``.\n+- ``sub`` subtracts ``src`` from ``dst`` and stores the result into ``dst``\n+\n+``width`` defines a number of bits to use from ``src`` field.\n+\n+``level`` is used to access any packet field on any encapsulation level\n+as well as any tag element in the tag array.\n+- ``0`` means the default behaviour. Depending on the packet type, it can\n+mean outermost, innermost or anything in between.\n+- ``1`` requests access to the outermost packet encapsulation level.\n+- ``2`` and subsequent values requests access to the specified packet\n+encapsulation level, from outermost to innermost (lower to higher values).\n+For the tag array (in case of multiple tags are supported and present)\n+``level`` translates directly into the array index.\n+\n+``offset`` specifies the number of bits to skip from a field's start.\n+That allows performing a partial copy of the needed part or to divide a big\n+packet field into multiple smaller fields. Alternatively, ``offset`` allows\n+going past the specified packet field boundary to copy a field to an\n+arbitrary place in a packet, essentially providing a way to copy any part of\n+a packet to any other part of it.\n+\n+``value`` sets an immediate value to be used as a source or points to a\n+location of the value in memory. It is used instead of ``level`` and ``offset``\n+for ``RTE_FLOW_FIELD_VALUE`` and ``RTE_FLOW_FIELD_POINTER`` respectively.\n+\n+.. _table_rte_flow_action_modify_field:\n+\n+.. table:: MODIFY_FIELD\n+\n+ +-----------------------------------------+\n+ | Field | Value |\n+ +===============+=========================+\n+ | ``op`` | operation to perform |\n+ | ``dst`` | destination field |\n+ | ``src`` | source field |\n+ | ``width`` | number of bits to use |\n+ +---------------+-------------------------+\n+\n+.. _table_rte_flow_action_modify_data:\n+\n+.. table:: destination/source field definition\n+\n+ +--------------------------------------------------------------------------+\n+ | Field | Value |\n+ +===============+==========================================================+\n+ | ``field`` | ID: packet field, mark, meta, tag, immediate, pointer |\n+ | ``level`` | encapsulation level of a packet field or tag array index |\n+ | ``offset`` | number of bits to skip at the beginning |\n+ | ``value`` | immediate value or a pointer to this value |\n+ +---------------+----------------------------------------------------------+\n+\n Negative types\n ~~~~~~~~~~~~~~\n \ndiff --git a/doc/guides/rel_notes/release_21_02.rst b/doc/guides/rel_notes/release_21_02.rst\nindex 3bb0b9a9ed..bb3cccd2e3 100644\n--- a/doc/guides/rel_notes/release_21_02.rst\n+++ b/doc/guides/rel_notes/release_21_02.rst\n@@ -55,6 +55,14 @@ New Features\n Also, make sure to start the actual text at the margin.\n =======================================================\n \n+* **Added support of modify field action in the flow API.**\n+\n+ Added modify action support to perform various operations on\n+ any arbitrary header field (as well as mark, metadata or tag values):\n+ ``RTE_FLOW_ACTION_TYPE_MODIFY_FIELD``.\n+ supported operations are: overwriting a field with the content from\n+ another field, addition and subtraction using an immediate value.\n+\n * **Updated Broadcom bnxt driver.**\n \n Updated the Broadcom bnxt driver with fixes and improvements, including:\ndiff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c\nindex a06f64c271..9dd051f3c2 100644\n--- a/lib/librte_ethdev/rte_flow.c\n+++ b/lib/librte_ethdev/rte_flow.c\n@@ -176,6 +176,8 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {\n \tMK_FLOW_ACTION(SET_IPV6_DSCP, sizeof(struct rte_flow_action_set_dscp)),\n \tMK_FLOW_ACTION(AGE, sizeof(struct rte_flow_action_age)),\n \tMK_FLOW_ACTION(SAMPLE, sizeof(struct rte_flow_action_sample)),\n+\tMK_FLOW_ACTION(MODIFY_FIELD,\n+\t\t sizeof(struct rte_flow_action_modify_field)),\n \t/**\n \t * Shared action represented as handle of type\n \t * (struct rte_flow_shared action *) stored in conf field (see\ndiff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h\nindex 0977a78270..d63fd79e1a 100644\n--- a/lib/librte_ethdev/rte_flow.h\n+++ b/lib/librte_ethdev/rte_flow.h\n@@ -2198,6 +2198,17 @@ enum rte_flow_action_type {\n \t * struct rte_flow_shared_action).\n \t */\n \tRTE_FLOW_ACTION_TYPE_SHARED,\n+\n+\t/**\n+\t * Modify a packet header field, tag, mark or metadata.\n+\t *\n+\t * Allow the modification of an arbitrary header field via\n+\t * set, add and sub operations or copying its content into\n+\t * tag, meta or mark for future processing.\n+\t *\n+\t * See struct rte_flow_action_modify_field.\n+\t */\n+\tRTE_FLOW_ACTION_TYPE_MODIFY_FIELD,\n };\n \n /**\n@@ -2777,7 +2788,6 @@ struct rte_flow_action_set_dscp {\n \tuint8_t dscp;\n };\n \n-\n /**\n * RTE_FLOW_ACTION_TYPE_SHARED\n *\n@@ -2791,6 +2801,87 @@ struct rte_flow_action_set_dscp {\n */\n struct rte_flow_shared_action;\n \n+/**\n+ * Field IDs for MODIFY_FIELD action.\n+ */\n+enum rte_flow_field_id {\n+\tRTE_FLOW_FIELD_START = 0, /**< Start of a packet. */\n+\tRTE_FLOW_FIELD_MAC_DST,\n+\tRTE_FLOW_FIELD_MAC_SRC,\n+\tRTE_FLOW_FIELD_VLAN_TYPE,\n+\tRTE_FLOW_FIELD_VLAN_ID,\n+\tRTE_FLOW_FIELD_MAC_TYPE,\n+\tRTE_FLOW_FIELD_IPV4_DSCP,\n+\tRTE_FLOW_FIELD_IPV4_TTL,\n+\tRTE_FLOW_FIELD_IPV4_SRC,\n+\tRTE_FLOW_FIELD_IPV4_DST,\n+\tRTE_FLOW_FIELD_IPV6_HOPLIMIT,\n+\tRTE_FLOW_FIELD_IPV6_SRC,\n+\tRTE_FLOW_FIELD_IPV6_DST,\n+\tRTE_FLOW_FIELD_TCP_PORT_SRC,\n+\tRTE_FLOW_FIELD_TCP_PORT_DST,\n+\tRTE_FLOW_FIELD_TCP_SEQ_NUM,\n+\tRTE_FLOW_FIELD_TCP_ACK_NUM,\n+\tRTE_FLOW_FIELD_TCP_FLAGS,\n+\tRTE_FLOW_FIELD_UDP_PORT_SRC,\n+\tRTE_FLOW_FIELD_UDP_PORT_DST,\n+\tRTE_FLOW_FIELD_VXLAN_VNI,\n+\tRTE_FLOW_FIELD_GENEVE_VNI,\n+\tRTE_FLOW_FIELD_GTP_TEID,\n+\tRTE_FLOW_FIELD_TAG,\n+\tRTE_FLOW_FIELD_MARK,\n+\tRTE_FLOW_FIELD_META,\n+\tRTE_FLOW_FIELD_POINTER, /**< Memory pointer. */\n+\tRTE_FLOW_FIELD_VALUE, /**< Immediate value. */\n+};\n+\n+/**\n+ * Field description for MODIFY_FIELD action.\n+ */\n+struct rte_flow_action_modify_data {\n+\tenum rte_flow_field_id field; /**< Field or memory type ID. */\n+\tRTE_STD_C11\n+\tunion {\n+\t\tstruct {\n+\t\t\t/**< Encapsulation level or tag index. */\n+\t\t\tuint32_t level;\n+\t\t\t/**< Number of bits to skip from a field. */\n+\t\t\tuint32_t offset;\n+\t\t};\n+\t\t/**\n+\t\t * Immediate value for RTE_FLOW_FIELD_VALUE or\n+\t\t * memory address for RTE_FLOW_FIELD_POINTER.\n+\t\t */\n+\t\tuint64_t value;\n+\t};\n+};\n+\n+/**\n+ * Operation types for MODIFY_FIELD action.\n+ */\n+enum rte_flow_modify_op {\n+\tRTE_FLOW_MODIFY_SET = 0, /**< Set a new value. */\n+\tRTE_FLOW_MODIFY_ADD, /**< Add a value to a field. */\n+\tRTE_FLOW_MODIFY_SUB, /**< Subtract a value from a field. */\n+};\n+\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this structure may change without prior notice\n+ *\n+ * RTE_FLOW_ACTION_TYPE_MODIFY_FIELD\n+ *\n+ * Modify a destination header field according to the specified\n+ * operation. Another packet field can be used as a source as well\n+ * as tag, mark, metadata, immediate value or a pointer to it.\n+ */\n+struct rte_flow_action_modify_field {\n+\tenum rte_flow_modify_op operation; /**< Operation to perform. */\n+\tstruct rte_flow_action_modify_data dst; /**< Destination field. */\n+\tstruct rte_flow_action_modify_data src; /**< Source field. */\n+\tuint32_t width; /**< Number of bits to use from a source field. */\n+};\n+\n /* Mbuf dynamic field offset for metadata. */\n extern int32_t rte_flow_dynf_metadata_offs;\n \n", "prefixes": [ "v9", "1/2" ] }{ "id": 86835, "url": "