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 5A8A7A0547; Wed, 1 Jun 2022 09:39:51 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 31BFF427FF; Wed, 1 Jun 2022 09:39:50 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2048.outbound.protection.outlook.com [40.107.94.48]) by mails.dpdk.org (Postfix) with ESMTP id 5F52B40689 for ; Wed, 1 Jun 2022 09:39:48 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X4UXnI9o8gG7e8kLitMmWntPXh/znHPXwtGo0SuTU10eObWillEUr6D268KcJlqJjyTOZvY1uUqAi6hcB1Lbooy3SLWbJi3GZH07Cce55zBm5gUIND+JYVAeB979EXZH76rfPdIrAqUXm5SwKv2V7ZmiCqJc0jQ643wcEwLr77NT2AFxYdyaoOJ4AnLpM2bFpGqckUdXGS7DSMtXByZoI50eKtiiDJsjdY6B1rNAlIl2+MKoTlnJFWy2jZJHvvwZUnP/cPfC/7B4qGy80u1TdDVSRm2qS3RZ/KPg9u7vbRUrctr4ORZXJRGXmY8AMp5mztzm9wdiIyl+3B0QTXTfZQ== 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=pyIVVvBTI/dGRsH0uWD9vkoFiTT+lgWJO5wOscQRggA=; b=V8d7sWmIUOkEfI3T1RUUaadhhOPZDaSbOEFlJvLAAxJCZxZJXU/dhz/VJ4bdmSUSgigwZXKdAFNSS/C95aOR68OhUFavz+qH4XlEwsN2q95fjworTmCBOGbHJPZr8BDHXbzkP9bJAio82LWdeQzFqZVzv4YYcJfqmJK+hW024a520nDYBcxDpXaZwq9GIN14/y5hV7Zwa7Q3fMQZQMddy9EAN8SmQ7F+AR3DC8ZRIH2MT4HPmjCJvVangyc0G5dc5sQgtc+B6Ip5VlScAose6aPgSfYWsvXJaQ9ZRps10lprSRZjR1ChCNCMJF3LDkI9taYw+KC9Zx65IAudcMGWmQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=oktetlabs.ru 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=pyIVVvBTI/dGRsH0uWD9vkoFiTT+lgWJO5wOscQRggA=; b=f692nSBhdpaI9jiMOKgcPG0bicWAqfbW0Of7iDZrlCdcoWYiZiZbeo4xzTIEE7onk0P0u33eOjFPJZGeQBkBJJVgsrJz3I/Xc9HPk+ZJqOiJjlyksOKYI8iV6NEVjgZo9Yfix2o4tWhSrAyP5zU3sMy8oLsPj6Cv7cqpaZwdIlRuv0IZKxeHmk1wmFHaUrGWE3w2DMNTD8X3N/zR/fbZ+UwhrpieXuo5XjwRMFqUiG5KIYKgqeVTZ1h2NZVa8nZjlEp7v5w9Vs/VHFyqmRtex53EgYe9bzzXWdYuLKLlgorUIC7oZVxQvoC0zk6muYbyf1P+S1L0FRPEJgTdKXdiIQ== Received: from BN0PR04CA0102.namprd04.prod.outlook.com (2603:10b6:408:ec::17) by DM6PR12MB3004.namprd12.prod.outlook.com (2603:10b6:5:11b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.13; Wed, 1 Jun 2022 07:39:46 +0000 Received: from BN8NAM11FT038.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ec:cafe::56) by BN0PR04CA0102.outlook.office365.com (2603:10b6:408:ec::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.13 via Frontend Transport; Wed, 1 Jun 2022 07:39:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) 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.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.234) by BN8NAM11FT038.mail.protection.outlook.com (10.13.176.246) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5314.12 via Frontend Transport; Wed, 1 Jun 2022 07:39:44 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Wed, 1 Jun 2022 07:39:44 +0000 Received: from nvidia.com (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.22; Wed, 1 Jun 2022 00:39:42 -0700 From: Xiaoyu Min To: , Ori Kam , Ferruh Yigit , Andrew Rybchenko CC: Subject: [RFC v2 2/2] ethdev: queue-based flow aged report Date: Wed, 1 Jun 2022 15:39:19 +0800 Message-ID: <7a45693f478b1b721b4e05131141b526185a175c.1654063912.git.jackmin@nvidia.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.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: c2db35d2-af82-4134-9743-08da43a1e5d9 X-MS-TrafficTypeDiagnostic: DM6PR12MB3004:EE_ X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,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: h+859afXtiZjtuxnlzBucgFOYle4iTMuTvMuaBHCXfeISpseFL5G3PA/kKfVqfvcWCNxdQ1a+8+dqtfLFVFCVctiLL5FfSrloGaPhc49t2J0v5AEAzsNyvpgyUHpBSDG9s+aReUBc06IiQFqDKAj+XR2gJbobG3ieXScOcgXmHlUxK20KpU3d3WJVBvmsEZPfSZquhjliPnPaMMTnv2yGj70aKHxCIFH/zEJ9eGHGxXh/w5iwuEMuJlwIj/ZUfxIRKAG8w1L4QWamFjJv3CDqCF++rDlS04HJiWj63rwryw+CQMg8nOTs3UyDNkaJ8YYRhi2CXw2Eg2FtZCzRABg9QDS0sgKnWwgCYMmmbvdq5MDIhl2BjBb+shFuUt9HgYYaV3I04ZOHEdZ7uxwjjnanZFPvgqixqEGrh9DRUJCsOoZ6iAnLFNRBhjspiU6tMNpOrKojgtub0KKBj8RISSJMMWEYlh1pOnK4JEHJG0z4VrjSHWTDknCJGLtgsQTxqGofD/V15HkIhNxkB+RUJz2y/FlCxjxXNussjnNpq+0fjfOlaL2RnP8JO2HIM3FmYEv08ylFhxupgavZzknVOMgSPhUGCku+/gv4iOhrtvVM07Lf8yS4VgChjMVtwgOFiUGvVgEpatrHW3pCC8vB5R98wvL3WrkyVeNtF938jTPDCbHRKNRYhByst2fPMA3aExa8CALxsGExFBnFiWFfWz8iA== X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(2906002)(110136005)(26005)(316002)(82310400005)(6286002)(2616005)(8676002)(36860700001)(55016003)(508600001)(47076005)(7696005)(356005)(81166007)(6666004)(86362001)(16526019)(40460700003)(186003)(336012)(36756003)(8936002)(83380400001)(426003)(70206006)(70586007)(4326008)(5660300002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2022 07:39:44.9666 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c2db35d2-af82-4134-9743-08da43a1e5d9 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.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT038.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3004 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 When application use queue-based flow rule management and operate the same flow rule on the same queue, e.g create/destroy/query, API of querying aged flow rules should also have queue id parameter just like other queue-based flow APIs. By this way, PMD can work in more optimized way since resources are isolated by queue and needn't synchronize. If application do use queue-based flow management but configure port without RTE_FLOW_PORT_FLAG_STRICT_QUEUE, which means application operate a given flow rule on different queues, the queue id parameter will be ignored. In addition to the above change, another new API is added which help the application get information about which queues have aged out flows after RTE_ETH_EVENT_FLOW_AGED event received. The queried queue id can be used in the above queue based query aged flows API. Signed-off-by: Xiaoyu Min --- lib/ethdev/rte_flow.h | 82 ++++++++++++++++++++++++++++++++++++ lib/ethdev/rte_flow_driver.h | 13 ++++++ 2 files changed, 95 insertions(+) diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 38439fcd1d..a12becfe3b 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -2810,6 +2810,7 @@ enum rte_flow_action_type { * See function rte_flow_get_aged_flows * see enum RTE_ETH_EVENT_FLOW_AGED * See struct rte_flow_query_age + * See function rte_flow_get_q_aged_flows */ RTE_FLOW_ACTION_TYPE_AGE, @@ -5624,6 +5625,87 @@ rte_flow_async_action_handle_update(uint16_t port_id, const void *update, void *user_data, struct rte_flow_error *error); + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Get flow queues which have aged out flows on a given port. + * + * The application can use this function to query which queues have aged out flows after + * a RTE_ETH_EVENT_FLOW_AGED event is received so the returned queue id can be used to + * get aged out flows on this given queue by call rte_flow_get_q_aged_flows. + * + * This function can be called from the event callback or synchronously regardless of the event. + * + * @param port_id + * Port identifier of Ethernet device. + * @param[in, out] queue_id + * Array of queue id that will be set. + * @param[in] nb_queue_id + * Maximum number of the queue id that can be returned. + * This value should be equal to the size of the queue_id array. + * @param[out] error + * Perform verbose error reporting if not NULL. Initialized in case of + * error only. + * + * @return + * if nb_queue_id is 0, return the amount of all queues which have aged out flows. + * if nb_queue_id is not 0 , return the amount of queues which have aged out flows + * reported in the queue_id array, otherwise negative errno value. + * + * @see rte_flow_action_age + * @see RTE_ETH_EVENT_FLOW_AGED + */ + +__rte_experimental +int +rte_flow_get_aged_queues(uint16_t port_id, uint32_t queue_id[], uint32_t nb_queue_id, + struct rte_flow_error *error); + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Get aged-out flows of a given port on the given flow queue. + * + * RTE_ETH_EVENT_FLOW_AGED event will be triggered at least one new aged out flow was + * detected on any flow queue after the last call to rte_flow_get_q_aged_flows. + * + * The application can use rte_flow_get_aged_queues to query which queues have aged + * out flows after RTE_ETH_EVEN_FLOW_AGED event. + * + * If application configure port attribute without RTE_FLOW_PORT_FLAG_STRICT_QUEUE + * the @p queue_id will be ignored. + * This function can be called to get the aged flows asynchronously from the + * event callback or synchronously regardless the event. + * + * @param port_id + * Port identifier of Ethernet device. + * @param queue_id + * Flow queue to query. Ignored when RTE_FLOW_PORT_FLAG_STRICT_QUEUE not set. + * @param[in, out] contexts + * The address of an array of pointers to the aged-out flows contexts. + * @param[in] nb_contexts + * The length of context array pointers. + * @param[out] error + * Perform verbose error reporting if not NULL. Initialized in case of + * error only. + * + * @return + * if nb_contexts is 0, return the amount of all aged contexts. + * if nb_contexts is not 0 , return the amount of aged flows reported + * in the context array, otherwise negative errno value. + * + * @see rte_flow_action_age + * @see RTE_ETH_EVENT_FLOW_AGED + * @see rte_flow_port_flag + */ + +__rte_experimental +int +rte_flow_get_q_aged_flows(uint16_t port_id, uint32_t queue_id, void **contexts, + uint32_t nb_contexts, 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 2bff732d6a..b665170bf4 100644 --- a/lib/ethdev/rte_flow_driver.h +++ b/lib/ethdev/rte_flow_driver.h @@ -260,6 +260,19 @@ struct rte_flow_ops { const void *update, void *user_data, struct rte_flow_error *error); + /** See rte_flow_get_aged_queues() */ + int (*get_aged_queues) + (uint16_t port_id, + uint32_t queue_id[], + uint32_t nb_queue_id, + struct rte_flow_error *error); + /** See rte_flow_get_q_aged_flows() */ + int (*get_q_aged_flows) + (uint16_t port_id, + uint32_t queue_id, + void **contexts, + uint32_t nb_contexts, + struct rte_flow_error *error); }; /** -- 2.36.1