From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3CFF4A0583; Fri, 20 Mar 2020 07:59:31 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5B1522BF2; Fri, 20 Mar 2020 07:59:30 +0100 (CET) Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by dpdk.org (Postfix) with ESMTP id 99431F94 for ; Fri, 20 Mar 2020 07:59:28 +0100 (CET) Received: by mail-io1-f65.google.com with SMTP id c25so4938708ioi.5 for ; Thu, 19 Mar 2020 23:59:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DCWsNHi9zplZENkzAAhH3xCETYE7aBPT/Oz4rxhNayc=; b=DbZW7eBqgerM1ZuQMOsefeWJMAA6w72pLmfMoH+TfaDhxqz9wbiD6fi2GaGfPGq9Bp X/QZ2W1Eti/aRhHeTo5bIqvU1GcfNcV8s4729u2N4fUIONCiHD0msv1lrTgbvRR/3hqp Lp6U/CuNbZnKxWY4VA8kAFA42KEcSBZ1R+sXtfDs2NvZc5TlOEOucwE2TPF4hTGnTi+l U6qgfEpIVc7EqOQZ/PV0P+q2IbK8aXZDHOxVk9gZJNTbvMQMDlFlumH4CHtxhUqUA6TB P5KMVnatb6lOGGlwO8uK8MCKabFP927BDXVNH4ZtkQRQX1jio4mRCY01CtuGcQOXhfSx yBbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DCWsNHi9zplZENkzAAhH3xCETYE7aBPT/Oz4rxhNayc=; b=oAoU61Fj26OzmZc/fCVxi66lMC1GIkMQKKrY/rIiofV+hm5vW++eLEorzMMhZ6tVDC LrKmUO4G66t/B8aATy3WmInS0CKNrmaZMb0hD5bw/hNJfzxwdqU4YxWckxuj8AnMOlQZ fY2nZRRFmKP+33L9zxIN83hOapaPhxMxf1lZoArXLdBJyIpWnq1Cr/OtFik/me/oLDY1 F4p8UcTiKgXCegetUH6GLuj013AkeBdBVND+Gk+AJvGBY9UnGP1EXtJz6ksmciMXewBh QyBoKYE3BRFvr+5k/SoUACpc3glUryI/WuT30D1VX8vWYy6W2CYhC9JXZbMNsGSlMKpB SJZg== X-Gm-Message-State: ANhLgQ0npRZ1ON4RQG/Nck/Bhf87kK0B57k04bv9bziHcV99AhhfgxbD jzywtyFXE/t0dwCsgECiGMvTQRhM0P+LSPAcKseAZwpgA6M= X-Google-Smtp-Source: ADFU+vviwvLOHp/wg9kH6dwlzu/LOVxpCmtdKCeTL0WOux87fhGhvwoPtatMQ1drvQLbTDs7oykI5D5PfqQzl20sGas= X-Received: by 2002:a02:3506:: with SMTP id k6mr6818297jaa.104.1584687567892; Thu, 19 Mar 2020 23:59:27 -0700 (PDT) MIME-Version: 1.0 References: <1558865893-23381-1-git-send-email-matan@mellanox.com> <20200316125205.22169-1-dongz@mellanox.com> In-Reply-To: <20200316125205.22169-1-dongz@mellanox.com> From: Jerin Jacob Date: Fri, 20 Mar 2020 12:29:11 +0530 Message-ID: To: BillZhou Cc: Adrien Mazarguil , Matan Azrad , dpdk-dev Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v2] [RFC] ethdev: support flow aging X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Mon, Mar 16, 2020 at 6:22 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 > --- > 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. */ > + 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 s/usynchronously/ asynchronously > + * 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 By default, everything is [in]. Not need to mention [in] explicitly. > + * 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_ETH_EVENT_FLOW_AGED can be added in @see Other than the above nits, This RFC looks good to me. > + */ > +__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 > -- > 2.21.0 >