Skip to content

Commit 5886a96

Browse files
ozshlomoSaeed Mahameed
authored andcommitted
net/mlx5: Revise gre and nvgre key formats
GRE RFC defines a 32 bit key field. NVGRE RFC splits the 32 bit key field to 24 bit VSID (gre_key_h) and 8 bit flow entropy (gre_key_l). Define the two key parsing alternatives in a union, thus enabling both access methods. Signed-off-by: Oz Shlomo <ozsh@mellanox.com> Reviewed-by: Eli Britstein <elibr@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
1 parent fd4572b commit 5886a96

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

drivers/infiniband/hw/mlx5/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2680,11 +2680,11 @@ static int parse_flow_attr(struct mlx5_core_dev *mdev, u32 *match_c,
26802680
ntohs(ib_spec->gre.val.protocol));
26812681

26822682
memcpy(MLX5_ADDR_OF(fte_match_set_misc, misc_params_c,
2683-
gre_key_h),
2683+
gre_key.nvgre.hi),
26842684
&ib_spec->gre.mask.key,
26852685
sizeof(ib_spec->gre.mask.key));
26862686
memcpy(MLX5_ADDR_OF(fte_match_set_misc, misc_params_v,
2687-
gre_key_h),
2687+
gre_key.nvgre.hi),
26882688
&ib_spec->gre.val.key,
26892689
sizeof(ib_spec->gre.val.key));
26902690
break;

drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ static void print_misc_parameters_hdrs(struct trace_seq *p,
161161
PRINT_MASKED_VAL(name, p, format); \
162162
}
163163
DECLARE_MASK_VAL(u64, gre_key) = {
164-
.m = MLX5_GET(fte_match_set_misc, mask, gre_key_h) << 8 |
165-
MLX5_GET(fte_match_set_misc, mask, gre_key_l),
166-
.v = MLX5_GET(fte_match_set_misc, value, gre_key_h) << 8 |
167-
MLX5_GET(fte_match_set_misc, value, gre_key_l)};
164+
.m = MLX5_GET(fte_match_set_misc, mask, gre_key.nvgre.hi) << 8 |
165+
MLX5_GET(fte_match_set_misc, mask, gre_key.nvgre.lo),
166+
.v = MLX5_GET(fte_match_set_misc, value, gre_key.nvgre.hi) << 8 |
167+
MLX5_GET(fte_match_set_misc, value, gre_key.nvgre.lo)};
168168

169169
PRINT_MASKED_VAL(gre_key, p, "%llu");
170170
PRINT_MASKED_VAL_MISC(u32, source_sqn, source_sqn, p, "%u");

include/linux/mlx5/mlx5_ifc.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,16 @@ struct mlx5_ifc_fte_match_set_lyr_2_4_bits {
423423
union mlx5_ifc_ipv6_layout_ipv4_layout_auto_bits dst_ipv4_dst_ipv6;
424424
};
425425

426+
struct mlx5_ifc_nvgre_key_bits {
427+
u8 hi[0x18];
428+
u8 lo[0x8];
429+
};
430+
431+
union mlx5_ifc_gre_key_bits {
432+
struct mlx5_ifc_nvgre_key_bits nvgre;
433+
u8 key[0x20];
434+
};
435+
426436
struct mlx5_ifc_fte_match_set_misc_bits {
427437
u8 reserved_at_0[0x8];
428438
u8 source_sqn[0x18];
@@ -444,8 +454,7 @@ struct mlx5_ifc_fte_match_set_misc_bits {
444454
u8 reserved_at_64[0xc];
445455
u8 gre_protocol[0x10];
446456

447-
u8 gre_key_h[0x18];
448-
u8 gre_key_l[0x8];
457+
union mlx5_ifc_gre_key_bits gre_key;
449458

450459
u8 vxlan_vni[0x18];
451460
u8 reserved_at_b8[0x8];

0 commit comments

Comments
 (0)