Skip to content

Commit

Permalink
net/mlx5: fix metadata endianness in modify field action
Browse files Browse the repository at this point in the history
[ upstream commit ced4900 ]

As modify field action immediate source parameter the metadata
should follow the CPU endianness (according to SET_META action
structure format), and mlx5 PMD wrongly handled the immediate
parameter metadata buffer as big-endian, resulting in wrong
metadata set action with incorrect endianness.

Fixes: 40c8fb1 ("net/mlx5: update modify field action")

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
  • Loading branch information
viacheslavo authored and kevintraynor committed Feb 21, 2022
1 parent 8f821b1 commit c9a140e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/net/mlx5/mlx5_flow_dv.c
Expand Up @@ -1867,7 +1867,7 @@ flow_dv_convert_action_modify_field
struct field_modify_info dcopy[MLX5_ACT_MAX_MOD_FIELDS] = {
{0, 0, 0} };
uint32_t mask[MLX5_ACT_MAX_MOD_FIELDS] = {0, 0, 0, 0, 0};
uint32_t type;
uint32_t type, meta = 0;
uint32_t shift = 0;

if (conf->src.field == RTE_FLOW_FIELD_POINTER ||
Expand All @@ -1880,6 +1880,11 @@ flow_dv_convert_action_modify_field
item.spec = conf->src.field == RTE_FLOW_FIELD_POINTER ?
(void *)(uintptr_t)conf->src.pvalue :
(void *)(uintptr_t)&conf->src.value;
if (conf->dst.field == RTE_FLOW_FIELD_META) {
meta = *(const unaligned_uint32_t *)item.spec;
meta = rte_cpu_to_be_32(meta);
item.spec = &meta;
}
} else {
type = MLX5_MODIFICATION_TYPE_COPY;
/** For COPY fill the destination field (dcopy) without mask. */
Expand Down

0 comments on commit c9a140e

Please sign in to comment.