From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8C923A0C47; Wed, 13 Oct 2021 19:03:17 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E9F834116A; Wed, 13 Oct 2021 19:03:00 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id F33B84067C for ; Wed, 13 Oct 2021 19:02:49 +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 AA6257F6F8; Wed, 13 Oct 2021 20:02:49 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru AA6257F6F8 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1634144569; bh=8nAh0y2m5cREwxXLFdM/XR89Yk4JxM1lR9naN0C5TIo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Xx0myOuexIopegbw/fthSfhe2m+hHSDWAsmruKaGRCd1ec/7uQyJAmLXtNIlBJPyG z5LMiLoarxfOf0ZguN6CvrPEj1H6kBDVyykf8DSR6vnIAqHR0RrGBA3zYJI0o7+AMu km07EC8185kN3YyS3zHXCAIY4M34te0dpMzWs3Ys= From: Ivan Malov To: dev@dpdk.org Cc: Ferruh Yigit , Thomas Monjalon , Ori Kam , Andrew Rybchenko , Xiaoyun Li Date: Wed, 13 Oct 2021 20:02:25 +0300 Message-Id: <20211013170233.25876-5-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211013170233.25876-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211013170233.25876-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v6 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 0868c14a4c..3abac9d460 100644 --- a/doc/guides/nics/features/default.ini +++ b/doc/guides/nics/features/default.ini @@ -192,3 +192,4 @@ vf = vxlan_decap = vxlan_encap = port_representor = +represented_port = 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 */ -- 2.20.1