DPDK patches and discussions
 help / color / mirror / Atom feed
* Re: [PATCH v2 01/10] ethdev: introduce flow pre-configuration hints
@ 2022-01-19 13:07 Ivan Malov
  2022-01-25  1:09 ` Alexander Kozyrev
  0 siblings, 1 reply; 22+ messages in thread
From: Ivan Malov @ 2022-01-19 13:07 UTC (permalink / raw)
  To: dev

Hi,

> +Rules management configuration
> +------------------------------
> +
> +Configure flow rules management.

It is either "management OF ruleS" or "rule management".
Perhaps fix similar occurrences across the series.

> +	/**
> +	 * 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;

If duplication of the same description is undesirable,
consider adding a common description for these fields:

/**
  * Resource preallocation settings. Use zero to
  * request that allocations be done on demand.
  */

Instead of "nb_aging", perhaps consider something like "nb_age_timers".

> + * 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.
> + * Must be called only after Ethernet device is configured, but may be called
> + * before or after the device is started as long as there are no flow rules.
> + * 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.

Consider:

* Pre-configure the port's flow API engine.
*
* This API can only be invoked before the application
* starts using the rest of the flow library functions.
*
* The API can be invoked multiple times to change the
* settings. The port, however, may reject the changes.

--
Ivan M.

^ permalink raw reply	[flat|nested] 22+ messages in thread
* [dpdk-dev] [RFC 0/3] ethdev: datapath-focused flow rules management
@ 2021-10-06  4:48 Alexander Kozyrev
  2022-01-18 15:30 ` [PATCH v2 00/10] " Alexander Kozyrev
  0 siblings, 1 reply; 22+ messages in thread
From: Alexander Kozyrev @ 2021-10-06  4:48 UTC (permalink / raw)
  To: dev
  Cc: thomas, orika, ivan.malov, andrew.rybchenko, ferruh.yigit,
	mohammad.abdul.awal, qi.z.zhang, jerinj, ajit.khaparde

The current flow rules insertion mechanism assumes applications
manage flow rules lifecycle in the control path. The flow rules
creation/destruction is performed synchronously and under a lock.
But for applications doing this job as part of the datapath, any
blocking operations are not desirable as they cause delay in the
packet processing.

These patches optimize a datapath-focused flow rules management
approach based on four main concepts:

1. Pre-configuration hints.
In order to reduce the overhead of the flow rules management, the
application may provide some hints at the initialization phase about
flow rules characteristics to be used. The configuration funtion
pre-allocates all the needed resources inside a PMD/HW beforehand and
these resources are used at a later stage without costly allocations.

2. Flow grouping using templates.
Unlike current stage where each flow rule is treated as independent entity,
new approach can leverage application knowledge about common patterns in
most of flows. Similar flows are grouped toghether using templates to enable
better resource management inside the PMD/HW.

3. Queue-based flow management.
Flow rules creation/destruction is done by using lockless flow queues.
The application configures number of queues during the initialization stage.
Then create/destroy operations are enqueued without any lock.

4. Asynchronous operations.
There is a way to spare the datapath from waiting for the flow rule
creation/destruction. Adopting an asynchronous queue-based approach,
the packet processing can continue with handling next packets while
inserting/deleting a flow rule inside the hardware. The application
is expected to poll for results later to see if the flow rule is
successfully inserted/deleted or not.

Example on how to use this approach. Init stage consists from the resources
preallocation, item and action templates definition and corresponding tables
create. All these steps should be done before a device is started:

rte_eth_dev_configure();
rte_flow_configure(port_id, number_of_flow_queues, max_num_of_counters);
rte_flow_item_template_create(port_id, items("eth/ipv4/udp"));
rte_flow_action_template_create(port_id, actions("counter/set_tp_src"));
rte_flow_table_create(port_id, item_template, action_template);
rte_eth_dev_start();

The packet processing can start once all the resources are preallocated.
Flow rules creation/destruction jobs are enqueued as a part of the packet
handling logic. These jobs are then flushed to the PMD/HW and their status
is beign rquested via the dequeue API as a method to ensure flow rules
are successfully created/destroyed.

rte_eth_rx_burst();
for (every received packet in the burts) {
  if (flow rule needs to be created) {
    rte_flow_q_flow_create(port_id, flow_queue_id, table_id,
        item_template_id, items("eth/ipv4 is 1.1.1.1/udp"),
         action_template_id, actions("counter/set_tp_src is 5555"));
  } else {flow rule needs tp be destroyed) {
    rte_flow_q_flow_destroy(port_id, flow_queue_id, flow_rule_id);
  }
  rte_flow_q_flush(port_id, flow_queue_id);
  rte_flow_q_dequeue(port_id, flow_queue_id, &result);
}

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Suggested-by: Ori Kam <orika@nvidia.com>

Alexander Kozyrev (3):
  ethdev: introduce flow pre-configuration hints
  ethdev: add flow item/action templates
  ethdev: add async queue-based flow rules operations

 lib/ethdev/rte_flow.h | 626 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 626 insertions(+)

-- 
2.18.2


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2022-01-27  9:35 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19 13:07 [PATCH v2 01/10] ethdev: introduce flow pre-configuration hints Ivan Malov
2022-01-25  1:09 ` Alexander Kozyrev
  -- strict thread matches above, loose matches on Subject: below --
2021-10-06  4:48 [dpdk-dev] [RFC 0/3] ethdev: datapath-focused flow rules management Alexander Kozyrev
2022-01-18 15:30 ` [PATCH v2 00/10] " Alexander Kozyrev
2022-01-18 15:30   ` [PATCH v2 01/10] ethdev: introduce flow pre-configuration hints Alexander Kozyrev
2022-01-24 14:36     ` Jerin Jacob
2022-01-24 17:35       ` Thomas Monjalon
2022-01-24 17:46         ` Jerin Jacob
2022-01-24 18:08           ` Bruce Richardson
2022-01-25  1:14             ` Alexander Kozyrev
2022-01-25 15:58             ` Ori Kam
2022-01-25 18:09               ` Bruce Richardson
2022-01-25 18:14                 ` Bruce Richardson
2022-01-26  9:45                   ` Ori Kam
2022-01-26 10:52                     ` Bruce Richardson
2022-01-26 11:21                       ` Thomas Monjalon
2022-01-26 12:19                         ` Ori Kam
2022-01-26 13:41                           ` Bruce Richardson
2022-01-26 15:12                             ` Ori Kam
2022-01-24 17:40       ` Ajit Khaparde
2022-01-25  1:28         ` Alexander Kozyrev
2022-01-25 18:44           ` Jerin Jacob
2022-01-26 22:02             ` Alexander Kozyrev
2022-01-27  9:34               ` Jerin Jacob

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).