From patchwork Sun Oct 10 14:39:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 100938 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id DF430A0C43; Sun, 10 Oct 2021 16:40:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A6C2E40F35; Sun, 10 Oct 2021 16:40:01 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 74C2240042 for ; Sun, 10 Oct 2021 16:39:59 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 13A837F6BF; Sun, 10 Oct 2021 17:39:59 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 13A837F6BF DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1633876799; bh=ysdVuRovoqd0Vztk/w/MtKBkiFOJeoONhVGpme5E/eE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lGjnANxfhSyHe6wPRgGlNcowcyQGbCREMjSwe7OOaW8N+UihpfyUzH7m9y0Fj/sLh ulk+APWbgU4G2jzUmjoSRW1+tv0H3nXLG+gVO60YGqhiGJyqfxOf7QXkrzqE0vT0fh 6gBqWCMO34KTWZxda2YxaYIoQeN40OYKxjS3LVMM= From: Ivan Malov To: dev@dpdk.org Cc: Thomas Monjalon , Ori Kam , Xiaoyun Li , Ferruh Yigit , Andrew Rybchenko Date: Sun, 10 Oct 2021 17:39:19 +0300 Message-Id: <20211010143930.4985-2-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211010143930.4985-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211010143930.4985-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 01/12] ethdev: add port representor item to flow API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" For use in "transfer" flows. Supposed to match traffic entering the embedded switch from the given ethdev. Must not be combined with direction attributes. Signed-off-by: Ivan Malov Acked-by: Ori Kam Acked-by: Andrew Rybchenko --- app/test-pmd/cmdline_flow.c | 27 ++++++++++ doc/guides/prog_guide/rte_flow.rst | 59 +++++++++++++++++++++ doc/guides/rel_notes/release_21_11.rst | 2 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 4 ++ lib/ethdev/rte_flow.c | 1 + lib/ethdev/rte_flow.h | 27 ++++++++++ 6 files changed, 120 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index bb22294dd3..a912a8d815 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -306,6 +306,8 @@ enum index { ITEM_POL_PORT, ITEM_POL_METER, ITEM_POL_POLICY, + ITEM_PORT_REPRESENTOR, + ITEM_PORT_REPRESENTOR_PORT_ID, /* Validate/create actions. */ ACTIONS, @@ -1000,6 +1002,7 @@ static const enum index next_item[] = { ITEM_GENEVE_OPT, ITEM_INTEGRITY, ITEM_CONNTRACK, + ITEM_PORT_REPRESENTOR, END_SET, ZERO, }; @@ -1368,6 +1371,12 @@ static const enum index item_integrity_lv[] = { ZERO, }; +static const enum index item_port_representor[] = { + ITEM_PORT_REPRESENTOR_PORT_ID, + ITEM_NEXT, + ZERO, +}; + static const enum index next_action[] = { ACTION_END, ACTION_VOID, @@ -3608,6 +3617,21 @@ static const struct token token_list[] = { item_param), .args = ARGS(ARGS_ENTRY(struct rte_flow_item_conntrack, flags)), }, + [ITEM_PORT_REPRESENTOR] = { + .name = "port_representor", + .help = "match traffic entering the embedded switch from the given ethdev", + .priv = PRIV_ITEM(PORT_REPRESENTOR, + sizeof(struct rte_flow_item_ethdev)), + .next = NEXT(item_port_representor), + .call = parse_vc, + }, + [ITEM_PORT_REPRESENTOR_PORT_ID] = { + .name = "port_id", + .help = "ethdev port ID", + .next = NEXT(item_port_representor, NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY(struct rte_flow_item_ethdev, port_id)), + }, /* Validate/create actions. */ [ACTIONS] = { .name = "actions", @@ -8343,6 +8367,9 @@ flow_item_default_mask(const struct rte_flow_item *item) case RTE_FLOW_ITEM_TYPE_PFCP: mask = &rte_flow_item_pfcp_mask; break; + case RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR: + mask = &rte_flow_item_ethdev_mask; + break; default: break; } diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 2b42d5ec8c..91d5bdd712 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1425,6 +1425,65 @@ Matches a conntrack state after conntrack action. - ``flags``: conntrack packet state flags. - Default ``mask`` matches all state bits. +Item: ``PORT_REPRESENTOR`` +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Matches traffic entering the embedded switch from the given ethdev. + +Term **ethdev** and the concept of **port representor** are synonymous. +The **represented port** is an *entity* plugged to the embedded switch +at the opposite end of the "wire" leading to the ethdev. + +:: + + .--------------------. + | PORT_REPRESENTOR | Ethdev (Application Port Referred to by its ID) + '--------------------' + || + \/ + .----------------. + | Logical Port | + '----------------' + || + || + || + \/ + .----------. + | Switch | + '----------' + : + : + : + : + .----------------. + | Logical Port | + '----------------' + : + : + .--------------------. + | REPRESENTED_PORT | Net / Guest / Another Ethdev (Same Application) + '--------------------' + + +- Incompatible with `Attribute: Traffic direction`_. +- Requires `Attribute: Transfer`_. + +.. _table_rte_flow_item_ethdev: + +.. table:: ``struct rte_flow_item_ethdev`` + + +----------+-------------+---------------------------+ + | Field | Subfield | Value | + +==========+=============+===========================+ + | ``spec`` | ``port_id`` | ethdev port ID | + +----------+-------------+---------------------------+ + | ``last`` | ``port_id`` | upper range value | + +----------+-------------+---------------------------+ + | ``mask`` | ``port_id`` | zeroed for wildcard match | + +----------+-------------+---------------------------+ + +- Default ``mask`` provides exact match behaviour. + Actions ~~~~~~~ diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst index 89d4b33ef1..1261cb2bf3 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -188,6 +188,8 @@ API Changes Also, make sure to start the actual text at the margin. ======================================================= +* ethdev: Added item ``PORT_REPRESENTOR`` to flow API. + * kvargs: The experimental function ``rte_kvargs_strcmp()`` has been removed. Its usages have been replaced by a new function ``rte_kvargs_get_with_value()``. diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 8ead7a4a71..dcb9f47d98 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3795,6 +3795,10 @@ This section lists supported pattern items and their attributes, if any. - ``conntrack``: match conntrack state. +- ``port_representor``: match traffic entering the embedded switch from the given ethdev + + - ``port_id {unsigned}``: ethdev port ID + Actions list ^^^^^^^^^^^^ diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 8cb7a069c8..5e9317c6d1 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -100,6 +100,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { MK_FLOW_ITEM(GENEVE_OPT, sizeof(struct rte_flow_item_geneve_opt)), MK_FLOW_ITEM(INTEGRITY, sizeof(struct rte_flow_item_integrity)), MK_FLOW_ITEM(CONNTRACK, sizeof(uint32_t)), + MK_FLOW_ITEM(PORT_REPRESENTOR, sizeof(struct rte_flow_item_ethdev)), }; /** Generate flow_action[] entry. */ diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 7b1ed7f110..3625fd2c12 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -574,6 +574,15 @@ enum rte_flow_item_type { * @see struct rte_flow_item_conntrack. */ RTE_FLOW_ITEM_TYPE_CONNTRACK, + + /** + * [META] + * + * Matches traffic entering the embedded switch from the given ethdev. + * + * @see struct rte_flow_item_ethdev + */ + RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR, }; /** @@ -1799,6 +1808,24 @@ static const struct rte_flow_item_conntrack rte_flow_item_conntrack_mask = { }; #endif +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * Provides an ethdev port ID for use with the following items: + * RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR. + */ +struct rte_flow_item_ethdev { + uint16_t port_id; /**< ethdev port ID */ +}; + +/** Default mask for items based on struct rte_flow_item_ethdev */ +#ifndef __cplusplus +static const struct rte_flow_item_ethdev rte_flow_item_ethdev_mask = { + .port_id = 0xffff, +}; +#endif + /** * Matching pattern item definition. * From patchwork Sun Oct 10 14:39:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 100939 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id 2844BA0C43; Sun, 10 Oct 2021 16:40:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B2D8A410E5; Sun, 10 Oct 2021 16:40:02 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id C25854003C for ; Sun, 10 Oct 2021 16:39:59 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 59A957F6D4; Sun, 10 Oct 2021 17:39:59 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 59A957F6D4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1633876799; bh=521kvpY52T4X3RECK+oy27IUCsJF9QUAxrbArwXoYTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=rzMM/EecW85MtswGIPYv6etB3+z95Grhule+J1lNhpEBPHKIwGfqQR3zosY/usLCW JzgfjIsOzF0HWpLyNn9vMzAbDdGcySczPprsA6MDBSf4Pen2Wrtq1kK6iTH/1OaWIE rfzZjK8eYgbMULPWY88jEc2VeghX3TQWV0lne2JY= From: Ivan Malov To: dev@dpdk.org Cc: Thomas Monjalon , Ori Kam , Xiaoyun Li , Ferruh Yigit , Andrew Rybchenko Date: Sun, 10 Oct 2021 17:39:20 +0300 Message-Id: <20211010143930.4985-3-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211010143930.4985-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211010143930.4985-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 02/12] ethdev: add represented port item to flow API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" For use in "transfer" flows. Supposed to match traffic entering the embedded switch from the entity represented by the given ethdev. Such an entity can be a network (via a network port), a guest machine (via a VF) or another ethdev in the same application. Must not be combined with direction attributes. Signed-off-by: Ivan Malov Acked-by: Ori Kam Acked-by: Andrew Rybchenko --- app/test-pmd/cmdline_flow.c | 25 +++++++++++ doc/guides/prog_guide/rte_flow.rst | 46 +++++++++++++++++++++ doc/guides/rel_notes/release_21_11.rst | 2 +- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 5 +++ lib/ethdev/rte_flow.c | 1 + lib/ethdev/rte_flow.h | 13 +++++- 6 files changed, 90 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index a912a8d815..68698d805d 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -308,6 +308,8 @@ enum index { ITEM_POL_POLICY, ITEM_PORT_REPRESENTOR, ITEM_PORT_REPRESENTOR_PORT_ID, + ITEM_REPRESENTED_PORT, + ITEM_REPRESENTED_PORT_ETHDEV_PORT_ID, /* Validate/create actions. */ ACTIONS, @@ -1003,6 +1005,7 @@ static const enum index next_item[] = { ITEM_INTEGRITY, ITEM_CONNTRACK, ITEM_PORT_REPRESENTOR, + ITEM_REPRESENTED_PORT, END_SET, ZERO, }; @@ -1377,6 +1380,12 @@ static const enum index item_port_representor[] = { ZERO, }; +static const enum index item_represented_port[] = { + ITEM_REPRESENTED_PORT_ETHDEV_PORT_ID, + ITEM_NEXT, + ZERO, +}; + static const enum index next_action[] = { ACTION_END, ACTION_VOID, @@ -3632,6 +3641,21 @@ static const struct token token_list[] = { item_param), .args = ARGS(ARGS_ENTRY(struct rte_flow_item_ethdev, port_id)), }, + [ITEM_REPRESENTED_PORT] = { + .name = "represented_port", + .help = "match traffic entering the embedded switch from the entity represented by the given ethdev", + .priv = PRIV_ITEM(REPRESENTED_PORT, + sizeof(struct rte_flow_item_ethdev)), + .next = NEXT(item_represented_port), + .call = parse_vc, + }, + [ITEM_REPRESENTED_PORT_ETHDEV_PORT_ID] = { + .name = "ethdev_port_id", + .help = "ethdev port ID", + .next = NEXT(item_represented_port, NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY(struct rte_flow_item_ethdev, port_id)), + }, /* Validate/create actions. */ [ACTIONS] = { .name = "actions", @@ -8368,6 +8392,7 @@ flow_item_default_mask(const struct rte_flow_item *item) mask = &rte_flow_item_pfcp_mask; break; case RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR: + case RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT: mask = &rte_flow_item_ethdev_mask; break; default: diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 91d5bdd712..12a216c1e3 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1484,6 +1484,52 @@ at the opposite end of the "wire" leading to the ethdev. - Default ``mask`` provides exact match behaviour. +Item: ``REPRESENTED_PORT`` +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Matches traffic entering the embedded switch from +the entity represented by the given ethdev. + +Term **ethdev** and the concept of **port representor** are synonymous. +The **represented port** is an *entity* plugged to the embedded switch +at the opposite end of the "wire" leading to the ethdev. + +:: + + .--------------------. + | PORT_REPRESENTOR | Ethdev (Application Port Referred to by its ID) + '--------------------' + : + : + .----------------. + | Logical Port | + '----------------' + : + : + : + : + .----------. + | Switch | + '----------' + /\ + || + || + || + .----------------. + | Logical Port | + '----------------' + /\ + || + .--------------------. + | REPRESENTED_PORT | Net / Guest / Another Ethdev (Same Application) + '--------------------' + + +- Incompatible with `Attribute: Traffic direction`_. +- Requires `Attribute: Transfer`_. + +This item is meant to use the same structure as `Item: PORT_REPRESENTOR`_. + Actions ~~~~~~~ diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst index 1261cb2bf3..39ff16780b 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -188,7 +188,7 @@ API Changes Also, make sure to start the actual text at the margin. ======================================================= -* ethdev: Added item ``PORT_REPRESENTOR`` to flow API. +* ethdev: Added items ``PORT_REPRESENTOR``, ``REPRESENTED_PORT`` to flow API. * kvargs: The experimental function ``rte_kvargs_strcmp()`` has been removed. Its usages have been replaced by a new function diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index dcb9f47d98..44a399899f 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3799,6 +3799,11 @@ This section lists supported pattern items and their attributes, if any. - ``port_id {unsigned}``: ethdev port ID +- ``represented_port``: match traffic entering the embedded switch from + the entity represented by the given ethdev + + - ``ethdev_port_id {unsigned}``: ethdev port ID + Actions list ^^^^^^^^^^^^ diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 5e9317c6d1..d4b654a2c6 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -101,6 +101,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { MK_FLOW_ITEM(INTEGRITY, sizeof(struct rte_flow_item_integrity)), MK_FLOW_ITEM(CONNTRACK, sizeof(uint32_t)), MK_FLOW_ITEM(PORT_REPRESENTOR, sizeof(struct rte_flow_item_ethdev)), + MK_FLOW_ITEM(REPRESENTED_PORT, sizeof(struct rte_flow_item_ethdev)), }; /** Generate flow_action[] entry. */ diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 3625fd2c12..24d41aeb7b 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -583,6 +583,16 @@ enum rte_flow_item_type { * @see struct rte_flow_item_ethdev */ RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR, + + /** + * [META] + * + * Matches traffic entering the embedded switch from + * the entity represented by the given ethdev. + * + * @see struct rte_flow_item_ethdev + */ + RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT, }; /** @@ -1813,7 +1823,8 @@ static const struct rte_flow_item_conntrack rte_flow_item_conntrack_mask = { * @b EXPERIMENTAL: this structure may change without prior notice * * Provides an ethdev port ID for use with the following items: - * RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR. + * RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR, + * RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT. */ struct rte_flow_item_ethdev { uint16_t port_id; /**< ethdev port ID */ From patchwork Sun Oct 10 14:39:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 100940 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id D1F38A0C43; Sun, 10 Oct 2021 16:40:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AFFF9410F2; Sun, 10 Oct 2021 16:40:03 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 103EF4003C for ; Sun, 10 Oct 2021 16:40:00 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 9D2017F6D5; Sun, 10 Oct 2021 17:39:59 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 9D2017F6D5 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1633876799; bh=9IZMNdUBYtmB1LZD2yOjf46mLQNTa5sShBOW/HKBknI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ZRq/SSYbjZZlKdiPZwKdRU4XafbzcBlXwMqPCwKmrEnaguWo4Y/CWSvJd2/EwKmio g0UdVBeCMPi6bw8KjR5SfM510vb2yc+GtqlmN8Guf3pWwavXQ8BiVAnWivtzpc4qZ4 9LDgX+ZEZEcrIXT60Sz78QjOtSRj1FL7sDowT848= From: Ivan Malov To: dev@dpdk.org Cc: Thomas Monjalon , Ori Kam , Xiaoyun Li , Ferruh Yigit , Andrew Rybchenko Date: Sun, 10 Oct 2021 17:39:21 +0300 Message-Id: <20211010143930.4985-4-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211010143930.4985-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211010143930.4985-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 03/12] ethdev: add port representor action to flow API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" For use in "transfer" flows. Supposed to send matching traffic to the given ethdev (to the application), at embedded switch level. Signed-off-by: Ivan Malov Acked-by: Ori Kam Acked-by: Andrew Rybchenko --- app/test-pmd/cmdline_flow.c | 26 ++++++++++ doc/guides/prog_guide/rte_flow.rst | 56 +++++++++++++++++++++ doc/guides/rel_notes/release_21_11.rst | 2 +- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 5 ++ lib/ethdev/rte_flow.c | 1 + lib/ethdev/rte_flow.h | 18 +++++++ 6 files changed, 107 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 68698d805d..ee6dac411a 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -460,6 +460,8 @@ enum index { ACTION_POL_G, ACTION_POL_Y, ACTION_POL_R, + ACTION_PORT_REPRESENTOR, + ACTION_PORT_REPRESENTOR_PORT_ID, }; /** Maximum size for pattern in struct rte_flow_item_raw. */ @@ -1452,6 +1454,7 @@ static const enum index next_action[] = { ACTION_MODIFY_FIELD, ACTION_CONNTRACK, ACTION_CONNTRACK_UPDATE, + ACTION_PORT_REPRESENTOR, ZERO, }; @@ -1733,6 +1736,12 @@ static const enum index action_update_conntrack[] = { ZERO, }; +static const enum index action_port_representor[] = { + ACTION_PORT_REPRESENTOR_PORT_ID, + ACTION_NEXT, + ZERO, +}; + static int parse_set_raw_encap_decap(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); @@ -4820,6 +4829,23 @@ static const struct token token_list[] = { .next = NEXT(action_update_conntrack), .call = parse_vc_action_conntrack_update, }, + [ACTION_PORT_REPRESENTOR] = { + .name = "port_representor", + .help = "at embedded switch level, send matching traffic to the given ethdev", + .priv = PRIV_ACTION(PORT_REPRESENTOR, + sizeof(struct rte_flow_action_ethdev)), + .next = NEXT(action_port_representor), + .call = parse_vc, + }, + [ACTION_PORT_REPRESENTOR_PORT_ID] = { + .name = "port_id", + .help = "ethdev port ID", + .next = NEXT(action_port_representor, + NEXT_ENTRY(COMMON_UNSIGNED)), + .args = ARGS(ARGS_ENTRY(struct rte_flow_action_ethdev, + port_id)), + .call = parse_vc_conf, + }, /* Indirect action destroy arguments. */ [INDIRECT_ACTION_DESTROY_ID] = { .name = "action_id", diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 12a216c1e3..a6401fb5df 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1484,6 +1484,8 @@ at the opposite end of the "wire" leading to the ethdev. - Default ``mask`` provides exact match behaviour. +See also `Action: PORT_REPRESENTOR`_. + Item: ``REPRESENTED_PORT`` ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -3104,6 +3106,60 @@ which is set in the packet meta-data (i.e. struct ``rte_mbuf::sched::color``) | ``meter_color`` | Packet color | +-----------------+--------------+ +Action: ``PORT_REPRESENTOR`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +At embedded switch level, send matching traffic to the given ethdev. + +Term **ethdev** and the concept of **port representor** are synonymous. +The **represented port** is an *entity* plugged to the embedded switch +at the opposite end of the "wire" leading to the ethdev. + +:: + + .--------------------. + | PORT_REPRESENTOR | Ethdev (Application Port Referred to by its ID) + '--------------------' + /\ + || + .----------------. + | Logical Port | + '----------------' + /\ + || + || + || + .----------. .--------------------. + | Switch | <== | Matching Traffic | + '----------' '--------------------' + : + : + : + : + .----------------. + | Logical Port | + '----------------' + : + : + .--------------------. + | REPRESENTED_PORT | Net / Guest / Another Ethdev (Same Application) + '--------------------' + + +- Requires `Attribute: Transfer`_. + +.. _table_rte_flow_action_ethdev: + +.. table:: ``struct rte_flow_action_ethdev`` + + +-------------+----------------+ + | Field | Value | + +=============+================+ + | ``port_id`` | ethdev port ID | + +-------------+----------------+ + +See also `Item: PORT_REPRESENTOR`_. + Negative types ~~~~~~~~~~~~~~ diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst index 39ff16780b..bf46329e52 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -188,7 +188,7 @@ API Changes Also, make sure to start the actual text at the margin. ======================================================= -* ethdev: Added items ``PORT_REPRESENTOR``, ``REPRESENTED_PORT`` to flow API. +* ethdev: Added items ``PORT_REPRESENTOR``, ``REPRESENTED_PORT`` and action ``PORT_REPRESENTOR`` to flow API. * kvargs: The experimental function ``rte_kvargs_strcmp()`` has been removed. Its usages have been replaced by a new function diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 44a399899f..5f127fdbcc 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -4079,6 +4079,11 @@ This section lists supported actions and their attributes, if any. - ``type {value}``: Set color type with specified value(green/yellow/red) +- ``port_representor``: at embedded switch level, send matching traffic to + the given ethdev + + - ``port_id {unsigned}``: ethdev port ID + Destroying flow rules ~~~~~~~~~~~~~~~~~~~~~ diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index d4b654a2c6..b074b1c77d 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -191,6 +191,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = { */ MK_FLOW_ACTION(INDIRECT, 0), MK_FLOW_ACTION(CONNTRACK, sizeof(struct rte_flow_action_conntrack)), + MK_FLOW_ACTION(PORT_REPRESENTOR, sizeof(struct rte_flow_action_ethdev)), }; int diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 24d41aeb7b..cf4165bef3 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -2447,6 +2447,13 @@ enum rte_flow_action_type { * See struct rte_flow_action_meter_color. */ RTE_FLOW_ACTION_TYPE_METER_COLOR, + + /** + * At embedded switch level, sends matching traffic to the given ethdev. + * + * @see struct rte_flow_action_ethdev + */ + RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR, }; /** @@ -3206,6 +3213,17 @@ struct rte_flow_action_meter_color { enum rte_color color; /**< Packet color. */ }; +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * Provides an ethdev port ID for use with the following actions: + * RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR. + */ +struct rte_flow_action_ethdev { + uint16_t port_id; /**< ethdev port ID */ +}; + /** * Field IDs for MODIFY_FIELD action. */ From patchwork Sun Oct 10 14:39:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 100941 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id 23F3FA0C43; Sun, 10 Oct 2021 16:40:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2C340410FA; Sun, 10 Oct 2021 16:40:05 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 3479D40042 for ; Sun, 10 Oct 2021 16:40:00 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id E01547F6D6; Sun, 10 Oct 2021 17:39:59 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru E01547F6D6 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1633876799; bh=BeAr3uRW28miWH5wumjcgoMrz8CXkEEWod+yCj8Y9bg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hoNu/FHZv1OwC6bpg+SiUGDRWK0ohM6P+pi2Gr1QhImSlaQRBPza7HMU9dvcsHTwR yzjV5KyEZGy+mNYbCfVyJi5ftQpqmT4+9iN/FdkZHkEYEH3HLvQi3k2NzDfI8xjwom cN2+D4rqTJEoDxxZmeALhaw2zn7GeYzXXmGAKV7I= From: Ivan Malov To: dev@dpdk.org Cc: Thomas Monjalon , Ori Kam , Xiaoyun Li , Ferruh Yigit , Andrew Rybchenko Date: Sun, 10 Oct 2021 17:39:22 +0300 Message-Id: <20211010143930.4985-5-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211010143930.4985-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211010143930.4985-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 04/12] ethdev: add represented port action to flow API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" For use in "transfer" flows. Supposed to send matching traffic to the entity represented by the given ethdev, at embedded switch level. Such an entity can be a network (via a network port), a guest machine (via a VF) or another ethdev in the same application. Signed-off-by: Ivan Malov Acked-by: Ori Kam Acked-by: Andrew Rybchenko --- app/test-pmd/cmdline_flow.c | 26 +++++++++++ doc/guides/prog_guide/rte_flow.rst | 49 +++++++++++++++++++++ doc/guides/rel_notes/release_21_11.rst | 2 +- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 5 +++ lib/ethdev/rte_flow.c | 1 + lib/ethdev/rte_flow.h | 11 ++++- 6 files changed, 92 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index ee6dac411a..c704bbaead 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -462,6 +462,8 @@ enum index { ACTION_POL_R, ACTION_PORT_REPRESENTOR, ACTION_PORT_REPRESENTOR_PORT_ID, + ACTION_REPRESENTED_PORT, + ACTION_REPRESENTED_PORT_ETHDEV_PORT_ID, }; /** Maximum size for pattern in struct rte_flow_item_raw. */ @@ -1455,6 +1457,7 @@ static const enum index next_action[] = { ACTION_CONNTRACK, ACTION_CONNTRACK_UPDATE, ACTION_PORT_REPRESENTOR, + ACTION_REPRESENTED_PORT, ZERO, }; @@ -1742,6 +1745,12 @@ static const enum index action_port_representor[] = { ZERO, }; +static const enum index action_represented_port[] = { + ACTION_REPRESENTED_PORT_ETHDEV_PORT_ID, + ACTION_NEXT, + ZERO, +}; + static int parse_set_raw_encap_decap(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); @@ -4846,6 +4855,23 @@ static const struct token token_list[] = { port_id)), .call = parse_vc_conf, }, + [ACTION_REPRESENTED_PORT] = { + .name = "represented_port", + .help = "at embedded switch level, send matching traffic to the entity represented by the given ethdev", + .priv = PRIV_ACTION(REPRESENTED_PORT, + sizeof(struct rte_flow_action_ethdev)), + .next = NEXT(action_represented_port), + .call = parse_vc, + }, + [ACTION_REPRESENTED_PORT_ETHDEV_PORT_ID] = { + .name = "ethdev_port_id", + .help = "ethdev port ID", + .next = NEXT(action_represented_port, + NEXT_ENTRY(COMMON_UNSIGNED)), + .args = ARGS(ARGS_ENTRY(struct rte_flow_action_ethdev, + port_id)), + .call = parse_vc_conf, + }, /* Indirect action destroy arguments. */ [INDIRECT_ACTION_DESTROY_ID] = { .name = "action_id", diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index a6401fb5df..2bc437e5cd 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1532,6 +1532,8 @@ at the opposite end of the "wire" leading to the ethdev. This item is meant to use the same structure as `Item: PORT_REPRESENTOR`_. +See also `Action: REPRESENTED_PORT`_. + Actions ~~~~~~~ @@ -3160,6 +3162,53 @@ at the opposite end of the "wire" leading to the ethdev. See also `Item: PORT_REPRESENTOR`_. +Action: ``REPRESENTED_PORT`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +At embedded switch level, send matching traffic to +the entity represented by the given ethdev. + +Term **ethdev** and the concept of **port representor** are synonymous. +The **represented port** is an *entity* plugged to the embedded switch +at the opposite end of the "wire" leading to the ethdev. + +:: + + .--------------------. + | PORT_REPRESENTOR | Ethdev (Application Port Referred to by its ID) + '--------------------' + : + : + .----------------. + | Logical Port | + '----------------' + : + : + : + : + .----------. .--------------------. + | Switch | <== | Matching Traffic | + '----------' '--------------------' + || + || + || + \/ + .----------------. + | Logical Port | + '----------------' + || + \/ + .--------------------. + | REPRESENTED_PORT | Net / Guest / Another Ethdev (Same Application) + '--------------------' + + +- Requires `Attribute: Transfer`_. + +This action is meant to use the same structure as `Action: PORT_REPRESENTOR`_. + +See also `Item: REPRESENTED_PORT`_. + Negative types ~~~~~~~~~~~~~~ diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst index bf46329e52..f689a10e63 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -188,7 +188,7 @@ API Changes Also, make sure to start the actual text at the margin. ======================================================= -* ethdev: Added items ``PORT_REPRESENTOR``, ``REPRESENTED_PORT`` and action ``PORT_REPRESENTOR`` to flow API. +* ethdev: Added items and actions ``PORT_REPRESENTOR``, ``REPRESENTED_PORT`` to flow API. * kvargs: The experimental function ``rte_kvargs_strcmp()`` has been removed. Its usages have been replaced by a new function diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 5f127fdbcc..d1c5cb7383 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -4084,6 +4084,11 @@ This section lists supported actions and their attributes, if any. - ``port_id {unsigned}``: ethdev port ID +- ``represented_port``: at embedded switch level, send matching traffic to + the entity represented by the given ethdev + + - ``ethdev_port_id {unsigned}``: ethdev port ID + Destroying flow rules ~~~~~~~~~~~~~~~~~~~~~ diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index b074b1c77d..542e40e496 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -192,6 +192,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = { MK_FLOW_ACTION(INDIRECT, 0), MK_FLOW_ACTION(CONNTRACK, sizeof(struct rte_flow_action_conntrack)), MK_FLOW_ACTION(PORT_REPRESENTOR, sizeof(struct rte_flow_action_ethdev)), + MK_FLOW_ACTION(REPRESENTED_PORT, sizeof(struct rte_flow_action_ethdev)), }; int diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index cf4165bef3..afd1f4c193 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -2454,6 +2454,14 @@ enum rte_flow_action_type { * @see struct rte_flow_action_ethdev */ RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR, + + /** + * At embedded switch level, send matching traffic to + * the entity represented by the given ethdev. + * + * @see struct rte_flow_action_ethdev + */ + RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT, }; /** @@ -3218,7 +3226,8 @@ struct rte_flow_action_meter_color { * @b EXPERIMENTAL: this structure may change without prior notice * * Provides an ethdev port ID for use with the following actions: - * RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR. + * RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR, + * RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT. */ struct rte_flow_action_ethdev { uint16_t port_id; /**< ethdev port ID */ From patchwork Sun Oct 10 14:39:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 100942 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id 239CFA0C43; Sun, 10 Oct 2021 16:40:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4C10841123; Sun, 10 Oct 2021 16:40:07 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 7F3D84003C for ; Sun, 10 Oct 2021 16:40:00 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 2DC597F6D7; Sun, 10 Oct 2021 17:40:00 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 2DC597F6D7 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1633876800; bh=6n9+fon2tp8nQD1WT6llae4RQxjJsPC4od7C41rMcS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eVROE0N2Bz2G9nLvSU3XTTVdqEwzhZ78wC6PTth4oDRq0OssMRmT6f5caHsmOWX16 M+cTI+HrHV47n++NS3Z7benKHOlz2S0Q4S7hty7WDnOPDUY6smwX0TisrzO0DQ5Ww+ LD0+n9hweRrZdvUfZhyniO7wZTNplZKcBw/NsS3M= From: Ivan Malov To: dev@dpdk.org Cc: Thomas Monjalon , Ori Kam , Ray Kinsella , Ferruh Yigit , Andrew Rybchenko Date: Sun, 10 Oct 2021 17:39:23 +0300 Message-Id: <20211010143930.4985-6-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211010143930.4985-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211010143930.4985-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 05/12] ethdev: deprecate hard-to-use or ambiguous items and actions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" PF, VF and PHY_PORT require that applications have extra knowledge of the underlying NIC and thus are hard to use. Also, the corresponding items depend on the direction attribute (ingress / egress), which complicates their use in applications and interpretation in PMDs. The concept of PORT_ID is ambiguous as it doesn't say whether the port in question is an ethdev or the represented entity. Items and actions PORT_REPRESENTOR, REPRESENTED_PORT should be used instead. Signed-off-by: Ivan Malov Acked-by: Ori Kam Acked-by: Andrew Rybchenko --- doc/guides/prog_guide/rte_flow.rst | 32 +++++++++++++++ doc/guides/rel_notes/deprecation.rst | 9 ++--- doc/guides/rel_notes/release_21_11.rst | 3 ++ lib/ethdev/rte_flow.h | 56 ++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 6 deletions(-) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 2bc437e5cd..1aa24e0633 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -504,6 +504,10 @@ Usage example, matching non-TCPv4 packets only: Item: ``PF`` ^^^^^^^^^^^^ +This item is deprecated. Consider: + - `Item: PORT_REPRESENTOR`_ + - `Item: REPRESENTED_PORT`_ + Matches traffic originating from (ingress) or going to (egress) the physical function of the current device. @@ -531,6 +535,10 @@ the application and thus not associated with a DPDK port ID. Item: ``VF`` ^^^^^^^^^^^^ +This item is deprecated. Consider: + - `Item: PORT_REPRESENTOR`_ + - `Item: REPRESENTED_PORT`_ + Matches traffic originating from (ingress) or going to (egress) a given virtual function of the current device. @@ -562,6 +570,10 @@ separate entities, should be addressed through their own DPDK port IDs. Item: ``PHY_PORT`` ^^^^^^^^^^^^^^^^^^ +This item is deprecated. Consider: + - `Item: PORT_REPRESENTOR`_ + - `Item: REPRESENTED_PORT`_ + Matches traffic originating from (ingress) or going to (egress) a physical port of the underlying device. @@ -596,6 +608,10 @@ associated with a port_id should be retrieved by other means. Item: ``PORT_ID`` ^^^^^^^^^^^^^^^^^ +This item is deprecated. Consider: + - `Item: PORT_REPRESENTOR`_ + - `Item: REPRESENTED_PORT`_ + Matches traffic originating from (ingress) or going to (egress) a given DPDK port ID. @@ -1965,6 +1981,10 @@ only matching traffic goes through. Action: ``PF`` ^^^^^^^^^^^^^^ +This action is deprecated. Consider: + - `Action: PORT_REPRESENTOR`_ + - `Action: REPRESENTED_PORT`_ + Directs matching traffic to the physical function (PF) of the current device. @@ -1985,6 +2005,10 @@ See `Item: PF`_. Action: ``VF`` ^^^^^^^^^^^^^^ +This action is deprecated. Consider: + - `Action: PORT_REPRESENTOR`_ + - `Action: REPRESENTED_PORT`_ + Directs matching traffic to a given virtual function of the current device. Packets matched by a VF pattern item can be redirected to their original VF @@ -2009,6 +2033,10 @@ See `Item: VF`_. Action: ``PHY_PORT`` ^^^^^^^^^^^^^^^^^^^^ +This action is deprecated. Consider: + - `Action: PORT_REPRESENTOR`_ + - `Action: REPRESENTED_PORT`_ + Directs matching traffic to a given physical port index of the underlying device. @@ -2028,6 +2056,10 @@ See `Item: PHY_PORT`_. Action: ``PORT_ID`` ^^^^^^^^^^^^^^^^^^^ +This action is deprecated. Consider: + - `Action: PORT_REPRESENTOR`_ + - `Action: REPRESENTED_PORT`_ + Directs matching traffic to a given DPDK port ID. See `Item: PORT_ID`_. diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index b86147dda1..c91d570099 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -122,12 +122,6 @@ Deprecation Notices is deprecated and will be removed in DPDK 21.11. Shared counters should be managed using shared actions API (``rte_flow_shared_action_create`` etc). -* ethdev: Definition of the flow API action ``RTE_FLOW_ACTION_TYPE_PORT_ID`` - is ambiguous and needs clarification. - Structure ``rte_flow_action_port_id`` will be extended to specify - traffic direction to the represented entity or ethdev port itself - in DPDK 21.11. - * ethdev: Flow API documentation is unclear if ethdev port used to create a flow rule adds any implicit match criteria in the case of transfer rules. The semantics will be clarified in DPDK 21.11 and it will require fixes in @@ -256,3 +250,6 @@ Deprecation Notices * cmdline: ``cmdline`` structure will be made opaque to hide platform-specific content. On Linux and FreeBSD, supported prior to DPDK 20.11, original structure will be kept until DPDK 21.11. + +* ethdev: Items and actions ``PF``, ``VF``, ``PHY_PORT``, ``PORT_ID`` are + deprecated as hard-to-use / ambiguous and will be removed in DPDK 22.11. diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst index f689a10e63..63f946ad88 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -190,6 +190,9 @@ API Changes * ethdev: Added items and actions ``PORT_REPRESENTOR``, ``REPRESENTED_PORT`` to flow API. +* ethdev: Deprecated items and actions ``PF``, ``VF``, ``PHY_PORT``, ``PORT_ID``. + Suggested items and actions ``PORT_REPRESENTOR``, ``REPRESENTED_PORT`` instead. + * kvargs: The experimental function ``rte_kvargs_strcmp()`` has been removed. Its usages have been replaced by a new function ``rte_kvargs_get_with_value()``. diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index afd1f4c193..afd50d6d51 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -160,6 +160,10 @@ enum rte_flow_item_type { RTE_FLOW_ITEM_TYPE_ANY, /** + * @deprecated + * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT + * * [META] * * Matches traffic originating from (ingress) or going to (egress) @@ -170,6 +174,10 @@ enum rte_flow_item_type { RTE_FLOW_ITEM_TYPE_PF, /** + * @deprecated + * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT + * * [META] * * Matches traffic originating from (ingress) or going to (egress) a @@ -180,6 +188,10 @@ enum rte_flow_item_type { RTE_FLOW_ITEM_TYPE_VF, /** + * @deprecated + * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT + * * [META] * * Matches traffic originating from (ingress) or going to (egress) a @@ -190,6 +202,10 @@ enum rte_flow_item_type { RTE_FLOW_ITEM_TYPE_PHY_PORT, /** + * @deprecated + * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT + * * [META] * * Matches traffic originating from (ingress) or going to (egress) a @@ -640,6 +656,10 @@ static const struct rte_flow_item_any rte_flow_item_any_mask = { #endif /** + * @deprecated + * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT + * * RTE_FLOW_ITEM_TYPE_VF * * Matches traffic originating from (ingress) or going to (egress) a given @@ -669,6 +689,10 @@ static const struct rte_flow_item_vf rte_flow_item_vf_mask = { #endif /** + * @deprecated + * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT + * * RTE_FLOW_ITEM_TYPE_PHY_PORT * * Matches traffic originating from (ingress) or going to (egress) a @@ -700,6 +724,10 @@ static const struct rte_flow_item_phy_port rte_flow_item_phy_port_mask = { #endif /** + * @deprecated + * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT + * * RTE_FLOW_ITEM_TYPE_PORT_ID * * Matches traffic originating from (ingress) or going to (egress) a given @@ -1990,6 +2018,10 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_RSS, /** + * @deprecated + * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT + * * Directs matching traffic to the physical function (PF) of the * current device. * @@ -1998,6 +2030,10 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_PF, /** + * @deprecated + * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT + * * Directs matching traffic to a given virtual function of the * current device. * @@ -2006,6 +2042,10 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_VF, /** + * @deprecated + * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT + * * Directs packets to a given physical port index of the underlying * device. * @@ -2014,6 +2054,10 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_PHY_PORT, /** + * @deprecated + * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT + * * Directs matching traffic to a given DPDK port ID. * * See struct rte_flow_action_port_id. @@ -2654,6 +2698,10 @@ struct rte_flow_action_rss { }; /** + * @deprecated + * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT + * * RTE_FLOW_ACTION_TYPE_VF * * Directs matching traffic to a given virtual function of the current @@ -2672,6 +2720,10 @@ struct rte_flow_action_vf { }; /** + * @deprecated + * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT + * * RTE_FLOW_ACTION_TYPE_PHY_PORT * * Directs packets to a given physical port index of the underlying @@ -2686,6 +2738,10 @@ struct rte_flow_action_phy_port { }; /** + * @deprecated + * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT + * * RTE_FLOW_ACTION_TYPE_PORT_ID * * Directs matching traffic to a given DPDK port ID. From patchwork Sun Oct 10 14:39:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 100943 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id 278B0A0C43; Sun, 10 Oct 2021 16:40:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A187C410DF; Sun, 10 Oct 2021 16:40:14 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id ABDF040DF8 for ; Sun, 10 Oct 2021 16:40:00 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 6E9457F6D8; Sun, 10 Oct 2021 17:40:00 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 6E9457F6D8 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1633876800; bh=iiVNYEdlMagjzZK0okXkaFdZR9fmEeNugxgCUGco33k=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=JnB3DjpSdQQo35ARkq/xz8HrjX7MhpOFzzuc91buOZFdVY29F35GX/ec1iV244P17 6Ulio7QSBlHV5YswL3Pc3O4IIIBv/h/9Uird8pJrCF+lGnWj/2M/IF/0DE1DQKRlxs 3S3euOiHh1gCDwx1NJM3EcQrUbg4uB78KcGUzAKQ= From: Ivan Malov To: dev@dpdk.org Cc: Thomas Monjalon , Ori Kam , Ray Kinsella , Ferruh Yigit , Andrew Rybchenko Date: Sun, 10 Oct 2021 17:39:24 +0300 Message-Id: <20211010143930.4985-7-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211010143930.4985-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211010143930.4985-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 06/12] ethdev: deprecate direction attributes in transfer flows X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Attributes "ingress" and "egress" can only apply unambiguosly to non-"transfer" flows. In "transfer" flows, the standpoint is effectively shifted to the embedded switch. There can be many different endpoints connected to the switch, so the use of "ingress" / "egress" does not shed light on which endpoints precisely can be considered as traffic sources. Add relevant deprecation notices and suggest the use of precise traffic source items (PORT_REPRESENTOR and REPRESENTED_PORT). Signed-off-by: Ivan Malov Acked-by: Ori Kam Acked-by: Andrew Rybchenko --- doc/guides/prog_guide/rte_flow.rst | 28 ++++++++---------- doc/guides/rel_notes/deprecation.rst | 9 +++--- doc/guides/rel_notes/release_21_11.rst | 3 ++ lib/ethdev/rte_flow.h | 41 ++++++++++++++++++++------ 4 files changed, 52 insertions(+), 29 deletions(-) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 1aa24e0633..f82b20c7b1 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -9,8 +9,8 @@ Overview -------- This API provides a generic means to configure hardware to match specific -ingress or egress traffic, alter its fate and query related counters -according to any number of user-defined rules. +traffic, alter its fate and query related counters according to any +number of user-defined rules. It is named *rte_flow* after the prefix used for all its symbols, and is defined in ``rte_flow.h``. @@ -146,13 +146,10 @@ Note that support for more than a single priority level is not guaranteed. Attribute: Traffic direction ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Flow rule patterns apply to inbound and/or outbound traffic. - -In the context of this API, **ingress** and **egress** respectively stand -for **inbound** and **outbound** based on the standpoint of the application -creating a flow rule. - -There are no exceptions to this definition. +Unless `Attribute: Transfer`_ is specified, flow rule patterns apply +to inbound and / or outbound traffic. With this respect, ``ingress`` +and ``egress`` respectively stand for **inbound** and **outbound** +based on the standpoint of the application creating a flow rule. Several pattern items and actions are valid and can be used in both directions. At least one direction must be specified. @@ -171,12 +168,13 @@ When supported, this effectively enables an application to reroute traffic not necessarily intended for it (e.g. coming from or addressed to different physical ports, VFs or applications) at the device level. -It complements the behavior of some pattern items such as `Item: PHY_PORT`_ -and is meaningless without them. - -When transferring flow rules, **ingress** and **egress** attributes -(`Attribute: Traffic direction`_) keep their original meaning, as if -processing traffic emitted or received by the application. +In "transfer" flows, the use of `Attribute: Traffic direction`_ in the sense of +implicitly matching packets going to or going from the ethdev used to create +flow rules is **deprecated**. `Attribute: Transfer`_ shifts the viewpoint to +the embedded switch. In it, `Attribute: Traffic direction`_ is ambiguous as +the switch serves many different endpoints. The application should match +traffic originating from precise locations. To do so, it should +use `Item: PORT_REPRESENTOR`_ and `Item: REPRESENTED_PORT`_. Pattern item ~~~~~~~~~~~~ diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index c91d570099..02a5b6eeba 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -122,11 +122,6 @@ Deprecation Notices is deprecated and will be removed in DPDK 21.11. Shared counters should be managed using shared actions API (``rte_flow_shared_action_create`` etc). -* ethdev: Flow API documentation is unclear if ethdev port used to create - a flow rule adds any implicit match criteria in the case of transfer rules. - The semantics will be clarified in DPDK 21.11 and it will require fixes in - drivers and applications which interpret it in a different way. - * ethdev: The flow API matching pattern structures, ``struct rte_flow_item_*``, should start with relevant protocol header. Some matching pattern structures implements this by duplicating protocol header @@ -253,3 +248,7 @@ Deprecation Notices * ethdev: Items and actions ``PF``, ``VF``, ``PHY_PORT``, ``PORT_ID`` are deprecated as hard-to-use / ambiguous and will be removed in DPDK 22.11. + +* ethdev: The use of attributes ``ingress`` / ``egress`` in "transfer" flows + is deprecated as ambiguous with respect to the embedded switch. The use of + these attributes will become invalid starting from DPDK 22.11. diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst index 63f946ad88..d4dadbfcf4 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -193,6 +193,9 @@ API Changes * ethdev: Deprecated items and actions ``PF``, ``VF``, ``PHY_PORT``, ``PORT_ID``. Suggested items and actions ``PORT_REPRESENTOR``, ``REPRESENTED_PORT`` instead. +* ethdev: Deprecated the use of attributes ``ingress`` / ``egress`` combined + with ``transfer``. See items ``PORT_REPRESENTOR``, ``REPRESENTED_PORT``. + * kvargs: The experimental function ``rte_kvargs_strcmp()`` has been removed. Its usages have been replaced by a new function ``rte_kvargs_get_with_value()``. diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index afd50d6d51..9e0adf7302 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -67,7 +67,10 @@ extern "C" { * Note that support for more than a single group and priority level is not * guaranteed. * - * Flow rules can apply to inbound and/or outbound traffic (ingress/egress). + * At vNIC / ethdev level, flow rules can apply to inbound and / or outbound + * traffic (ingress / egress), with respect to the vNIC / ethdev in question. + * At embedded switch level, flow rules apply to all traffic seen by it + * unless fitting meta items are used to set concrete traffic source(s). * * Several pattern items and actions are valid and can be used in both * directions. Those valid for only one direction are described as such. @@ -80,8 +83,32 @@ extern "C" { struct rte_flow_attr { uint32_t group; /**< Priority group. */ uint32_t priority; /**< Rule priority level within group. */ - uint32_t ingress:1; /**< Rule applies to ingress traffic. */ - uint32_t egress:1; /**< Rule applies to egress traffic. */ + /** + * The rule in question applies to ingress traffic (non-"transfer"). + * + * @deprecated + * It has been possible to combine this attribute with "transfer". + * Doing so has been assumed to restrict the scope of matching + * to traffic going from within the embedded switch toward the + * ethdev the flow rule being created through. This behaviour + * is deprecated. During the transition period, one may still + * rely on it, but PMDs and applications are encouraged to + * gradually move away from this approach. + */ + uint32_t ingress:1; + /** + * The rule in question applies to egress traffic (non-"transfer"). + * + * @deprecated + * It has been possible to combine this attribute with "transfer". + * Doing so has been assumed to restrict the scope of matching + * to traffic sent by the application by virtue of the ethdev + * the flow rule being created through. This behaviour is now + * deprecated. During the transition period, one may still + * rely on it, but PMDs and applications are encouraged to + * gradually move away from this approach. + */ + uint32_t egress:1; /** * Instead of simply matching the properties of traffic as it would * appear on a given DPDK port ID, enabling this attribute transfers @@ -93,12 +120,8 @@ struct rte_flow_attr { * from or addressed to different physical ports, VFs or * applications) at the device level. * - * It complements the behavior of some pattern items such as - * RTE_FLOW_ITEM_TYPE_PHY_PORT and is meaningless without them. - * - * When transferring flow rules, ingress and egress attributes keep - * their original meaning, as if processing traffic emitted or - * received by the application. + * The application should match traffic originating from precise + * locations. See items PORT_REPRESENTOR and REPRESENTED_PORT. */ uint32_t transfer:1; uint32_t reserved:29; /**< Reserved, must be zero. */ From patchwork Sun Oct 10 14:39:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 100944 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id 2C55BA0C43; Sun, 10 Oct 2021 16:40:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BD10641130; Sun, 10 Oct 2021 16:40:15 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 0985540DF8 for ; Sun, 10 Oct 2021 16:40:01 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id AC27E7F6D9; Sun, 10 Oct 2021 17:40:00 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru AC27E7F6D9 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1633876800; bh=utttDEaZeq32TztOhvSBBeOaoECWKaDVhnOFJ3CtlPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mgGFSF+HBqwUskyadDdQWItiKPDjpxYaCfZbkW3OgW7K1ZQN5/mdDa7URo3b5GUgd qzMG0R8yVHmnUdTnbBnVtarQVWVwhEfjsczQi/wMYvaSrHKUN6OSyFK19A0iPZaXXf 0t8dqRf+EfdaZki800WQIJo71/PQ2sHWBFErpfbk= From: Ivan Malov To: dev@dpdk.org Cc: Thomas Monjalon , Ori Kam , Andrew Rybchenko , Ajit Khaparde , Somnath Kotur Date: Sun, 10 Oct 2021 17:39:25 +0300 Message-Id: <20211010143930.4985-8-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211010143930.4985-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211010143930.4985-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 07/12] net/bnxt: support meta flow items to match on traffic source X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Andrew Rybchenko Add support for items PORT_REPRESENTOR and REPRESENTED_PORT based on the existing support for item PORT_ID. The use of item PORT_ID depends on the specified direction attribute. Items PORT_REPRESENTOR and REPRESENTED_PORT, in turn, define traffic direction themselves. The former matches traffic from the driver's vNIC. The latter matches packets from either a v-port (network) or a VF's vNIC (if the driver's port is a VF representor). Signed-off-by: Andrew Rybchenko --- drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c | 10 ++- drivers/net/bnxt/tf_ulp/ulp_rte_parser.c | 77 ++++++++++++++----- drivers/net/bnxt/tf_ulp/ulp_rte_parser.h | 6 +- 3 files changed, 70 insertions(+), 23 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c b/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c index 9b165c12b5..d28dd2e587 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c @@ -266,7 +266,7 @@ struct bnxt_ulp_rte_hdr_info ulp_hdr_info[] = { }, [RTE_FLOW_ITEM_TYPE_PORT_ID] = { .hdr_type = BNXT_ULP_HDR_TYPE_SUPPORTED, - .proto_hdr_func = ulp_rte_port_id_hdr_handler + .proto_hdr_func = ulp_rte_port_hdr_handler }, [RTE_FLOW_ITEM_TYPE_RAW] = { .hdr_type = BNXT_ULP_HDR_TYPE_NOT_SUPPORTED, @@ -427,6 +427,14 @@ struct bnxt_ulp_rte_hdr_info ulp_hdr_info[] = { [RTE_FLOW_ITEM_TYPE_HIGIG2] = { .hdr_type = BNXT_ULP_HDR_TYPE_NOT_SUPPORTED, .proto_hdr_func = NULL + }, + [RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR] = { + .hdr_type = BNXT_ULP_HDR_TYPE_SUPPORTED, + .proto_hdr_func = ulp_rte_port_hdr_handler + }, + [RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT] = { + .hdr_type = BNXT_ULP_HDR_TYPE_SUPPORTED, + .proto_hdr_func = ulp_rte_port_hdr_handler } }; diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c index 3a9c9bba27..e1ea8932b0 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c @@ -400,7 +400,8 @@ bnxt_ulp_rte_parser_direction_compute(struct ulp_rte_parser_params *params) static int32_t ulp_rte_parser_svif_set(struct ulp_rte_parser_params *params, uint32_t ifindex, - uint16_t mask) + uint16_t mask, + enum bnxt_ulp_direction_type item_dir) { uint16_t svif; enum bnxt_ulp_direction_type dir; @@ -429,11 +430,14 @@ ulp_rte_parser_svif_set(struct ulp_rte_parser_params *params, bnxt_ulp_rte_parser_direction_compute(params); /* Get the computed direction */ - dir = ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_DIRECTION); - if (dir == BNXT_ULP_DIR_INGRESS) { + dir = (item_dir != BNXT_ULP_DIR_INVALID) ? item_dir : + ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_DIRECTION); + if (dir == BNXT_ULP_DIR_INGRESS && + port_type != BNXT_ULP_INTF_TYPE_VF_REP) { svif_type = BNXT_ULP_PHY_PORT_SVIF; } else { - if (port_type == BNXT_ULP_INTF_TYPE_VF_REP) + if (port_type == BNXT_ULP_INTF_TYPE_VF_REP && + item_dir != BNXT_ULP_DIR_EGRESS) svif_type = BNXT_ULP_VF_FUNC_SVIF; else svif_type = BNXT_ULP_DRV_FUNC_SVIF; @@ -474,7 +478,8 @@ ulp_rte_parser_implicit_match_port_process(struct ulp_rte_parser_params *params) } /* Update the SVIF details */ - rc = ulp_rte_parser_svif_set(params, ifindex, svif_mask); + rc = ulp_rte_parser_svif_set(params, ifindex, svif_mask, + BNXT_ULP_DIR_INVALID); return rc; } @@ -522,7 +527,8 @@ ulp_rte_pf_hdr_handler(const struct rte_flow_item *item __rte_unused, } /* Update the SVIF details */ - return ulp_rte_parser_svif_set(params, ifindex, svif_mask); + return ulp_rte_parser_svif_set(params, ifindex, svif_mask, + BNXT_ULP_DIR_INVALID); } /* Function to handle the parsing of RTE Flow item VF Header. */ @@ -555,39 +561,72 @@ ulp_rte_vf_hdr_handler(const struct rte_flow_item *item, return rc; } /* Update the SVIF details */ - return ulp_rte_parser_svif_set(params, ifindex, mask); + return ulp_rte_parser_svif_set(params, ifindex, mask, + BNXT_ULP_DIR_INVALID); } -/* Function to handle the parsing of RTE Flow item port id Header. */ +/* Parse items PORT_ID, PORT_REPRESENTOR and REPRESENTED_PORT. */ int32_t -ulp_rte_port_id_hdr_handler(const struct rte_flow_item *item, - struct ulp_rte_parser_params *params) +ulp_rte_port_hdr_handler(const struct rte_flow_item *item, + struct ulp_rte_parser_params *params) { - const struct rte_flow_item_port_id *port_spec = item->spec; - const struct rte_flow_item_port_id *port_mask = item->mask; + enum bnxt_ulp_direction_type item_dir; + uint16_t ethdev_id; uint16_t mask = 0; int32_t rc = BNXT_TF_RC_PARSE_ERR; uint32_t ifindex; - if (!port_spec) { - BNXT_TF_DBG(ERR, "ParseErr:Port id is not valid\n"); + if (!item->spec) { + BNXT_TF_DBG(ERR, "ParseErr:Port spec is not valid\n"); return rc; } - if (!port_mask) { - BNXT_TF_DBG(ERR, "ParseErr:Phy Port mask is not valid\n"); + if (!item->mask) { + BNXT_TF_DBG(ERR, "ParseErr:Port mask is not valid\n"); + return rc; + } + + switch (item->type) { + case RTE_FLOW_ITEM_TYPE_PORT_ID: { + const struct rte_flow_item_port_id *port_spec = item->spec; + const struct rte_flow_item_port_id *port_mask = item->mask; + + item_dir = BNXT_ULP_DIR_INVALID; + ethdev_id = port_spec->id; + mask = port_mask->id; + break; + } + case RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR: { + const struct rte_flow_item_ethdev *ethdev_spec = item->spec; + const struct rte_flow_item_ethdev *ethdev_mask = item->mask; + + item_dir = BNXT_ULP_DIR_INGRESS; + ethdev_id = ethdev_spec->port_id; + mask = ethdev_mask->port_id; + break; + } + case RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT: { + const struct rte_flow_item_ethdev *ethdev_spec = item->spec; + const struct rte_flow_item_ethdev *ethdev_mask = item->mask; + + item_dir = BNXT_ULP_DIR_EGRESS; + ethdev_id = ethdev_spec->port_id; + mask = ethdev_mask->port_id; + break; + } + default: + BNXT_TF_DBG(ERR, "ParseErr:Unexpected item\n"); return rc; } - mask = port_mask->id; /* perform the conversion from dpdk port to bnxt ifindex */ if (ulp_port_db_dev_port_to_ulp_index(params->ulp_ctx, - port_spec->id, + ethdev_id, &ifindex)) { BNXT_TF_DBG(ERR, "ParseErr:Portid is not valid\n"); return rc; } /* Update the SVIF details */ - return ulp_rte_parser_svif_set(params, ifindex, mask); + return ulp_rte_parser_svif_set(params, ifindex, mask, item_dir); } /* Function to handle the parsing of RTE Flow item phy port Header. */ diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h index e14f86278a..0acb93946b 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h @@ -90,10 +90,10 @@ int32_t ulp_rte_vf_hdr_handler(const struct rte_flow_item *item, struct ulp_rte_parser_params *params); -/* Function to handle the parsing of RTE Flow item port id Header. */ +/* Parse items PORT_ID, PORT_REPRESENTOR and REPRESENTED_PORT. */ int32_t -ulp_rte_port_id_hdr_handler(const struct rte_flow_item *item, - struct ulp_rte_parser_params *params); +ulp_rte_port_hdr_handler(const struct rte_flow_item *item, + struct ulp_rte_parser_params *params); /* Function to handle the parsing of RTE Flow item port Header. */ int32_t From patchwork Sun Oct 10 14:39:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 100945 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id 08A90A0C43; Sun, 10 Oct 2021 16:40:53 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D44CA4113A; Sun, 10 Oct 2021 16:40:16 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 3054340E5A for ; Sun, 10 Oct 2021 16:40:01 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id EC6517F6DA; Sun, 10 Oct 2021 17:40:00 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru EC6517F6DA DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1633876801; bh=eo5deMUxw1m00kMsWSIRqs0aa4kK5OOwSV1Zuz1H4Tk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=c0a+8I8LnjFJ9ANUMPKcDPgc+jLvzy6QIYhUJhxlIIuLztPUJDKE1IhV7utqDN5Np xLUlCA268IzbOLRVR6UGJFyREcKU1TIadIGjgVNqTypo8u9AkWLzYsSN94zs+Z25cW JgmEDKHIpBSUKg50uSmrjCvAhAlBfIYOoybWtGcg= From: Ivan Malov To: dev@dpdk.org Cc: Thomas Monjalon , Ori Kam , Andrew Rybchenko , Ajit Khaparde , Somnath Kotur Date: Sun, 10 Oct 2021 17:39:26 +0300 Message-Id: <20211010143930.4985-9-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211010143930.4985-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211010143930.4985-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 08/12] net/bnxt: support meta flow actions to overrule destinations X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Andrew Rybchenko Add support for actions PORT_REPRESENTOR and REPRESENTED_PORT based on the existing support for action PORT_ID. Signed-off-by: Andrew Rybchenko --- drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c | 12 ++- drivers/net/bnxt/tf_ulp/ulp_rte_parser.c | 84 ++++++++++++++----- drivers/net/bnxt/tf_ulp/ulp_rte_parser.h | 6 +- 3 files changed, 77 insertions(+), 25 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c b/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c index d28dd2e587..e9337ecd2c 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c @@ -67,7 +67,7 @@ struct bnxt_ulp_rte_act_info ulp_act_info[] = { }, [RTE_FLOW_ACTION_TYPE_PORT_ID] = { .act_type = BNXT_ULP_ACT_TYPE_SUPPORTED, - .proto_act_func = ulp_rte_port_id_act_handler + .proto_act_func = ulp_rte_port_act_handler }, [RTE_FLOW_ACTION_TYPE_METER] = { .act_type = BNXT_ULP_ACT_TYPE_NOT_SUPPORTED, @@ -212,7 +212,15 @@ struct bnxt_ulp_rte_act_info ulp_act_info[] = { [RTE_FLOW_ACTION_TYPE_SAMPLE] = { .act_type = BNXT_ULP_ACT_TYPE_SUPPORTED, .proto_act_func = ulp_rte_sample_act_handler - } + }, + [RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR] = { + .act_type = BNXT_ULP_ACT_TYPE_SUPPORTED, + .proto_act_func = ulp_rte_port_act_handler + }, + [RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT] = { + .act_type = BNXT_ULP_ACT_TYPE_SUPPORTED, + .proto_act_func = ulp_rte_port_act_handler + }, }; struct bnxt_ulp_rte_act_info ulp_vendor_act_info[] = { diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c index e1ea8932b0..f0e218d8ec 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c @@ -496,10 +496,11 @@ ulp_rte_parser_implicit_act_port_process(struct ulp_rte_parser_params *params) return BNXT_TF_RC_SUCCESS; } port_id.id = ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_INCOMING_IF); + action_item.type = RTE_FLOW_ACTION_TYPE_PORT_ID; action_item.conf = &port_id; /* Update the action port based on incoming port */ - ulp_rte_port_id_act_handler(&action_item, params); + ulp_rte_port_act_handler(&action_item, params); /* Reset the action port set bit */ ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_ACT_PORT_IS_SET, 0); @@ -2168,7 +2169,8 @@ ulp_rte_count_act_handler(const struct rte_flow_action *action_item, /* Function to handle the parsing of action ports. */ static int32_t ulp_rte_parser_act_port_set(struct ulp_rte_parser_params *param, - uint32_t ifindex) + uint32_t ifindex, + enum bnxt_ulp_direction_type act_dir) { enum bnxt_ulp_direction_type dir; uint16_t pid_s; @@ -2178,8 +2180,13 @@ ulp_rte_parser_act_port_set(struct ulp_rte_parser_params *param, uint32_t vnic_type; /* Get the direction */ - dir = ULP_COMP_FLD_IDX_RD(param, BNXT_ULP_CF_IDX_DIRECTION); - if (dir == BNXT_ULP_DIR_EGRESS) { + /* If action implicitly specifies direction, use the specification. */ + dir = (act_dir == BNXT_ULP_DIR_INVALID) ? + ULP_COMP_FLD_IDX_RD(param, BNXT_ULP_CF_IDX_DIRECTION) : + act_dir; + port_type = ULP_COMP_FLD_IDX_RD(param, BNXT_ULP_CF_IDX_ACT_PORT_TYPE); + if (dir == BNXT_ULP_DIR_EGRESS && + port_type != BNXT_ULP_INTF_TYPE_VF_REP) { /* For egress direction, fill vport */ if (ulp_port_db_vport_get(param->ulp_ctx, ifindex, &pid_s)) return BNXT_TF_RC_ERROR; @@ -2190,9 +2197,17 @@ ulp_rte_parser_act_port_set(struct ulp_rte_parser_params *param, &pid, BNXT_ULP_ACT_PROP_SZ_VPORT); } else { /* For ingress direction, fill vnic */ - port_type = ULP_COMP_FLD_IDX_RD(param, - BNXT_ULP_CF_IDX_ACT_PORT_TYPE); - if (port_type == BNXT_ULP_INTF_TYPE_VF_REP) + /* + * Action Destination + * ------------------------------------ + * PORT_REPRESENTOR Driver Function + * ------------------------------------ + * REPRESENTED_PORT VF + * ------------------------------------ + * PORT_ID VF + */ + if (act_dir != BNXT_ULP_DIR_INGRESS && + port_type == BNXT_ULP_INTF_TYPE_VF_REP) vnic_type = BNXT_ULP_VF_FUNC_VNIC; else vnic_type = BNXT_ULP_DRV_FUNC_VNIC; @@ -2239,7 +2254,8 @@ ulp_rte_pf_act_handler(const struct rte_flow_action *action_item __rte_unused, } /* Update the action properties */ ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_ACT_PORT_TYPE, intf_type); - return ulp_rte_parser_act_port_set(params, ifindex); + return ulp_rte_parser_act_port_set(params, ifindex, + BNXT_ULP_DIR_INVALID); } /* Function to handle the parsing of RTE Flow action VF. */ @@ -2290,31 +2306,59 @@ ulp_rte_vf_act_handler(const struct rte_flow_action *action_item, /* Update the action properties */ ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_ACT_PORT_TYPE, intf_type); - return ulp_rte_parser_act_port_set(params, ifindex); + return ulp_rte_parser_act_port_set(params, ifindex, + BNXT_ULP_DIR_INVALID); } -/* Function to handle the parsing of RTE Flow action port_id. */ +/* Parse actions PORT_ID, PORT_REPRESENTOR and REPRESENTED_PORT. */ int32_t -ulp_rte_port_id_act_handler(const struct rte_flow_action *act_item, - struct ulp_rte_parser_params *param) +ulp_rte_port_act_handler(const struct rte_flow_action *act_item, + struct ulp_rte_parser_params *param) { - const struct rte_flow_action_port_id *port_id = act_item->conf; + uint32_t ethdev_id; uint32_t ifindex; enum bnxt_ulp_intf_type intf_type; + enum bnxt_ulp_direction_type act_dir; - if (!port_id) { + if (!act_item->conf) { BNXT_TF_DBG(ERR, "ParseErr: Invalid Argument\n"); return BNXT_TF_RC_PARSE_ERR; } - if (port_id->original) { - BNXT_TF_DBG(ERR, - "ParseErr:Portid Original not supported\n"); - return BNXT_TF_RC_PARSE_ERR; + switch (act_item->type) { + case RTE_FLOW_ACTION_TYPE_PORT_ID: { + const struct rte_flow_action_port_id *port_id = act_item->conf; + + if (port_id->original) { + BNXT_TF_DBG(ERR, + "ParseErr:Portid Original not supported\n"); + return BNXT_TF_RC_PARSE_ERR; + } + ethdev_id = port_id->id; + act_dir = BNXT_ULP_DIR_INVALID; + break; + } + case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR: { + const struct rte_flow_action_ethdev *ethdev = act_item->conf; + + ethdev_id = ethdev->port_id; + act_dir = BNXT_ULP_DIR_INGRESS; + break; + } + case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: { + const struct rte_flow_action_ethdev *ethdev = act_item->conf; + + ethdev_id = ethdev->port_id; + act_dir = BNXT_ULP_DIR_EGRESS; + break; + } + default: + BNXT_TF_DBG(ERR, "Unknown port action\n"); + return BNXT_TF_RC_ERROR; } /* Get the port db ifindex */ - if (ulp_port_db_dev_port_to_ulp_index(param->ulp_ctx, port_id->id, + if (ulp_port_db_dev_port_to_ulp_index(param->ulp_ctx, ethdev_id, &ifindex)) { BNXT_TF_DBG(ERR, "Invalid port id\n"); return BNXT_TF_RC_ERROR; @@ -2329,7 +2373,7 @@ ulp_rte_port_id_act_handler(const struct rte_flow_action *act_item, /* Set the action port */ ULP_COMP_FLD_IDX_WR(param, BNXT_ULP_CF_IDX_ACT_PORT_TYPE, intf_type); - return ulp_rte_parser_act_port_set(param, ifindex); + return ulp_rte_parser_act_port_set(param, ifindex, act_dir); } /* Function to handle the parsing of RTE Flow action phy_port. */ diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h index 0acb93946b..e4225d00f8 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h @@ -204,10 +204,10 @@ int32_t ulp_rte_vf_act_handler(const struct rte_flow_action *action_item, struct ulp_rte_parser_params *params); -/* Function to handle the parsing of RTE Flow action port_id. */ +/* Parse actions PORT_ID, PORT_REPRESENTOR and REPRESENTED_PORT. */ int32_t -ulp_rte_port_id_act_handler(const struct rte_flow_action *act_item, - struct ulp_rte_parser_params *params); +ulp_rte_port_act_handler(const struct rte_flow_action *act_item, + struct ulp_rte_parser_params *params); /* Function to handle the parsing of RTE Flow action phy_port. */ int32_t From patchwork Sun Oct 10 14:39:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 100946 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id 8CDE1A0C43; Sun, 10 Oct 2021 16:40:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 184144113F; Sun, 10 Oct 2021 16:40:18 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 85E5740DF8 for ; Sun, 10 Oct 2021 16:40:01 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 3464A7F6DB; Sun, 10 Oct 2021 17:40:01 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 3464A7F6DB DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1633876801; bh=uCiNROpaS+TvBFonTXQ4IYGhlZqo6By8pj0+JsMyMO8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=RbWKpt83dwMcLIPMNJkQXeDrzHTxfk7gnfqgG0aGNTJYp+DwtDlAXAuC0X2/e0LQb JRIjR002UFApPr2iOEIODJODQMO+nGLILy2VNFy+CoLdWGN+gnMNzZs7OmeP8JzvqP vu3TgAPjlFPBk/HZxudlE4Lo9blVWcx+xKcHBbFs= From: Ivan Malov To: dev@dpdk.org Cc: Thomas Monjalon , Ori Kam , Andrew Rybchenko , John Daley , Hyong Youb Kim Date: Sun, 10 Oct 2021 17:39:27 +0300 Message-Id: <20211010143930.4985-10-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211010143930.4985-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211010143930.4985-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 09/12] net/enic: support meta flow actions to overrule destinations X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Andrew Rybchenko Add support for actions PORT_REPRESENTOR and REPRESENTED_PORT based on the existing support for action PORT_ID. Signed-off-by: Andrew Rybchenko Acked-by: Hyong Youb Kim --- drivers/net/enic/enic_fm_flow.c | 93 ++++++++++++++++++++++++++------- 1 file changed, 75 insertions(+), 18 deletions(-) diff --git a/drivers/net/enic/enic_fm_flow.c b/drivers/net/enic/enic_fm_flow.c index cd364ee16b..4092ff1f61 100644 --- a/drivers/net/enic/enic_fm_flow.c +++ b/drivers/net/enic/enic_fm_flow.c @@ -1242,6 +1242,35 @@ vf_egress_port_id_action(struct enic_flowman *fm, return 0; } +static int +enic_fm_check_transfer_dst(struct enic *enic, uint16_t dst_port_id, + struct rte_eth_dev **dst_dev, + struct rte_flow_error *error) +{ + struct rte_eth_dev *dev; + + ENICPMD_LOG(DEBUG, "port id %u", dst_port_id); + if (!rte_eth_dev_is_valid_port(dst_port_id)) { + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, + NULL, "invalid port_id"); + } + dev = &rte_eth_devices[dst_port_id]; + if (!dev_is_enic(dev)) { + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, + NULL, "port_id is not enic"); + } + if (enic->switch_domain_id != pmd_priv(dev)->switch_domain_id) { + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, + NULL, "destination and source ports are not in the same switch domain"); + } + + *dst_dev = dev; + return 0; +} + /* Translate flow actions to flowman TCAM entry actions */ static int enic_fm_copy_action(struct enic_flowman *fm, @@ -1446,24 +1475,10 @@ enic_fm_copy_action(struct enic_flowman *fm, vnic_h = enic->fm_vnic_handle; /* This port */ break; } - ENICPMD_LOG(DEBUG, "port id %u", port->id); - if (!rte_eth_dev_is_valid_port(port->id)) { - return rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_ACTION, - NULL, "invalid port_id"); - } - dev = &rte_eth_devices[port->id]; - if (!dev_is_enic(dev)) { - return rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_ACTION, - NULL, "port_id is not enic"); - } - if (enic->switch_domain_id != - pmd_priv(dev)->switch_domain_id) { - return rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_ACTION, - NULL, "destination and source ports are not in the same switch domain"); - } + ret = enic_fm_check_transfer_dst(enic, port->id, &dev, + error); + if (ret) + return ret; vnic_h = pmd_priv(dev)->fm_vnic_handle; overlap |= PORT_ID; /* @@ -1560,6 +1575,48 @@ enic_fm_copy_action(struct enic_flowman *fm, ovlan |= rte_be_to_cpu_16(vid->vlan_vid); break; } + case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR: { + const struct rte_flow_action_ethdev *ethdev; + struct rte_eth_dev *dev; + + ethdev = actions->conf; + ret = enic_fm_check_transfer_dst(enic, ethdev->port_id, + &dev, error); + if (ret) + return ret; + vnic_h = pmd_priv(dev)->fm_vnic_handle; + overlap |= PORT_ID; + /* + * Action PORT_REPRESENTOR implies ingress destination. + * Noting to do. We add an implicit stree at the + * end if needed. + */ + ingress = 1; + break; + } + case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: { + const struct rte_flow_action_ethdev *ethdev; + struct rte_eth_dev *dev; + + if (overlap & PORT_ID) { + ENICPMD_LOG(DEBUG, "cannot have multiple egress PORT_ID actions"); + goto unsupported; + } + ethdev = actions->conf; + ret = enic_fm_check_transfer_dst(enic, ethdev->port_id, + &dev, error); + if (ret) + return ret; + vnic_h = pmd_priv(dev)->fm_vnic_handle; + overlap |= PORT_ID; + /* Action REPRESENTED_PORT: always egress destination */ + ingress = 0; + ret = vf_egress_port_id_action(fm, dev, vnic_h, &fm_op, + error); + if (ret) + return ret; + break; + } default: goto unsupported; } From patchwork Sun Oct 10 14:39:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 100947 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id D033EA0C43; Sun, 10 Oct 2021 16:41:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 64A9041147; Sun, 10 Oct 2021 16:40:19 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id BF9D6410E1 for ; Sun, 10 Oct 2021 16:40:01 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 709487F6DD; Sun, 10 Oct 2021 17:40:01 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 709487F6DD DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1633876801; bh=pwNPN6a/Vv4OwTKXX6MVzdlmL53XvNGEPl3v0vE+PNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LF4pBwzERr1RDkv8oLZjTuTF0qMTJl5RCs8ugO55RPtsldVOMWxRDhKn3T5gJUR/e odrBGjZs1190/QJNaMKJCK7aI5t1JHHugoCEJQHKJIZA5JH7hW/P7fkt8PtVM2Fz+P +kSa43h7qdaDiGjeJ6IYKX4PoQS7I2lTJzJgfXEg= From: Ivan Malov To: dev@dpdk.org Cc: Thomas Monjalon , Ori Kam , Andrew Rybchenko , Matan Azrad , Viacheslav Ovsiienko Date: Sun, 10 Oct 2021 17:39:28 +0300 Message-Id: <20211010143930.4985-11-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211010143930.4985-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211010143930.4985-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 10/12] net/mlx5: support represented port flow action X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Andrew Rybchenko Semantics of the existing support for action PORT_ID suggests that support for equal action REPRESENTED_PORT be implemented. Helper functions keep port_id suffix since action MLX5_FLOW_ACTION_PORT_ID is still used internally. Signed-off-by: Andrew Rybchenko --- doc/guides/nics/mlx5.rst | 4 +-- drivers/net/mlx5/mlx5_flow_dv.c | 62 ++++++++++++++++++++++++++------- 2 files changed, 52 insertions(+), 14 deletions(-) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index bae73f42d8..b76e979f47 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -431,8 +431,8 @@ Limitations - yellow: NULL or END. - RED: DROP / END. - The only supported meter policy actions: - - green: QUEUE, RSS, PORT_ID, JUMP, DROP, MARK and SET_TAG. - - yellow: QUEUE, RSS, PORT_ID, JUMP, DROP, MARK and SET_TAG. + - green: QUEUE, RSS, PORT_ID, REPRESENTED_PORT, JUMP, DROP, MARK and SET_TAG. + - yellow: QUEUE, RSS, PORT_ID, REPRESENTED_PORT, JUMP, DROP, MARK and SET_TAG. - RED: must be DROP. - Policy actions of RSS for green and yellow should have the same configuration except queues. - meter profile packet mode is supported. diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index c6370cd1d6..835cc5018c 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -5048,14 +5048,14 @@ flow_dv_validate_action_jump(struct rte_eth_dev *dev, } /* - * Validate the port_id action. + * Validate action PORT_ID / REPRESENTED_PORT. * * @param[in] dev * Pointer to rte_eth_dev structure. * @param[in] action_flags * Bit-fields that holds the actions detected until now. * @param[in] action - * Port_id RTE action structure. + * PORT_ID / REPRESENTED_PORT action structure. * @param[in] attr * Attributes of flow that includes this action. * @param[out] error @@ -5072,6 +5072,7 @@ flow_dv_validate_action_port_id(struct rte_eth_dev *dev, struct rte_flow_error *error) { const struct rte_flow_action_port_id *port_id; + const struct rte_flow_action_ethdev *ethdev; struct mlx5_priv *act_priv; struct mlx5_priv *dev_priv; uint16_t port; @@ -5080,13 +5081,13 @@ flow_dv_validate_action_port_id(struct rte_eth_dev *dev, return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, - "port id action is valid in transfer" + "port action is valid in transfer" " mode only"); if (!action || !action->conf) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION_CONF, NULL, - "port id action parameters must be" + "port action parameters must be" " specified"); if (action_flags & (MLX5_FLOW_FATE_ACTIONS | MLX5_FLOW_FATE_ESWITCH_ACTIONS)) @@ -5100,13 +5101,26 @@ flow_dv_validate_action_port_id(struct rte_eth_dev *dev, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, "failed to obtain E-Switch info"); - port_id = action->conf; - port = port_id->original ? dev->data->port_id : port_id->id; + switch (action->type) { + case RTE_FLOW_ACTION_TYPE_PORT_ID: + port_id = action->conf; + port = port_id->original ? dev->data->port_id : port_id->id; + break; + case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: + ethdev = action->conf; + port = ethdev->port_id; + break; + default: + return rte_flow_error_set + (error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, action, + "unknown E-Switch action"); + } act_priv = mlx5_port_to_eswitch_info(port, false); if (!act_priv) return rte_flow_error_set (error, rte_errno, - RTE_FLOW_ERROR_TYPE_ACTION_CONF, port_id, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, action->conf, "failed to obtain E-Switch port id for port"); if (act_priv->domain_id != dev_priv->domain_id) return rte_flow_error_set @@ -5669,6 +5683,7 @@ flow_dv_validate_action_sample(uint64_t *action_flags, ++actions_n; break; case RTE_FLOW_ACTION_TYPE_PORT_ID: + case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: ret = flow_dv_validate_action_port_id(dev, sub_action_flags, act, @@ -7296,6 +7311,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, case RTE_FLOW_ACTION_TYPE_VOID: break; case RTE_FLOW_ACTION_TYPE_PORT_ID: + case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: ret = flow_dv_validate_action_port_id(dev, action_flags, actions, @@ -10770,12 +10786,12 @@ flow_dv_tag_release(struct rte_eth_dev *dev, } /** - * Translate port ID action to vport. + * Translate action PORT_ID / REPRESENTED_PORT to vport. * * @param[in] dev * Pointer to rte_eth_dev structure. * @param[in] action - * Pointer to the port ID action. + * Pointer to action PORT_ID / REPRESENTED_PORT. * @param[out] dst_port_id * The target port ID. * @param[out] error @@ -10792,10 +10808,28 @@ flow_dv_translate_action_port_id(struct rte_eth_dev *dev, { uint32_t port; struct mlx5_priv *priv; - const struct rte_flow_action_port_id *conf = - (const struct rte_flow_action_port_id *)action->conf; - port = conf->original ? dev->data->port_id : conf->id; + switch (action->type) { + case RTE_FLOW_ACTION_TYPE_PORT_ID: { + const struct rte_flow_action_port_id *conf; + + conf = (const struct rte_flow_action_port_id *)action->conf; + port = conf->original ? dev->data->port_id : conf->id; + break; + } + case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: { + const struct rte_flow_action_ethdev *ethdev; + + ethdev = (const struct rte_flow_action_ethdev *)action->conf; + port = ethdev->port_id; + break; + } + default: + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, action, + "unknown E-Switch action"); + } + priv = mlx5_port_to_eswitch_info(port, false); if (!priv) return rte_flow_error_set(error, -rte_errno, @@ -11634,6 +11668,7 @@ flow_dv_translate_action_sample(struct rte_eth_dev *dev, break; } case RTE_FLOW_ACTION_TYPE_PORT_ID: + case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: { struct mlx5_flow_dv_port_id_action_resource port_id_resource; @@ -12714,6 +12749,7 @@ flow_dv_translate(struct rte_eth_dev *dev, case RTE_FLOW_ACTION_TYPE_VOID: break; case RTE_FLOW_ACTION_TYPE_PORT_ID: + case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: if (flow_dv_translate_action_port_id(dev, action, &port_id, error)) return -rte_errno; @@ -15475,6 +15511,7 @@ __flow_dv_create_domain_policy_acts(struct rte_eth_dev *dev, break; } case RTE_FLOW_ACTION_TYPE_PORT_ID: + case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: { struct mlx5_flow_dv_port_id_action_resource port_id_resource; @@ -17683,6 +17720,7 @@ flow_dv_validate_mtr_policy_acts(struct rte_eth_dev *dev, NULL, "too many actions"); switch (act->type) { case RTE_FLOW_ACTION_TYPE_PORT_ID: + case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: if (!priv->config.dv_esw_en) return -rte_mtr_error_set(error, ENOTSUP, From patchwork Sun Oct 10 14:39:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 100948 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id 6D4C1A0C43; Sun, 10 Oct 2021 16:41:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 934A84114D; Sun, 10 Oct 2021 16:40:20 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id E5B2140DF8 for ; Sun, 10 Oct 2021 16:40:01 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id AF01A7F6DE; Sun, 10 Oct 2021 17:40:01 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru AF01A7F6DE DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1633876801; bh=ntsKNuJ0W1I42ZxkNcKCrKMzA+dlyZEsFdIA3McueII=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=tAdYx695WguOWo3guOtysJYJ3XCztNOa/sn5Vn1+rheHqD8/8IiMBQlD1xD2ow1rT kLlFkGv3OtzfYQMSzOjZNmmsVjSL51Gs7Nh7tGXmIis6dscYK2UdbTLYv2R3SwtGBQ d9Cng3CI5dYQeKjqHnxdiigJqP8pgFtcVoncDGak= From: Ivan Malov To: dev@dpdk.org Cc: Thomas Monjalon , Ori Kam , Andrew Rybchenko , Jerin Jacob , Nithin Dabilpuram , Kiran Kumar K Date: Sun, 10 Oct 2021 17:39:29 +0300 Message-Id: <20211010143930.4985-12-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211010143930.4985-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211010143930.4985-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 11/12] net/octeontx2: support port representor flow action X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Andrew Rybchenko Action PORT_ID implementation assumes ingress only. Its semantics suggests that support for equal action PORT_REPRESENTOR be added. Signed-off-by: Andrew Rybchenko --- doc/guides/nics/octeontx2.rst | 5 ++++- drivers/net/octeontx2/otx2_flow_parse.c | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/doc/guides/nics/octeontx2.rst b/doc/guides/nics/octeontx2.rst index e35c8116f7..eae32f0afe 100644 --- a/doc/guides/nics/octeontx2.rst +++ b/doc/guides/nics/octeontx2.rst @@ -403,10 +403,13 @@ Actions: +----+-----------------------------------------+ | 12 | RTE_FLOW_ACTION_TYPE_PORT_ID | +----+-----------------------------------------+ + | 13 | RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR | + +----+-----------------------------------------+ .. note:: - ``RTE_FLOW_ACTION_TYPE_PORT_ID`` is only supported between PF and its VFs. + ``RTE_FLOW_ACTION_TYPE_PORT_ID``, ``RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR`` + are only supported between PF and its VFs. .. _table_octeontx2_supported_egress_action_types: diff --git a/drivers/net/octeontx2/otx2_flow_parse.c b/drivers/net/octeontx2/otx2_flow_parse.c index 63a33142a5..890c6d0719 100644 --- a/drivers/net/octeontx2/otx2_flow_parse.c +++ b/drivers/net/octeontx2/otx2_flow_parse.c @@ -900,7 +900,6 @@ otx2_flow_parse_actions(struct rte_eth_dev *dev, { struct otx2_eth_dev *hw = dev->data->dev_private; struct otx2_npc_flow_info *npc = &hw->npc_flow; - const struct rte_flow_action_port_id *port_act; const struct rte_flow_action_count *act_count; const struct rte_flow_action_mark *act_mark; const struct rte_flow_action_queue *act_q; @@ -987,9 +986,18 @@ otx2_flow_parse_actions(struct rte_eth_dev *dev, break; case RTE_FLOW_ACTION_TYPE_PORT_ID: - port_act = (const struct rte_flow_action_port_id *) - actions->conf; - port_id = port_act->id; + case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR: + if (actions->type == RTE_FLOW_ACTION_TYPE_PORT_ID) { + const struct rte_flow_action_port_id *port_act; + + port_act = actions->conf; + port_id = port_act->id; + } else { + const struct rte_flow_action_ethdev *ethdev_act; + + ethdev_act = actions->conf; + port_id = ethdev_act->port_id; + } if (rte_eth_dev_get_name_by_port(port_id, if_name)) { errmsg = "Name not found for output port id"; errcode = EINVAL; From patchwork Sun Oct 10 14:39:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 100949 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id 7A81CA0C43; Sun, 10 Oct 2021 16:41:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 122C741152; Sun, 10 Oct 2021 16:40:22 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 26EBF410E1 for ; Sun, 10 Oct 2021 16:40:02 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id EC8D87F6DF; Sun, 10 Oct 2021 17:40:01 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru EC8D87F6DF DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1633876802; bh=1lLta6zQBfHCT+WDgb9+6yhx+W8O8aztOUqe3SjcIpM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=qKU2xnW5C4Z+eckmJooDtIAHQnULWKHysLU/0MWIBN/4XsSv8XZbeirWaNCOkk16o BlhAz4skwA1f1AAWR4WllfqLC1u72vJVm6gVAsLLdxS3/DxQulUdf+Bm3CNnD0gBSS pAv+sX4RVxGp7OC/tyYfJsuU2EXdmj/CEYYAT1nE= From: Ivan Malov To: dev@dpdk.org Cc: Thomas Monjalon , Ori Kam , Andrew Rybchenko Date: Sun, 10 Oct 2021 17:39:30 +0300 Message-Id: <20211010143930.4985-13-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211010143930.4985-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211010143930.4985-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 12/12] net/sfc: support port representor flow item X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Andrew Rybchenko Add support for item PORT_REPRESENTOR which should be used instead of ambiguous item PORT_ID. Signed-off-by: Andrew Rybchenko --- doc/guides/nics/sfc_efx.rst | 2 ++ drivers/net/sfc/sfc_mae.c | 72 +++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index 163bc2533f..9a9710325f 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -190,6 +190,8 @@ Supported actions (***non-transfer*** rules): Supported pattern items (***transfer*** rules): +- PORT_REPRESENTOR (cannot repeat; conflicts with other traffic source items) + - PORT_ID (cannot repeat; conflicts with other traffic source items) - PHY_PORT (cannot repeat; conflicts with other traffic source items) diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c index 4b520bc619..392f6ec098 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -1100,6 +1100,66 @@ sfc_mae_rule_parse_item_port_id(const struct rte_flow_item *item, return 0; } +static int +sfc_mae_rule_parse_item_port_representor(const struct rte_flow_item *item, + struct sfc_flow_parse_ctx *ctx, + struct rte_flow_error *error) +{ + struct sfc_mae_parse_ctx *ctx_mae = ctx->mae; + const struct rte_flow_item_ethdev supp_mask = { + .port_id = 0xffff, + }; + const void *def_mask = &rte_flow_item_ethdev_mask; + const struct rte_flow_item_ethdev *spec = NULL; + const struct rte_flow_item_ethdev *mask = NULL; + efx_mport_sel_t mport_sel; + int rc; + + if (ctx_mae->match_mport_set) { + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ITEM, item, + "Can't handle multiple traffic source items"); + } + + rc = sfc_flow_parse_init(item, + (const void **)&spec, (const void **)&mask, + (const void *)&supp_mask, def_mask, + sizeof(struct rte_flow_item_ethdev), error); + if (rc != 0) + return rc; + + if (mask->port_id != supp_mask.port_id) { + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, item, + "Bad mask in the PORT_REPRESENTOR pattern item"); + } + + /* If "spec" is not set, could be any port ID */ + if (spec == NULL) + return 0; + + rc = sfc_mae_switch_port_by_ethdev( + ctx_mae->sa->mae.switch_domain_id, + spec->port_id, &mport_sel); + if (rc != 0) { + return rte_flow_error_set(error, rc, + RTE_FLOW_ERROR_TYPE_ITEM, item, + "Can't find RTE ethdev by the port ID"); + } + + rc = efx_mae_match_spec_mport_set(ctx_mae->match_spec, + &mport_sel, NULL); + if (rc != 0) { + return rte_flow_error_set(error, rc, + RTE_FLOW_ERROR_TYPE_ITEM, item, + "Failed to set MPORT for the port ID"); + } + + ctx_mae->match_mport_set = B_TRUE; + + return 0; +} + static int sfc_mae_rule_parse_item_phy_port(const struct rte_flow_item *item, struct sfc_flow_parse_ctx *ctx, @@ -1995,6 +2055,18 @@ static const struct sfc_flow_item sfc_flow_items[] = { .ctx_type = SFC_FLOW_PARSE_CTX_MAE, .parse = sfc_mae_rule_parse_item_port_id, }, + { + .type = RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR, + .name = "PORT_REPRESENTOR", + /* + * In terms of RTE flow, this item is a META one, + * and its position in the pattern is don't care. + */ + .prev_layer = SFC_FLOW_ITEM_ANY_LAYER, + .layer = SFC_FLOW_ITEM_ANY_LAYER, + .ctx_type = SFC_FLOW_PARSE_CTX_MAE, + .parse = sfc_mae_rule_parse_item_port_representor, + }, { .type = RTE_FLOW_ITEM_TYPE_PHY_PORT, .name = "PHY_PORT",