ethdev: forbid the use of direction attr in transfer flows

Message ID 20220930094248.1842617-1-ivan.malov@oktetlabs.ru (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series ethdev: forbid the use of direction attr in transfer flows |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-x86_64-unit-testing success Testing PASS
ci/intel-Testing success Testing PASS

Commit Message

Ivan Malov Sept. 30, 2022, 9:42 a.m. UTC
  As part of DPDK 21.11 release, it was announced that the
use of attributes 'ingress' and 'egress' in 'transfer'
rules was deprecated. The transition period is over.

Starting from DPDK 22.11, the use of direction attributes
with attribute 'transfer' is not allowed. To enforce that,
a generic check is added to flow rule validate API.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
 doc/guides/prog_guide/rte_flow.rst     |  9 ++-------
 doc/guides/rel_notes/deprecation.rst   |  4 ----
 doc/guides/rel_notes/release_22_11.rst |  4 ++++
 lib/ethdev/rte_flow.c                  |  7 +++++++
 lib/ethdev/rte_flow.h                  | 18 ------------------
 5 files changed, 13 insertions(+), 29 deletions(-)
  

Comments

Ori Kam Sept. 30, 2022, 10:42 a.m. UTC | #1
Hi Ivan,

> -----Original Message-----
> From: Ivan Malov <ivan.malov@oktetlabs.ru>
> Sent: Friday, 30 September 2022 12:43
> 
> As part of DPDK 21.11 release, it was announced that the
> use of attributes 'ingress' and 'egress' in 'transfer'
> rules was deprecated. The transition period is over.
> 
> Starting from DPDK 22.11, the use of direction attributes
> with attribute 'transfer' is not allowed. To enforce that,
> a generic check is added to flow rule validate API.
> 
> Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
> Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> ---

Acked-by: Ori Kam <orika@nvidia.com>
Best,
Ori
  
Ferruh Yigit Oct. 4, 2022, 2:02 a.m. UTC | #2
On 9/30/2022 11:42 AM, Ori Kam wrote:

> 
> Hi Ivan,
> 
>> -----Original Message-----
>> From: Ivan Malov <ivan.malov@oktetlabs.ru>
>> Sent: Friday, 30 September 2022 12:43
>>
>> As part of DPDK 21.11 release, it was announced that the
>> use of attributes 'ingress' and 'egress' in 'transfer'
>> rules was deprecated. The transition period is over.
>>
>> Starting from DPDK 22.11, the use of direction attributes
>> with attribute 'transfer' is not allowed. To enforce that,
>> a generic check is added to flow rule validate API.
>>
>> Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
>> Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>> ---
> 
> Acked-by: Ori Kam <orika@nvidia.com>

Applied to dpdk-next-net/main, thanks.
  

Patch

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index cb102633c2..2415dd7226 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -204,13 +204,8 @@  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.
 
-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`_.
+In "transfer" flows, the use of `Attribute: Traffic direction`_ in not allowed.
+One may use `Item: PORT_REPRESENTOR`_ and `Item: REPRESENTED_PORT`_ instead.
 
 Pattern item
 ~~~~~~~~~~~~
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index b718784ad1..dc1e652d99 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -101,10 +101,6 @@  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.
-
 * ethdev: Actions ``OF_SET_MPLS_TTL``, ``OF_DEC_MPLS_TTL``, ``OF_SET_NW_TTL``,
   ``OF_COPY_TTL_OUT``, ``OF_COPY_TTL_IN`` are deprecated as not supported by
   any PMD, so they will be removed in DPDK 22.11.
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 6d3b43aed2..88e8c49984 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -223,6 +223,10 @@  API Changes
 
 * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
 
+* ethdev: Banned the use of attributes ``ingress``/``egress`` in "transfer"
+  flows, as the final step of deprecation process that had been started
+  in DPDK 21.11. See items ``PORT_REPRESENTOR``, ``REPRESENTED_PORT``.
+
 
 ABI Changes
 -----------
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index fd802f87a2..d81b5426d2 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -355,6 +355,13 @@  rte_flow_validate(uint16_t port_id,
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
 	int ret;
 
+	if (likely(!!attr) && attr->transfer &&
+	    (attr->ingress || attr->egress)) {
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ATTR,
+					  attr, "cannot use attr ingress/egress with attr transfer");
+	}
+
 	if (unlikely(!ops))
 		return -rte_errno;
 	if (likely(!!ops->validate)) {
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index 4598ccceaf..6d6c736a1b 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -88,28 +88,10 @@  struct rte_flow_attr {
 	uint32_t priority; /**< Rule priority level within group. */
 	/**
 	 * 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;
 	/**