Skip to content

Commit ca0d475

Browse files
Maor Gottliebdledford
authored andcommitted
IB/mlx5: Add support in TOS and protocol to flow steering
Add support to receive TOS or specific IPv4 protocol. Signed-off-by: Maor Gottlieb <maorg@mellanox.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Doug Ledford <dledford@redhat.com>
1 parent a72c6a2 commit ca0d475

File tree

1 file changed

+21
-1
lines changed
  • drivers/infiniband/hw/mlx5

1 file changed

+21
-1
lines changed

drivers/infiniband/hw/mlx5/main.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1436,9 +1436,23 @@ static bool outer_header_zero(u32 *match_criteria)
14361436
size - 1);
14371437
}
14381438

1439+
static void set_proto(void *outer_c, void *outer_v, u8 mask, u8 val)
1440+
{
1441+
MLX5_SET(fte_match_set_lyr_2_4, outer_c, ip_protocol, mask);
1442+
MLX5_SET(fte_match_set_lyr_2_4, outer_v, ip_protocol, val);
1443+
}
1444+
1445+
static void set_tos(void *outer_c, void *outer_v, u8 mask, u8 val)
1446+
{
1447+
MLX5_SET(fte_match_set_lyr_2_4, outer_c, ip_ecn, mask);
1448+
MLX5_SET(fte_match_set_lyr_2_4, outer_v, ip_ecn, val);
1449+
MLX5_SET(fte_match_set_lyr_2_4, outer_c, ip_dscp, mask >> 2);
1450+
MLX5_SET(fte_match_set_lyr_2_4, outer_v, ip_dscp, val >> 2);
1451+
}
1452+
14391453
#define LAST_ETH_FIELD vlan_tag
14401454
#define LAST_IB_FIELD sl
1441-
#define LAST_IPV4_FIELD dst_ip
1455+
#define LAST_IPV4_FIELD tos
14421456
#define LAST_IPV6_FIELD dst_ip
14431457
#define LAST_TCP_UDP_FIELD src_port
14441458

@@ -1524,6 +1538,12 @@ static int parse_flow_attr(u32 *match_c, u32 *match_v,
15241538
dst_ipv4_dst_ipv6.ipv4_layout.ipv4),
15251539
&ib_spec->ipv4.val.dst_ip,
15261540
sizeof(ib_spec->ipv4.val.dst_ip));
1541+
1542+
set_tos(outer_headers_c, outer_headers_v,
1543+
ib_spec->ipv4.mask.tos, ib_spec->ipv4.val.tos);
1544+
1545+
set_proto(outer_headers_c, outer_headers_v,
1546+
ib_spec->ipv4.mask.proto, ib_spec->ipv4.val.proto);
15271547
break;
15281548
case IB_FLOW_SPEC_IPV6:
15291549
if (FIELDS_NOT_SUPPORTED(ib_spec->ipv6.mask, LAST_IPV6_FIELD))

0 commit comments

Comments
 (0)