net/mlx5: reject copy to mark via modify action
authorAlexander Kozyrev <akozyrev@nvidia.com>
Fri, 16 Jul 2021 08:43:05 +0000 (11:43 +0300)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 22 Jul 2021 14:26:41 +0000 (16:26 +0200)
The Mark action is a two-stage process in the Mellanox driver.
First, a hardware register is filled with the required value,
then this value is registered in the software resource table.

The MODIFY_FIELD action can instruct a Mellanox NIC to copy
some value from an arbitrary packet header field into the
hardware register, associated with the Mark item. But there
is no way NIC can modify the software resource table as well.

Due to these driver limitations the copying of arbitrary value
to the MARK can not be supported and should be rejected in the
MODIFY_FIELD action.

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
drivers/net/mlx5/mlx5_flow_dv.c

index 1e49d70..736227b 100644 (file)
@@ -4944,10 +4944,11 @@ flow_dv_validate_action_modify_field(struct rte_eth_dev *dev,
                                "source and destination fields"
                                " cannot be the same");
        if (action_modify_field->dst.field == RTE_FLOW_FIELD_VALUE ||
-           action_modify_field->dst.field == RTE_FLOW_FIELD_POINTER)
+           action_modify_field->dst.field == RTE_FLOW_FIELD_POINTER ||
+           action_modify_field->dst.field == RTE_FLOW_FIELD_MARK)
                return rte_flow_error_set(error, EINVAL,
                                RTE_FLOW_ERROR_TYPE_ACTION, action,
-                               "immediate value or a pointer to it"
+                               "mark, immediate value or a pointer to it"
                                " cannot be used as a destination");
        if (action_modify_field->dst.field == RTE_FLOW_FIELD_START ||
            action_modify_field->src.field == RTE_FLOW_FIELD_START)