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 EED0DA0548; Thu, 2 Jun 2022 11:39:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF93C40691; Thu, 2 Jun 2022 11:39:47 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2089.outbound.protection.outlook.com [40.107.244.89]) by mails.dpdk.org (Postfix) with ESMTP id 219F54021E for ; Thu, 2 Jun 2022 11:39:46 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZET8CxO6etugzPm6X35QTWJsr/6Tnr3/7pi8fqpHXm3pGmRMVahR4qCdiD8nOH/fb4PKZ12WghqQtdOQOU4A1X3jqhYCfcgoFUttSkS9N4d0oS4OEawCHdsp+IuPn4k/IEiSS50JE0y4yg6zY4Qhm85hxgX5nSK/ELy3kKa49ClkkN/g34jw3Ethpxxf5cWI1AzJiWIrRk+5O7bZ4e3kO+s/H+4LAr/fCg/Rjz/OLft/zbiExMGLULwyaewcpsCdKo6IMwTd5ac630dyKuqklO88Y87QY2d0Ti/RSKcocEvoW3QJGgcE7Gz8AsKPHu0K6SZQk26ORpIZQw/+4A/2VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4R6fKbq4dsY1AJRrA1i58C/v1LJdYkd0HVSgSl1NQvo=; b=UsbZwlpcrUKtEV3xeycyTdMVgUQjXVe3XjQTSHCO/gD9blQfvj4w8XUUnZuMCi1EEbkaKsaHoQUFUx6uiYi4gomGHH4sO90k3+6AkuxWhtck91+KqXe6QTa2H/75HM9G6wRbbV2+KGVnlAh2+CpijX0z5HHZV5YV9WiUKlUfvy2hhkybJAV9GZJ0s/dtcKdGMZWCnaxM95fXJ8kYCsGeoIgJBqusYc+evive4v4B6cdHCIkYOW11qqzIw6tqYQY8pK29uc+Knd3J2yU9E6zMs64jizj5rctKWLaVAI9cgEejlc2dtNCKAEhFSdDy2i42BRm2lJ4fyT5BzF3fD5woVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4R6fKbq4dsY1AJRrA1i58C/v1LJdYkd0HVSgSl1NQvo=; b=Lhm4Bu0dxlJb6cyjvooXPW6dRB44syukN1R4zXfkBXupJaHitydH1JZBWoUutCC81UGxBTRJmUXuvq7hprwzzPKBJUNjY+mOTnQj0tuHelfqseGYIMvrZJaPZKTFb/uIiCezPWPqODdRD9MCJH4rOtXidhTxRQwUlVJXkGYqg5P+S75kEMSqq7TZJfcOU4CDYgAQ9N1BPjEcWjl3iI7fDIFvK+clE6tqm5baSXr7s6A2o2NXlUNe4IPZSMKQph73nhrMCd0/CierNolrQvW6/7mEGZ5d0y9L/62HTnwg6STNERZi7YKrmQD/aUxjQplqZY7AFScr1AmEamJtShWdKQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CO6PR12MB5459.namprd12.prod.outlook.com (2603:10b6:303:13b::16) by SJ0PR12MB5633.namprd12.prod.outlook.com (2603:10b6:a03:428::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.13; Thu, 2 Jun 2022 09:39:44 +0000 Received: from CO6PR12MB5459.namprd12.prod.outlook.com ([fe80::34ef:8717:3038:667]) by CO6PR12MB5459.namprd12.prod.outlook.com ([fe80::34ef:8717:3038:667%3]) with mapi id 15.20.5314.014; Thu, 2 Jun 2022 09:39:44 +0000 Content-Type: multipart/alternative; boundary="------------C2ytOeYR0MkydK6QB1bnijCy" Message-ID: Date: Thu, 2 Jun 2022 17:39:36 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [RFC v2 2/2] ethdev: queue-based flow aged report Content-Language: en-US To: Andrew Rybchenko , thomas@monjalon.net, Ori Kam , Ferruh Yigit Cc: dev@dpdk.org References: <7a45693f478b1b721b4e05131141b526185a175c.1654063912.git.jackmin@nvidia.com> From: Jack Min In-Reply-To: X-ClientProxiedBy: HK2PR0401CA0015.apcprd04.prod.outlook.com (2603:1096:202:2::25) To CO6PR12MB5459.namprd12.prod.outlook.com (2603:10b6:303:13b::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 18af0ed6-c94b-4a8d-b9b7-08da447bd330 X-MS-TrafficTypeDiagnostic: SJ0PR12MB5633:EE_ X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FBQKMWM2kI4lTq8GW+lATMK0kLolP3VO5728EpdwdkdPmX8wj3zzwRFKLcT1ADxvZjW97e67o0/TB+KNlU+UBmRMmndO3toS3k+hJeGIlzto/4sk4PwBsA6AD6/zsLqK1R9m9lEIbtz2bUaZhEgK2Rl/DD2HhNOCdzDwwZFOTy7xRaWQghMEylE/udJGgtWF8MOkKuxNNMeiIYG/8HtqRs2U/n1SoFrd7sFcUA8cOz8Tz0ZThTDQrzjLIGVYB8tZvfpW+yEP2OXfEy7/ReycEvTzKfOs8ha0NY2qH30cYVF9pHlvAlJvKx9adaEt8SYXyMgWIRFgD/1Dh7whUarvwLQSBst068WH4lbiRTvDIzTJmHJlGizHuXSCXTJru3Qu3wFJ9QW4FacYB3gKquhO0SDtL1kQiBHOfg+73yu8KHoUiRcn3obMRFJC3I/ibaJeyhYpL0ufRRIYPVsNvn8MRrVAE92jlJ3PyHDS5mxytxB7jBeyJxJmFGKDpTuwh/SAiQILdajq0dVhd1x7Y1jaYPHkdQo0hgx9YkEqKvcoz5Zl2/YJw+8f2+xysjC38dzKoXn/uQjZMhSSaVw4a8OqXXVxW7vHmKtZH6jehKgdbnljZMuzpmPUyPMDHdUKguvqiqwGhV6fHiQn4Zr4cQfHumQBCrm4kwomNF+GMTeAQfsGY39w87yGWPgiMEa0DwA2GOeCFr42+FD1+SBITyscdlsE+qRXzF38EcGje2pdeajSjIvun7DGEQI/rLh1RJsb X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR12MB5459.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(38100700002)(36756003)(30864003)(5660300002)(6486002)(53546011)(6666004)(6506007)(31686004)(33964004)(6512007)(26005)(110136005)(8936002)(316002)(66476007)(66556008)(31696002)(8676002)(2616005)(66946007)(86362001)(2906002)(4326008)(186003)(508600001)(83380400001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QVQ0Z2dkaVRSY2x6NmtFUXN2QkNxbWhjcVJxSXF2L2VJWkMrQWZkcS9OSzFC?= =?utf-8?B?NDVnSHJHTER2cjd1bUJnYVFmRDhoRFNadG5sYnIrY0NYVG9BS0w4LzBEWVd4?= =?utf-8?B?bFg0cUNiZFlwYnd6bWljOXFTeUkwWGVZT3JuQmhkREE5ajVHUkZIc2ZpemJI?= =?utf-8?B?RGVBKzJ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NRzl6TDIwbjY0WVd4?= =?utf-8?B?ckZxSUN3bkY3WTBzYjJYRVJucFVuaHZWVTk5VGdiYmlUODRpOVF5VXJ5V3ZV?= =?utf-8?B?NllZOEt6SUVQaEFOajE3MDlKcWJFeFQwVmRXRkVIaHczeHlheGtkczltM3Fy?= =?utf-8?B?Mk9CdXZWeXExdDdZWHEyTUNjNDQ5UlJYQjlBTmNFV2E3SWtScXA3OFZvY1hi?= =?utf-8?B?VWxqdVlsYnlHT1lRZWw5dUp0S3VRM2FWVEJ5citVdGE0OWtTQkM0cUNUMVJp?= =?utf-8?B?N2lQaVR3OUV3blpldkZxcVcyd3pScVBUTE8zaXpKdE56ODJSY28zOXdzKzh0?= =?utf-8?B?K3NDQy9tUWQ4dFg2b0g1c3RiUmxlQlhML28yQk5Ha0FzZXZtMkZZZz09?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 18af0ed6-c94b-4a8d-b9b7-08da447bd330 X-MS-Exchange-CrossTenant-AuthSource: CO6PR12MB5459.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2022 09:39:44.2292 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 01ji31FxhXtr/4YPOycgIGTJtlRffr9iy3q7/N9fS8dRHhtKTuK9YHKFMAmm9+ly+ZjVvqEhC9ZkRa3e8jL1Ig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB5633 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 --------------C2ytOeYR0MkydK6QB1bnijCy Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 6/2/22 02:21, Andrew Rybchenko wrote: > Again, summary must not be a statement. I'l re-phrase it. > 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); >>   }; >>     /** > --------------C2ytOeYR0MkydK6QB1bnijCy Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
On 6/2/22 02:21, Andrew Rybchenko wrote:
Again, summary must not be a statement.
I'l re-phrase it.
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 <jackmin@nvidia.com>
---
  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);
  };
    /**

--------------C2ytOeYR0MkydK6QB1bnijCy--