From: "Etelson, Gregory" <getelson@nvidia.com>
To: Ferruh Yigit <ferruh.yigit@amd.com>
Cc: Gregory Etelson <getelson@nvidia.com>,
dev@dpdk.org, mkashani@nvidia.com, Ori Kam <orika@nvidia.com>,
Aman Singh <aman.deep.singh@intel.com>,
Yuying Zhang <yuying.zhang@intel.com>,
Thomas Monjalon <thomas@monjalon.net>,
Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Subject: Re: [PATCH] ethdev: add template table resize API
Date: Tue, 30 Jan 2024 20:49:24 +0200 (IST) [thread overview]
Message-ID: <34f48282-05e6-e784-df85-3f7d0b5c88ce@nvidia.com> (raw)
In-Reply-To: <8e9afae9-d35d-4134-bbb0-66ed4116503a@amd.com>
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 <getelson@nvidia.com>
>> Acked-by: Ori Kam <orika@nvidia.com>
>>
>> ---
>> 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.
next prev parent reply other threads:[~2024-01-30 18:49 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-17 9:32 Gregory Etelson
2024-01-29 14:24 ` Ferruh Yigit
2024-01-29 15:08 ` Etelson, Gregory
2024-01-30 8:58 ` Ferruh Yigit
2024-01-30 12:46 ` Etelson, Gregory
2024-01-30 14:34 ` Ferruh Yigit
2024-01-30 18:15 ` Etelson, Gregory
2024-02-08 12:46 ` Ferruh Yigit
2024-02-09 5:55 ` Etelson, Gregory
2024-01-30 14:56 ` Ferruh Yigit
2024-01-30 18:49 ` Etelson, Gregory [this message]
2024-01-31 9:59 ` [PATCH v2] " Gregory Etelson
2024-02-06 22:31 ` Thomas Monjalon
2024-02-07 7:09 ` Etelson, Gregory
2024-02-07 7:03 ` [PATCH v3] " Gregory Etelson
2024-02-07 17:36 ` [PATCH v4] " Gregory Etelson
2024-02-11 9:30 ` [PATCH v5] " Gregory Etelson
2024-02-12 14:02 ` Thomas Monjalon
2024-02-12 14:48 ` Etelson, Gregory
2024-02-12 14:14 ` Ferruh Yigit
2024-02-12 15:01 ` Etelson, Gregory
2024-02-12 15:07 ` Ferruh Yigit
2024-02-12 18:12 ` [PATCH v6] " Gregory Etelson
2024-02-12 20:30 ` Ferruh Yigit
2024-02-13 11:51 ` Thomas Monjalon
2024-02-14 14:32 ` [PATCH v7] " Gregory Etelson
2024-02-14 14:42 ` Thomas Monjalon
2024-02-14 15:56 ` Ferruh Yigit
2024-02-14 17:07 ` Etelson, Gregory
2024-02-14 21:59 ` Ferruh Yigit
2024-02-15 5:41 ` Etelson, Gregory
2024-02-15 6:13 ` [PATCH v8] " Gregory Etelson
2024-02-15 13:13 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=34f48282-05e6-e784-df85-3f7d0b5c88ce@nvidia.com \
--to=getelson@nvidia.com \
--cc=aman.deep.singh@intel.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=mkashani@nvidia.com \
--cc=orika@nvidia.com \
--cc=thomas@monjalon.net \
--cc=yuying.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).