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 7ADC6A0C4D; Wed, 13 Oct 2021 06:11:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 024BD40150; Wed, 13 Oct 2021 06:11:47 +0200 (CEST) Received: from mail-io1-f42.google.com (mail-io1-f42.google.com [209.85.166.42]) by mails.dpdk.org (Postfix) with ESMTP id A2E1240142 for ; Wed, 13 Oct 2021 06:11:45 +0200 (CEST) Received: by mail-io1-f42.google.com with SMTP id 5so1268525iov.9 for ; Tue, 12 Oct 2021 21:11:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DXw/6/MQoLIOJPoEuS5iz9Z1sAO27nHhAr62NBjuT5I=; b=OCcUZ8MCO/nFISH7NPuv6hCI4DMs2+mUKN5G9uyeeRI363XC2Ha9wZEhLEEJ2UQcCe hvFMnxKwnfDssGw5JK1FtmF1ukCf0BbIvwZaE2ATtTu1GaQlsZ5C3dWaPUIZF2GIClqk dkXvs+nFyDVgVfSE02kHhAi0ORcc48cVF4vnw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DXw/6/MQoLIOJPoEuS5iz9Z1sAO27nHhAr62NBjuT5I=; b=CsiWVYeCrppMRN98LoNPbTQV4zqO9D8svX1wlhtjp+mzbKp7cmzrrQRWGsqWnoijDY t7gEeLajnG4BwarVWjkZed33XUu93WvOi33Yrr8pUT7SxkV/votg4bikWZfEDDtPW9MV 67Ta1UizpVrjohBot/SiiS0rmdAhiudbdv5ybDLUlYcyZtYDMMqrDcsKv3MrXdvoNmqC dX6lGGL+iod2x2+91yzlhcget2ivHGrnul7rNe433ro9f92YN7Dklh6gkFD3op/sajqK TiRKhywYh0YJQ02Ya6XpYza95zRO7JyOmqf+3xZoYjFZQLu7ACwiHT4KCVXkxFUYEjH7 wwYw== X-Gm-Message-State: AOAM531M9FN1kbmyqkzKPhiaJbpm3VWCCRrffp6AcUXuPjmi8l06Kf3D SwcfXVZeoxJRXGl6Opb7/AIbbO2FCXEvJ1sJEu9V3g== X-Google-Smtp-Source: ABdhPJx5j181zFGlDBFxNb8Wnrz4dmXXGh0RqR44G3v5Tm5Ac3oRnfZohcX+bQjS8NA2C0dZKNUvwlsmbVep9411aeI= X-Received: by 2002:a6b:6a16:: with SMTP id x22mr1009423iog.179.1634098304904; Tue, 12 Oct 2021 21:11:44 -0700 (PDT) MIME-Version: 1.0 References: <20211006044835.3936226-1-akozyrev@nvidia.com> <20211006044835.3936226-2-akozyrev@nvidia.com> In-Reply-To: <20211006044835.3936226-2-akozyrev@nvidia.com> From: Ajit Khaparde Date: Tue, 12 Oct 2021 21:11:29 -0700 Message-ID: To: Alexander Kozyrev Cc: dpdk-dev , Thomas Monjalon , Ori Kam , Ivan Malov , Andrew Rybchenko , Ferruh Yigit , mohammad.abdul.awal@intel.com, Qi Zhang , Jerin Jacob Kollanukkaran Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH 1/3] ethdev: introduce flow pre-configuration hints 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 Sender: "dev" On Tue, Oct 5, 2021 at 9:48 PM Alexander Kozyrev wrote: > > The flow rules creation/destruction at a large scale incurs a performance > penalty and may negatively impact the packet processing when used > as part of the datapath logic. This is mainly because software/hardware > resources are allocated and prepared during the flow rule creation. > > In order to optimize the insertion rate, PMD may use some hints provided > by the application at the initialization phase. The rte_flow_configure() > function allows to pre-allocate all the needed resources beforehand. > These resources can be used at a later stage without costly allocations. > Every PMD may use only the subset of hints and ignore unused ones. This could get tricky. An application can avoid attempts to create flows for items/actions if it can get a hint that PMD cannot satisfy some of the hints provided. Also what if the application tries to configure a higher count than what the PMD/HW can support? It will be good if the hints can be negotiated. Something like this? Application could start with a set of hints. PMD can check what can be supported and return an updated set. Application stays within those values till it needs to resize. > > Signed-off-by: Alexander Kozyrev > Suggested-by: Ori Kam > --- > lib/ethdev/rte_flow.h | 70 +++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 70 insertions(+) > > diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h > index 7b1ed7f110..c69d503b90 100644 > --- a/lib/ethdev/rte_flow.h > +++ b/lib/ethdev/rte_flow.h > @@ -4288,6 +4288,76 @@ rte_flow_tunnel_item_release(uint16_t port_id, > struct rte_flow_item *items, > uint32_t num_of_items, > struct rte_flow_error *error); > + > +/** > + * Flow engine configuration. > + */ > +__extension__ > +struct rte_flow_port_attr { > + /** > + * Version of the struct layout, should be 0. > + */ > + uint32_t version; > + /** > + * Memory size allocated for the flow rules management. > + * If set to 0, memory is allocated dynamically. > + */ > + uint32_t mem_size; > + /** > + * Number of counter actions pre-configured. > + * If set to 0, PMD will allocate counters dynamically. > + * @see RTE_FLOW_ACTION_TYPE_COUNT > + */ > + uint32_t nb_counters; > + /** > + * Number of aging actions pre-configured. > + * If set to 0, PMD will allocate aging dynamically. > + * @see RTE_FLOW_ACTION_TYPE_AGE > + */ > + uint32_t nb_aging; > + /** > + * Number of traffic metering actions pre-configured. > + * If set to 0, PMD will allocate meters dynamically. > + * @see RTE_FLOW_ACTION_TYPE_METER > + */ > + uint32_t nb_meters; > + /** > + * Resources reallocation strategy. > + * If set to 1, PMD is not allowed to allocate more resources on demand. > + * An application can only allocate more resources by calling the > + * configure API again with new values (may not be supported by PMD). > + */ > + uint32_t fixed_resource_size:1; > +}; > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Configure flow rules module. > + * To pre-allocate resources as per the flow port attributes, > + * this configuration function must be called before any flow rule is created. > + * No other rte_flow function should be called while this function is invoked. > + * This function can be called again to change the configuration. > + * Some PMDs may not support re-configuration at all, > + * or may only allow increasing the number of resources allocated. > + * > + * @param port_id > + * Port identifier of Ethernet device. > + * @param[in] port_attr > + * Port configuration attributes. > + * @param[out] error > + * Perform verbose error reporting if not NULL. > + * PMDs initialize this structure in case of error only. > + * > + * @return > + * 0 on success, a negative errno value otherwise and rte_errno is set. > + */ > +__rte_experimental > +int > +rte_flow_configure(uint16_t port_id, > + const struct rte_flow_port_attr *port_attr, > + struct rte_flow_error *error); > #ifdef __cplusplus > } > #endif > -- > 2.18.2 >