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 9BD52A034F; Tue, 22 Feb 2022 00:03:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0741D4115F; Tue, 22 Feb 2022 00:03:17 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2048.outbound.protection.outlook.com [40.107.244.48]) by mails.dpdk.org (Postfix) with ESMTP id E705F41154 for ; Tue, 22 Feb 2022 00:03:14 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jhHfFDZY251AfkCD3cbfapQETtARZiop58Y2501PJZlMLXHZMQWA/mbJlUmJqronOWoFVXvVUAZTriD/oWhIK0koMglr5UAhmvVqWDCEBpX2+smN+RlJl9Pnu06d7z2eSBgdmpZjQFmv46yQkdRzriZos8p3RpbK2r6ggGdlJHLfqAyQxm/6mrU2Fec93HB50c2vCjDbwXQI+AbtiBUuqNMigVCg4GxlHF1Ky01LgLdfhp1uzWQEtg867SLrIvcAnWVyq8vpMLn2OsznT3EBzyQji132iHda/CUnswTw4bEXC0PGYb+w8G6fqdJy9qFw41wvNiDd4Sok8BmLlzOjWw== 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=gKSt+aFT9tP8o0rlyszGJ0/fWjG5OUWroYKVYrioEBE=; b=PN5zvdbxcbGR+J3c586AMetYtlkcYze4aaDp0Ae9z616rnFxAW6KAJAJN/ntL60sLvPWGHXE5sE809MToH4WRzuCz34SxA2DFo+mFbV7jClKRJM7VaeURSshdCmUeYwaFH6UQPNLAwlp07pW7HncMU6w4i1sph0sXYAA4bTF9sOrW8QH+Au2Q5cWjwgJdBolZ5/3Zqf71eZFg0Sp96dTCqOprwz7p3dRRSyoWpD1Cn88TngHJz/za6Eq28Jg0/sMT/8hy4F/8ijF24aubsqWfj75eRipMG1LNxw/oypcff9lhr4WRqbTbjqmO9fn3Qm8ynBRELvQ7Q4jCUegGYGT6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) 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=gKSt+aFT9tP8o0rlyszGJ0/fWjG5OUWroYKVYrioEBE=; b=Xv9GDl7RvtgCc5cQBYigVQL8LpJk8wR2ynDF8WEgHPCD/p912TCfvA0hdfgElqJq7eBtnspsmj10+iYvIL5ranq9fo2UKqy9eUPMRH2nJ/GUUmS3Wnu+oV3L1E5WAvSAdYY6H9LIO17WCWZ6uSZgT+4ulisyLYaFz3HvGxYZTFB0Z6poE7+hb+GheCNFM62s+KcH8g4fGo4hg1cwNOn4nRQNYj5e6hqUuDcH4UPpbff37nJ3BQzt+j0nHIxUrKuWjSy4qL1+yPqYRtp/MSPGVXJPe8ul42T0Swpo9bGV6QHPWHWS2kPwvzaJQKl/DKcRMYDJTR65PE/ltIhk2yX1Dg== Received: from MWHPR1201MB0271.namprd12.prod.outlook.com (2603:10b6:301:57::16) by BN8PR12MB3076.namprd12.prod.outlook.com (2603:10b6:408:61::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.15; Mon, 21 Feb 2022 23:03:12 +0000 Received: from BN9PR03CA0651.namprd03.prod.outlook.com (2603:10b6:408:13b::26) by MWHPR1201MB0271.namprd12.prod.outlook.com (2603:10b6:301:57::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.16; Mon, 21 Feb 2022 23:03:11 +0000 Received: from BN8NAM11FT011.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13b:cafe::1c) by BN9PR03CA0651.outlook.office365.com (2603:10b6:408:13b::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.16 via Frontend Transport; Mon, 21 Feb 2022 23:03:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) 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.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by BN8NAM11FT011.mail.protection.outlook.com (10.13.176.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4995.15 via Frontend Transport; Mon, 21 Feb 2022 23:03:10 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 21 Feb 2022 23:03:10 +0000 Received: from pegasus01.mtr.labs.mlnx (10.126.230.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; Mon, 21 Feb 2022 15:03:06 -0800 From: Alexander Kozyrev To: CC: , , , , , , , , , Subject: [PATCH v9 04/11] ethdev: bring in async indirect actions operations Date: Tue, 22 Feb 2022 01:02:33 +0200 Message-ID: <20220221230240.2409665-5-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20220221230240.2409665-1-akozyrev@nvidia.com> References: <20220220034409.2226860-1-akozyrev@nvidia.com> <20220221230240.2409665-1-akozyrev@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: be4830f7-eaf1-4629-6275-08d9f58e54cb X-MS-TrafficTypeDiagnostic: MWHPR1201MB0271:EE_|BN8PR12MB3076: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: Rb7shT27bYY54dp35auJMsNhAuo0zrSQHltUnvLsbChoI86SCu4Kf8H+llhM4i4xmD1KFnw4mxzXb4KEg63+bJuXKBbClQCbytaH/YSG8Az4JeF/37QW5ot0DPw87FhV/cC6xKpn65aK4Qw+aN0IZp9AbuXBxrYHRU/lw/xIHe54mvTnHrtDhRae2421gi1zIkMiELL3H1ZtiMdbOpQSwTetQwaY1ny7oOZjlC6RK97J0r57h3SywfXPoidZ99OUJGdhXE5PIRRIQZ0q2IkWTo0yP7RczldSiTXBkN7xvPCaMy6vtxRrSEN8t7I7ywfgmjHojVyIU61Y+FXBi4KJ+TO5aArqcQJ5EMhdIUcQ2Yx7ZUYbPmEv60ebJ80zZoSoct0i7SW+23q5XO0yVO17WjQ9n/ZULz3QjgyCCHuW26EqyRgeUGDgFnAowShtoDxSrSLVLStiGldhmiGaClMZjADEOM2lBNq7Cj00FKu9Bme02sE/nfkKqX7uqQrBAZiN9mecFu6j0yAn+LghigrjI0CCv0jdHS6stxjOYYkw0RsJNb0Xv/dkAoqAEDY3+mCmccaBdUQspw5s/V3JfzDf7kBm2aQ8/GyGi9dbsh/W3M9s2MxNIYa/hkP1Jpf7u92wd9NYTqy0PuhKyKdDEGgZf4k8r8Nrgt2QyZ6EdCdnOgIa5fbHmJR9sXcjWB5lre9dJxRVODkUrh3BzTxCx8Smhg== X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(47076005)(70586007)(70206006)(40460700003)(6916009)(54906003)(426003)(83380400001)(8676002)(508600001)(4326008)(36756003)(6666004)(336012)(356005)(186003)(8936002)(86362001)(2616005)(30864003)(81166007)(16526019)(26005)(1076003)(5660300002)(316002)(36860700001)(7416002)(2906002)(82310400004)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2022 23:03:10.4693 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: be4830f7-eaf1-4629-6275-08d9f58e54cb 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.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT011.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3076 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 | 61 ++++++++++++++ lib/ethdev/rte_flow.h | 109 +++++++++++++++++++++++++ lib/ethdev/rte_flow_driver.h | 26 ++++++ lib/ethdev/version.map | 3 + 6 files changed, 254 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..9a902da660 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -1791,3 +1791,64 @@ 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; + + if (unlikely(!ops)) + return -rte_errno; + if (unlikely(!ops->async_action_handle_update)) + return rte_flow_error_set(error, ENOSYS, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, rte_strerror(ENOSYS)); + 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