net/mlx5: fix mark action in active tunnel offload
authorGregory Etelson <getelson@nvidia.com>
Wed, 20 Jan 2021 19:17:09 +0000 (21:17 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 29 Jan 2021 17:16:08 +0000 (18:16 +0100)
Tunnel offload mode allows application to restore partially offloaded
tunneled packets to its original state.
MLX5 PMD stores internal data required to restore partially offloaded
packet in packet mark section. Therefore MLX5 PMD will not allow
applications to use mark action if tunnel offload mode was activated.
The restriction is applied both to regular and tunnel offload rules.

The patch rejects application rules with mark action while tunnel
offload is active.

Fixes: 4ec6360de37d ("net/mlx5: implement tunnel offload")
Cc: stable@dpdk.org
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
drivers/net/mlx5/mlx5_flow_dv.c

index f32d6c1..faafc92 100644 (file)
@@ -2445,6 +2445,11 @@ flow_dv_validate_action_mark(struct rte_eth_dev *dev,
        const struct rte_flow_action_mark *mark = action->conf;
        int ret;
 
+       if (is_tunnel_offload_active(dev))
+               return rte_flow_error_set(error, ENOTSUP,
+                                         RTE_FLOW_ERROR_TYPE_ACTION, NULL,
+                                         "no mark action "
+                                         "if tunnel offload active");
        /* Fall back if no extended metadata register support. */
        if (config->dv_xmeta_en == MLX5_XMETA_MODE_LEGACY)
                return mlx5_flow_validate_action_mark(action, action_flags,