<html data-lt-installed="true"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div class="moz-cite-prefix">On 6/2/22 02:21, Andrew Rybchenko
wrote:<br>
</div>
<blockquote type="cite" cite="mid:c15c5f92-9964-5af0-53aa-31f7e9f1f3f0@oktetlabs.ru">Again,
summary must not be a statement.
<br>
</blockquote>
I'l re-phrase it.<br>
<blockquote type="cite" cite="mid:c15c5f92-9964-5af0-53aa-31f7e9f1f3f0@oktetlabs.ru">On
6/1/22 10:39, Xiaoyu Min wrote:
<br>
<blockquote type="cite">When application use queue-based flow rule
management and operate the
<br>
same flow rule on the same queue, e.g create/destroy/query, API
of
<br>
querying aged flow rules should also have queue id parameter
just like
<br>
other queue-based flow APIs.
<br>
<br>
By this way, PMD can work in more optimized way since resources
are
<br>
isolated by queue and needn't synchronize.
<br>
<br>
If application do use queue-based flow management but configure
port
<br>
without RTE_FLOW_PORT_FLAG_STRICT_QUEUE, which means application
operate
<br>
a given flow rule on different queues, the queue id parameter
will
<br>
be ignored.
<br>
<br>
In addition to the above change, another new API is added which
help the
<br>
application get information about which queues have aged out
flows after
<br>
RTE_ETH_EVENT_FLOW_AGED event received. The queried queue id can
be
<br>
used in the above queue based query aged flows API.
<br>
<br>
Signed-off-by: Xiaoyu Min <a class="moz-txt-link-rfc2396E" href="mailto:jackmin@nvidia.com"><jackmin@nvidia.com></a>
<br>
---
<br>
lib/ethdev/rte_flow.h | 82
++++++++++++++++++++++++++++++++++++
<br>
lib/ethdev/rte_flow_driver.h | 13 ++++++
<br>
2 files changed, 95 insertions(+)
<br>
<br>
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
<br>
index 38439fcd1d..a12becfe3b 100644
<br>
--- a/lib/ethdev/rte_flow.h
<br>
+++ b/lib/ethdev/rte_flow.h
<br>
@@ -2810,6 +2810,7 @@ enum rte_flow_action_type {
<br>
* See function rte_flow_get_aged_flows
<br>
* see enum RTE_ETH_EVENT_FLOW_AGED
<br>
* See struct rte_flow_query_age
<br>
+ * See function rte_flow_get_q_aged_flows
<br>
*/
<br>
RTE_FLOW_ACTION_TYPE_AGE,
<br>
@@ -5624,6 +5625,87 @@
rte_flow_async_action_handle_update(uint16_t port_id,
<br>
const void *update,
<br>
void *user_data,
<br>
struct rte_flow_error *error);
<br>
+
<br>
+/**
<br>
+ * @warning
<br>
+ * @b EXPERIMENTAL: this API may change without prior notice.
<br>
+ *
<br>
+ * Get flow queues which have aged out flows on a given port.
<br>
+ *
<br>
+ * The application can use this function to query which queues
have aged out flows after
<br>
+ * a RTE_ETH_EVENT_FLOW_AGED event is received so the returned
queue id can be used to
<br>
+ * get aged out flows on this given queue by call
rte_flow_get_q_aged_flows.
<br>
+ *
<br>
+ * This function can be called from the event callback or
synchronously regardless of the event.
<br>
+ *
<br>
+ * @param port_id
<br>
+ * Port identifier of Ethernet device.
<br>
+ * @param[in, out] queue_id
<br>
+ * Array of queue id that will be set.
<br>
+ * @param[in] nb_queue_id
<br>
+ * Maximum number of the queue id that can be returned.
<br>
+ * This value should be equal to the size of the queue_id
array.
<br>
+ * @param[out] error
<br>
+ * Perform verbose error reporting if not NULL. Initialized
in case of
<br>
+ * error only.
<br>
+ *
<br>
+ * @return
<br>
+ * if nb_queue_id is 0, return the amount of all queues which
have aged out flows.
<br>
+ * if nb_queue_id is not 0 , return the amount of queues
which have aged out flows
<br>
+ * reported in the queue_id array, otherwise negative errno
value.
<br>
</blockquote>
<br>
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
<br>
much as we can. The question is how to report that we have more
queues.
<br>
It looks like the only sensible way is to return value greater
than
<br>
nb_queue_id.
<br>
<br>
<blockquote type="cite">+ *
<br>
+ * @see rte_flow_action_age
<br>
+ * @see RTE_ETH_EVENT_FLOW_AGED
<br>
+ */
<br>
+
<br>
+__rte_experimental
<br>
+int
<br>
+rte_flow_get_aged_queues(uint16_t port_id, uint32_t queue_id[],
uint32_t nb_queue_id,
<br>
+ struct rte_flow_error *error);
<br>
+
<br>
+/**
<br>
+ * @warning
<br>
+ * @b EXPERIMENTAL: this API may change without prior notice.
<br>
+ *
<br>
+ * Get aged-out flows of a given port on the given flow queue.
<br>
+ *
<br>
+ * RTE_ETH_EVENT_FLOW_AGED event will be triggered at least one
new aged out flow was
<br>
+ * detected on any flow queue after the last call to
rte_flow_get_q_aged_flows.
<br>
+ *
<br>
+ * The application can use rte_flow_get_aged_queues to query
which queues have aged
<br>
+ * out flows after RTE_ETH_EVEN_FLOW_AGED event.
<br>
+ *
<br>
+ * If application configure port attribute without
RTE_FLOW_PORT_FLAG_STRICT_QUEUE
<br>
+ * the @p queue_id will be ignored.
<br>
+ * This function can be called to get the aged flows
asynchronously from the
<br>
+ * event callback or synchronously regardless the event.
<br>
+ *
<br>
+ * @param port_id
<br>
+ * Port identifier of Ethernet device.
<br>
+ * @param queue_id
<br>
+ * Flow queue to query. Ignored when
RTE_FLOW_PORT_FLAG_STRICT_QUEUE not set.
<br>
+ * @param[in, out] contexts
<br>
+ * The address of an array of pointers to the aged-out flows
contexts.
<br>
+ * @param[in] nb_contexts
<br>
+ * The length of context array pointers.
<br>
+ * @param[out] error
<br>
+ * Perform verbose error reporting if not NULL. Initialized
in case of
<br>
+ * error only.
<br>
+ *
<br>
+ * @return
<br>
+ * if nb_contexts is 0, return the amount of all aged
contexts.
<br>
+ * if nb_contexts is not 0 , return the amount of aged flows
reported
<br>
+ * in the context array, otherwise negative errno value.
<br>
+ *
<br>
+ * @see rte_flow_action_age
<br>
+ * @see RTE_ETH_EVENT_FLOW_AGED
<br>
+ * @see rte_flow_port_flag
<br>
+ */
<br>
+
<br>
+__rte_experimental
<br>
+int
<br>
+rte_flow_get_q_aged_flows(uint16_t port_id, uint32_t queue_id,
void **contexts,
<br>
+ uint32_t nb_contexts, struct rte_flow_error
*error);
<br>
#ifdef __cplusplus
<br>
}
<br>
#endif
<br>
diff --git a/lib/ethdev/rte_flow_driver.h
b/lib/ethdev/rte_flow_driver.h
<br>
index 2bff732d6a..b665170bf4 100644
<br>
--- a/lib/ethdev/rte_flow_driver.h
<br>
+++ b/lib/ethdev/rte_flow_driver.h
<br>
@@ -260,6 +260,19 @@ struct rte_flow_ops {
<br>
const void *update,
<br>
void *user_data,
<br>
struct rte_flow_error *error);
<br>
+ /** See rte_flow_get_aged_queues() */
<br>
+ int (*get_aged_queues)
<br>
+ (uint16_t port_id,
<br>
+ uint32_t queue_id[],
<br>
+ uint32_t nb_queue_id,
<br>
+ struct rte_flow_error *error);
<br>
+ /** See rte_flow_get_q_aged_flows() */
<br>
+ int (*get_q_aged_flows)
<br>
+ (uint16_t port_id,
<br>
+ uint32_t queue_id,
<br>
+ void **contexts,
<br>
+ uint32_t nb_contexts,
<br>
+ struct rte_flow_error *error);
<br>
};
<br>
/**
<br>
</blockquote>
<br>
</blockquote>
</body>
<lt-container></lt-container>
</html>