From patchwork Wed Oct 13 17:34:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 101440 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 3A4C3A0C52; Wed, 13 Oct 2021 19:35:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2CDFC41143; Wed, 13 Oct 2021 19:35:04 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 18EC941125 for ; Wed, 13 Oct 2021 19:35:02 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.99]) (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 B21997F5FD; Wed, 13 Oct 2021 20:35:01 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru B21997F5FD DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1634146501; bh=DH5TrvsF5OKBCQ+5ILz3wLZlQxj8YGdvej+uYl8CZPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=AZwVn14n6KTn8fd1vj9krqf2SOuKFRvoCZLvMF8ZXARdVUaYqFR8inPfQDQ/f2T1J aSsm4MvagEtZZRjjJF+ijdK+roTRWoMyKoxfyBChK3oBNZYhgGxRVRpTdwtIOspy2G T7zNclhAIy6FMThORg5m0BYwr86saoIs0ka9ohAw= From: Ivan Malov To: dev@dpdk.org Cc: Ferruh Yigit , Thomas Monjalon , Ori Kam , Andrew Rybchenko , Xiaoyun Li Date: Wed, 13 Oct 2021 20:34:37 +0300 Message-Id: <20211013173448.28621-2-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211013173448.28621-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211013173448.28621-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v7 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/nics/features/default.ini | 1 + 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 ++++++++++ 7 files changed, 121 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 0b5856c7d5..5c480db91d 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, @@ -999,6 +1001,7 @@ static const enum index next_item[] = { ITEM_GENEVE_OPT, ITEM_INTEGRITY, ITEM_CONNTRACK, + ITEM_PORT_REPRESENTOR, END_SET, ZERO, }; @@ -1367,6 +1370,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, @@ -3606,6 +3615,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", @@ -8333,6 +8357,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/nics/features/default.ini b/doc/guides/nics/features/default.ini index d473b94091..560a13c1ce 100644 --- a/doc/guides/nics/features/default.ini +++ b/doc/guides/nics/features/default.ini @@ -120,6 +120,7 @@ pf = pfcp = phy_port = port_id = +port_representor = pppoed = pppoes = pppoe_proto_id = diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 3cb014c1fa..d194640469 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 d5c762df62..07f9d39a5b 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -252,6 +252,8 @@ API Changes the crypto/security operation. This field will be used to communicate events such as soft expiry with IPsec in lookaside mode. +* ethdev: Added item ``PORT_REPRESENTOR`` to flow API. + ABI Changes ----------- diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index a0efb7d0b0..90765f9090 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3801,6 +3801,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 5f87851f8c..1e3ef77ead 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 Wed Oct 13 17:34:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 101441 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 1CC3FA0C52; Wed, 13 Oct 2021 19:35:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 48BFD41166; Wed, 13 Oct 2021 19:35:09 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 502C5410E4 for ; Wed, 13 Oct 2021 19:35:02 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.99]) (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 055077F6B9; Wed, 13 Oct 2021 20:35:02 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 055077F6B9 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1634146502; bh=LpBSc4Vv7yfKb/SjoJTkYkT2OalbCJ77Ma6WamSv95A=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=uNG+6JcIjAeO5VAtbzCr5MzuaimiluaOZ6SOxAEodVuYemKD8gSHQC+h5K6h+6mnF G635S9w915SSm86iFc04Ie47Ra/52gMgtI1IkhzcOdNGDaWsTaA+UMR3VV7CKGenEa BAu6DR8ftdbXw4PTlj2OUDj4lEyQgNzabOEFrKi8= From: Ivan Malov To: dev@dpdk.org Cc: Ferruh Yigit , Thomas Monjalon , Ori Kam , Andrew Rybchenko , Xiaoyun Li Date: Wed, 13 Oct 2021 20:34:38 +0300 Message-Id: <20211013173448.28621-3-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211013173448.28621-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211013173448.28621-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v7 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/nics/features/default.ini | 1 + 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 +++++- 7 files changed, 91 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 5c480db91d..354f0fb2d7 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, @@ -1002,6 +1004,7 @@ static const enum index next_item[] = { ITEM_INTEGRITY, ITEM_CONNTRACK, ITEM_PORT_REPRESENTOR, + ITEM_REPRESENTED_PORT, END_SET, ZERO, }; @@ -1376,6 +1379,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, @@ -3630,6 +3639,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", @@ -8358,6 +8382,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/nics/features/default.ini b/doc/guides/nics/features/default.ini index 560a13c1ce..419bffc66e 100644 --- a/doc/guides/nics/features/default.ini +++ b/doc/guides/nics/features/default.ini @@ -125,6 +125,7 @@ pppoed = pppoes = pppoe_proto_id = raw = +represented_port = sctp = tag = tcp = diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index d194640469..2da286dce8 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 07f9d39a5b..b9f918cab8 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -252,7 +252,7 @@ API Changes the crypto/security operation. This field will be used to communicate events such as soft expiry with IPsec in lookaside mode. -* ethdev: Added item ``PORT_REPRESENTOR`` to flow API. +* ethdev: Added items ``PORT_REPRESENTOR``, ``REPRESENTED_PORT`` to flow API. ABI Changes diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 90765f9090..61669d1d5a 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3805,6 +3805,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 1e3ef77ead..b50c3d38b5 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 Wed Oct 13 17:34:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 101442 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 96347A0C52; Wed, 13 Oct 2021 19:35:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 65C534117C; Wed, 13 Oct 2021 19:35:10 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id A4D7C410E4 for ; Wed, 13 Oct 2021 19:35:02 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.99]) (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 4A5707F6F4; Wed, 13 Oct 2021 20:35:02 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 4A5707F6F4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1634146502; bh=pFwzZoYt3xgOMElsJrCwVaFCNr0yAN+khWZL8h2FjQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=oCSH8jNYW9jMWrBrh61Blze7lTWgiZ/pT+7rluwiZzZ/e+hy2+Pu/ybRJPiSKeeEe ljc6hiq2ReFcRoIhgiLd476MmSFZg1bzbDtrHYUxbr6AV2Sl6Z+gmZAjvZyesw/SDx VCMVCLGM5DVS7jZxWVeJyp4hdRushTfBlBzp2q1w= From: Ivan Malov To: dev@dpdk.org Cc: Ferruh Yigit , Thomas Monjalon , Ori Kam , Andrew Rybchenko , Xiaoyun Li Date: Wed, 13 Oct 2021 20:34:39 +0300 Message-Id: <20211013173448.28621-4-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211013173448.28621-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211013173448.28621-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v7 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/nics/features/default.ini | 1 + 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 +++++++ 7 files changed, 108 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 354f0fb2d7..1496d7a067 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -459,6 +459,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. */ @@ -1451,6 +1453,7 @@ static const enum index next_action[] = { ACTION_MODIFY_FIELD, ACTION_CONNTRACK, ACTION_CONNTRACK_UPDATE, + ACTION_PORT_REPRESENTOR, ZERO, }; @@ -1731,6 +1734,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); @@ -4810,6 +4819,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/nics/features/default.ini b/doc/guides/nics/features/default.ini index 419bffc66e..f7f937ca0a 100644 --- a/doc/guides/nics/features/default.ini +++ b/doc/guides/nics/features/default.ini @@ -169,6 +169,7 @@ passthru = pf = phy_port = port_id = +port_representor = queue = raw_decap = raw_encap = diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 2da286dce8..587ed37c2c 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`` ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -3089,6 +3091,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 b9f918cab8..9a0ab97914 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -252,7 +252,7 @@ API Changes the crypto/security operation. This field will be used to communicate events such as soft expiry with IPsec in lookaside mode. -* ethdev: Added items ``PORT_REPRESENTOR``, ``REPRESENTED_PORT`` to flow API. +* ethdev: Added items ``PORT_REPRESENTOR``, ``REPRESENTED_PORT`` and action ``PORT_REPRESENTOR`` to flow API. ABI Changes diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 61669d1d5a..46b7f07cbc 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -4085,6 +4085,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 b50c3d38b5..56fd4393e5 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -2455,6 +2455,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, }; /** @@ -3200,6 +3207,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 Wed Oct 13 17:34:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 101443 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 E8244A0C52; Wed, 13 Oct 2021 19:35:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7CBD84118E; Wed, 13 Oct 2021 19:35:11 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id E366E410E4 for ; Wed, 13 Oct 2021 19:35:02 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.99]) (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 9006E7F6F8; Wed, 13 Oct 2021 20:35:02 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 9006E7F6F8 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1634146502; bh=50ewFX4Q+YgynxbaaJj5wbkC1pk6bEUuAXIBlnpHcMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=R6JlfvAKB27ke0yUHFhoSmRU3zUg6IyQLduNZpabvaXf2HG+JNy0krYQwLaZT50GJ unzXbUHPYI5zib11qTIJZtibu+6Cr1biDR3u8aPUb5SwUyKDRblyA+2x1Z24MXq462 AOn2K5gFCqnq6mcpu31JVzkicQD1LQEdT/4NNLAQ= From: Ivan Malov To: dev@dpdk.org Cc: Ferruh Yigit , Thomas Monjalon , Ori Kam , Andrew Rybchenko , Xiaoyun Li Date: Wed, 13 Oct 2021 20:34:40 +0300 Message-Id: <20211013173448.28621-5-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211013173448.28621-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211013173448.28621-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v7 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/nics/features/default.ini | 1 + 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 ++++- 7 files changed, 93 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 1496d7a067..d897d0d1d4 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -461,6 +461,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. */ @@ -1454,6 +1456,7 @@ static const enum index next_action[] = { ACTION_CONNTRACK, ACTION_CONNTRACK_UPDATE, ACTION_PORT_REPRESENTOR, + ACTION_REPRESENTED_PORT, ZERO, }; @@ -1740,6 +1743,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); @@ -4836,6 +4845,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/nics/features/default.ini b/doc/guides/nics/features/default.ini index f7f937ca0a..09914b1ad3 100644 --- a/doc/guides/nics/features/default.ini +++ b/doc/guides/nics/features/default.ini @@ -173,6 +173,7 @@ port_representor = queue = raw_decap = raw_encap = +represented_port = rss = sample = security = diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 587ed37c2c..27a17fac58 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 ~~~~~~~ @@ -3145,6 +3147,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 9a0ab97914..6c15afc1e9 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -252,7 +252,7 @@ API Changes the crypto/security operation. This field will be used to communicate events such as soft expiry with IPsec in lookaside mode. -* 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. ABI Changes diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 46b7f07cbc..22ba8f0516 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -4090,6 +4090,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 56fd4393e5..ff32c0a5ee 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -2462,6 +2462,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, }; /** @@ -3212,7 +3220,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 Wed Oct 13 17:34:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 101444 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 EB51AA0C52; Wed, 13 Oct 2021 19:35:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8217941198; Wed, 13 Oct 2021 19:35:12 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 1340841125 for ; Wed, 13 Oct 2021 19:35:03 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.99]) (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 CEB167F6F9; Wed, 13 Oct 2021 20:35:02 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru CEB167F6F9 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1634146502; bh=Z+owkV+j37LAnsZFaoRPn3mqsl/hpAiEYVEI3YCyfS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=W+ujqInyuHhzio4uAzY8p+3oY+p0Ax2sZW4r7oTL+W1YsYvZoizUXaE3NQDppuVFz Pj+Na11dhjzANBHs9rdttaJEvGPywP1J5KW6qwoxyGRI9iurt5aXexEv9SfnaG4fIn P3VSskuQW0lOnSPJarcNF5TnkRqiGD/HGSLaoGOY= From: Ivan Malov To: dev@dpdk.org Cc: Ferruh Yigit , Thomas Monjalon , Ori Kam , Andrew Rybchenko , Ray Kinsella Date: Wed, 13 Oct 2021 20:34:41 +0300 Message-Id: <20211013173448.28621-6-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211013173448.28621-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211013173448.28621-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v7 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 27a17fac58..d7185c49df 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. @@ -1950,6 +1966,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. @@ -1970,6 +1990,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 @@ -1994,6 +2018,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. @@ -2013,6 +2041,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 5853b5988d..25aec56bec 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -113,12 +113,6 @@ Deprecation Notices to support modifying fields larger than 64 bits. In addition, documentation will be updated to clarify byte order. -* 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 @@ -149,6 +143,9 @@ Deprecation Notices consistent with existing outer header checksum status flag naming, which should help in reducing confusion about its usage. +* 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. + * net: The structure ``rte_ipv4_hdr`` will have two unions. The first union is for existing ``version_ihl`` byte and new bitfield for version and IHL. diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst index 6c15afc1e9..75c4f6d018 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -254,6 +254,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. + ABI Changes ----------- diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index ff32c0a5ee..76653105a0 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 @@ -1998,6 +2026,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. * @@ -2006,6 +2038,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. * @@ -2014,6 +2050,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. * @@ -2022,6 +2062,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. @@ -2648,6 +2692,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 @@ -2666,6 +2714,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 @@ -2680,6 +2732,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 Wed Oct 13 17:34:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 101445 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 351FAA0C52; Wed, 13 Oct 2021 19:35:43 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 98EBA411AA; Wed, 13 Oct 2021 19:35:13 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 7304241143 for ; Wed, 13 Oct 2021 19:35:03 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.99]) (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 1B8DD7F6FA; Wed, 13 Oct 2021 20:35:03 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 1B8DD7F6FA DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1634146503; bh=g9fVePOWOYXDiJmAwzt611bNO3nkHSrzHEW3QBzDPvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=KIhaoxImrWfHi08sDJ7r7hauqTxWswZ8j12Rzif4D5GCgPYKIcQFi8506/j/4mZrA hksQORuK3r9UUzp/Pe+Ksebr6tJHmSf+VnNktZSVDF6g1OFC2pSxBfnUEkhoiXA35E UfT0smi7QuhAmY0+OZZaqpPaKVYtEABnX/KRWOws= From: Ivan Malov To: dev@dpdk.org Cc: Ferruh Yigit , Thomas Monjalon , Ori Kam , Andrew Rybchenko , Ray Kinsella Date: Wed, 13 Oct 2021 20:34:42 +0300 Message-Id: <20211013173448.28621-7-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211013173448.28621-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211013173448.28621-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v7 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 Acked-by: Viacheslav Ovsiienko --- 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 d7185c49df..5957b8df4f 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 25aec56bec..ef2e2c1141 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -113,11 +113,6 @@ Deprecation Notices to support modifying fields larger than 64 bits. In addition, documentation will be updated to clarify byte order. -* 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 @@ -146,6 +141,10 @@ 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. + * net: The structure ``rte_ipv4_hdr`` will have two unions. The first union is for existing ``version_ihl`` byte and new bitfield for version and IHL. diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst index 75c4f6d018..45c019eb04 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -257,6 +257,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``. + ABI Changes ----------- diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 76653105a0..7e7b4bce5b 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 Wed Oct 13 17:34:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 101446 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 557DEA0C52; Wed, 13 Oct 2021 19:35:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AFE91411B5; Wed, 13 Oct 2021 19:35:14 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id B865641143 for ; Wed, 13 Oct 2021 19:35:03 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.99]) (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 5D0C57F6FB; Wed, 13 Oct 2021 20:35:03 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 5D0C57F6FB DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1634146503; bh=x47iZffuDkRXkt6NzJOr1g1by1jz1Ju30yPvCtoUqzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=THhdriuPIZoUFUPzSM67fD/1BcEamy3bF19BahdoZKOiIK18kZM3rJqM8/lwJCdqF p1VCTso81SVcRF9rrh3bVYMAbT0J7QOwQlDAVvcTrEDtAixyz63boyFpummg84FC5C u6ErUGNHseW3VfpxHcdnI1VveSSrIg49oZ+83PR8= From: Ivan Malov To: dev@dpdk.org Cc: Ferruh Yigit , Thomas Monjalon , Ori Kam , Andrew Rybchenko , Ajit Khaparde , Somnath Kotur Date: Wed, 13 Oct 2021 20:34:43 +0300 Message-Id: <20211013173448.28621-8-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211013173448.28621-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211013173448.28621-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v7 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 --- doc/guides/nics/features/bnxt.ini | 2 + 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 +- 4 files changed, 72 insertions(+), 23 deletions(-) diff --git a/doc/guides/nics/features/bnxt.ini b/doc/guides/nics/features/bnxt.ini index 60cc8bfa15..c0956497b5 100644 --- a/doc/guides/nics/features/bnxt.ini +++ b/doc/guides/nics/features/bnxt.ini @@ -64,6 +64,8 @@ icmp6 = Y pf = Y phy_port = Y port_id = Y +port_representor = Y +represented_port = Y tcp = Y udp = Y vf = Y 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 f1e270af8b..efda522c3e 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 Wed Oct 13 17:34:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 101447 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 9CE51A0C52; Wed, 13 Oct 2021 19:35:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BB61C411C1; Wed, 13 Oct 2021 19:35:15 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id DE22941147 for ; Wed, 13 Oct 2021 19:35:03 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.99]) (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 A236A7F6FC; Wed, 13 Oct 2021 20:35:03 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru A236A7F6FC DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1634146503; bh=+ijFr/Yuh/ohm/sP9/BjIyn+zyC3KGib4QQBBM9xFG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=S5tetcE/pHbyPbMPkGHF0OgSTZZ0pHu0BUJF9TM3viOHE1qzx2O5L+TDvAyUwO2OY cfAEAktek31IiJUx+9YkELodRn8uL0fkrzoMEzqZMMss1x99zKBzsV+UanY98zyVtx VlOk95BPwOhXOb1EMzUcMuHlLvG/lzMt2NygwfRw= From: Ivan Malov To: dev@dpdk.org Cc: Ferruh Yigit , Thomas Monjalon , Ori Kam , Andrew Rybchenko , Ajit Khaparde , Somnath Kotur Date: Wed, 13 Oct 2021 20:34:44 +0300 Message-Id: <20211013173448.28621-9-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211013173448.28621-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211013173448.28621-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v7 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 --- doc/guides/nics/features/bnxt.ini | 2 + 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 +- 4 files changed, 79 insertions(+), 25 deletions(-) diff --git a/doc/guides/nics/features/bnxt.ini b/doc/guides/nics/features/bnxt.ini index c0956497b5..c0e8ecb82b 100644 --- a/doc/guides/nics/features/bnxt.ini +++ b/doc/guides/nics/features/bnxt.ini @@ -85,6 +85,8 @@ of_set_vlan_vid = Y pf = Y phy_port = Y port_id = Y +port_representor = Y +represented_port = Y rss = Y sample = Y set_ipv4_dst = Y 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 efda522c3e..40da953f06 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); @@ -2163,7 +2164,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; @@ -2173,8 +2175,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; @@ -2185,9 +2192,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; @@ -2234,7 +2249,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. */ @@ -2285,31 +2301,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; @@ -2324,7 +2368,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 Wed Oct 13 17:34:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 101448 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 7D3FBA0C52; Wed, 13 Oct 2021 19:36:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C853B411CE; Wed, 13 Oct 2021 19:35:16 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 4A43441166 for ; Wed, 13 Oct 2021 19:35:04 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.99]) (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 EA3477F6FD; Wed, 13 Oct 2021 20:35:03 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru EA3477F6FD DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1634146504; bh=tgFrB5XaIG7OLv4R1Eyu1Ibwh8tRdnWJW/kmPt6sTeA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=oYjfvOqPQuTMaRiVu/ltKRlUpRE31w/Zc58oWajco1STy52pPwpuHh5wg4j3b7RgG B1vz4ILgGd7IT8u09zJxvlhvf64MmNIV/Xkv5XnPcu0M4rTCPLT/lsap737YMbCTRO fe0z0hFUAN1sb+NQ2A38m5YmK/PCAVGEZgZmOciQ= From: Ivan Malov To: dev@dpdk.org Cc: Ferruh Yigit , Thomas Monjalon , Ori Kam , Andrew Rybchenko , Hyong Youb Kim , John Daley Date: Wed, 13 Oct 2021 20:34:45 +0300 Message-Id: <20211013173448.28621-10-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211013173448.28621-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211013173448.28621-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v7 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 --- doc/guides/nics/features/enic.ini | 2 + drivers/net/enic/enic_fm_flow.c | 93 +++++++++++++++++++++++++------ 2 files changed, 77 insertions(+), 18 deletions(-) diff --git a/doc/guides/nics/features/enic.ini b/doc/guides/nics/features/enic.ini index a582616c07..ecff6c5f26 100644 --- a/doc/guides/nics/features/enic.ini +++ b/doc/guides/nics/features/enic.ini @@ -62,6 +62,8 @@ of_set_vlan_pcp = Y of_set_vlan_vid = Y passthru = Y port_id = Y +port_representor = Y +represented_port = Y queue = Y rss = Y vxlan_decap = Y 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 Wed Oct 13 17:34:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 101449 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 0610DA0C52; Wed, 13 Oct 2021 19:36:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D7C5D411D7; Wed, 13 Oct 2021 19:35:17 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 882BD41166 for ; Wed, 13 Oct 2021 19:35:04 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.99]) (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 3A2637F6FE; Wed, 13 Oct 2021 20:35:04 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 3A2637F6FE DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1634146504; bh=r8S5y/fL14EFtOxm704tqF7C5ko8PQFaf2ERBCaSXSc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nlotNymGNqAHNIHmpzG2HTASekynCnL8Js+9eboGAaf1jtZ+LC8yGyi7R9dLa6ice vhqEPYZkGLKgwRXN9mQ76wMFWO4KuqaQ0ZklYtufStWWra8Z0R4MFP2oHcxPP183DR Nl6xKz0t5tE0xe4Xv9jg/T9Cpjh3bmWw7HB09W2U= From: Ivan Malov To: dev@dpdk.org Cc: Ferruh Yigit , Thomas Monjalon , Ori Kam , Andrew Rybchenko , Matan Azrad , Viacheslav Ovsiienko Date: Wed, 13 Oct 2021 20:34:46 +0300 Message-Id: <20211013173448.28621-11-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211013173448.28621-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211013173448.28621-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v7 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/features/mlx5.ini | 1 + doc/guides/nics/mlx5.rst | 4 +- drivers/net/mlx5/mlx5_flow_dv.c | 64 +++++++++++++++++++++++++------ 3 files changed, 55 insertions(+), 14 deletions(-) diff --git a/doc/guides/nics/features/mlx5.ini b/doc/guides/nics/features/mlx5.ini index f01abd4231..0e72021d4a 100644 --- a/doc/guides/nics/features/mlx5.ini +++ b/doc/guides/nics/features/mlx5.ini @@ -107,6 +107,7 @@ port_id = Y queue = Y raw_decap = Y raw_encap = Y +represented_port = Y rss = I sample = Y set_ipv4_dscp = Y 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 d5d9fed6c4..1fd1bd4989 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -5028,14 +5028,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 @@ -5052,6 +5052,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; @@ -5060,13 +5061,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)) @@ -5080,13 +5081,27 @@ 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: + MLX5_ASSERT(false); + 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 @@ -5648,6 +5663,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, @@ -7210,6 +7226,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, @@ -10685,12 +10702,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 @@ -10707,10 +10724,29 @@ 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: + MLX5_ASSERT(false); + 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, @@ -11547,6 +11583,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; @@ -12627,6 +12664,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; @@ -15387,6 +15425,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; @@ -17583,6 +17622,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 Wed Oct 13 17:34:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 101450 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 9B052A0C52; Wed, 13 Oct 2021 19:36:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DE0BA411E0; Wed, 13 Oct 2021 19:35:18 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id B1A234116B for ; Wed, 13 Oct 2021 19:35:04 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.99]) (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 7BE897F700; Wed, 13 Oct 2021 20:35:04 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 7BE897F700 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1634146504; bh=yKrcwdyqRII4g37e/0OSRDAodSmJLQviI1gSTB8rCLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mn3EGY43rUGr7CSmK91SG9ZXkxa5Ze5nl9KAnglaMWzQ6XOBBzFeLYDN9ji+WtgnD yvAlaxnNOSi1nYruRgfK8y4U21hgaEvdgc4zVHpYOAm1hXHaHGtxUw0auo7KUw04+U v67tyxTOmOfspcEjpmeyoZQcNuYYIyPIN+LHJ6nA= From: Ivan Malov To: dev@dpdk.org Cc: Ferruh Yigit , Thomas Monjalon , Ori Kam , Andrew Rybchenko , Jerin Jacob , Nithin Dabilpuram , Kiran Kumar K Date: Wed, 13 Oct 2021 20:34:47 +0300 Message-Id: <20211013173448.28621-12-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211013173448.28621-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211013173448.28621-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v7 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 Acked-by: Kiran Kumar Kokkilagadda --- doc/guides/nics/features/octeontx2.ini | 1 + doc/guides/nics/octeontx2.rst | 5 ++++- drivers/net/octeontx2/otx2_flow_parse.c | 16 ++++++++++++---- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/doc/guides/nics/features/octeontx2.ini b/doc/guides/nics/features/octeontx2.ini index fa32bc7890..e0277988d4 100644 --- a/doc/guides/nics/features/octeontx2.ini +++ b/doc/guides/nics/features/octeontx2.ini @@ -91,6 +91,7 @@ of_set_vlan_pcp = Y of_set_vlan_vid = Y pf = Y port_id = Y +port_representor = Y queue = Y rss = Y security = Y 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 30a232f033..79b92fda8a 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_mark *act_mark; const struct rte_flow_action_queue *act_q; const struct rte_flow_action_vf *vf_act; @@ -977,9 +976,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 Wed Oct 13 17:34:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 101451 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 39EA7A0C52; Wed, 13 Oct 2021 19:36:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 05A01411E8; Wed, 13 Oct 2021 19:35:20 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 1326241166 for ; Wed, 13 Oct 2021 19:35:05 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.123.99]) (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 C0F897F519; Wed, 13 Oct 2021 20:35:04 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru C0F897F519 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1634146504; bh=ED82LMtZx10I2tOxy1MhCmi3hoSZyd/5WN6/D+JmMNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kGLQaELW6nLx5p3wcoglscNqXR/ptRePYrn1sbqqM0P1nAJQe0vm8d0DovK/ASAt2 gpwbldlQCXgyDaS/PMyxa78YWwqXC2rpVERlHfSaQQeQ0MHWVAYHslRXr2gnZKsZob Jy/RRx7vvvMH03ltw0t7c7rQeDe5Yg5fgvb7qoTU= From: Ivan Malov To: dev@dpdk.org Cc: Ferruh Yigit , Thomas Monjalon , Ori Kam , Andrew Rybchenko Date: Wed, 13 Oct 2021 20:34:48 +0300 Message-Id: <20211013173448.28621-13-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211013173448.28621-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211013173448.28621-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v7 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/features/sfc.ini | 1 + doc/guides/nics/sfc_efx.rst | 2 + drivers/net/sfc/sfc_mae.c | 72 ++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+) diff --git a/doc/guides/nics/features/sfc.ini b/doc/guides/nics/features/sfc.ini index 013fcd7086..6945f321f3 100644 --- a/doc/guides/nics/features/sfc.ini +++ b/doc/guides/nics/features/sfc.ini @@ -50,6 +50,7 @@ nvgre = Y pf = Y phy_port = Y port_id = Y +port_representor = Y pppoed = Y pppoes = Y tcp = Y diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index 4719031508..843c24991c 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -192,6 +192,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 ca91627d2f..4c5c7b776f 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -1284,6 +1284,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, @@ -2211,6 +2271,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",