Skip to content

Commit ce2b6eb

Browse files
committed
Merge tag 'mlx5-updates-2021-12-28' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== mlx5 Software steering, New features and optimizations This patch series brings various SW steering features, optimizations and debug-ability focused improvements. 1) Expose debugfs for dumping the SW steering resources 2) Removing unused fields 3) support for matching on new fields 4) steering optimization for RX/TX-only rules 5) Make Software steering the default steering mechanism when available, applies only to Switchdev mode FDB From Yevgeny Kliteynik and Muhammad Sammar: - Patch 1 fixes an error flow in creating matchers - Patch 2 fix lower case macro prefix "mlx5_" to "MLX5_" - Patch 3 removes unused struct member in mlx5dr_matcher - Patch 4 renames list field in matcher struct to list_node to reflect the fact that is field is for list node that is stored on another struct's lists - Patch 5 adds checking for valid Flex parser ID value - Patch 6 adds the missing reserved fields to dr_match_param and aligns it to the format that is defined by HW spec - Patch 7 adds support for dumping SW steering (SMFS) resources using debugfs in CSV format: domain and its tables, matchers and rules - Patch 8 adds support for a new destination type - UPLINK - Patch 9 adds WARN_ON_ONCE on refcount checks in SW steering object destructors - Patches 10, 11, 12 add misc5 flow table match parameters and add support for matching on tunnel headers 0 and 1 - Patch 13 adds support for matching on geneve_tlv_option_0_exist field - Patch 14 implements performance optimization for for empty or RX/TX-only matchers by splitting RX and TX matchers handling: matcher connection in the matchers chain is split into two separate lists (RX only and TX only), which solves a usecase of many RX or TX only rules that create a long chain of RX/TX-only paths w/o the actual rules - Patch 15 ignores modify TTL if device doesn't support it instead of adding and unsupported action - Patch 16 sets SMFS as a default steering mode ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 20a9013 + aa36c94 commit ce2b6eb

22 files changed

Lines changed: 1323 additions & 279 deletions

File tree

‎drivers/net/ethernet/mellanox/mlx5/core/Makefile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ mlx5_core-$(CONFIG_MLX5_SW_STEERING) += steering/dr_domain.o steering/dr_table.o
104104
steering/dr_ste.o steering/dr_send.o \
105105
steering/dr_ste_v0.o steering/dr_ste_v1.o \
106106
steering/dr_cmd.o steering/dr_fw.o \
107-
steering/dr_action.o steering/fs_dr.o
107+
steering/dr_action.o steering/fs_dr.o \
108+
steering/dr_dbg.o
108109
#
109110
# SF device
110111
#

