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 81A3DA0547; Wed, 1 Jun 2022 20:21:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 92E4F410EA; Wed, 1 Jun 2022 20:21:07 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 77CB640E5A for ; Wed, 1 Jun 2022 20:21:06 +0200 (CEST) Received: from [192.168.1.126] (unknown [188.242.181.57]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 07F9FB3; Wed, 1 Jun 2022 21:21:06 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 07F9FB3 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1654107666; bh=pq3sSFoK4amFzONLerciifv5w1+ghrMlVi3wT40mOcA=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=XJFbeu0BfHdoR1JgvWQcE9S0GN7g28pQOnEEbF1ryidwh1UkQjiVvbQiTFU389zmm g8nnkTL1dBGJmSpSwdb3BMx6AHys/fvUdAJ2mg4CGKgh53kZvfWor62NgTQ6CUBta5 wlLSUGxAMt89jRZ7WCF+gw3hPxc35NIH7bzkalgY= Message-ID: Date: Wed, 1 Jun 2022 21:21:05 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [RFC v2 2/2] ethdev: queue-based flow aged report Content-Language: en-US To: Xiaoyu Min , thomas@monjalon.net, Ori Kam , Ferruh Yigit Cc: dev@dpdk.org References: <7a45693f478b1b721b4e05131141b526185a175c.1654063912.git.jackmin@nvidia.com> From: Andrew Rybchenko In-Reply-To: <7a45693f478b1b721b4e05131141b526185a175c.1654063912.git.jackmin@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 Again, summary must not be a statement. On 6/1/22 10:39, Xiaoyu Min wrote: > When application use queue-based flow rule management and operate the > same flow rule on the same queue, e.g create/destroy/query, API of > querying aged flow rules should also have queue id parameter just like > other queue-based flow APIs. > > By this way, PMD can work in more optimized way since resources are > isolated by queue and needn't synchronize. > > If application do use queue-based flow management but configure port > without RTE_FLOW_PORT_FLAG_STRICT_QUEUE, which means application operate > a given flow rule on different queues, the queue id parameter will > be ignored. > > In addition to the above change, another new API is added which help the > application get information about which queues have aged out flows after > RTE_ETH_EVENT_FLOW_AGED event received. The queried queue id can be > used in the above queue based query aged flows API. > > Signed-off-by: Xiaoyu Min > --- > lib/ethdev/rte_flow.h | 82 ++++++++++++++++++++++++++++++++++++ > lib/ethdev/rte_flow_driver.h | 13 ++++++ > 2 files changed, 95 insertions(+) > > diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h > index 38439fcd1d..a12becfe3b 100644 > --- a/lib/ethdev/rte_flow.h > +++ b/lib/ethdev/rte_flow.h > @@ -2810,6 +2810,7 @@ enum rte_flow_action_type { > * See function rte_flow_get_aged_flows > * see enum RTE_ETH_EVENT_FLOW_AGED > * See struct rte_flow_query_age > + * See function rte_flow_get_q_aged_flows > */ > RTE_FLOW_ACTION_TYPE_AGE, > > @@ -5624,6 +5625,87 @@ rte_flow_async_action_handle_update(uint16_t port_id, > const void *update, > void *user_data, > struct rte_flow_error *error); > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Get flow queues which have aged out flows on a given port. > + * > + * The application can use this function to query which queues have aged out flows after > + * a RTE_ETH_EVENT_FLOW_AGED event is received so the returned queue id can be used to > + * get aged out flows on this given queue by call rte_flow_get_q_aged_flows. > + * > + * This function can be called from the event callback or synchronously regardless of the event. > + * > + * @param port_id > + * Port identifier of Ethernet device. > + * @param[in, out] queue_id > + * Array of queue id that will be set. > + * @param[in] nb_queue_id > + * Maximum number of the queue id that can be returned. > + * This value should be equal to the size of the queue_id array. > + * @param[out] error > + * Perform verbose error reporting if not NULL. Initialized in case of > + * error only. > + * > + * @return > + * if nb_queue_id is 0, return the amount of all queues which have aged out flows. > + * if nb_queue_id is not 0 , return the amount of queues which have aged out flows > + * reported in the queue_id array, otherwise negative errno value. I'm sorry, but it is unclear for me what happens if provided array is insufficient to return all queues. IMHO, we still should provide as much as we can. The question is how to report that we have more queues. It looks like the only sensible way is to return value greater than nb_queue_id. > + * > + * @see rte_flow_action_age > + * @see RTE_ETH_EVENT_FLOW_AGED > + */ > + > +__rte_experimental > +int > +rte_flow_get_aged_queues(uint16_t port_id, uint32_t queue_id[], uint32_t nb_queue_id, > + struct rte_flow_error *error); > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Get aged-out flows of a given port on the given flow queue. > + * > + * RTE_ETH_EVENT_FLOW_AGED event will be triggered at least one new aged out flow was > + * detected on any flow queue after the last call to rte_flow_get_q_aged_flows. > + * > + * The application can use rte_flow_get_aged_queues to query which queues have aged > + * out flows after RTE_ETH_EVEN_FLOW_AGED event. > + * > + * If application configure port attribute without RTE_FLOW_PORT_FLAG_STRICT_QUEUE > + * the @p queue_id will be ignored. > + * This function can be called to get the aged flows asynchronously from the > + * event callback or synchronously regardless the event. > + * > + * @param port_id > + * Port identifier of Ethernet device. > + * @param queue_id > + * Flow queue to query. Ignored when RTE_FLOW_PORT_FLAG_STRICT_QUEUE not set. > + * @param[in, out] contexts > + * The address of an array of pointers to the aged-out flows contexts. > + * @param[in] nb_contexts > + * The length of context array pointers. > + * @param[out] error > + * Perform verbose error reporting if not NULL. Initialized in case of > + * error only. > + * > + * @return > + * if nb_contexts is 0, return the amount of all aged contexts. > + * if nb_contexts is not 0 , return the amount of aged flows reported > + * in the context array, otherwise negative errno value. > + * > + * @see rte_flow_action_age > + * @see RTE_ETH_EVENT_FLOW_AGED > + * @see rte_flow_port_flag > + */ > + > +__rte_experimental > +int > +rte_flow_get_q_aged_flows(uint16_t port_id, uint32_t queue_id, void **contexts, > + uint32_t nb_contexts, struct rte_flow_error *error); > #ifdef __cplusplus > } > #endif > diff --git a/lib/ethdev/rte_flow_driver.h b/lib/ethdev/rte_flow_driver.h > index 2bff732d6a..b665170bf4 100644 > --- a/lib/ethdev/rte_flow_driver.h > +++ b/lib/ethdev/rte_flow_driver.h > @@ -260,6 +260,19 @@ struct rte_flow_ops { > const void *update, > void *user_data, > struct rte_flow_error *error); > + /** See rte_flow_get_aged_queues() */ > + int (*get_aged_queues) > + (uint16_t port_id, > + uint32_t queue_id[], > + uint32_t nb_queue_id, > + struct rte_flow_error *error); > + /** See rte_flow_get_q_aged_flows() */ > + int (*get_q_aged_flows) > + (uint16_t port_id, > + uint32_t queue_id, > + void **contexts, > + uint32_t nb_contexts, > + struct rte_flow_error *error); > }; > > /**