]> git.droids-corp.org - dpdk.git/commitdiff
ethdev: bring in async indirect actions operations
authorAlexander Kozyrev <akozyrev@nvidia.com>
Wed, 23 Feb 2022 03:02:33 +0000 (05:02 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 24 Feb 2022 13:04:48 +0000 (14:04 +0100)
Queue-based flow rules management mechanism is suitable
not only for flow rules creation/destruction, but also
for speeding up other types of Flow API management.
Indirect action object operations may be executed
asynchronously as well. Provide async versions for all
indirect action operations, namely:
rte_flow_async_action_handle_create,
rte_flow_async_action_handle_destroy and
rte_flow_async_action_handle_update.

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
doc/guides/prog_guide/rte_flow.rst
doc/guides/rel_notes/release_22_03.rst
lib/ethdev/rte_flow.c
lib/ethdev/rte_flow.h
lib/ethdev/rte_flow_driver.h
lib/ethdev/version.map

index 5af849dafd882db24ee802dfdcf3530be075e7a8..f2deef95d8128a76542731eb86001c898e106c64 100644 (file)
@@ -3861,6 +3861,56 @@ Enqueueing a flow rule destruction operation is similar to simple destruction.
                           void *user_data,
                           struct rte_flow_error *error);
 
+Enqueue indirect action creation operation
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Asynchronous version of indirect action creation API.
+
+.. code-block:: c
+
+   struct rte_flow_action_handle *
+   rte_flow_async_action_handle_create(uint16_t port_id,
+           uint32_t queue_id,
+           const struct rte_flow_op_attr *q_ops_attr,
+           const struct rte_flow_indir_action_conf *indir_action_conf,
+           const struct rte_flow_action *action,
+           void *user_data,
+           struct rte_flow_error *error);
+
+A valid handle in case of success is returned. It must be destroyed later by
+``rte_flow_async_action_handle_destroy()`` even if the rule was rejected.
+
+Enqueue indirect action destruction operation
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Asynchronous version of indirect action destruction API.
+
+.. code-block:: c
+
+   int
+   rte_flow_async_action_handle_destroy(uint16_t port_id,
+           uint32_t queue_id,
+           const struct rte_flow_op_attr *q_ops_attr,
+           struct rte_flow_action_handle *action_handle,
+           void *user_data,
+           struct rte_flow_error *error);
+
+Enqueue indirect action update operation
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Asynchronous version of indirect action update API.
+
+.. code-block:: c
+
+   int
+   rte_flow_async_action_handle_update(uint16_t port_id,
+           uint32_t queue_id,
+           const struct rte_flow_op_attr *q_ops_attr,
+           struct rte_flow_action_handle *action_handle,
+           const void *update,
+           void *user_data,
+           struct rte_flow_error *error);
+
 Push enqueued operations
 ~~~~~~~~~~~~~~~~~~~~~~~~
 
index 1ae6d4aaf8a0d95d4617ee62be5ec77f6d103c1d..73e506455735f9c374116cd5bbad48af49cda8a0 100644 (file)
@@ -92,6 +92,11 @@ New Features
     ``rte_flow_pull`` to poll and retrieve results of these operations and
     ``rte_flow_push`` to push all the in-flight        operations to the NIC.
 
+  * Added asynchronous API for indirect actions management:
+    ``rte_flow_async_action_handle_create``,
+    ``rte_flow_async_action_handle_destroy`` and
+    ``rte_flow_async_action_handle_update``.
+
 * **Added rte_flow support for matching GRE optional fields.**
 
   Added ``gre_option`` item in rte_flow to support checksum/key/sequence
index c314129870ae049bd2414587a27d1e74da75909c..2c35a2f13e5235241ac5d62355e7fdf21e45a32f 100644 (file)
@@ -1791,3 +1791,58 @@ rte_flow_pull(uint16_t port_id,
        ret = ops->pull(dev, queue_id, res, n_res, error);
        return ret ? ret : flow_err(port_id, ret, error);
 }
