Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'mlx5-updates-2018-05-17' of git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux

Saeed Mahameed says:

====================
mlx5-updates-2018-05-17

mlx5 core dirver updates for both net-next and rdma-next branches.

From Christophe JAILLET, first three patche to use kvfree where needed.

From: Or Gerlitz <ogerlitz@mellanox.com>

Next six patches from Roi and Co adds support for merged
sriov e-switch which comes to serve cases where both PFs, VFs set
on them and both uplinks are to be used in single v-switch SW model.
When merged e-switch is supported, the per-port e-switch is logically
merged into one e-switch that spans both physical ports and all the VFs.

This model allows to offload TC eswitch rules between VFs belonging
to different PFs (and hence have different eswitch affinity), it also
sets the some of the foundations needed for uplink LAG support.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+62 -17
+1 -1
drivers/infiniband/hw/mlx5/cq.c
··· 849 849 return 0; 850 850 851 851 err_cqb: 852 - kfree(*cqb); 852 + kvfree(*cqb); 853 853 854 854 err_db: 855 855 mlx5_ib_db_unmap_user(to_mucontext(context), &cq->db);
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c
··· 235 235 236 236 switch (dst->type) { 237 237 case MLX5_FLOW_DESTINATION_TYPE_VPORT: 238 - trace_seq_printf(p, "vport=%u\n", dst->vport_num); 238 + trace_seq_printf(p, "vport=%u\n", dst->vport.num); 239 239 break; 240 240 case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE: 241 241 trace_seq_printf(p, "ft=%p\n", dst->ft);
+3
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
··· 839 839 out_priv = netdev_priv(encap_dev); 840 840 rpriv = out_priv->ppriv; 841 841 attr->out_rep = rpriv->rep; 842 + attr->out_mdev = out_priv->mdev; 842 843 } 843 844 844 845 err = mlx5_eswitch_add_vlan_action(esw, attr); ··· 2498 2497 return -EINVAL; 2499 2498 2500 2499 attr->in_rep = rpriv->rep; 2500 + attr->in_mdev = priv->mdev; 2501 2501 2502 2502 tcf_exts_to_list(exts, &actions); 2503 2503 list_for_each_entry(a, &actions, list) { ··· 2541 2539 out_priv = netdev_priv(out_dev); 2542 2540 rpriv = out_priv->ppriv; 2543 2541 attr->out_rep = rpriv->rep; 2542 + attr->out_mdev = out_priv->mdev; 2544 2543 } else if (encap) { 2545 2544 parse_attr->mirred_ifindex = out_dev->ifindex; 2546 2545 parse_attr->tun_info = *info;
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
··· 192 192 } 193 193 194 194 dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT; 195 - dest.vport_num = vport; 195 + dest.vport.num = vport; 196 196 197 197 esw_debug(esw->dev, 198 198 "\tFDB add rule dmac_v(%pM) dmac_c(%pM) -> vport(%d)\n",
+2
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
··· 237 237 struct mlx5_esw_flow_attr { 238 238 struct mlx5_eswitch_rep *in_rep; 239 239 struct mlx5_eswitch_rep *out_rep; 240 + struct mlx5_core_dev *out_mdev; 241 + struct mlx5_core_dev *in_mdev; 240 242 241 243 int action; 242 244 __be16 vlan_proto;
+17 -4
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
··· 71 71 72 72 if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) { 73 73 dest[i].type = MLX5_FLOW_DESTINATION_TYPE_VPORT; 74 - dest[i].vport_num = attr->out_rep->vport; 74 + dest[i].vport.num = attr->out_rep->vport; 75 + if (MLX5_CAP_ESW(esw->dev, merged_eswitch)) { 76 + dest[i].vport.vhca_id = 77 + MLX5_CAP_GEN(attr->out_mdev, vhca_id); 78 + dest[i].vport.vhca_id_valid = 1; 79 + } 75 80 i++; 76 81 } 77 82 if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_COUNT) { ··· 93 88 misc = MLX5_ADDR_OF(fte_match_param, spec->match_value, misc_parameters); 94 89 MLX5_SET(fte_match_set_misc, misc, source_port, attr->in_rep->vport); 95 90 91 + if (MLX5_CAP_ESW(esw->dev, merged_eswitch)) 92 + MLX5_SET(fte_match_set_misc, misc, 93 + source_eswitch_owner_vhca_id, 94 + MLX5_CAP_GEN(attr->in_mdev, vhca_id)); 95 + 96 96 misc = MLX5_ADDR_OF(fte_match_param, spec->match_criteria, misc_parameters); 97 97 MLX5_SET_TO_ONES(fte_match_set_misc, misc, source_port); 98 + if (MLX5_CAP_ESW(esw->dev, merged_eswitch)) 99 + MLX5_SET_TO_ONES(fte_match_set_misc, misc, 100 + source_eswitch_owner_vhca_id); 98 101 99 102 if (attr->match_level == MLX5_MATCH_NONE) 100 103 spec->match_criteria_enable = MLX5_MATCH_MISC_PARAMETERS; ··· 360 347 361 348 spec->match_criteria_enable = MLX5_MATCH_MISC_PARAMETERS; 362 349 dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT; 363 - dest.vport_num = vport; 350 + dest.vport.num = vport; 364 351 flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; 365 352 366 353 flow_rule = mlx5_add_flow_rules(esw->fdb_table.offloads.fdb, spec, ··· 404 391 dmac_c[0] = 0x01; 405 392 406 393 dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT; 407 - dest.vport_num = 0; 394 + dest.vport.num = 0; 408 395 flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; 409 396 410 397 flow_rule = mlx5_add_flow_rules(esw->fdb_table.offloads.fdb, spec, ··· 680 667 681 668 esw->offloads.vport_rx_group = g; 682 669 out: 683 - kfree(flow_group_in); 670 + kvfree(flow_group_in); 684 671 return err; 685 672 } 686 673
+9
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
··· 372 372 if (dst->dest_attr.type == 373 373 MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE) { 374 374 id = dst->dest_attr.ft->id; 375 + } else if (dst->dest_attr.type == 376 + MLX5_FLOW_DESTINATION_TYPE_VPORT) { 377 + id = dst->dest_attr.vport.num; 378 + MLX5_SET(dest_format_struct, in_dests, 379 + destination_eswitch_owner_vhca_id_valid, 380 + dst->dest_attr.vport.vhca_id_valid); 381 + MLX5_SET(dest_format_struct, in_dests, 382 + destination_eswitch_owner_vhca_id, 383 + dst->dest_attr.vport.vhca_id); 375 384 } else { 376 385 id = dst->dest_attr.tir_num; 377 386 }
+11 -1
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
··· 1374 1374 struct mlx5_core_dev *dev = get_dev(&ft->node); 1375 1375 int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in); 1376 1376 void *match_criteria_addr; 1377 + u8 src_esw_owner_mask_on; 1378 + void *misc; 1377 1379 int err; 1378 1380 u32 *in; 1379 1381 ··· 1388 1386 MLX5_SET(create_flow_group_in, in, start_flow_index, fg->start_index); 1389 1387 MLX5_SET(create_flow_group_in, in, end_flow_index, fg->start_index + 1390 1388 fg->max_ftes - 1); 1389 + 1390 + misc = MLX5_ADDR_OF(fte_match_param, fg->mask.match_criteria, 1391 + misc_parameters); 1392 + src_esw_owner_mask_on = !!MLX5_GET(fte_match_set_misc, misc, 1393 + source_eswitch_owner_vhca_id); 1394 + MLX5_SET(create_flow_group_in, in, 1395 + source_eswitch_owner_vhca_id_valid, src_esw_owner_mask_on); 1396 + 1391 1397 match_criteria_addr = MLX5_ADDR_OF(create_flow_group_in, 1392 1398 in, match_criteria); 1393 1399 memcpy(match_criteria_addr, fg->mask.match_criteria, ··· 1416 1406 { 1417 1407 if (d1->type == d2->type) { 1418 1408 if ((d1->type == MLX5_FLOW_DESTINATION_TYPE_VPORT && 1419 - d1->vport_num == d2->vport_num) || 1409 + d1->vport.num == d2->vport.num) || 1420 1410 (d1->type == MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE && 1421 1411 d1->ft == d2->ft) || 1422 1412 (d1->type == MLX5_FLOW_DESTINATION_TYPE_TIR &&
+3 -3
drivers/net/ethernet/mellanox/mlx5/core/vport.c
··· 511 511 *system_image_guid = MLX5_GET64(query_nic_vport_context_out, out, 512 512 nic_vport_context.system_image_guid); 513 513 514 - kfree(out); 514 + kvfree(out); 515 515 516 516 return 0; 517 517 } ··· 531 531 *node_guid = MLX5_GET64(query_nic_vport_context_out, out, 532 532 nic_vport_context.node_guid); 533 533 534 - kfree(out); 534 + kvfree(out); 535 535 536 536 return 0; 537 537 } ··· 587 587 *qkey_viol_cntr = MLX5_GET(query_nic_vport_context_out, out, 588 588 nic_vport_context.qkey_violation_counter); 589 589 590 - kfree(out); 590 + kvfree(out); 591 591 592 592 return 0; 593 593 }
+5 -1
include/linux/mlx5/fs.h
··· 90 90 union { 91 91 u32 tir_num; 92 92 struct mlx5_flow_table *ft; 93 - u32 vport_num; 94 93 struct mlx5_fc *counter; 94 + struct { 95 + u16 num; 96 + u16 vhca_id; 97 + bool vhca_id_valid; 98 + } vport; 95 99 }; 96 100 }; 97 101
+9 -5
include/linux/mlx5/mlx5_ifc.h
··· 396 396 u8 reserved_at_0[0x8]; 397 397 u8 source_sqn[0x18]; 398 398 399 - u8 reserved_at_20[0x10]; 399 + u8 source_eswitch_owner_vhca_id[0x10]; 400 400 u8 source_port[0x10]; 401 401 402 402 u8 outer_second_prio[0x3]; ··· 541 541 u8 vport_svlan_insert[0x1]; 542 542 u8 vport_cvlan_insert_if_not_exist[0x1]; 543 543 u8 vport_cvlan_insert_overwrite[0x1]; 544 - u8 reserved_at_5[0x19]; 544 + u8 reserved_at_5[0x18]; 545 + u8 merged_eswitch[0x1]; 545 546 u8 nic_vport_node_guid_modify[0x1]; 546 547 u8 nic_vport_port_guid_modify[0x1]; 547 548 ··· 1132 1131 struct mlx5_ifc_dest_format_struct_bits { 1133 1132 u8 destination_type[0x8]; 1134 1133 u8 destination_id[0x18]; 1135 - 1136 - u8 reserved_at_20[0x20]; 1134 + u8 destination_eswitch_owner_vhca_id_valid[0x1]; 1135 + u8 reserved_at_21[0xf]; 1136 + u8 destination_eswitch_owner_vhca_id[0x10]; 1137 1137 }; 1138 1138 1139 1139 struct mlx5_ifc_flow_counter_list_bits { ··· 6979 6977 u8 reserved_at_a0[0x8]; 6980 6978 u8 table_id[0x18]; 6981 6979 6982 - u8 reserved_at_c0[0x20]; 6980 + u8 source_eswitch_owner_vhca_id_valid[0x1]; 6981 + 6982 + u8 reserved_at_c1[0x1f]; 6983 6983 6984 6984 u8 start_flow_index[0x20]; 6985 6985