From: Andrew Rybchenko <arybchenko@solarflare.com>
To: BillZhou <dongz@mellanox.com>, <adrien.mazarguil@6wind.com>,
<matan@mellanox.com>
Cc: <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v2] [RFC] ethdev: support flow aging
Date: Tue, 24 Mar 2020 13:18:04 +0300 [thread overview]
Message-ID: <ba0864e5-2d67-e65b-f992-a574eba7d234@solarflare.com> (raw)
In-Reply-To: <20200316125205.22169-1-dongz@mellanox.com>
On 3/16/20 3:52 PM, BillZhou wrote:
> One of the reasons to destroy a flow is the fact that no packet matches the
> flow for "timeout" time.
> For example, when TCP\UDP sessions are suddenly closed.
>
> Currently, there is no any dpdk mechanism for flow aging and the
> applications use there own ways to detect and destroy aged-out flows.
>
> This RFC introduces flow aging APIs to offload the flow aging task from
> the application to the port.
>
> Design:
> - A new rte_flow action: RTE_FLOW_ACTION_TYPE_AGE to set the timeout and
> the application flow context for each flow.
> - A new ethdev event: RTE_ETH_EVENT_FLOW_AGED for the driver to report
> that there are new aged-out flows.
> - A new rte_flow API: rte_flow_get_aged_flows to get the aged-out flows
> contexts from the port.
>
> By this design each PMD can use its best way to do the aging with the
> device offloads supported by its HW.
>
> Signed-off-by: BillZhou <dongz@mellanox.com>
LGTM
> ---
> v2:For API rte_flow_get_aged_flows, delete "struct rte_flow *flows[]"
> this parameter.
> ---
> lib/librte_ethdev/rte_ethdev.h | 1 +
> lib/librte_ethdev/rte_flow.h | 56 ++++++++++++++++++++++++++++++++++
> 2 files changed, 57 insertions(+)
>
> diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
> index d1a593ad11..03135a7138 100644
> --- a/lib/librte_ethdev/rte_ethdev.h
> +++ b/lib/librte_ethdev/rte_ethdev.h
> @@ -3015,6 +3015,7 @@ enum rte_eth_event_type {
> RTE_ETH_EVENT_NEW, /**< port is probed */
> RTE_ETH_EVENT_DESTROY, /**< port is released */
> RTE_ETH_EVENT_IPSEC, /**< IPsec offload related event */
> + RTE_ETH_EVENT_FLOW_AGED,/**< New aged-out flows detected in the port */
> RTE_ETH_EVENT_MAX /**< max value of this enum */
> };
>
> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> index 5625dc4917..1fc05bf56c 100644
> --- a/lib/librte_ethdev/rte_flow.h
> +++ b/lib/librte_ethdev/rte_flow.h
> @@ -2051,6 +2051,14 @@ enum rte_flow_action_type {
> * See struct rte_flow_action_set_dscp.
> */
> RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP,
> +
> + /**
> + * Report as aged-out if timeout passed without any matching on the
> + * flow.
> + *
> + * See struct rte_flow_action_age.
> + */
> + RTE_FLOW_ACTION_TYPE_AGE,
> };
>
> /**
> @@ -2633,6 +2641,22 @@ struct rte_flow_action {
> const void *conf; /**< Pointer to action configuration object. */
> };
>
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this structure may change without prior notice
> + *
> + * RTE_FLOW_ACTION_TYPE_AGE
> + *
> + * Report as aged-out if timeout passed without any matching on the flow.
> + *
> + * The flow context and the flow handle will be reported by the
> + * rte_flow_get_aged_flows API.
> + */
> +struct rte_flow_action_age {
> + uint16_t timeout; /**< Time in seconds. */
Is it intentionally defined small? May be it is better to
use uint32_t? I just want to understand the rational behind
the type choice.
> + void *context; /**< The user flow context. */
> +};
> +
> /**
> * Opaque type returned after successfully creating a flow.
> *
> @@ -3224,6 +3248,38 @@ rte_flow_conv(enum rte_flow_conv_op op,
> const void *src,
> struct rte_flow_error *error);
>
> +/**
> + * Get aged-out flows of a given port.
> + *
> + * RTE_ETH_EVENT_FLOW_AGED is triggered when a port detects aged-out flows.
> + * This function can be called to get the aged flows usynchronously from the
> + * event callback or synchronously when the user wants it.
> + * The callback synchronization is on the user responsibility.
> + *
> + * @param port_id
> + * Port identifier of Ethernet device.
> + * @param[in/out] contexts
> + * An allocated array to get the aged-out flows contexts from input age
> + * action config, if input contexts is null, return the aged-out flows.
> + * NULL indicates the flow contexts should not be reported.
> + * @param[in] nb_context
> + * The allocated array entries number of @p contexts if exist.
> + * @param[out] error
> + * Perform verbose error reporting if not NULL. Initialized in case of
> + * error only.
> + *
> + * @return
> + * 0 in case there are not any aged-out contexts or flows, otherwise if
> + * positive is the number of the reported aged-out contexts or flows to
> + * @p contexts, a negative errno value otherwise and rte_errno is set.
> + *
> + * @see rte_flow_action_age
> + */
> +__rte_experimental
> +int
> +rte_flow_get_aged_flows(uint16_t port_id, void *contexts[],
> + int nb_context, struct rte_flow_error *error);
> +
> #ifdef __cplusplus
> }
> #endif
>
next prev parent reply other threads:[~2020-03-24 10:18 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-26 10:18 [dpdk-dev] [PATCH] " Matan Azrad
2019-06-06 10:24 ` Jerin Jacob Kollanukkaran
2019-06-06 10:51 ` Matan Azrad
2019-06-06 12:15 ` Jerin Jacob Kollanukkaran
2019-06-18 5:56 ` Matan Azrad
2019-06-24 6:26 ` Jerin Jacob Kollanukkaran
2019-06-27 8:26 ` Matan Azrad
2020-03-16 16:13 ` Stephen Hemminger
2020-03-16 10:22 ` [dpdk-dev] [PATCH v2] " BillZhou
2020-03-16 12:52 ` BillZhou
2020-03-20 6:59 ` Jerin Jacob
2020-03-24 10:18 ` Andrew Rybchenko [this message]
2020-04-10 9:46 ` [dpdk-dev] [PATCH] " BillZhou
2020-04-10 10:14 ` Thomas Monjalon
2020-04-13 4:02 ` Bill Zhou
2020-04-10 12:07 ` Andrew Rybchenko
2020-04-10 12:41 ` Jerin Jacob
2020-04-12 9:13 ` Ori Kam
2020-04-12 9:48 ` Matan Azrad
2020-04-14 8:32 ` [dpdk-dev] [PATCH v2] " Dong Zhou
2020-04-14 8:49 ` Ori Kam
2020-04-14 9:23 ` Bill Zhou
2020-04-16 13:32 ` Ferruh Yigit
2020-04-17 22:00 ` Ferruh Yigit
2020-04-17 22:07 ` Stephen Hemminger
2020-04-18 5:04 ` Bill Zhou
2020-04-18 9:44 ` Thomas Monjalon
2020-04-20 14:06 ` Ferruh Yigit
2020-04-20 16:10 ` Thomas Monjalon
2020-04-21 10:04 ` Ferruh Yigit
2020-04-21 10:09 ` Thomas Monjalon
2020-04-21 15:59 ` Andrew Rybchenko
2020-04-21 6:22 ` [dpdk-dev] [PATCH v3] " Bill Zhou
2020-04-21 10:11 ` [dpdk-dev] [PATCH v4] " Bill Zhou
2020-04-21 17:13 ` Ferruh Yigit
2020-04-29 14:50 ` Tom Barbette
2020-04-30 7:36 ` Matan Azrad
2020-04-30 7:49 ` Tom Barbette
2020-04-13 14:53 ` [dpdk-dev] [PATCH 0/2] " Dong Zhou
2020-04-13 14:53 ` [dpdk-dev] [PATCH 1/2] net/mlx5: modify ext-counter memory allocation Dong Zhou
2020-04-13 14:53 ` [dpdk-dev] [PATCH 2/2] net/mlx5: support flow aging Dong Zhou
2020-04-24 10:45 ` [dpdk-dev] [PATCH v2 0/2] " Bill Zhou
2020-04-24 10:45 ` [dpdk-dev] [PATCH v2 1/2] net/mlx5: modify ext-counter memory allocation Bill Zhou
2020-04-24 10:45 ` [dpdk-dev] [PATCH v2 2/2] net/mlx5: support flow aging Bill Zhou
2020-04-26 7:07 ` Suanming Mou
2020-04-29 2:25 ` [dpdk-dev] [PATCH v3 0/2] " Bill Zhou
2020-04-29 2:25 ` [dpdk-dev] [PATCH v3 1/2] net/mlx5: modify ext-counter memory allocation Bill Zhou
2020-04-29 2:25 ` [dpdk-dev] [PATCH v3 2/2] net/mlx5: support flow aging Bill Zhou
2020-05-03 7:41 ` [dpdk-dev] [PATCH v3 0/2] " Matan Azrad
2020-05-03 11:47 ` Raslan Darawsheh
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=ba0864e5-2d67-e65b-f992-a574eba7d234@solarflare.com \
--to=arybchenko@solarflare.com \
--cc=adrien.mazarguil@6wind.com \
--cc=dev@dpdk.org \
--cc=dongz@mellanox.com \
--cc=matan@mellanox.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).