Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/86716/?format=api
https://patches.dpdk.org/api/patches/86716/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210116045054.14539-2-akozyrev@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": "<20210116045054.14539-2-akozyrev@nvidia.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20210116045054.14539-2-akozyrev@nvidia.com", "date": "2021-01-16T04:50:53", "name": "[v7,1/2] ethdev: introduce generic modify rte flow action", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "09122783dfb2d21a4d14bcab39e6642bab6caa1f", "submitter": { "id": 1873, "url": "https://patches.dpdk.org/api/people/1873/?format=api", "name": "Alexander Kozyrev", "email": "akozyrev@nvidia.com" }, "delegate": { "id": 319, "url": "https://patches.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20210116045054.14539-2-akozyrev@nvidia.com/mbox/", "series": [ { "id": 14788, "url": "https://patches.dpdk.org/api/series/14788/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=14788", "date": "2021-01-16T04:50:53", "name": "generic modify rte flow action support", "version": 7, "mbox": "https://patches.dpdk.org/series/14788/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/86716/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/86716/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 3AAEDA0A02;\n\tSat, 16 Jan 2021 05:50:58 +0100 (CET)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 04B2D140DCD;\n\tSat, 16 Jan 2021 05:50: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 42DFD140DCC\n for <dev@dpdk.org>; Sat, 16 Jan 2021 05:50:57 +0100 (CET)", "from Internal Mail-Server by MTLPINE1 (envelope-from\n akozyrev@nvidia.com) with SMTP; 16 Jan 2021 06:50:55 +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 10G4otZI019927;\n Sat, 16 Jan 2021 06:50:55 +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", "Date": "Sat, 16 Jan 2021 04:50:53 +0000", "Message-Id": "<20210116045054.14539-2-akozyrev@nvidia.com>", "X-Mailer": "git-send-email 2.24.1", "In-Reply-To": "<20210116045054.14539-1-akozyrev@nvidia.com>", "References": "<20210116044407.13596-1-akozyrev@nvidia.com>\n <20210116045054.14539-1-akozyrev@nvidia.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH v7 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 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\nRFC: http://patches.dpdk.org/patch/85384/\n\nSigned-off-by: Alexander Kozyrev <akozyrev@nvidia.com>\nAcked-by: Ori Kam <orika@nvidia.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.\n---\n doc/guides/prog_guide/rte_flow.rst | 65 +++++++++++++++++++++\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 | 79 +++++++++++++++++++++++++-\n 4 files changed, 153 insertions(+), 1 deletion(-)", "diff": "diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst\nindex 86b3444803..d959ca4a8c 100644\n--- a/doc/guides/prog_guide/rte_flow.rst\n+++ b/doc/guides/prog_guide/rte_flow.rst\n@@ -2766,6 +2766,71 @@ 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 (move, 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 ``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 if supported by an underlying PMD driver.\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 c64294e7a6..5962c9f80b 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..07c4d859c2 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,73 @@ struct rte_flow_action_set_dscp {\n */\n struct rte_flow_shared_action;\n \n+enum rte_flow_field_id {\n+\tRTE_FLOW_FIELD_START = 0,\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,\n+\tRTE_FLOW_FIELD_VALUE,\n+};\n+\n+struct rte_flow_action_modify_data {\n+\tenum rte_flow_field_id field;\n+\tRTE_STD_C11\n+\tunion {\n+\t\tstruct {\n+\t\t\tuint32_t level;\n+\t\t\tuint32_t offset;\n+\t\t};\n+\t\tuint64_t value;\n+\t};\n+};\n+\n+enum rte_flow_modify_op {\n+\tRTE_FLOW_MODIFY_SET = 0,\n+\tRTE_FLOW_MODIFY_ADD,\n+\tRTE_FLOW_MODIFY_SUB,\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+ * Modifies 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 or an immediate value or a pointer to it.\n+ * Width is the number of bits used from the source item.\n+ */\n+struct rte_flow_action_modify_field {\n+\tenum rte_flow_modify_op operation;\n+\tstruct rte_flow_action_modify_data dst;\n+\tstruct rte_flow_action_modify_data src;\n+\tuint32_t width;\n+};\n+\n /* Mbuf dynamic field offset for metadata. */\n extern int32_t rte_flow_dynf_metadata_offs;\n \n", "prefixes": [ "v7", "1/2" ] }{ "id": 86716, "url": "