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 B5C5EA034C; Wed, 23 Feb 2022 04:03:33 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3335B41169; Wed, 23 Feb 2022 04:03:14 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2063.outbound.protection.outlook.com [40.107.243.63]) by mails.dpdk.org (Postfix) with ESMTP id 5BDBD41158 for ; Wed, 23 Feb 2022 04:03:12 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b2oUexd5Cpa1WlN1RP5fs0ikTPTryXqHH6jGRVtzBJBcFUrz6d/gTUcH03jrUxPyb+n7f9IlreuMG3IHU1Yf87DbH7jKIptZiUhnBpMAzHVgauFpeFvXp77+3Tildm0zjjSVrEqohM4nRIgY6C4leu0tUeJeD4533o/uc8atgX6GPz5nczQ5NucLaSfbmLt54Xacnx3WNniSCH1iqQsO5qVwfTHjhXtkaLO69Nd6hygTgjumv8qxinUHiwncV0lCNMPk/CkqDVDMRvnuWcgVCTqMQCSrwMwDe/QwUsrg6jZ73AvIFIH7+pCDQDx6sTaIv9TsFv9cGxPuOqv6MXitfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pIdBYf8Dmf2K+ypuNh6nsVpi06OyTSX5qy1ez7Q/ezc=; b=I5UBgXD2zoZz1BS1Pd5M1dZST3Sh/Fn+z/q75+G2UXEU/4034ivtWY/lIWTwStV+N/mpR1jLcOky9WxI8c5yNNYXwNtxZQ7USkZi3YJX5yD0jBKY97frq8ao01ZsNv59V6SIHgbezXMt0xXc0dbxcGYP2rGvnx5QjQHYjxzkglqTd547q+lmxx9V4k8ABFFfMz2E8UzY3hs3yVPVqiAKcyfnfWkUPftosxEVxL0clRfpabSPsNeW91wXfQv6V/2z8sgR/XrX/Hvrmk/fShrPK7q4lx5lr4qx4vO2ttFPTIJiHdNOKTLr6tfuTqxRSrLcEmvkkckX9n2Tp3wNHDPJhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pIdBYf8Dmf2K+ypuNh6nsVpi06OyTSX5qy1ez7Q/ezc=; b=H6fDfgU54F2xEBwHUp8jfegfoOPz7OZ+/1Dst8sZmrhkH7l8UeO4RUNQbD1Gscuyr9xXR16EL3Cyn3cqYyY9f7HIIgfpsnhvFT9F2CbByM9734dakhzW7KozAJ4N/DmVxCf5gIH0iZNPgOtINZPezVkSH9lNhjrTVYvLyZCUgnfrPyiI+bjfi/AuH2AbdYuMycZfqgvI0cjEp87K385i4CfrTdRR/xxpVqA/WF23cEvJKwgSo1rwcGbnzKk5BEpJ2/7IO7amGXYCnuiLJtnRNYx02jpoLcUoNUI+dnmiZN6o7jASiiMZFqrEPoBvzp+FFvALTu+sllOHe+d+R47Z3Q== Received: from DM6PR12MB2650.namprd12.prod.outlook.com (2603:10b6:5:4a::23) by DM5PR1201MB0076.namprd12.prod.outlook.com (2603:10b6:4:55::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.21; Wed, 23 Feb 2022 03:03:10 +0000 Received: from DM5PR2201CA0019.namprd22.prod.outlook.com (2603:10b6:4:14::29) by DM6PR12MB2650.namprd12.prod.outlook.com (2603:10b6:5:4a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.24; Wed, 23 Feb 2022 03:03:09 +0000 Received: from DM6NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:4:14:cafe::7c) by DM5PR2201CA0019.outlook.office365.com (2603:10b6:4:14::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.23 via Frontend Transport; Wed, 23 Feb 2022 03:03:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.235) by DM6NAM11FT044.mail.protection.outlook.com (10.13.173.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5017.22 via Frontend Transport; Wed, 23 Feb 2022 03:03:09 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 23 Feb 2022 03:03:09 +0000 Received: from pegasus01.mtr.labs.mlnx (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9; Tue, 22 Feb 2022 19:03:05 -0800 From: Alexander Kozyrev To: CC: , , , , , , , , , Subject: [PATCH v10 04/11] ethdev: bring in async indirect actions operations Date: Wed, 23 Feb 2022 05:02:33 +0200 Message-ID: <20220223030240.2506513-5-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20220223030240.2506513-1-akozyrev@nvidia.com> References: <20220221230240.2409665-1-akozyrev@nvidia.com> <20220223030240.2506513-1-akozyrev@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 59a86049-0166-48d5-a3ab-08d9f67905ac X-MS-TrafficTypeDiagnostic: DM6PR12MB2650:EE_|DM5PR1201MB0076:EE_ X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JAorU1g923obdwWlGwbOkXK3oM5cLaL+yuuLOlM/fTPuwLbfYRvFuNRs6ip/C3+Nksrr3t8TZCGbs28W3uGFWKpz14ktlrcFZLjQuYn8pI6ewmKPSTT2qvDsWQ3eQE7uSkREnNhOpuMCBkXUevfP7uc0b0EeGJTuP2rtVGSHBaVCHNJviuQqJpSDUbnPIETQz4ky+8gCuxBSyJugILAQvChfUnmthov+ocXrz1PDvv+xz+xn5riZ6fFJohDVnLAmloonAH18JznJkeIBuTmSFe3uALyU1fldyfEh5YKGTgA/lIxGbLSY2hXLGK6aK7GEmZFR94oBvbDv/ZTyoBB3QOU3HlQVepH7hUcF8sKgYiCdo8vRLIIMNzn1mGY4E2ijSi7RmoY8z5w3DHKH40NTQknCcREmMCNqKPcxEk0qdERuneLv0El0f7pkU0dEY+DjKrD3uUV/U6S7qZ+8RtgAZaW1EJdYk44DjuGL5/e5qWzPgZy8ICRZzsVj2F7XIi0qk1dNXM/ORF7GegJ1WzSiO69De7BPdDMAxjLC+2fdQaBUegN9bDzsbmUHwa8r+dqtWRBGVfMCvmF+2U/rC+433APN7jWX5wJZsB9tJeESPWNfw8HvqGImAjaGWdKqZo65F7khn/Kcq204K0k8mm5dP11HjYeHW2bGY8UwIwNiKqR5pqRitQT4YId4l7IE5q9JfuZfnAIhFPZ40RozJIl7Yg== X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(8676002)(186003)(2616005)(1076003)(70586007)(70206006)(26005)(6666004)(16526019)(83380400001)(2906002)(36756003)(40460700003)(4326008)(316002)(47076005)(54906003)(81166007)(508600001)(86362001)(356005)(36860700001)(7416002)(5660300002)(426003)(336012)(6916009)(8936002)(82310400004)(30864003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2022 03:03:09.4593 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 59a86049-0166-48d5-a3ab-08d9f67905ac X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0076 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 Queue-based flow rules management mechanism is suitable not only for flow rules creation/destruction, but also for speeding up other types of Flow API management. Indirect action object operations may be executed asynchronously as well. Provide async versions for all indirect action operations, namely: rte_flow_async_action_handle_create, rte_flow_async_action_handle_destroy and rte_flow_async_action_handle_update. Signed-off-by: Alexander Kozyrev Acked-by: Ori Kam --- doc/guides/prog_guide/rte_flow.rst | 50 ++++++++++++ doc/guides/rel_notes/release_22_03.rst | 5 ++ lib/ethdev/rte_flow.c | 55 +++++++++++++ lib/ethdev/rte_flow.h | 109 +++++++++++++++++++++++++ lib/ethdev/rte_flow_driver.h | 26 ++++++ lib/ethdev/version.map | 3 + 6 files changed, 248 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index c6f6f0afba..8148531073 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -3861,6 +3861,56 @@ Enqueueing a flow rule destruction operation is similar to simple destruction. void *user_data, struct rte_flow_error *error); +Enqueue indirect action creation operation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Asynchronous version of indirect action creation API. + +.. code-block:: c + + struct rte_flow_action_handle * + rte_flow_async_action_handle_create(uint16_t port_id, + uint32_t queue_id, + const struct rte_flow_q_ops_attr *q_ops_attr, + const struct rte_flow_indir_action_conf *indir_action_conf, + const struct rte_flow_action *action, + void *user_data, + struct rte_flow_error *error); + +A valid handle in case of success is returned. It must be destroyed later by +``rte_flow_async_action_handle_destroy()`` even if the rule was rejected. + +Enqueue indirect action destruction operation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Asynchronous version of indirect action destruction API. + +.. code-block:: c + + int + rte_flow_async_action_handle_destroy(uint16_t port_id, + uint32_t queue_id, + const struct rte_flow_q_ops_attr *q_ops_attr, + struct rte_flow_action_handle *action_handle, + void *user_data, + struct rte_flow_error *error); + +Enqueue indirect action update operation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Asynchronous version of indirect action update API. + +.. code-block:: c + + int + rte_flow_async_action_handle_update(uint16_t port_id, + uint32_t queue_id, + const struct rte_flow_q_ops_attr *q_ops_attr, + struct rte_flow_action_handle *action_handle, + const void *update, + void *user_data, + struct rte_flow_error *error); + Push enqueued operations ~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/guides/rel_notes/release_22_03.rst b/doc/guides/rel_notes/release_22_03.rst index 2477f53ca6..da186315a5 100644 --- a/doc/guides/rel_notes/release_22_03.rst +++ b/doc/guides/rel_notes/release_22_03.rst @@ -120,6 +120,11 @@ New Features ``rte_flow_pull`` to poll and retrieve results of these operations and ``rte_flow_push`` to push all the in-flight operations to the NIC. + * ethdev: Added asynchronous API for indirect actions management: + ``rte_flow_async_action_handle_create``, + ``rte_flow_async_action_handle_destroy`` and + ``rte_flow_async_action_handle_update``. + * **Updated AF_XDP PMD** * Added support for libxdp >=v1.2.2. diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index c314129870..2c35a2f13e 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -1791,3 +1791,58 @@ rte_flow_pull(uint16_t port_id, ret = ops->pull(dev, queue_id, res, n_res, error); return ret ? ret : flow_err(port_id, ret, error); } + +struct rte_flow_action_handle * +rte_flow_async_action_handle_create(uint16_t port_id, + uint32_t queue_id, + const struct rte_flow_op_attr *op_attr, + const struct rte_flow_indir_action_conf *indir_action_conf, + const struct rte_flow_action *action, + void *user_data, + struct rte_flow_error *error) +{ + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error); + struct rte_flow_action_handle *handle; + + handle = ops->async_action_handle_create(dev, queue_id, op_attr, + indir_action_conf, action, user_data, error); + if (handle == NULL) + flow_err(port_id, -rte_errno, error); + return handle; +} + +int +rte_flow_async_action_handle_destroy(uint16_t port_id, + uint32_t queue_id, + const struct rte_flow_op_attr *op_attr, + struct rte_flow_action_handle *action_handle, + void *user_data, + struct rte_flow_error *error) +{ + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error); + int ret; + + ret = ops->async_action_handle_destroy(dev, queue_id, op_attr, + action_handle, user_data, error); + return flow_err(port_id, ret, error); +} + +int +rte_flow_async_action_handle_update(uint16_t port_id, + uint32_t queue_id, + const struct rte_flow_op_attr *op_attr, + struct rte_flow_action_handle *action_handle, + const void *update, + void *user_data, + struct rte_flow_error *error) +{ + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error); + int ret; + + ret = ops->async_action_handle_update(dev, queue_id, op_attr, + action_handle, update, user_data, error); + return flow_err(port_id, ret, error); +} diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 3fb7cb03ae..d8827dd184 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -5504,6 +5504,115 @@ rte_flow_pull(uint16_t port_id, uint16_t n_res, struct rte_flow_error *error); +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Enqueue indirect action creation operation. + * @see rte_flow_action_handle_create + * + * @param[in] port_id + * Port identifier of Ethernet device. + * @param[in] queue_id + * Flow queue which is used to create the rule. + * @param[in] op_attr + * Indirect action creation operation attributes. + * @param[in] indir_action_conf + * Action configuration for the indirect action object creation. + * @param[in] action + * Specific configuration of the indirect action object. + * @param[in] user_data + * The user data that will be returned on the completion events. + * @param[out] error + * Perform verbose error reporting if not NULL. + * PMDs initialize this structure in case of error only. + * + * @return + * A valid handle in case of success, NULL otherwise and rte_errno is set. + */ +__rte_experimental +struct rte_flow_action_handle * +rte_flow_async_action_handle_create(uint16_t port_id, + uint32_t queue_id, + const struct rte_flow_op_attr *op_attr, + const struct rte_flow_indir_action_conf *indir_action_conf, + const struct rte_flow_action *action, + void *user_data, + struct rte_flow_error *error); + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Enqueue indirect action destruction operation. + * The destroy queue must be the same + * as the queue on which the action was created. + * + * @param[in] port_id + * Port identifier of Ethernet device. + * @param[in] queue_id + * Flow queue which is used to destroy the rule. + * @param[in] op_attr + * Indirect action destruction operation attributes. + * @param[in] action_handle + * Handle for the indirect action object to be destroyed. + * @param[in] user_data + * The user data that will be returned on the completion events. + * @param[out] error + * Perform verbose error reporting if not NULL. + * PMDs initialize this structure in case of error only. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +__rte_experimental +int +rte_flow_async_action_handle_destroy(uint16_t port_id, + uint32_t queue_id, + const struct rte_flow_op_attr *op_attr, + struct rte_flow_action_handle *action_handle, + void *user_data, + struct rte_flow_error *error); + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Enqueue indirect action update operation. + * @see rte_flow_action_handle_create + * + * @param[in] port_id + * Port identifier of Ethernet device. + * @param[in] queue_id + * Flow queue which is used to update the rule. + * @param[in] op_attr + * Indirect action update operation attributes. + * @param[in] action_handle + * Handle for the indirect action object to be updated. + * @param[in] update + * Update profile specification used to modify the action pointed by handle. + * *update* could be with the same type of the immediate action corresponding + * to the *handle* argument when creating, or a wrapper structure includes + * action configuration to be updated and bit fields to indicate the member + * of fields inside the action to update. + * @param[in] user_data + * The user data that will be returned on the completion events. + * @param[out] error + * Perform verbose error reporting if not NULL. + * PMDs initialize this structure in case of error only. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +__rte_experimental +int +rte_flow_async_action_handle_update(uint16_t port_id, + uint32_t queue_id, + const struct rte_flow_op_attr *op_attr, + struct rte_flow_action_handle *action_handle, + const void *update, + void *user_data, + struct rte_flow_error *error); #ifdef __cplusplus } #endif diff --git a/lib/ethdev/rte_flow_driver.h b/lib/ethdev/rte_flow_driver.h index 5907dd63c3..2bff732d6a 100644 --- a/lib/ethdev/rte_flow_driver.h +++ b/lib/ethdev/rte_flow_driver.h @@ -234,6 +234,32 @@ struct rte_flow_ops { struct rte_flow_op_result res[], uint16_t n_res, struct rte_flow_error *error); + /** See rte_flow_async_action_handle_create() */ + struct rte_flow_action_handle *(*async_action_handle_create) + (struct rte_eth_dev *dev, + uint32_t queue_id, + const struct rte_flow_op_attr *op_attr, + const struct rte_flow_indir_action_conf *indir_action_conf, + const struct rte_flow_action *action, + void *user_data, + struct rte_flow_error *err); + /** See rte_flow_async_action_handle_destroy() */ + int (*async_action_handle_destroy) + (struct rte_eth_dev *dev, + uint32_t queue_id, + const struct rte_flow_op_attr *op_attr, + struct rte_flow_action_handle *action_handle, + void *user_data, + struct rte_flow_error *error); + /** See rte_flow_async_action_handle_update() */ + int (*async_action_handle_update) + (struct rte_eth_dev *dev, + uint32_t queue_id, + const struct rte_flow_op_attr *op_attr, + struct rte_flow_action_handle *action_handle, + const void *update, + void *user_data, + struct rte_flow_error *error); }; /** diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index 13c1a22118..20391ab29e 100644 --- a/lib/ethdev/version.map +++ b/lib/ethdev/version.map @@ -276,6 +276,9 @@ EXPERIMENTAL { rte_flow_async_destroy; rte_flow_push; rte_flow_pull; + rte_flow_async_action_handle_create; + rte_flow_async_action_handle_destroy; + rte_flow_async_action_handle_update; }; INTERNAL { -- 2.18.2