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 431F1A0C41; Sun, 10 Oct 2021 02:05:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9FDE0410E1; Sun, 10 Oct 2021 02:05:24 +0200 (CEST) Received: from shelob.oktetlabs.ru (unknown [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 570894003C for ; Sun, 10 Oct 2021 02:05:18 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.122.166]) (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 C43AF7F6BF; Sun, 10 Oct 2021 03:05:11 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru C43AF7F6BF DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1633824311; bh=hZddYs0eNLnZUwkPj8JAaysH58Bzzb0pRF9KuZf0gNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=AfNjnbAobLeMuh3IwI0g9BStgd1tRjVDbHAW4pZ71VnJGecZC3FYkf4peQL5dk8F9 dWYJuiUyz2v/VYfQY194vJgsmdrAbZr7lqiVkYxggWzLoj2hnKvKDL/+TLVb+5SxIj czHeUqgQs2LWK3AhS2eQDVjUbilgcTmG4MWlxTT4= From: Ivan Malov To: dev@dpdk.org Cc: Thomas Monjalon , Ori Kam , Xiaoyun Li , Ferruh Yigit , Andrew Rybchenko Date: Sun, 10 Oct 2021 03:04:53 +0300 Message-Id: <20211010000503.28712-3-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211010000503.28712-1-ivan.malov@oktetlabs.ru> References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211010000503.28712-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 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 --- app/test-pmd/cmdline_flow.c | 25 +++++++++++ doc/guides/prog_guide/rte_flow.rst | 46 +++++++++++++++++++++ doc/guides/rel_notes/release_21_11.rst | 2 +- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 5 +++ lib/ethdev/rte_flow.c | 1 + lib/ethdev/rte_flow.h | 13 +++++- 6 files changed, 90 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index a912a8d815..68698d805d 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -308,6 +308,8 @@ enum index { ITEM_POL_POLICY, ITEM_PORT_REPRESENTOR, ITEM_PORT_REPRESENTOR_PORT_ID, + ITEM_REPRESENTED_PORT, + ITEM_REPRESENTED_PORT_ETHDEV_PORT_ID, /* Validate/create actions. */ ACTIONS, @@ -1003,6 +1005,7 @@ static const enum index next_item[] = { ITEM_INTEGRITY, ITEM_CONNTRACK, ITEM_PORT_REPRESENTOR, + ITEM_REPRESENTED_PORT, END_SET, ZERO, }; @@ -1377,6 +1380,12 @@ static const enum index item_port_representor[] = { ZERO, }; +static const enum index item_represented_port[] = { + ITEM_REPRESENTED_PORT_ETHDEV_PORT_ID, + ITEM_NEXT, + ZERO, +}; + static const enum index next_action[] = { ACTION_END, ACTION_VOID, @@ -3632,6 +3641,21 @@ static const struct token token_list[] = { item_param), .args = ARGS(ARGS_ENTRY(struct rte_flow_item_ethdev, port_id)), }, + [ITEM_REPRESENTED_PORT] = { + .name = "represented_port", + .help = "match traffic entering the embedded switch from the entity represented by the given ethdev", + .priv = PRIV_ITEM(REPRESENTED_PORT, + sizeof(struct rte_flow_item_ethdev)), + .next = NEXT(item_represented_port), + .call = parse_vc, + }, + [ITEM_REPRESENTED_PORT_ETHDEV_PORT_ID] = { + .name = "ethdev_port_id", + .help = "ethdev port ID", + .next = NEXT(item_represented_port, NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY(struct rte_flow_item_ethdev, port_id)), + }, /* Validate/create actions. */ [ACTIONS] = { .name = "actions", @@ -8368,6 +8392,7 @@ flow_item_default_mask(const struct rte_flow_item *item) mask = &rte_flow_item_pfcp_mask; break; case RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR: + case RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT: mask = &rte_flow_item_ethdev_mask; break; default: diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 2e0f590777..3dc209af4d 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) + '------------------------' + : + : + .------------------------. + | Embedded Switch Port | Logical Port + '------------------------' + : + : + : + : + .------------------------. + | Embedded Flow Engine | + '------------------------' + /\ + || + || + || + .------------------------. + | Embedded Switch Port | Logical Port + '------------------------' + /\ + || + .------------------------. + | REPRESENTED_PORT | Net / Guest / Another Ethdev (Same Application) + '------------------------' + + +- Incompatibe with `Attribute: Traffic direction`_. +- Requires `Attribute: Transfer`_. + +This item is meant to use the same structure as `Item: PORT_REPRESENTOR`_. + Actions ~~~~~~~ diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst index 1261cb2bf3..39ff16780b 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -188,7 +188,7 @@ API Changes Also, make sure to start the actual text at the margin. ======================================================= -* ethdev: Added item ``PORT_REPRESENTOR`` to flow API. +* ethdev: Added items ``PORT_REPRESENTOR``, ``REPRESENTED_PORT`` to flow API. * kvargs: The experimental function ``rte_kvargs_strcmp()`` has been removed. Its usages have been replaced by a new function diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index dcb9f47d98..44a399899f 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3799,6 +3799,11 @@ This section lists supported pattern items and their attributes, if any. - ``port_id {unsigned}``: ethdev port ID +- ``represented_port``: match traffic entering the embedded switch from + the entity represented by the given ethdev + + - ``ethdev_port_id {unsigned}``: ethdev port ID + Actions list ^^^^^^^^^^^^ diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 5e9317c6d1..d4b654a2c6 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -101,6 +101,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { MK_FLOW_ITEM(INTEGRITY, sizeof(struct rte_flow_item_integrity)), MK_FLOW_ITEM(CONNTRACK, sizeof(uint32_t)), MK_FLOW_ITEM(PORT_REPRESENTOR, sizeof(struct rte_flow_item_ethdev)), + MK_FLOW_ITEM(REPRESENTED_PORT, sizeof(struct rte_flow_item_ethdev)), }; /** Generate flow_action[] entry. */ diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 3625fd2c12..24d41aeb7b 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -583,6 +583,16 @@ enum rte_flow_item_type { * @see struct rte_flow_item_ethdev */ RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR, + + /** + * [META] + * + * Matches traffic entering the embedded switch from + * the entity represented by the given ethdev. + * + * @see struct rte_flow_item_ethdev + */ + RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT, }; /** @@ -1813,7 +1823,8 @@ static const struct rte_flow_item_conntrack rte_flow_item_conntrack_mask = { * @b EXPERIMENTAL: this structure may change without prior notice * * Provides an ethdev port ID for use with the following items: - * RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR. + * RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR, + * RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT. */ struct rte_flow_item_ethdev { uint16_t port_id; /**< ethdev port ID */ -- 2.20.1