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 133A443A0F; Tue, 30 Jan 2024 19:49:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 91E3A402CD; Tue, 30 Jan 2024 19:49:34 +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 B8EAA402A8 for ; Tue, 30 Jan 2024 19:49:32 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jr2mbP69tfBpHNPbc8soOnTkTv9r0lUIY9S+WS1+xFaIhXS6EfLyLQAQzDhru0JKyvbDNg00OfMuEqoP/F2HgDoB26StKkUX1PY0AWBabgNyYYjkxazxOFTnCxUsU182IvdpOgpj2xifBFTcyq1JquvzvdkfR7tbumn6jHGayDAmVFrlWcEJPoONE97HdjyFiupTKJHdJz+nLDXmh5usTo9sqhLI2s0tSGCQS5nXWnRdNRI6I8EGfZU1qbnpRvLvnpu870UBS15EDszcNb3t4u90ZnxdZugDu8gAEDllvfUg+pGeXkDITFt04AWs+F/yejnT3NmqSO9LzSmBdwOhuA== 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=IpdpTYKBvqVN87ZKp4fW3ATLtVQnX8LCy1D2+rckmgw=; b=hBHVQrCqOFUtHW1lofjTrmLOrzL+nFsMQBdefFOxOTazo/4FWfNRl756ZKG/PUR5uweicVdTW9+Nz8KZ+TZhCeeGXFMShh/3jFnuE8t7K+oqpLb15MAml33tAx2O90qTBj2MELmm8i+10M6ZLFCfZHJIb+ARM8ORmR9i4S3BRWJENentZhbBNtzlm+PnP+nKvn0IL00a09xYIHwlSBp4D1nbvIRzlyg213fUcwVh9lNSPyUWgNe0JAZ8ugowyUFzo+e/iROAvn9EYyQ6A5OGpojyA0WAdthJs23t2n+akCNJzS/7yWvJHhK7y13RC5ngypG0tKfMubMRshA1hsgQWA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; 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=IpdpTYKBvqVN87ZKp4fW3ATLtVQnX8LCy1D2+rckmgw=; b=fnApyjunlWRAlxSXfb4SIkMPfctI40Ot8kj76GansSa4TEV0flmOJ/Sl0+XYI2GKcyh/8vJ/4ANHACrTGXe4zulPZCO6e42UuhGb5dLoojrFI14nZoItTuEEQgCYOk1EX4K10p5bqVoq+qvWymfZwM2BK7Hjkrvu+S+5+5keMXhTjB1vEXQ+1hi0I5F6j8lFNU1kxvrcDSrFiYp9SKD29OCWS39BuosnCi84O9DhPH71banjETNGfobqgbj8Hj0JpQhHKDH7A1Xi/uNEi0ptXdY9emmVMLmgTCH0odg1ghuIUYjWdsA2yb9LX04QsppGJYh5J1nXzjjfEWbLKhWI3g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from IA1PR12MB6332.namprd12.prod.outlook.com (2603:10b6:208:3e2::13) by CH3PR12MB7761.namprd12.prod.outlook.com (2603:10b6:610:153::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.34; Tue, 30 Jan 2024 18:49:29 +0000 Received: from IA1PR12MB6332.namprd12.prod.outlook.com ([fe80::5610:835d:9e24:6cfd]) by IA1PR12MB6332.namprd12.prod.outlook.com ([fe80::5610:835d:9e24:6cfd%4]) with mapi id 15.20.7249.017; Tue, 30 Jan 2024 18:49:29 +0000 Date: Tue, 30 Jan 2024 20:49:24 +0200 (IST) From: "Etelson, Gregory" To: Ferruh Yigit cc: Gregory Etelson , dev@dpdk.org, mkashani@nvidia.com, Ori Kam , Aman Singh , Yuying Zhang , Thomas Monjalon , Andrew Rybchenko Subject: Re: [PATCH] ethdev: add template table resize API In-Reply-To: <8e9afae9-d35d-4134-bbb0-66ed4116503a@amd.com> Message-ID: <34f48282-05e6-e784-df85-3f7d0b5c88ce@nvidia.com> References: <20231217093205.321082-1-getelson@nvidia.com> <8e9afae9-d35d-4134-bbb0-66ed4116503a@amd.com> Content-Type: text/plain; charset=US-ASCII; format=flowed X-ClientProxiedBy: LO4P123CA0489.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1ab::8) To IA1PR12MB6332.namprd12.prod.outlook.com (2603:10b6:208:3e2::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR12MB6332:EE_|CH3PR12MB7761:EE_ X-MS-Office365-Filtering-Correlation-Id: f1fc5628-09cd-4c86-e359-08dc21c4308f X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WlU+sejqIvu2sgnHeZGdJqL8wuAmvaX22Bv+kqzxzz+/iT+47CdhaC97WTxayMoL0rKbARX80fiupTNToK9SsG66tWaO252SI5kv3Ql5kg4PWahchRIqHTO//2aoMJOSn/6hW7edykPOrSkd4q3FkI9i0/aWiKHIAmlQ9yhiPltVyDt5YVVIpgIb4U86JLH+8anqMkt1V/Z+CXp8Qq46aCCaF2NgNAZ6w3tyv6rn0UOM/2fYsZh6KdjyZQOsPI6/biiti/NcA4+95tFnB57vOGh8NtJmf25+6qOaShi6CNvtS1JIDClktgbDCr7DaGruws++6onZV4RSjA1B9TMl8qCaB9qxh15WtUDxAL4b3gEnoek3ZfNbI/EC1X0Y4vFqA6vcb7xF6G34FS5R2On5mMSZB9nBTuA+e8r7xgDjGtbPmSyvrtOASRF97paTBlaSvIHomz1Is9CJ1i5d0Y5apGWzGzhZhDkpUrP5nBIYEAUBmYJPcaBSIE2sguYB8ylR18D3IXhP/g88NkJtdve9Y1m1fSr9GKRs/GMo7Oy1fzBotVlxGBJqK5QLxV0z55f0plOoEM82zL8oGuYBxxNkYGpBzwfOgn+Kq/2zixbRHSfk+oPXsRC8XT0NqnVNQGE8gO4dPjBwt93Q/NWEVNL0VKobgYz0a79Sy6mO/C8vvmc= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:IA1PR12MB6332.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(346002)(136003)(396003)(376002)(39860400002)(366004)(230922051799003)(230273577357003)(230173577357003)(451199024)(1800799012)(186009)(64100799003)(36756003)(2906002)(41300700001)(6916009)(83380400001)(316002)(66946007)(54906003)(66556008)(66476007)(6486002)(6506007)(6666004)(6512007)(478600001)(2616005)(38100700002)(31696002)(5660300002)(4326008)(86362001)(8676002)(8936002)(31686004)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ACo5wpk/ybuhqHQ2z1C0kgpI3cTnzXCcUFd8smNCLayxWaX3l4P4XpnxuFX+?= =?us-ascii?Q?HEEPNOHMlRSk8Nxw5/Ly4N5tB62nfTUlsigAx1d/Krn6ddPHr7fZXofj2SuI?= =?us-ascii?Q?KG3ODgRI51850bkqLeh/ZG11HLiwyrzDZfMVb39wj7ri30utuJXlTOUgNqjg?= =?us-ascii?Q?hojdSu3YuC08MQN9rY14bNswm+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b6sp4VNLbYfsNCnTuii3uzHen+PM4/er1Q2+M4wMe3weVkTkvLTkREq?= =?us-ascii?Q?iIruKWb8lbnRKyadniosNReSeqpotoyZh6By+/asyLKUuTHGSKUvdMzbjV57?= =?us-ascii?Q?iDBDoym1SbLskU+78ZqybkAlzUM+auZY3+qaguc+M52NHiTExYcMxAp+cmPZ?= =?us-ascii?Q?H8+drkfepvqO5FSSV0WnlAUh+H62A0xnSMkKodCAVqzqDo5dsrsgHt934sxP?= =?us-ascii?Q?IIdmbVDNDsyiweIByzKNwVQ8kTJqEGINoREYKCMrqw3wq77NmOhRAWBL8AMd?= =?us-ascii?Q?YoA9+hIFvYWNj9+JppZIGkb6ep/jMmzu/STam24JJYtKbQa2VXkXAV+ax4hd?= =?us-ascii?Q?ya88/RFjkQOrnDpcw/1jK4foXxZQ70UpDeMsm8O8C9Dpn47KSER1fQfNmT/y?= =?us-ascii?Q?mo98IYUw/ivNc1TR7VQMCSxHPUK8p5nfCeo1KatIdeCLqZ0E+Q3S5DT8IT3/?= =?us-ascii?Q?1BRmfI8s0ook9ICC10qb/hdhGnhcoIUZYyhr9dX5ot1i2DX01CnSFo7htMRs?= =?us-ascii?Q?m9LNBzQRzjWFtszZx187KFu2rRKOR6yVHX05X/itoWqc?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: f1fc5628-09cd-4c86-e359-08dc21c4308f X-MS-Exchange-CrossTenant-AuthSource: IA1PR12MB6332.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2024 18:49:29.3278 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OggkLmBFBXrUAQvH3arvLPsN4uWa7IEetRAGg7oeHeQ8yTAR7M+el6Y99ex/uGupFHICke98/CssqX8+r7MVuA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7761 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 Hello Ferruh, >> Template table creation API sets table flows capacity. >> If application needs more flows then the table was designed for, >> the following procedures must be completed: >> 1. Create a new template table with larger flows capacity. >> 2. Re-create existing flows in the new table and delete flows from >> the original table. >> 3. Destroy original table. >> >> Application cannot always execute that procedure: >> * Port may not have sufficient resources to allocate a new table >> while maintaining original table. >> * Application may not have existing flows "recipes" to re-create >> flows in a new table. >> >> The patch defines a new API that allows application to resize >> existing template table: >> >> * Resizable template table must be created with the >> RTE_FLOW_TABLE_SPECIALIZE_RESIZABLE_TABLE bit set. >> >> * Application resizes existing table with the >> `rte_flow_template_table_resize()` function call. >> The table resize procedure updates the table maximal flow number >> only. Other table attributes are not affected by the table resize. >> ** The table resize procedure must not interrupt >> existing table flows operations in hardware. >> ** The table resize procedure must not alter flow handlers held by >> application. >> >> * After `rte_flow_template_table_resize()` returned, application must >> update all existing table flow rules by calling >> `rte_flow_async_update_resized()`. >> The table resize procedure does not change application flow handler. >> However, flow object can reference internal PMD resources that are >> obsolete after table resize. >> `rte_flow_async_update_resized()` moves internal flow references >> to the updated table resources. >> The flow update must not interrupt hardware flow operations. >> >> * When all table flow were updated, application must call >> `rte_flow_template_table_resize_complete()`. >> The function releases PMD resources related to the original >> table. >> Application can start new table resize after >> `rte_flow_template_table_resize_complete()` returned. >> >> Signed-off-by: Gregory Etelson >> Acked-by: Ori Kam >> >> --- >> app/test-pmd/cmdline_flow.c | 86 +++++++++++++++++++-- >> app/test-pmd/config.c | 102 +++++++++++++++++++++++++ >> app/test-pmd/testpmd.h | 6 ++ >> > > It helps to document added/updated command in the commit log, and in the > documentation 'testpmd_funcs.rst'. > Including new attribute to create table etc... > > Please check following commit as sample: > Commit 98ab16778daa ("app/testpmd: add random item support") > I'll post v2 with an update. > >> doc/guides/rel_notes/release_24_03.rst | 2 + >> lib/ethdev/ethdev_trace.h | 33 ++++++++ >> lib/ethdev/ethdev_trace_points.c | 9 +++ >> lib/ethdev/rte_flow.c | 69 +++++++++++++++++ >> lib/ethdev/rte_flow.h | 97 +++++++++++++++++++++++ >> lib/ethdev/rte_flow_driver.h | 15 ++++ >> lib/ethdev/version.map | 3 + >> 10 files changed, 417 insertions(+), 5 deletions(-) >> > > Just to double check if there will be driver implementation of the new > APIs in this release? > I'll post driver patches after DPDK API approval. > <...> > >> >> +static __rte_always_inline bool >> +rte_flow_table_resizable(const struct rte_flow_template_table_attr *tbl_attr) >> +{ >> + return (tbl_attr->specialize & >> + RTE_FLOW_TABLE_SPECIALIZE_RESIZABLE_TABLE) != 0; >> +} >> + > > Ahh, this is the 4th API added in this patch, missed before. > > Why it is exposed to the application? That API is for application and a driver. > What is the expected usage for the function, it doesn't get 'port_id' as > parameter and directly works on the table_attribute, feels like API There is no usage for `port_id` in that query. > should be for drivers? > Why it is inlined? I prefer inline functions to macros. > > <...> > >> +/** >> + * @warning >> + * @b EXPERIMENTAL: this API may change without prior notice. >> + * >> + * Change template table flow rules capacity. >> + * >> + * @param port_id >> + * Port identifier of Ethernet device. >> + * @param table >> + * Template table to modify. >> + * @param nb_rules >> + * New flow rules capacity. >> + * @param error >> + * Perform verbose error reporting if not NULL. >> + * PMDs initialize this structure in case of error only. >> + * >> + * @return >> + * - (0) if success. >> + * - (-ENODEV) if *port_id* invalid. >> + * - (-ENOTSUP) if underlying device does not support this functionality. >> + * - (-EINVAL) if *table* cannot be resized or invalid *nb_rules* >> > > What is invalid 'nb_rules', does it make sense to document it in above > @param for it. Like if 0 valid, or is there a max, or is it allowed to > shrink the size of table? I'll post v2 with an update. > > >> + */ >> +__rte_experimental >> +int >> +rte_flow_template_table_resize(uint16_t port_id, >> + struct rte_flow_template_table *table, >> + uint32_t nb_rules, >> + struct rte_flow_error *error); >> +/** >> + * @warning >> + * @b EXPERIMENTAL: this API may change without prior notice. >> + * >> + * Following table resize, update flow resources in port. >> + * >> + * @param port_id >> + * Port identifier of Ethernet device. >> + * @param queue >> + * Flow queue for async operation. >> + * @param attr >> + * Async operation attributes. >> + * @param rule >> + * Flow rule to update. >> + * @param user_data >> + * The user data that will be returned on async completion event. >> + * @param error >> + * Perform verbose error reporting if not NULL. >> + * PMDs initialize this structure in case of error only. >> + * >> + * @return >> + * - (0) if success. >> + * - (-ENODEV) if *port_id* invalid. >> + * - (-ENOTSUP) if underlying device does not support this functionality. >> + * - (-EINVAL) if *rule* cannot be updated. >> + */ >> +__rte_experimental >> +int >> +rte_flow_async_update_resized(uint16_t port_id, uint32_t queue, >> + const struct rte_flow_op_attr *attr, >> + struct rte_flow *rule, void *user_data, >> + struct rte_flow_error *error); >> + > > Should API have 'table' or 'template' in name, if it is out of this > context, it is not intuitive that update_resized refers to template > table resize. It may be confused as if this is something related to the > rule itself resize. That function call should have been called `rte_flow_async_update_flow_after_table_resize` The current version was selected after a long debate. Please suggest an alternative. > > >> +/** >> + * @warning >> + * @b EXPERIMENTAL: this API may change without prior notice. >> + * >> + * Following table resize, notify port that all table flows were updated. >> + * >> + * @param port_id >> + * Port identifier of Ethernet device. >> + * @param table >> + * Template table that undergoing resize operation. >> + * @param error >> + * Perform verbose error reporting if not NULL. >> + * PMDs initialize this structure in case of error only. >> + * >> + * @return >> + * - (0) if success. >> + * - (-ENODEV) if *port_id* invalid. >> + * - (-ENOTSUP) if underlying device does not support this functionality. >> + * - (-EINVAL) PMD cannot complete table resize. >> + */ >> +__rte_experimental >> +int >> +rte_flow_template_table_resize_complete(uint16_t port_id, >> + struct rte_flow_template_table *table, >> + struct rte_flow_error *error); >> > > Does it make sense to add a new error type to differentiate > unrecoverable error (I don't know if there is any) and an error that is > caused by not all rules updated? That API should not return unrecoverable error. When it called, all hardware related updates already completed. No new resources required. > > <...> > >> >> /** >> diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map >> index 5c4917c020..e37bab9b81 100644 >> --- a/lib/ethdev/version.map >> +++ b/lib/ethdev/version.map >> @@ -316,6 +316,9 @@ EXPERIMENTAL { >> rte_eth_recycle_rx_queue_info_get; >> rte_flow_group_set_miss_actions; >> rte_flow_calc_table_hash; >> + rte_flow_template_table_resize; >> + rte_flow_async_update_resized; >> + rte_flow_template_table_resize_complete; >> > > New APIs should go below "# added in 24.03" comment > I'll post an update in v2.