‎drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,8 @@ static int mlx5_set_extended_dest(struct mlx5_core_dev *dev,
451451
list_for_each_entry(dst, &fte->node.children, node.list) {
452452
if (dst->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_COUNTER)
453453
continue;
454-
if (dst->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_VPORT &&
454+
if ((dst->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_VPORT ||
455+
dst->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_UPLINK) &&
455456
dst->dest_attr.vport.flags & MLX5_FLOW_DEST_VPORT_REFORMAT_ID)
456457
num_encap++;
457458
num_fwd_destinations++;

‎drivers/net/ethernet/mellanox/mlx5/core/fs_core.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1525,7 +1525,8 @@ static bool mlx5_flow_dests_cmp(struct mlx5_flow_destination *d1,
15251525
struct mlx5_flow_destination *d2)
15261526
{
15271527
if (d1->type == d2->type) {
1528-
if ((d1->type == MLX5_FLOW_DESTINATION_TYPE_VPORT &&
1528+
if (((d1->type == MLX5_FLOW_DESTINATION_TYPE_VPORT ||
1529+
d1->type == MLX5_FLOW_DESTINATION_TYPE_UPLINK) &&
15291530
d1->vport.num == d2->vport.num &&
15301531
d1->vport.flags == d2->vport.flags &&
15311532
((d1->vport.flags & MLX5_FLOW_DEST_VPORT_VHCA_ID) ?
@@ -3082,6 +3083,11 @@ int mlx5_init_fs(struct mlx5_core_dev *dev)
30823083
steering->dev = dev;
30833084
dev->priv.steering = steering;
30843085

3086+
if (mlx5_fs_dr_is_supported(dev))
3087+
steering->mode = MLX5_FLOW_STEERING_MODE_SMFS;
3088+
else
3089+
steering->mode = MLX5_FLOW_STEERING_MODE_DMFS;
3090+
30853091
steering->fgs_cache = kmem_cache_create("mlx5_fs_fgs",
30863092
sizeof(struct mlx5_flow_group), 0,
30873093
0, NULL);

‎drivers/net/ethernet/mellanox/mlx5/core/fs_core.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ struct mlx5_ft_underlay_qp {
203203
u32 qpn;
204204
};
205205

206-
#define MLX5_FTE_MATCH_PARAM_RESERVED reserved_at_c00
206+
#define MLX5_FTE_MATCH_PARAM_RESERVED reserved_at_e00
207207
/* Calculate the fte_match_param length and without the reserved length.
208208
* Make sure the reserved field is the last.
209209
*/

‎drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c‎

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,6 +1560,12 @@ dr_action_modify_check_is_ttl_modify(const void *sw_action)
15601560
return sw_field == MLX5_ACTION_IN_FIELD_OUT_IP_TTL;
15611561
}
15621562

1563+
static bool dr_action_modify_ttl_ignore(struct mlx5dr_domain *dmn)
1564+
{
1565+
return !mlx5dr_ste_supp_ttl_cs_recalc(&dmn->info.caps) &&
1566+
!MLX5_CAP_ESW_FLOWTABLE(dmn->mdev, fdb_ipv4_ttl_modify);
1567+
}
1568+
15631569
static int dr_actions_convert_modify_header(struct mlx5dr_action *action,
15641570
u32 max_hw_actions,
15651571
u32 num_sw_actions,
@@ -1591,8 +1597,13 @@ static int dr_actions_convert_modify_header(struct mlx5dr_action *action,
15911597
if (ret)
15921598
return ret;
15931599

1594-
if (!(*modify_ttl))
1595-
*modify_ttl = dr_action_modify_check_is_ttl_modify(sw_action);
1600+
if (!(*modify_ttl) &&
1601+
dr_action_modify_check_is_ttl_modify(sw_action)) {
1602+
if (dr_action_modify_ttl_ignore(dmn))
1603+
continue;
1604+
1605+
*modify_ttl = true;
1606+
}
15961607

15971608
/* Convert SW action to HW action */
15981609
ret = dr_action_modify_sw_to_hw(dmn,
@@ -1631,7 +1642,7 @@ static int dr_actions_convert_modify_header(struct mlx5dr_action *action,
16311642
* modify actions doesn't exceeds the limit
16321643
*/
16331644
hw_idx++;
1634-
if ((num_sw_actions + hw_idx - i) >= max_hw_actions) {
1645+
if (hw_idx >= max_hw_actions) {
16351646
mlx5dr_dbg(dmn, "Modify header action number exceeds HW limit\n");
16361647
return -EINVAL;
16371648
}
@@ -1642,6 +1653,10 @@ static int dr_actions_convert_modify_header(struct mlx5dr_action *action,
16421653
hw_idx++;
16431654
}
16441655

1656+
/* if the resulting HW actions list is empty, add NOP action */
1657+
if (!hw_idx)
1658+
hw_idx++;
1659+
16451660
*num_hw_actions = hw_idx;
16461661

16471662
return 0;
@@ -1792,7 +1807,7 @@ mlx5dr_action_create_dest_vport(struct mlx5dr_domain *dmn,
17921807

17931808
int mlx5dr_action_destroy(struct mlx5dr_action *action)
17941809
{
1795-
if (refcount_read(&action->refcount) > 1)
1810+
if (WARN_ON_ONCE(refcount_read(&action->refcount) > 1))
17961811
return -EBUSY;
17971812

17981813
switch (action->action_type) {

‎drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c‎

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@ int mlx5dr_cmd_query_device(struct mlx5_core_dev *mdev,
132132

133133
caps->isolate_vl_tc = MLX5_CAP_GEN(mdev, isolate_vl_tc_new);
134134

135+
/* geneve_tlv_option_0_exist is the indication of
136+
* STE support for lookup type flex_parser_ok
137+
*/
138+
caps->flex_parser_ok_bits_supp =
139+
MLX5_CAP_FLOWTABLE(mdev,
140+
flow_table_properties_nic_receive.ft_field_support.geneve_tlv_option_0_exist);
141+
135142
if (caps->flex_protocols & MLX5_FLEX_PARSER_ICMP_V4_ENABLED) {
136143
caps->flex_parser_id_icmp_dw0 = MLX5_CAP_GEN(mdev, flex_parser_id_icmp_dw0);
137144
caps->flex_parser_id_icmp_dw1 = MLX5_CAP_GEN(mdev, flex_parser_id_icmp_dw1);
@@ -152,7 +159,7 @@ int mlx5dr_cmd_query_device(struct mlx5_core_dev *mdev,
152159
caps->flex_parser_id_mpls_over_gre =
153160
MLX5_CAP_GEN(mdev, flex_parser_id_outer_first_mpls_over_gre);
154161

155-
if (caps->flex_protocols & mlx5_FLEX_PARSER_MPLS_OVER_UDP_ENABLED)
162+
if (caps->flex_protocols & MLX5_FLEX_PARSER_MPLS_OVER_UDP_ENABLED)
156163
caps->flex_parser_id_mpls_over_udp =
157164
MLX5_CAP_GEN(mdev, flex_parser_id_outer_first_mpls_over_udp_label);
158165

@@ -599,7 +606,8 @@ static int mlx5dr_cmd_set_extended_dest(struct mlx5_core_dev *dev,
599606
for (i = 0; i < fte->dests_size; i++) {
600607
if (fte->dest_arr[i].type == MLX5_FLOW_DESTINATION_TYPE_COUNTER)
601608
continue;
602-
if (fte->dest_arr[i].type == MLX5_FLOW_DESTINATION_TYPE_VPORT &&
609+
if ((fte->dest_arr[i].type == MLX5_FLOW_DESTINATION_TYPE_VPORT ||
610+
fte->dest_arr[i].type == MLX5_FLOW_DESTINATION_TYPE_UPLINK) &&
603611
fte->dest_arr[i].vport.flags & MLX5_FLOW_DEST_VPORT_REFORMAT_ID)
604612
num_encap++;
605613
num_fwd_destinations++;
@@ -724,12 +732,19 @@ int mlx5dr_cmd_set_fte(struct mlx5_core_dev *dev,
724732
case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE:
725733
id = fte->dest_arr[i].ft_id;
726734
break;
735+
case MLX5_FLOW_DESTINATION_TYPE_UPLINK:
727736
case MLX5_FLOW_DESTINATION_TYPE_VPORT:
728-
id = fte->dest_arr[i].vport.num;
729-
MLX5_SET(dest_format_struct, in_dests,
730-
destination_eswitch_owner_vhca_id_valid,
731-
!!(fte->dest_arr[i].vport.flags &
732-
MLX5_FLOW_DEST_VPORT_VHCA_ID));
737+
if (type == MLX5_FLOW_DESTINATION_TYPE_VPORT) {
738+
id = fte->dest_arr[i].vport.num;
739+
MLX5_SET(dest_format_struct, in_dests,
740+
destination_eswitch_owner_vhca_id_valid,
741+
!!(fte->dest_arr[i].vport.flags &
742+
MLX5_FLOW_DEST_VPORT_VHCA_ID));
743+
} else {
744+
id = 0;
745+
MLX5_SET(dest_format_struct, in_dests,
746+
destination_eswitch_owner_vhca_id_valid, 1);
747+
}
733748
MLX5_SET(dest_format_struct, in_dests,
734749
destination_eswitch_owner_vhca_id,
735750
fte->dest_arr[i].vport.vhca_id);

0 commit comments

Comments
 (0)