Skip to content

Commit

Permalink
net/mlx5/hws: enable multiple integrity items
Browse files Browse the repository at this point in the history
[ upstream commit 8c178ac8ce81ab0cbd9e90fd7eb4a2b47fca7c2b ]

The integrity item uses the DW "oks1" in header layout. It includes the
all supported bits for both inner and outer. When item is integrity
type, the relevant bits are turned on and all DW is submitted.

When user provides more then single integrity item in same pattern, the
last one overrides the values were submitted before. This is problematic
when user wants to match integrity bits for both inner and outer in same
pattern, he cannot merge them into single item since rte_flow API
provides encapsulation level field to match either inner or outer.

This patch avoids the overriding values, when "oks1" is submitted,
operator "or" is used instead of regular set.

Fixes: c55c2bf ("net/mlx5/hws: add definer layer")

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Reviewed-by: Erez Shitrit <erezsh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
  • Loading branch information
michaelbaum1 authored and bluca committed Mar 13, 2024
1 parent ff41fc1 commit 325c88d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/net/mlx5/hws/mlx5dr_definer.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
(bit_off))); \
} while (0)

/* Getter function based on bit offset and mask, for 32bit DW*/
#define DR_GET_32(p, byte_off, bit_off, mask) \
((rte_be_to_cpu_32(*((const rte_be32_t *)(p) + ((byte_off) / 4))) >> (bit_off)) & (mask))

/* Setter function based on bit offset and mask */
#define DR_SET(p, v, byte_off, bit_off, mask) \
do { \
Expand Down Expand Up @@ -271,7 +275,7 @@ mlx5dr_definer_integrity_set(struct mlx5dr_definer_fc *fc,
{
bool inner = (fc->fname == MLX5DR_DEFINER_FNAME_INTEGRITY_I);
const struct rte_flow_item_integrity *v = item_spec;
uint32_t ok1_bits = 0;
uint32_t ok1_bits = DR_GET_32(tag, fc->byte_off, fc->bit_off, fc->bit_mask);

if (v->l3_ok)
ok1_bits |= inner ? BIT(MLX5DR_DEFINER_OKS1_SECOND_L3_OK) |
Expand Down

0 comments on commit 325c88d

Please sign in to comment.