From patchwork Fri Sep 30 09:42:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 117204 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 22A53A00C4; Fri, 30 Sep 2022 11:42:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BADD240E5A; Fri, 30 Sep 2022 11:42:55 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id F0B3B40684 for ; Fri, 30 Sep 2022 11:42:53 +0200 (CEST) Received: from bree.oktetlabs.ru (bree.oktetlabs.ru [192.168.34.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPS id 1089566; Fri, 30 Sep 2022 12:42:53 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 1089566 Authentication-Results: shelob.oktetlabs.ru/1089566; dkim=none; dkim-atps=neutral From: Ivan Malov To: dev@dpdk.org Cc: Andrew Rybchenko , Ori Kam , Ray Kinsella , Thomas Monjalon , Ferruh Yigit Subject: [PATCH] ethdev: forbid the use of direction attr in transfer flows Date: Fri, 30 Sep 2022 12:42:48 +0300 Message-Id: <20220930094248.1842617-1-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 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 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 Reviewed-by: Andrew Rybchenko Acked-by: Ori Kam --- 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(-) 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; /**