From patchwork Wed Oct 19 14:49:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 118602 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru 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 1C709A06CC; Wed, 19 Oct 2022 16:49:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6BE2242C00; Wed, 19 Oct 2022 16:49:37 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2082.outbound.protection.outlook.com [40.107.243.82]) by mails.dpdk.org (Postfix) with ESMTP id 7260D42BF7 for ; Wed, 19 Oct 2022 16:49:35 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B8fJq7PapuAR72UfbfQEm4SXMJb3xWx6msVQRDt3m72Ehzhp047kzZtVf0h6cObJaYQ7R9W30ZDXjOVju05YA5thiB4v7dT/nKqZSJ4UAwVIqHZ1jcmnzcnZ7kcE5tkQo6f0ewTR0rNllEHTfil8YJjSyp/+V4CYc1nVAWPA6fRIBL4L74SffXXKOvmNchMXXnNExT4cDxbBNZBKK6nRwt+MyQ/Wi7Q72G+mSRfvjImX/7lZWZ7l+UKM39l1FXhDGgdF48eVOeWW4jsvEfXk8woHbpvR9DQey1QBVcqB/iR2g0D5V5KK3i6ueANdoRH4oApgpxzMkyNhaqokqAHjGg== 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=KV5zFZXV6hY80WaISQMBgvkIsNdjUwOcOZusMJMYrTY=; b=SjZCwZNKvbVJ7S9qrm/KgRlgve1Z2diTXl2EBJwjSFpyocwaSqk8cG9YkJxfT2vS4rQWrCnN1hpgjW/7U9kF74QZxNvcPuuntAfL+r3B+MHF9QBfieKUGWr3tv40BKU0/Y70u9MARm1L07+Ib3rp/ERhT9RuPs20I7Lu1qHFoMtFoaNqIOX9XgXNCpTIzKBjW0q8ujNl/YNoUnEMHjCt9xzJbNV+zvF4iIZm6vW1hBc4oesXgAQFIYFSinjYI8i1aFawtY7mpU/l2jmAR330D5kOLDV+lspJtAQoFrcj1Q6MiICF16Ix1OV/g/RHfZHD330ox7wH/y3boZzPRTc4hA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject 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=KV5zFZXV6hY80WaISQMBgvkIsNdjUwOcOZusMJMYrTY=; b=sunjqpkNQ9hP8ce+2aLKajxBuBqpYaEzkVOAWEGvmisM0JzgaONMYHYmxU9IXaFCMzuUMsdB78Bwxz2rzhMQ+2VkV+sv1RzqDuguV03s4XEBcu0WurGMu6R6zJZ8BFPCsL5J36UYj/w10RIw6CG8EyBasehnp410l9Wdcv8jHWgrbV5XCX63Eqfqx36EMxbaqOMeeUW6Vt+0w0ACFqFvg9NJVftmbCZ2J7ccNiIBdH4QkuoG+IrATX5jnxe49KNgCGMQQ/wUU1JYU6qEosk4E3EyUeoyEHKR5L0IQ48qJRVp68FfxHoIeXWrU/zUZ3tBq8mh9nsBpCRGiNTHzK27og== Received: from BN9PR03CA0343.namprd03.prod.outlook.com (2603:10b6:408:f6::18) by PH7PR12MB6933.namprd12.prod.outlook.com (2603:10b6:510:1b7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20; Wed, 19 Oct 2022 14:49:33 +0000 Received: from BN8NAM11FT103.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f6:cafe::17) by BN9PR03CA0343.outlook.office365.com (2603:10b6:408:f6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.34 via Frontend Transport; Wed, 19 Oct 2022 14:49:33 +0000 X-MS-Exchange-Authentication-Results: spf=none (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=nvidia.com; Received-SPF: None (protection.outlook.com: nvidia.com does not designate permitted sender hosts) Received: from mail.nvidia.com (216.228.117.161) by BN8NAM11FT103.mail.protection.outlook.com (10.13.176.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.16 via Frontend Transport; Wed, 19 Oct 2022 14:49:33 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Wed, 19 Oct 2022 07:49:14 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Wed, 19 Oct 2022 07:49:13 -0700 Received: from nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29 via Frontend Transport; Wed, 19 Oct 2022 07:49:12 -0700 From: Michael Baum To: CC: Matan Azrad , Raslan Darawsheh , "Ori Kam" Subject: [PATCH v3 1/3] ethdev: add strict queue to pre-configuration flow hints Date: Wed, 19 Oct 2022 17:49:02 +0300 Message-ID: <20221019144904.2543586-2-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221019144904.2543586-1-michaelba@nvidia.com> References: <20221019131228.2538941-1-michaelba@nvidia.com> <20221019144904.2543586-1-michaelba@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT103:EE_|PH7PR12MB6933:EE_ X-MS-Office365-Filtering-Correlation-Id: 09c2cf12-f614-4ea2-06e9-08dab1e122c6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x5ED2GpIWaLcppvTEAG6BRs5vuXjjeLQNgj6+pUeB3EqLyTaIGr1IFOl1wY7Yv4AFw9HRradnsTHA9kiT1OTd6pilJD82P5beh6dpJpmLUmvd44COaKMoJwYw3G8taLPr3UP9SoyNuBRGZWQCLZPLv75k5zgBymegvFBAAOeUctloXpy3lw8+VTH6aU1vIWqunnEIzvmxnTH2SpZNFjQOwQBavO9oKjRNx+kpAnsp1CjLaJb3DGk4fULu6i5RM+nLc7HKxXPx4mVuKQkH7LQJJXcN6ziQ1JwJ9x/v5gcC7YM6nKREShG5PCX503O2QwSU5YJNCgo0TpgpKYy3qhUZRWb/T7qKm3hVewZXmHeuHkJSDdpOx8XRkWR7NUiiHa7tvLbw7L542rPfQsMbt18FD0vdNGL8r7Zk+lJCbSTtgoYre78q2M+Vt/4G1aiDuGZqNoD6OpkyR1alSwZ8U0t0c/xHzsCnza4hzsQXQmMNn1jxbL7W2xwn4eKdjpxKISrJxJlEFah4Ve9UlBxF/f9wjhYc3Fm61BOowIGPib6sgOl9iDS9LpTbXhH75O79iGGyD9/oo54v1sFGJhQ8PU3Evb+yP4w99k/OV3TZR9AVM7ubLNXJUXTIT64MNMBeTyhbVlWftKHHfLD5RUYJd9S3i3+Sv3cGN9FmqbrlGciCrae9LK+jpjwUJiXzkIRCxAL9IzRiNCWPmJGthA0hEGml9YSz7qzHT21CTzMafUrw5z+vUROqRGCCQC1YKZdKTczK3HCfFzFq+yGiofAFVN/DQ== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(396003)(39860400002)(376002)(346002)(136003)(451199015)(46966006)(40470700004)(36840700001)(316002)(26005)(2616005)(36860700001)(8936002)(6286002)(4326008)(8676002)(55016003)(36756003)(40480700001)(5660300002)(70206006)(336012)(6666004)(107886003)(70586007)(41300700001)(2906002)(186003)(7696005)(40460700003)(86362001)(1076003)(83380400001)(6916009)(82740400003)(54906003)(82310400005)(478600001)(356005)(47076005)(7636003)(426003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2022 14:49:33.3164 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 09c2cf12-f614-4ea2-06e9-08dab1e122c6 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT103.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6933 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 The data-path focused flow rule management can manage flow rules in more optimized way than traditional one by using hints provided by application in initialization phase. In addition to the current hints we have in port attr, more hints could be provided by application about its behaviour. One example is how the application do with the same flow rule ? A. create/destroy flow on same queue but query flow on different queue or queue-less way (i.e, counter query) B. All flow operations will be exactly on the same queue, by which PMD could be in more optimized way then A because resource could be isolated and access based on queue, without lock, for example. This patch add flag about above situation and could be extended to cover more situations. Signed-off-by: Michael Baum Acked-by: Ori Kam Acked-by: Andrew Rybchenko --- app/test-pmd/cmdline_flow.c | 10 ++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 4 ++-- lib/ethdev/rte_flow.h | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 810dfb9854..59829371d4 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -226,6 +226,7 @@ enum index { CONFIG_AGING_OBJECTS_NUMBER, CONFIG_METERS_NUMBER, CONFIG_CONN_TRACK_NUMBER, + CONFIG_FLAGS, /* Indirect action arguments */ INDIRECT_ACTION_CREATE, @@ -1092,6 +1093,7 @@ static const enum index next_config_attr[] = { CONFIG_AGING_OBJECTS_NUMBER, CONFIG_METERS_NUMBER, CONFIG_CONN_TRACK_NUMBER, + CONFIG_FLAGS, END, ZERO, }; @@ -2692,6 +2694,14 @@ static const struct token token_list[] = { .args = ARGS(ARGS_ENTRY(struct buffer, args.configure.port_attr.nb_conn_tracks)), }, + [CONFIG_FLAGS] = { + .name = "flags", + .help = "configuration flags", + .next = NEXT(next_config_attr, + NEXT_ENTRY(COMMON_UNSIGNED)), + .args = ARGS(ARGS_ENTRY(struct buffer, + args.configure.port_attr.flags)), + }, /* Top-level command. */ [PATTERN_TEMPLATE] = { .name = "pattern_template", diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index b3f31df69a..a8b99c8c19 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -2891,7 +2891,7 @@ following sections. [queues_number {number}] [queues_size {size}] [counters_number {number}] [aging_counters_number {number}] - [meters_number {number}] + [meters_number {number}] [flags {number}] - Create a pattern template:: flow pattern_template {port_id} create [pattern_template_id {id}] @@ -3042,7 +3042,7 @@ for asynchronous flow creation/destruction operations. It is bound to [queues_number {number}] [queues_size {size}] [counters_number {number}] [aging_counters_number {number}] - [meters_number {number}] + [meters_number {number}] [flags {number}] If successful, it will show:: diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index cddbe74c33..a93ec796cb 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -4741,6 +4741,12 @@ rte_flow_flex_item_release(uint16_t port_id, const struct rte_flow_item_flex_handle *handle, struct rte_flow_error *error); +/** + * Indicate all operations for a given flow rule will _strictly_ + * happen on the same queue (create/destroy/query/update). + */ +#define RTE_FLOW_PORT_FLAG_STRICT_QUEUE RTE_BIT32(0) + /** * @warning * @b EXPERIMENTAL: this API may change without prior notice. @@ -4774,6 +4780,10 @@ struct rte_flow_port_info { * @see RTE_FLOW_ACTION_TYPE_CONNTRACK */ uint32_t max_nb_conn_tracks; + /** + * Port supported flags (RTE_FLOW_PORT_FLAG_*). + */ + uint32_t supported_flags; }; /** @@ -4848,6 +4858,10 @@ struct rte_flow_port_attr { * @see RTE_FLOW_ACTION_TYPE_CONNTRACK */ uint32_t nb_conn_tracks; + /** + * Port flags (RTE_FLOW_PORT_FLAG_*). + */ + uint32_t flags; }; /** From patchwork Wed Oct 19 14:49:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 118600 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru 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 D7A6FA06CC; Wed, 19 Oct 2022 16:49:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4A48842BF0; Wed, 19 Oct 2022 16:49:32 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2074.outbound.protection.outlook.com [40.107.237.74]) by mails.dpdk.org (Postfix) with ESMTP id EBCA642BDD for ; Wed, 19 Oct 2022 16:49:30 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HgK7xz9qfF/bHOUaVzF/4RV6RkJdCpFwR8X8Ark8KRn6byLkdeJuOFJCRYTsnew4VZ+8qCYfWJ+RDY5nuoyUK+j/I5zy5HrTDWi6Ed2YqLv0Y/VGG6FzXFMquMd6okRoCf4pOLJPb/1HDOzJZB2rsP8jSlpNbH2mkH6ATFQNE/8jEIYL3RBD9kgNxz0DqBiIoRY+a6KM0UXXCR0kt6KJD+fRVcLmYWgnz6vi23f7mOf+njrY0ALkg2x/835x+eaQTurs4r4R90q6Et12CtJYeYmOMM7XOpuyGkIFSH0wJAI0nRSPlqPRMCUikcRtv4yA5fNfD0eW0vHStFAPRHgSdA== 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=ZRyv/0EEl6c/NhxvG80pg2cT+pyjN5zYE6oV3u4nP6k=; b=cbwmw8/bQqqYiT6QiFM5V4unskm2GRqnkUPWfcLJ9YXGsHGQPdS1qiSIn+ZRcbmNMEmUM/LZUjyxlIxypejqzxS/vHZQ9uBK2CxMP7FYdpPXKBFV9MUWZ6AdpSCTJRojr0BxHbFMmI/VCw4iG6eUKAWk6MG+er09I80nm09lwqJsOchd3aqGrpuVKSunoTEW31lqESZbtJaFrNEQx8tqaVeQjeyXR5tJzfQNyEhV2dI4ZrzKVaVxFcEPQAP61C0S+Z910LMm2+h+6PZ9eixMLl9vYM8aAhIkWypeOWiz/ynvUG18+PhPMKDVbQn6pyIQ5sgpJFzhO1WVoC8FaPvq6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 216.228.117.160) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject 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=ZRyv/0EEl6c/NhxvG80pg2cT+pyjN5zYE6oV3u4nP6k=; b=oalMxd8dPfbCepVgoXsl+GBtsEHWwUWJ5pV2wWlzwRGi90ScZ6yiEsbPLmBhzB39OWCgUVbgACAs8cGhA067WxTEoQGpecmh9EE7g+Q5J7feSu3evsoA4V5QY9ZwQAkTQ10hKWpezGhsjDhX3+6OjHWOLwaKG2kP/kbsgvOlQDHDoox8p7NTOCR/6+Ld+ZUGmVR+EGdI8U/Xyl//QQgst9PtB3m7bgwYJUT4IrVhBh8kLlTomfMiRVC80bQ4Q/9poIqL3bDyurL1wK7RLSNbC30G2Uac7Gkhi7BnmjeIn7XKOgEdBxOC+hZsp/14pzXjo+3tS3yS2tlpl4Mb8/qpuQ== Received: from MW4PR04CA0187.namprd04.prod.outlook.com (2603:10b6:303:86::12) by DM4PR12MB6301.namprd12.prod.outlook.com (2603:10b6:8:a5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.33; Wed, 19 Oct 2022 14:49:28 +0000 Received: from CO1NAM11FT015.eop-nam11.prod.protection.outlook.com (2603:10b6:303:86:cafe::99) by MW4PR04CA0187.outlook.office365.com (2603:10b6:303:86::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.34 via Frontend Transport; Wed, 19 Oct 2022 14:49:28 +0000 X-MS-Exchange-Authentication-Results: spf=none (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=nvidia.com; Received-SPF: None (protection.outlook.com: nvidia.com does not designate permitted sender hosts) Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT015.mail.protection.outlook.com (10.13.175.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.16 via Frontend Transport; Wed, 19 Oct 2022 14:49:28 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Wed, 19 Oct 2022 07:49:16 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Wed, 19 Oct 2022 07:49:15 -0700 Received: from nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29 via Frontend Transport; Wed, 19 Oct 2022 07:49:14 -0700 From: Michael Baum To: CC: Matan Azrad , Raslan Darawsheh , "Ori Kam" Subject: [PATCH v3 2/3] ethdev: add queue-based API to report aged flow rules Date: Wed, 19 Oct 2022 17:49:03 +0300 Message-ID: <20221019144904.2543586-3-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221019144904.2543586-1-michaelba@nvidia.com> References: <20221019131228.2538941-1-michaelba@nvidia.com> <20221019144904.2543586-1-michaelba@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT015:EE_|DM4PR12MB6301:EE_ X-MS-Office365-Filtering-Correlation-Id: 14b019f8-63f4-494b-a08f-08dab1e11ff4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DdvSwfJRDvXBwilayEI+LuHwwanbiI8iwpMQSVQMLIGdoXHNX7vBUsBhYZumrUyf7H3Q+LwB1qqhsWPXVi7aAiMZSQi0CcLwbj8Cdtf2G0xpCOWVHa0ZFJbvens1FsrR78mfqSGjqiOLBlLYsnIQIgOeZBBu7diO0SAkKxPVMurS27WTXlC3qo9tAmAYiwbpN8W4g4fCeM0uCZq3JFX4kpn7mU48XSL457GSGIGe/tLvt91fZYcaLhwATLF1+eE1e0bLrueaCmICcIFCqYP0YvsBXVWnSUel81/ODbYepbQs3ibZNEisg3nNnWzUSDH/Trk+xjzpB6BF2vlfMJXt6IFuXts4ib/tb3gUr19gvC4h5R6BqKU9rIhGH9ZQIM+Ur2mgAvcjg3samglCTwuO4d+VZUKuKM0P2HLytUl+P7TK8dtqsC0V4iriT81jRAaOGpP2SnU7y/omdmP5uffbwOJbrRbWV2Aj8gebhEv97aJGDfOlrrmx0KfKe2YWmXEwM1TDwd3QMo/M4q9FSCCiCniL8t3cGuB75NjmOS8nmj/YR0HKzGv66kLEmfozexBE06HXmvQN/RkR6BOv1YL85O8eEnKT2pz/vUHXog4zfo3M62QUM55AtudeqfR0MajTxIgvdamPFO0XdUYNON8cZk1+wnqKpbCXEqrMah2rLrQetlBK+spI9UDWuW+F1/mhs2qQKam3iInaaj9386vTWBmgQrlswBoiDLsrBwzHNGETw8O5WfAmhWYQnZCKhdU39hnADnN73Myjyvwpdbm02Q== X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(376002)(346002)(39860400002)(396003)(136003)(451199015)(46966006)(36840700001)(40470700004)(6666004)(107886003)(41300700001)(8936002)(478600001)(4326008)(54906003)(6916009)(8676002)(36860700001)(36756003)(7696005)(7636003)(316002)(356005)(40460700003)(55016003)(186003)(82740400003)(86362001)(426003)(2616005)(40480700001)(1076003)(336012)(6286002)(70206006)(26005)(83380400001)(47076005)(82310400005)(2906002)(70586007)(5660300002)(30864003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2022 14:49:28.7136 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 14b019f8-63f4-494b-a08f-08dab1e11ff4 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT015.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6301 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. Signed-off-by: Michael Baum Acked-by: Ori Kam Acked-by: Andrew Rybchenko --- app/test-pmd/cmdline_flow.c | 17 ++- app/test-pmd/config.c | 159 +++++++++++++++++++- app/test-pmd/testpmd.h | 1 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 86 ++++++++++- lib/ethdev/rte_flow.c | 22 +++ lib/ethdev/rte_flow.h | 49 +++++- lib/ethdev/rte_flow_driver.h | 7 + lib/ethdev/version.map | 1 + 8 files changed, 332 insertions(+), 10 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 59829371d4..992aeb95b3 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -129,6 +129,7 @@ enum index { /* Queue arguments. */ QUEUE_CREATE, QUEUE_DESTROY, + QUEUE_AGED, QUEUE_INDIRECT_ACTION, /* Queue create arguments. */ @@ -1170,6 +1171,7 @@ static const enum index next_table_destroy_attr[] = { static const enum index next_queue_subcmd[] = { QUEUE_CREATE, QUEUE_DESTROY, + QUEUE_AGED, QUEUE_INDIRECT_ACTION, ZERO, }; @@ -2967,6 +2969,13 @@ static const struct token token_list[] = { .args = ARGS(ARGS_ENTRY(struct buffer, queue)), .call = parse_qo_destroy, }, + [QUEUE_AGED] = { + .name = "aged", + .help = "list and destroy aged flows", + .next = NEXT(next_aged_attr, NEXT_ENTRY(COMMON_QUEUE_ID)), + .args = ARGS(ARGS_ENTRY(struct buffer, queue)), + .call = parse_aged, + }, [QUEUE_INDIRECT_ACTION] = { .name = "indirect_action", .help = "queue indirect actions", @@ -8654,8 +8663,8 @@ parse_aged(struct context *ctx, const struct token *token, /* Nothing else to do if there is no buffer. */ if (!out) return len; - if (!out->command) { - if (ctx->curr != AGED) + if (!out->command || out->command == QUEUE) { + if (ctx->curr != AGED && ctx->curr != QUEUE_AGED) return -1; if (sizeof(*out) > size) return -1; @@ -10610,6 +10619,10 @@ cmd_flow_parsed(const struct buffer *in) case PULL: port_queue_flow_pull(in->port, in->queue); break; + case QUEUE_AGED: + port_queue_flow_aged(in->port, in->queue, + in->args.aged.destroy); + break; case QUEUE_INDIRECT_ACTION_CREATE: port_queue_action_handle_create( in->port, in->queue, in->postpone, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 0f7dbd698f..18f3543887 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2509,6 +2509,7 @@ port_queue_flow_create(portid_t port_id, queueid_t queue_id, const struct rte_flow_action *actions) { struct rte_flow_op_attr op_attr = { .postpone = postpone }; + struct rte_flow_attr flow_attr = { 0 }; struct rte_flow *flow; struct rte_port *port; struct port_flow *pf; @@ -2568,7 +2569,7 @@ port_queue_flow_create(portid_t port_id, queueid_t queue_id, } job->type = QUEUE_JOB_TYPE_FLOW_CREATE; - pf = port_flow_new(NULL, pattern, actions, &error); + pf = port_flow_new(&flow_attr, pattern, actions, &error); if (!pf) { free(job); return port_flow_complain(&error); @@ -2905,6 +2906,162 @@ port_queue_flow_push(portid_t port_id, queueid_t queue_id) return ret; } +/** Pull queue operation results from the queue. */ +static int +port_queue_aged_flow_destroy(portid_t port_id, queueid_t queue_id, + const uint32_t *rule, int nb_flows) +{ + struct rte_port *port = &ports[port_id]; + struct rte_flow_op_result *res; + struct rte_flow_error error; + uint32_t n = nb_flows; + int ret = 0; + int i; + + res = calloc(port->queue_sz, sizeof(struct rte_flow_op_result)); + if (!res) { + printf("Failed to allocate memory for pulled results\n"); + return -ENOMEM; + } + + memset(&error, 0x66, sizeof(error)); + while (nb_flows > 0) { + int success = 0; + + if (n > port->queue_sz) + n = port->queue_sz; + ret = port_queue_flow_destroy(port_id, queue_id, true, n, rule); + if (ret < 0) { + free(res); + return ret; + } + ret = rte_flow_push(port_id, queue_id, &error); + if (ret < 0) { + printf("Failed to push operations in the queue: %s\n", + strerror(-ret)); + free(res); + return ret; + } + while (success < nb_flows) { + ret = rte_flow_pull(port_id, queue_id, res, + port->queue_sz, &error); + if (ret < 0) { + printf("Failed to pull a operation results: %s\n", + strerror(-ret)); + free(res); + return ret; + } + + for (i = 0; i < ret; i++) { + if (res[i].status == RTE_FLOW_OP_SUCCESS) + success++; + } + } + rule += n; + nb_flows -= n; + n = nb_flows; + } + + free(res); + return ret; +} + +/** List simply and destroy all aged flows per queue. */ +void +port_queue_flow_aged(portid_t port_id, uint32_t queue_id, uint8_t destroy) +{ + void **contexts; + int nb_context, total = 0, idx; + uint32_t *rules = NULL; + struct rte_port *port; + struct rte_flow_error error; + enum age_action_context_type *type; + union { + struct port_flow *pf; + struct port_indirect_action *pia; + } ctx; + + if (port_id_is_invalid(port_id, ENABLED_WARN) || + port_id == (portid_t)RTE_PORT_ALL) + return; + port = &ports[port_id]; + if (queue_id >= port->queue_nb) { + printf("Error: queue #%u is invalid\n", queue_id); + return; + } + total = rte_flow_get_q_aged_flows(port_id, queue_id, NULL, 0, &error); + if (total < 0) { + port_flow_complain(&error); + return; + } + printf("Port %u queue %u total aged flows: %d\n", + port_id, queue_id, total); + if (total == 0) + return; + contexts = calloc(total, sizeof(void *)); + if (contexts == NULL) { + printf("Cannot allocate contexts for aged flow\n"); + return; + } + printf("%-20s\tID\tGroup\tPrio\tAttr\n", "Type"); + nb_context = rte_flow_get_q_aged_flows(port_id, queue_id, contexts, + total, &error); + if (nb_context > total) { + printf("Port %u queue %u get aged flows count(%d) > total(%d)\n", + port_id, queue_id, nb_context, total); + free(contexts); + return; + } + if (destroy) { + rules = malloc(sizeof(uint32_t) * nb_context); + if (rules == NULL) + printf("Cannot allocate memory for destroy aged flow\n"); + } + total = 0; + for (idx = 0; idx < nb_context; idx++) { + if (!contexts[idx]) { + printf("Error: get Null context in port %u queue %u\n", + port_id, queue_id); + continue; + } + type = (enum age_action_context_type *)contexts[idx]; + switch (*type) { + case ACTION_AGE_CONTEXT_TYPE_FLOW: + ctx.pf = container_of(type, struct port_flow, age_type); + printf("%-20s\t%" PRIu32 "\t%" PRIu32 "\t%" PRIu32 + "\t%c%c%c\t\n", + "Flow", + ctx.pf->id, + ctx.pf->rule.attr->group, + ctx.pf->rule.attr->priority, + ctx.pf->rule.attr->ingress ? 'i' : '-', + ctx.pf->rule.attr->egress ? 'e' : '-', + ctx.pf->rule.attr->transfer ? 't' : '-'); + if (rules != NULL) { + rules[total] = ctx.pf->id; + total++; + } + break; + case ACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION: + ctx.pia = container_of(type, + struct port_indirect_action, + age_type); + printf("%-20s\t%" PRIu32 "\n", "Indirect action", + ctx.pia->id); + break; + default: + printf("Error: invalid context type %u\n", port_id); + break; + } + } + if (rules != NULL) { + port_queue_aged_flow_destroy(port_id, queue_id, rules, total); + free(rules); + } + printf("\n%d flows destroyed\n", total); + free(contexts); +} + /** Pull queue operation results from the queue. */ int port_queue_flow_pull(portid_t port_id, queueid_t queue_id) diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index acdb7e855d..918c2377d8 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -941,6 +941,7 @@ int port_queue_action_handle_query(portid_t port_id, uint32_t queue_id, bool postpone, uint32_t id); int port_queue_flow_push(portid_t port_id, queueid_t queue_id); int port_queue_flow_pull(portid_t port_id, queueid_t queue_id); +void port_queue_flow_aged(portid_t port_id, uint32_t queue_id, uint8_t destroy); int port_flow_validate(portid_t port_id, const struct rte_flow_attr *attr, const struct rte_flow_item *pattern, diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index a8b99c8c19..8e21b2a5b7 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -2894,9 +2894,10 @@ following sections. [meters_number {number}] [flags {number}] - Create a pattern template:: + flow pattern_template {port_id} create [pattern_template_id {id}] [relaxed {boolean}] [ingress] [egress] [transfer] - template {item} [/ {item} [...]] / end + template {item} [/ {item} [...]] / end - Destroy a pattern template:: @@ -2995,6 +2996,10 @@ following sections. flow aged {port_id} [destroy] +- Enqueue list and destroy aged flow rules:: + + flow queue {port_id} aged {queue_id} [destroy] + - Tunnel offload - create a tunnel stub:: flow tunnel create {port_id} type {tunnel_type} @@ -4236,7 +4241,7 @@ Disabling isolated mode:: testpmd> Dumping HW internal information -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``flow dump`` dumps the hardware's internal representation information of all flows. It is bound to ``rte_flow_dev_dump()``:: @@ -4252,10 +4257,10 @@ Otherwise, it will complain error occurred:: Caught error type [...] ([...]): [...] Listing and destroying aged flow rules -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``flow aged`` simply lists aged flow rules be get from api ``rte_flow_get_aged_flows``, -and ``destroy`` parameter can be used to destroy those flow rules in PMD. +and ``destroy`` parameter can be used to destroy those flow rules in PMD:: flow aged {port_id} [destroy] @@ -4290,7 +4295,7 @@ will be ID 3, ID 1, ID 0:: 1 0 0 i-- 0 0 0 i-- -If attach ``destroy`` parameter, the command will destroy all the list aged flow rules. +If attach ``destroy`` parameter, the command will destroy all the list aged flow rules:: testpmd> flow aged 0 destroy Port 0 total aged flows: 4 @@ -4308,6 +4313,77 @@ If attach ``destroy`` parameter, the command will destroy all the list aged flow testpmd> flow aged 0 Port 0 total aged flows: 0 + +Enqueueing listing and destroying aged flow rules +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +``flow queue aged`` simply lists aged flow rules be get from +``rte_flow_get_q_aged_flows`` API, and ``destroy`` parameter can be used to +destroy those flow rules in PMD:: + + flow queue {port_id} aged {queue_id} [destroy] + +Listing current aged flow rules:: + + testpmd> flow queue 0 aged 0 + Port 0 queue 0 total aged flows: 0 + testpmd> flow queue 0 create 0 ingress tanle 0 item_template 0 action_template 0 + pattern eth / ipv4 src is 2.2.2.14 / end + actions age timeout 5 / queue index 0 / end + Flow rule #0 creation enqueued + testpmd> flow queue 0 create 0 ingress tanle 0 item_template 0 action_template 0 + pattern eth / ipv4 src is 2.2.2.15 / end + actions age timeout 4 / queue index 0 / end + Flow rule #1 creation enqueued + testpmd> flow queue 0 create 0 ingress tanle 0 item_template 0 action_template 0 + pattern eth / ipv4 src is 2.2.2.16 / end + actions age timeout 4 / queue index 0 / end + Flow rule #2 creation enqueued + testpmd> flow queue 0 create 0 ingress tanle 0 item_template 0 action_template 0 + pattern eth / ipv4 src is 2.2.2.17 / end + actions age timeout 4 / queue index 0 / end + Flow rule #3 creation enqueued + testpmd> flow pull 0 queue 0 + Queue #0 pulled 4 operations (0 failed, 4 succeeded) + +Aged Rules are simply list as command ``flow queue {port_id} list {queue_id}``, +but strip the detail rule information, all the aged flows are sorted by the +longest timeout time. For example, if those rules is configured in the same time, +ID 2 will be the first aged out rule, the next will be ID 3, ID 1, ID 0:: + + testpmd> flow queue 0 aged 0 + Port 0 queue 0 total aged flows: 4 + ID Group Prio Attr + 2 0 0 --- + 3 0 0 --- + 1 0 0 --- + 0 0 0 --- + + 0 flows destroyed + +If attach ``destroy`` parameter, the command will destroy all the list aged flow rules:: + + testpmd> flow queue 0 aged 0 destroy + Port 0 queue 0 total aged flows: 4 + ID Group Prio Attr + 2 0 0 --- + 3 0 0 --- + 1 0 0 --- + 0 0 0 --- + Flow rule #2 destruction enqueued + Flow rule #3 destruction enqueued + Flow rule #1 destruction enqueued + Flow rule #0 destruction enqueued + + 4 flows destroyed + testpmd> flow queue 0 aged 0 + Port 0 total aged flows: 0 + +.. note:: + + The queue must be empty before attaching ``destroy`` parameter. + + Creating indirect actions ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index d11ba270db..7d0c24366c 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -1132,6 +1132,28 @@ rte_flow_get_aged_flows(uint16_t port_id, void **contexts, NULL, rte_strerror(ENOTSUP)); } +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) +{ + 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 (likely(!!ops->get_q_aged_flows)) { + fts_enter(dev); + ret = ops->get_q_aged_flows(dev, queue_id, contexts, + nb_contexts, error); + fts_exit(dev); + return flow_err(port_id, ret, error); + } + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, rte_strerror(ENOTSUP)); +} + struct rte_flow_action_handle * rte_flow_action_handle_create(uint16_t port_id, const struct rte_flow_indir_action_conf *conf, diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index a93ec796cb..64ec8f0903 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -2639,6 +2639,7 @@ enum rte_flow_action_type { * flow. * * See struct rte_flow_action_age. + * See function rte_flow_get_q_aged_flows * See function rte_flow_get_aged_flows * see enum RTE_ETH_EVENT_FLOW_AGED * See struct rte_flow_query_age @@ -2784,8 +2785,8 @@ struct rte_flow_action_queue { * on the flow. RTE_ETH_EVENT_FLOW_AGED event is triggered when a * port detects new aged-out flows. * - * The flow context and the flow handle will be reported by the - * rte_flow_get_aged_flows API. + * The flow context and the flow handle will be reported by the either + * rte_flow_get_aged_flows or rte_flow_get_q_aged_flows APIs. */ struct rte_flow_action_age { uint32_t timeout:24; /**< Time in seconds. */ @@ -4314,6 +4315,50 @@ int rte_flow_get_aged_flows(uint16_t port_id, void **contexts, uint32_t nb_contexts, 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. + * + * If application configure port attribute with RTE_FLOW_PORT_FLAG_STRICT_QUEUE, + * there is no RTE_ETH_EVENT_FLOW_AGED event and this function must be called to + * get the aged flows synchronously. + * + * If application configure port attribute without + * RTE_FLOW_PORT_FLAG_STRICT_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. + * In addition, 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[in] port_id + * Port identifier of Ethernet device. + * @param[in] 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); + /** * Specify indirect action object configuration */ diff --git a/lib/ethdev/rte_flow_driver.h b/lib/ethdev/rte_flow_driver.h index 7289deb538..c7d0699c91 100644 --- a/lib/ethdev/rte_flow_driver.h +++ b/lib/ethdev/rte_flow_driver.h @@ -84,6 +84,13 @@ struct rte_flow_ops { void **context, uint32_t nb_contexts, struct rte_flow_error *err); + /** See rte_flow_get_q_aged_flows() */ + int (*get_q_aged_flows) + (struct rte_eth_dev *dev, + uint32_t queue_id, + void **contexts, + uint32_t nb_contexts, + struct rte_flow_error *error); /** See rte_flow_action_handle_create() */ struct rte_flow_action_handle *(*action_handle_create) (struct rte_eth_dev *dev, diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index e749678b96..17201fbe0f 100644 --- a/lib/ethdev/version.map +++ b/lib/ethdev/version.map @@ -295,6 +295,7 @@ EXPERIMENTAL { rte_eth_rx_descriptor_dump; rte_eth_tx_descriptor_dump; rte_flow_async_action_handle_query; + rte_flow_get_q_aged_flows; rte_mtr_meter_policy_get; rte_mtr_meter_profile_get; }; From patchwork Wed Oct 19 14:49:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 118601 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru 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 4E916A06CC; Wed, 19 Oct 2022 16:49:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1A99B42BE5; Wed, 19 Oct 2022 16:49:35 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2049.outbound.protection.outlook.com [40.107.92.49]) by mails.dpdk.org (Postfix) with ESMTP id A2A9A42BE3 for ; Wed, 19 Oct 2022 16:49:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ByvHCB/0RCBDEgwYbxmDIFkkGw/TFChVzpbDI3RH7SWIr5OLZckPk6rdbrdj33r6AJRGL0LY88frJ2alxdp2IIKiXicqqqTFkHiWF85WHBp6KRd6ytuyxCjSiqq1jwoR/myyvm9vGtDJxIjQumvr1xNaOUxhjyBLOUfg3ixKiGzHwSTWipz84aw71qgxv/sqizFnVW+JHaq/11r46WZxWcbyy3Y2NVIOyWysEC4aOuLLW76Jn5lluHmROVq/lQFqzyO6TczzFPsZagOb+ccY+/x4ie+jjBPNBIeL/BuXdC/PH+horKK9Snac3Nb6POVDe4on2LN5l4A626a50769lQ== 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=dibTpUnPxDio42kQASntAq31BU84e7lLhnvQhDe/kG8=; b=KLgu2Mi8bpP6mVOa7v8fWzyRSmdcz5BwoFBvhBi3RHT0BcXQmmdt3axrukVXBa0SnnkCCwgg3lJ6QMXzPgMzhCJJtDwXWQJPjzMsbUjZVZU5fvyRQVUk0/dWL5pOmlEWcv5s0InzMXzqF4uHL/AMQgqwlOqrLwE5wIQ61SogwiRlAR16SlbdmN1Lh/5Wzri0Ar6riM7drwkvSTId10ARWWgvjomsi02LrqQdZTgChtDIttbXs+ISJtz0SPr9K8qIh8RW4lF2iZOWfg79CFjDhzmgZjpf1MU80GaoS9ijGCuAJtXYjf4ozuIn3cHnhmB2bJhI9myZzVP4wM8JXS8Ysg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 216.228.117.160) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject 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=dibTpUnPxDio42kQASntAq31BU84e7lLhnvQhDe/kG8=; b=iFxSjJZPLBdqGp2At6y4eQrbVWpMbe4xRK64ZC2KHDFkELyhYP/VzLpsMTkDEVDJPn503l8hcgvGgelnJgxNXnDO1H1rbCAoMPosqp6kN671XxNMa29yNt202uD7Q953a/n+Hd8nGVtMkzg8BTzljRUt1kQzoMq0mDd8krrumX1r5LqAOaeyIiIjU3N1LoibFFtR1FF5twh5teXwGKTglI2hfaBdniBo7tV9Eoe07TrH5O6sl0/YjIeKXI0sw/wyBW8YXwBJNKHYGcrLmQ0IKXjRc1VKt7M3/u1jLxra8WYJH6nLKDMjxIFZi5EcGOVJ6ygl0YNSX+T/yIjDhEF0XQ== Received: from MW4PR04CA0366.namprd04.prod.outlook.com (2603:10b6:303:81::11) by MN2PR12MB4424.namprd12.prod.outlook.com (2603:10b6:208:26a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30; Wed, 19 Oct 2022 14:49:31 +0000 Received: from CO1NAM11FT025.eop-nam11.prod.protection.outlook.com (2603:10b6:303:81:cafe::e1) by MW4PR04CA0366.outlook.office365.com (2603:10b6:303:81::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.34 via Frontend Transport; Wed, 19 Oct 2022 14:49:31 +0000 X-MS-Exchange-Authentication-Results: spf=none (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=nvidia.com; Received-SPF: None (protection.outlook.com: nvidia.com does not designate permitted sender hosts) Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT025.mail.protection.outlook.com (10.13.175.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.16 via Frontend Transport; Wed, 19 Oct 2022 14:49:31 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Wed, 19 Oct 2022 07:49:18 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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.29; Wed, 19 Oct 2022 07:49:17 -0700 Received: from nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29 via Frontend Transport; Wed, 19 Oct 2022 07:49:16 -0700 From: Michael Baum To: CC: Matan Azrad , Raslan Darawsheh , "Ori Kam" Subject: [PATCH v3 3/3] ethdev: add structure for indirect AGE update Date: Wed, 19 Oct 2022 17:49:04 +0300 Message-ID: <20221019144904.2543586-4-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221019144904.2543586-1-michaelba@nvidia.com> References: <20221019131228.2538941-1-michaelba@nvidia.com> <20221019144904.2543586-1-michaelba@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT025:EE_|MN2PR12MB4424:EE_ X-MS-Office365-Filtering-Correlation-Id: 540ddf7d-45d4-4b67-4037-08dab1e1217f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 07D5NZX+toESl7bdKxp1qHd4ZfKGuztd2VeYn/vxz2oAmEU8Kp7hcEh9sM2b8PQPMdvK5R7LIxGXczApFsbEFDqUYdqVqsIGmky+oNHN0x3rdIKY6zisyesGD5GcvmgUGKZfjKbIWN8DGiLjoBcWQ00eLdrSFK+mI9fQyHKC5vHvuZpsbI4h0QmjGWSP6VMc8NwqWlgK/vHH1mQg+a46Hph5CYiHVO6gBXWZnBp8eDZxCtGH+VrYV2rGugY2neGW7QXgfN3r8qgOsd8Z5e4s8ZweNFZdnHC1nHmdpQjUtaLOv0avSSd00LpWBJHc6FdKwkDofuPrLZMc9yI7QPK1m9vfk/IHfYj+hKixIlUcxahAm3FYjOp+dKERYpnm3QDtuYMLElFbiG7/4PNEcEg5NpyelNOPDl45g9OVbpL2XkCw5T/tgkqKyGVS66vfOAofmY96hL2HbB7O8bcA/r6mKwnXYzRTplFZayPAtc1Qb95kb+6YHAMEOjhZBDnLr7nnHF2uAYlcBHSXquZaTEIMq3Eg40e7La5E1uBZSivJG7Zk8pt8tcMxu6+7DUglIpz0h9GcuIDGYniAITK8IgvjgJJnzLPfDoJj7dGn7BTJFyffATz/9U4M8KoPoVzfWUYN5G1l4eoNLJetn0NgJH0QerKFMmreDpYVn0Dg6MRWvUArAyePye3fD2vCX48TZESVxqUZjjxGKhESsQB61ncPToQqa69lP+rYhj461AXECZ/+6S0saG9QfjDy7XW6+4sV9wQX5/K4pA5QGYmYJnlz5g== X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(346002)(396003)(136003)(376002)(39860400002)(451199015)(36840700001)(40470700004)(46966006)(6916009)(8676002)(70586007)(70206006)(4326008)(107886003)(40460700003)(54906003)(316002)(15650500001)(6666004)(186003)(2616005)(1076003)(36756003)(2906002)(86362001)(55016003)(83380400001)(426003)(40480700001)(47076005)(336012)(7696005)(36860700001)(41300700001)(5660300002)(26005)(6286002)(8936002)(356005)(478600001)(7636003)(82740400003)(82310400005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2022 14:49:31.2998 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 540ddf7d-45d4-4b67-4037-08dab1e1217f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT025.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4424 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 Add a new structure for indirect AGE update. This new structure enables: 1. Update timeout value. 2. Stop AGE checking. 3. Start AGE checking. 4. restart AGE checking. Signed-off-by: Michael Baum Acked-by: Ori Kam Acked-by: Andrew Rybchenko --- app/test-pmd/cmdline_flow.c | 66 ++++++++++++++++++++++++++++++ app/test-pmd/config.c | 19 ++++++--- doc/guides/prog_guide/rte_flow.rst | 25 +++++++++-- lib/ethdev/rte_flow.h | 28 +++++++++++++ 4 files changed, 129 insertions(+), 9 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 992aeb95b3..88108498e0 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -586,6 +586,9 @@ enum index { ACTION_SET_IPV6_DSCP_VALUE, ACTION_AGE, ACTION_AGE_TIMEOUT, + ACTION_AGE_UPDATE, + ACTION_AGE_UPDATE_TIMEOUT, + ACTION_AGE_UPDATE_TOUCH, ACTION_SAMPLE, ACTION_SAMPLE_RATIO, ACTION_SAMPLE_INDEX, @@ -1874,6 +1877,7 @@ static const enum index next_action[] = { ACTION_SET_IPV4_DSCP, ACTION_SET_IPV6_DSCP, ACTION_AGE, + ACTION_AGE_UPDATE, ACTION_SAMPLE, ACTION_INDIRECT, ACTION_MODIFY_FIELD, @@ -2110,6 +2114,14 @@ static const enum index action_age[] = { ZERO, }; +static const enum index action_age_update[] = { + ACTION_AGE_UPDATE, + ACTION_AGE_UPDATE_TIMEOUT, + ACTION_AGE_UPDATE_TOUCH, + ACTION_NEXT, + ZERO, +}; + static const enum index action_sample[] = { ACTION_SAMPLE, ACTION_SAMPLE_RATIO, @@ -2188,6 +2200,9 @@ static int parse_vc_spec(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); static int parse_vc_conf(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); +static int parse_vc_conf_timeout(struct context *, const struct token *, + const char *, unsigned int, void *, + unsigned int); static int parse_vc_item_ecpri_type(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); @@ -6206,6 +6221,30 @@ static const struct token token_list[] = { .next = NEXT(action_age, NEXT_ENTRY(COMMON_UNSIGNED)), .call = parse_vc_conf, }, + [ACTION_AGE_UPDATE] = { + .name = "age_update", + .help = "update aging parameter", + .next = NEXT(action_age_update), + .priv = PRIV_ACTION(AGE, + sizeof(struct rte_flow_update_age)), + .call = parse_vc, + }, + [ACTION_AGE_UPDATE_TIMEOUT] = { + .name = "timeout", + .help = "age timeout update value", + .args = ARGS(ARGS_ENTRY_BF(struct rte_flow_update_age, + timeout, 24)), + .next = NEXT(action_age_update, NEXT_ENTRY(COMMON_UNSIGNED)), + .call = parse_vc_conf_timeout, + }, + [ACTION_AGE_UPDATE_TOUCH] = { + .name = "touch", + .help = "this flow is touched", + .next = NEXT(action_age_update, NEXT_ENTRY(COMMON_BOOLEAN)), + .args = ARGS(ARGS_ENTRY_BF(struct rte_flow_update_age, + touch, 1)), + .call = parse_vc_conf, + }, [ACTION_SAMPLE] = { .name = "sample", .help = "set a sample action", @@ -7045,6 +7084,33 @@ parse_vc_conf(struct context *ctx, const struct token *token, return len; } +/** Parse action configuration field. */ +static int +parse_vc_conf_timeout(struct context *ctx, const struct token *token, + const char *str, unsigned int len, + void *buf, unsigned int size) +{ + struct buffer *out = buf; + struct rte_flow_update_age *update; + + (void)size; + if (ctx->curr != ACTION_AGE_UPDATE_TIMEOUT) + return -1; + /* Token name must match. */ + if (parse_default(ctx, token, str, len, NULL, 0) < 0) + return -1; + /* Nothing else to do if there is no buffer. */ + if (!out) + return len; + /* Point to selected object. */ + ctx->object = out->args.vc.data; + ctx->objmask = NULL; + /* Update the timeout is valid. */ + update = (struct rte_flow_update_age *)out->args.vc.data; + update->timeout_valid = 1; + return len; +} + /** Parse eCPRI common header type field. */ static int parse_vc_item_ecpri_type(struct context *ctx, const struct token *token, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 18f3543887..e8a1b77c2a 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1886,6 +1886,7 @@ port_action_handle_update(portid_t port_id, uint32_t id, if (!pia) return -EINVAL; switch (pia->type) { + case RTE_FLOW_ACTION_TYPE_AGE: case RTE_FLOW_ACTION_TYPE_CONNTRACK: update = action->conf; break; @@ -2816,17 +2817,23 @@ port_queue_action_handle_update(portid_t port_id, return -EINVAL; } - if (pia->type == RTE_FLOW_ACTION_TYPE_METER_MARK) { + switch (pia->type) { + case RTE_FLOW_ACTION_TYPE_AGE: + update = action->conf; + break; + case RTE_FLOW_ACTION_TYPE_METER_MARK: rte_memcpy(&mtr_update.meter_mark, action->conf, sizeof(struct rte_flow_action_meter_mark)); mtr_update.profile_valid = 1; - mtr_update.policy_valid = 1; - mtr_update.color_mode_valid = 1; - mtr_update.init_color_valid = 1; - mtr_update.state_valid = 1; + mtr_update.policy_valid = 1; + mtr_update.color_mode_valid = 1; + mtr_update.init_color_valid = 1; + mtr_update.state_valid = 1; update = &mtr_update; - } else { + break; + default: update = action; + break; } if (rte_flow_async_action_handle_update(port_id, queue_id, &attr, diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 565868aeea..1ce0277e65 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -2737,7 +2737,7 @@ Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned. Action: ``AGE`` ^^^^^^^^^^^^^^^ -Set ageing timeout configuration to a flow. +Set aging timeout configuration to a flow. Event RTE_ETH_EVENT_FLOW_AGED will be reported if timeout passed without any matching on the flow. @@ -2756,8 +2756,8 @@ timeout passed without any matching on the flow. | ``context`` | user input flow context | +--------------+---------------------------------+ -Query structure to retrieve ageing status information of a -shared AGE action, or a flow rule using the AGE action: +Query structure to retrieve aging status information of an +indirect AGE action, or a flow rule using the AGE action: .. _table_rte_flow_query_age: @@ -2773,6 +2773,25 @@ shared AGE action, or a flow rule using the AGE action: | ``sec_since_last_hit`` | out | Seconds since last traffic hit | +------------------------------+-----+----------------------------------------+ +Update structure to modify the parameters of an indirect AGE action. +The update structure is used by ``rte_flow_action_handle_update()`` function. + +.. _table_rte_flow_update_age: + +.. table:: AGE update + + +-------------------+--------------------------------------------------------------+ + | Field | Value | + +===================+==============================================================+ + | ``reserved`` | 6 bits reserved, must be zero | + +-------------------+--------------------------------------------------------------+ + | ``timeout_valid`` | 1 bit, timeout value is valid | + +-------------------+--------------------------------------------------------------+ + | ``timeout`` | 24 bits timeout value | + +-------------------+--------------------------------------------------------------+ + | ``touch`` | 1 bit, touch the AGE action to set ``sec_since_last_hit`` 0 | + +-------------------+--------------------------------------------------------------+ + Action: ``SAMPLE`` ^^^^^^^^^^^^^^^^^^ diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 64ec8f0903..8858b56428 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -2643,6 +2643,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 struct rte_flow_update_age */ RTE_FLOW_ACTION_TYPE_AGE, @@ -2809,6 +2810,33 @@ struct rte_flow_query_age { uint32_t sec_since_last_hit:24; /**< Seconds since last traffic hit. */ }; +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ACTION_TYPE_AGE + * + * Update indirect AGE action attributes: + * - Timeout can be updated including stop/start action: + * +-------------+-------------+------------------------------+ + * | Old Timeout | New Timeout | Updating | + * +=============+=============+==============================+ + * | 0 | positive | Start aging with new value | + * +-------------+-------------+------------------------------+ + * | positive | 0 | Stop aging | + * +-------------+-------------+------------------------------+ + * | positive | positive | Change timeout to new value | + * +-------------+-------------+------------------------------+ + * - sec_since_last_hit can be reset. + */ +struct rte_flow_update_age { + uint32_t reserved:6; /**< Reserved, must be zero. */ + uint32_t timeout_valid:1; /**< The timeout is valid for update. */ + uint32_t timeout:24; /**< Time in seconds. */ + /** Means that aging should assume packet passed the aging. */ + uint32_t touch:1; +}; + /** * @warning * @b EXPERIMENTAL: this structure may change without prior notice