Skip to content

Commit

Permalink
net/mlx5: allow meta modifications in legacy mode
Browse files Browse the repository at this point in the history
The MODIFY_FIELD RTE action rejects copy to/from metadata
in case of the legacy mode extensive flow metadata support.
It is not consistent with SET_META action that has no such
restriction imposed. Registers A or B are used for META in
legacy mode. Allow meta modifications in legacy mode as well.

On other hand, SET_META rejects actions in case register C
is not available even though it is not needed in legacy mode.
Skip this check for legacy mode and allow setting META.

Fixes: edf325d ("net/mlx5: check extended metadata for meta modification")
Cc: [email protected]

Signed-off-by: Alexander Kozyrev <[email protected]>
Acked-by: Viacheslav Ovsiienko <[email protected]>
  • Loading branch information
aleks-kozyrev authored and raslandarawsheh committed Oct 31, 2021
1 parent f4f8f5a commit a5a0a43
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions drivers/net/mlx5/mlx5_flow_dv.c
Original file line number Diff line number Diff line change
Expand Up @@ -3175,11 +3175,14 @@ flow_dv_validate_action_set_meta(struct rte_eth_dev *dev,
const struct rte_flow_attr *attr,
struct rte_flow_error *error)
{
struct mlx5_priv *priv = dev->data->dev_private;
struct mlx5_dev_config *config = &priv->config;
const struct rte_flow_action_set_meta *conf;
uint32_t nic_mask = UINT32_MAX;
int reg;

if (!mlx5_flow_ext_mreg_supported(dev))
if (config->dv_xmeta_en != MLX5_XMETA_MODE_LEGACY &&
!mlx5_flow_ext_mreg_supported(dev))
return rte_flow_error_set(error, ENOTSUP,
RTE_FLOW_ERROR_TYPE_ACTION, action,
"extended metadata register"
Expand Down Expand Up @@ -4911,15 +4914,27 @@ flow_dv_validate_action_modify_field(struct rte_eth_dev *dev,
"modifications of the GENEVE Network"
" Identifier is not supported");
if (action_modify_field->dst.field == RTE_FLOW_FIELD_MARK ||
action_modify_field->src.field == RTE_FLOW_FIELD_MARK ||
action_modify_field->dst.field == RTE_FLOW_FIELD_META ||
action_modify_field->src.field == RTE_FLOW_FIELD_META) {
action_modify_field->src.field == RTE_FLOW_FIELD_MARK)
if (config->dv_xmeta_en == MLX5_XMETA_MODE_LEGACY ||
!mlx5_flow_ext_mreg_supported(dev))
return rte_flow_error_set(error, ENOTSUP,
RTE_FLOW_ERROR_TYPE_ACTION, action,
"cannot modify mark or metadata without"
" extended metadata register support");
"cannot modify mark in legacy mode"
" or without extensive registers");
if (action_modify_field->dst.field == RTE_FLOW_FIELD_META ||
action_modify_field->src.field == RTE_FLOW_FIELD_META) {
if (config->dv_xmeta_en != MLX5_XMETA_MODE_LEGACY &&
!mlx5_flow_ext_mreg_supported(dev))
return rte_flow_error_set(error, ENOTSUP,
RTE_FLOW_ERROR_TYPE_ACTION, action,
"cannot modify meta without"
" extensive registers support");
ret = flow_dv_get_metadata_reg(dev, attr, error);
if (ret < 0 || ret == REG_NON)
return rte_flow_error_set(error, ENOTSUP,
RTE_FLOW_ERROR_TYPE_ACTION, action,
"cannot modify meta without"
" extensive registers available");
}
if (action_modify_field->operation != RTE_FLOW_MODIFY_SET)
return rte_flow_error_set(error, ENOTSUP,
Expand Down

0 comments on commit a5a0a43

Please sign in to comment.