]> git.droids-corp.org - dpdk.git/commitdiff
net/mlx5: fix tag ID conflict with sample action
authorJiawei Wang <jiaweiw@nvidia.com>
Wed, 3 Nov 2021 13:07:59 +0000 (15:07 +0200)
committerRaslan Darawsheh <rasland@nvidia.com>
Wed, 10 Nov 2021 14:44:43 +0000 (15:44 +0100)
For the flows containing sample action, the tag action was added
implicitly to store the unique flow index into metadata register in the
split prefix subflow, and then match on this index in the split suffix
subflow. The metadata register for flow index of sample split subflows
was also used to store application metadata TAG 0 item, this might cause
TAG 0 corruption in the flows with sample actions.

This patch uses the same metadata register C index as used for
ASO action since it's reserved and not used directly by the application,
and adds the checking in validation to make sure not to conflict
with ASO CT in the same flow.

Fixes: b4c0ddbfcc58 ("net/mlx5: split sample flow into two sub-flows")
Cc: stable@dpdk.org
Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
drivers/net/mlx5/mlx5_flow.c
drivers/net/mlx5/mlx5_flow.h
drivers/net/mlx5/mlx5_flow_dv.c

index 29134b4825f1783f095fa0afba3af159cfb6ff46..f657980737e93316be6d822aefe2b019adbdf4ca 100644 (file)
@@ -907,6 +907,7 @@ mlx5_flow_get_reg_id(struct rte_eth_dev *dev,
        case MLX5_MTR_COLOR:
        case MLX5_ASO_FLOW_HIT:
        case MLX5_ASO_CONNTRACK:
+       case MLX5_SAMPLE_ID:
                /* All features use the same REG_C. */
                MLX5_ASSERT(priv->mtr_color_reg != REG_NON);
                return priv->mtr_color_reg;
@@ -5581,7 +5582,7 @@ flow_sample_split_prep(struct rte_eth_dev *dev,
                /* Prepare the prefix tag action. */
                append_index++;
                set_tag = (void *)(actions_pre + actions_n + append_index);
-               ret = mlx5_flow_get_reg_id(dev, MLX5_APP_TAG, 0, error);
+               ret = mlx5_flow_get_reg_id(dev, MLX5_SAMPLE_ID, 0, error);
                if (ret < 0)
                        return ret;
                mlx5_ipool_malloc(priv->sh->ipool
index 4026255ce49d44d6d9988f4022392a03e7855216..696d294ca5e010bfd73133e5345ee77ea97822cf 100644 (file)
@@ -109,6 +109,7 @@ enum mlx5_feature_name {
        MLX5_MTR_ID,
        MLX5_ASO_FLOW_HIT,
        MLX5_ASO_CONNTRACK,
+       MLX5_SAMPLE_ID,
 };
 
 /* Default queue number. */
index 8fa7829341f464c6ec55cefa5c05b0b2887c980b..0beaf7b62dcf4ae45a643de82ba9aecb42fdef00 100644 (file)
@@ -5574,6 +5574,10 @@ flow_dv_validate_action_sample(uint64_t *action_flags,
                                          RTE_FLOW_ERROR_TYPE_ACTION, action,
                                          "wrong action order, jump should "
                                          "be after sample action");
+       if (*action_flags & MLX5_FLOW_ACTION_CT)
+               return rte_flow_error_set(error, EINVAL,
+                                         RTE_FLOW_ERROR_TYPE_ACTION, action,
+                                         "Sample after CT not supported");
        act = sample->actions;
        for (; act->type != RTE_FLOW_ACTION_TYPE_END; act++) {
                if (actions_n == MLX5_DV_MAX_NUMBER_OF_ACTIONS)