+
+struct rte_flow_action_handle *
+rte_flow_async_action_handle_create(uint16_t port_id,
+               uint32_t queue_id,
+               const struct rte_flow_op_attr *op_attr,
+               const struct rte_flow_indir_action_conf *indir_action_conf,
+               const struct rte_flow_action *action,
+               void *user_data,
+               struct rte_flow_error *error)
+{
+       struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+       const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
+       struct rte_flow_action_handle *handle;
+
+       handle = ops->async_action_handle_create(dev, queue_id, op_attr,
+                                            indir_action_conf, action, user_data, error);
+       if (handle == NULL)
+               flow_err(port_id, -rte_errno, error);
+       return handle;
+}
+
+int
+rte_flow_async_action_handle_destroy(uint16_t port_id,
+               uint32_t queue_id,
+               const struct rte_flow_op_attr *op_attr,
+               struct rte_flow_action_handle *action_handle,
+               void *user_data,
+               struct rte_flow_error *error)
+{
+       struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+       const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
+       int ret;
+
+       ret = ops->async_action_handle_destroy(dev, queue_id, op_attr,
+                                          action_handle, user_data, error);
+       return flow_err(port_id, ret, error);
+}
+
+int
+rte_flow_async_action_handle_update(uint16_t port_id,
+               uint32_t queue_id,
+               const struct rte_flow_op_attr *op_attr,
+               struct rte_flow_action_handle *action_handle,
+               const void *update,
+               void *user_data,
+               struct rte_flow_error *error)
+{
+       struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+       const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
+       int ret;
+
+       ret = ops->async_action_handle_update(dev, queue_id, op_attr,
+                                         action_handle, update, user_data, error);
+       return flow_err(port_id, ret, error);
+}
index 3fb7cb03ae6a3fb048513feadd2e73ec7ac78306..d8827dd184b00df3590666b07862b7d892b95e9e 100644 (file)
@@ -5504,6 +5504,115 @@ rte_flow_pull(uint16_t port_id,
              uint16_t n_res,
              struct rte_flow_error *error);
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Enqueue indirect action creation operation.
+ * @see rte_flow_action_handle_create
+ *
+ * @param[in] port_id
+ *   Port identifier of Ethernet device.
+ * @param[in] queue_id
+ *   Flow queue which is used to create the rule.
+ * @param[in] op_attr
+ *   Indirect action creation operation attributes.
+ * @param[in] indir_action_conf
+ *   Action configuration for the indirect action object creation.
+ * @param[in] action
+ *   Specific configuration of the indirect action object.
+ * @param[in] user_data
+ *   The user data that will be returned on the completion events.
+ * @param[out] error
+ *   Perform verbose error reporting if not NULL.
+ *   PMDs initialize this structure in case of error only.
+ *
+ * @return
+ *   A valid handle in case of success, NULL otherwise and rte_errno is set.
+ */
+__rte_experimental
+struct rte_flow_action_handle *
+rte_flow_async_action_handle_create(uint16_t port_id,
+               uint32_t queue_id,
+               const struct rte_flow_op_attr *op_attr,
+               const struct rte_flow_indir_action_conf *indir_action_conf,
+               const struct rte_flow_action *action,
+               void *user_data,
+               struct rte_flow_error *error);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Enqueue indirect action destruction operation.
+ * The destroy queue must be the same
+ * as the queue on which the action was created.
+ *
+ * @param[in] port_id
+ *   Port identifier of Ethernet device.
+ * @param[in] queue_id
+ *   Flow queue which is used to destroy the rule.
+ * @param[in] op_attr
+ *   Indirect action destruction operation attributes.
+ * @param[in] action_handle
+ *   Handle for the indirect action object to be destroyed.
+ * @param[in] user_data
+ *   The user data that will be returned on the completion events.
+ * @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_async_action_handle_destroy(uint16_t port_id,
+               uint32_t queue_id,
+               const struct rte_flow_op_attr *op_attr,
+               struct rte_flow_action_handle *action_handle,
+               void *user_data,
+               struct rte_flow_error *error);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Enqueue indirect action update operation.
+ * @see rte_flow_action_handle_create
+ *
+ * @param[in] port_id
+ *   Port identifier of Ethernet device.
+ * @param[in] queue_id
+ *   Flow queue which is used to update the rule.
+ * @param[in] op_attr
+ *   Indirect action update operation attributes.
+ * @param[in] action_handle
+ *   Handle for the indirect action object to be updated.
+ * @param[in] update
+ *   Update profile specification used to modify the action pointed by handle.
+ *   *update* could be with the same type of the immediate action corresponding
+ *   to the *handle* argument when creating, or a wrapper structure includes
+ *   action configuration to be updated and bit fields to indicate the member
+ *   of fields inside the action to update.
+ * @param[in] user_data
+ *   The user data that will be returned on the completion events.
+ * @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_async_action_handle_update(uint16_t port_id,
+               uint32_t queue_id,
+               const struct rte_flow_op_attr *op_attr,
+               struct rte_flow_action_handle *action_handle,
+               const void *update,
+               void *user_data,
+               struct rte_flow_error *error);
 #ifdef __cplusplus
 }
 #endif
index 5907dd63c327a40adf3d4889bd031b432919a9e2..2bff732d6a9c04ac6257b028db6078f4d0fad4a0 100644 (file)
@@ -234,6 +234,32 @@ struct rte_flow_ops {
                 struct rte_flow_op_result res[],
                 uint16_t n_res,
                 struct rte_flow_error *error);
+       /** See rte_flow_async_action_handle_create() */
+       struct rte_flow_action_handle *(*async_action_handle_create)
+               (struct rte_eth_dev *dev,
+                uint32_t queue_id,
+                const struct rte_flow_op_attr *op_attr,
+                const struct rte_flow_indir_action_conf *indir_action_conf,
+                const struct rte_flow_action *action,
+                void *user_data,
+                struct rte_flow_error *err);
+       /** See rte_flow_async_action_handle_destroy() */
+       int (*async_action_handle_destroy)
+               (struct rte_eth_dev *dev,
+                uint32_t queue_id,
+                const struct rte_flow_op_attr *op_attr,
+                struct rte_flow_action_handle *action_handle,
+                void *user_data,
+                struct rte_flow_error *error);
+       /** See rte_flow_async_action_handle_update() */
+       int (*async_action_handle_update)
+               (struct rte_eth_dev *dev,
+                uint32_t queue_id,
+                const struct rte_flow_op_attr *op_attr,
+                struct rte_flow_action_handle *action_handle,
+                const void *update,
+                void *user_data,
+                struct rte_flow_error *error);
 };
 
 /**
index 13c1a22118a781fa32e64ab9636f011a25f94eae..20391ab29edfb7590be42d0122ce5d013ec4ddd6 100644 (file)
@@ -276,6 +276,9 @@ EXPERIMENTAL {
        rte_flow_async_destroy;
        rte_flow_push;
        rte_flow_pull;
+       rte_flow_async_action_handle_create;
+       rte_flow_async_action_handle_destroy;
+       rte_flow_async_action_handle_update;
 };
 
 INTERNAL {