Add new mlx5 action flag MLX5_FLOW_ACTION_SEND_TO_KERNEL.

Add element MLX5_FLOW_FATE_SEND_TO_KERNEL in enum mlx5_flow_fate_type.
For that purpose field 'fate_action' in structure mlx5_flow_handle must be
expanded from 3 bits to 4 bits.

Signed-off-by: Michael Savisko <michael...@nvidia.com>
Acked-by: Matan Azrad <ma...@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.h    |  7 +++++--
 drivers/net/mlx5/mlx5_flow_dv.c | 17 +++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 0fa1735b1a..18a77ec619 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -277,12 +277,14 @@ enum mlx5_feature_name {
 #define MLX5_FLOW_ACTION_MODIFY_FIELD (1ull << 39)
 #define MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY (1ull << 40)
 #define MLX5_FLOW_ACTION_CT (1ull << 41)
+#define MLX5_FLOW_ACTION_SEND_TO_KERNEL (1ull << 42)
 
 #define MLX5_FLOW_FATE_ACTIONS \
        (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | \
         MLX5_FLOW_ACTION_RSS | MLX5_FLOW_ACTION_JUMP | \
         MLX5_FLOW_ACTION_DEFAULT_MISS | \
-        MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY)
+        MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY | \
+        MLX5_FLOW_ACTION_SEND_TO_KERNEL)
 
 #define MLX5_FLOW_FATE_ESWITCH_ACTIONS \
        (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_PORT_ID | \
@@ -477,6 +479,7 @@ enum mlx5_flow_fate_type {
        MLX5_FLOW_FATE_DEFAULT_MISS,
        MLX5_FLOW_FATE_SHARED_RSS,
        MLX5_FLOW_FATE_MTR,
+       MLX5_FLOW_FATE_SEND_TO_KERNEL,
        MLX5_FLOW_FATE_MAX,
 };
 
@@ -709,7 +712,7 @@ struct mlx5_flow_handle {
        void *drv_flow; /**< pointer to driver flow object. */
        uint32_t split_flow_id:27; /**< Sub flow unique match flow id. */
        uint32_t is_meter_flow_id:1; /**< Indicate if flow_id is for meter. */
-       uint32_t fate_action:3; /**< Fate action type. */
+       uint32_t fate_action:4; /**< Fate action type. */
        union {
                uint32_t rix_hrxq; /**< Hash Rx queue object index. */
                uint32_t rix_jump; /**< Index to the jump action resource. */
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 91f287af5c..6c355efed7 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -7970,6 +7970,12 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct 
rte_flow_attr *attr,
                         * list it here as a supported type
                         */
                        break;
+#ifdef HAVE_MLX5DV_DR_ACTION_CREATE_DEST_ROOT_TABLE
+               case RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL:
+                       action_flags |= MLX5_FLOW_ACTION_SEND_TO_KERNEL;
+                       ++actions_n;
+                       break;
+#endif
                default:
                        return rte_flow_error_set(error, ENOTSUP,
                                                  RTE_FLOW_ERROR_TYPE_ACTION,
@@ -13694,6 +13700,11 @@ flow_dv_translate(struct rte_eth_dev *dev,
                        actions_n++;
                        action_flags |= MLX5_FLOW_ACTION_CT;
                        break;
+               case RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL:
+                       return rte_flow_error_set(error, ENOTSUP,
+                               RTE_FLOW_ERROR_TYPE_ACTION,
+                               NULL, "send to kernel action is not 
supported.");
+                       break;
                case RTE_FLOW_ACTION_TYPE_END:
                        actions_end = true;
                        if (mhdr_res->actions_num) {
@@ -14742,6 +14753,12 @@ flow_dv_fate_resource_release(struct rte_eth_dev *dev,
                flow_dv_port_id_action_resource_release(dev,
                                handle->rix_port_id_action);
                break;
+       case MLX5_FLOW_FATE_SEND_TO_KERNEL:
+               /* In case of send_to_kernel action the actual release of
+                * resource is done when all shared DR resources are released
+                * since this resource is created once and always reused.
+                */
+               break;
        default:
                DRV_LOG(DEBUG, "Incorrect fate action:%d", handle->fate_action);
                break;
-- 
2.27.0

Reply via email to