Skip to content

Commit 3888ea4

Browse files
committed
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 <[email protected]> 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 <[email protected]>
2 parents 2c47a65 + 10ff535 commit 3888ea4

File tree

11 files changed

+62
-17
lines changed

11 files changed

+62
-17
lines changed

drivers/infiniband/hw/mlx5/cq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ static int create_cq_user(struct mlx5_ib_dev *dev, struct ib_udata *udata,
849849
return 0;
850850

851851
err_cqb:
852-
kfree(*cqb);
852+
kvfree(*cqb);
853853

854854
err_db:
855855
mlx5_ib_db_unmap_user(to_mucontext(context), &cq->db);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ const char *parse_fs_dst(struct trace_seq *p,
235235

236236
switch (dst->type) {
237237
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);
239239
break;
240240
case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE:
241241
trace_seq_printf(p, "ft=%p\n", dst->ft);

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,7 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
839839
out_priv = netdev_priv(encap_dev);
840840
rpriv = out_priv->ppriv;
841841
attr->out_rep = rpriv->rep;
842+
attr->out_mdev = out_priv->mdev;
842843
}
843844

844845
err = mlx5_eswitch_add_vlan_action(esw, attr);
@@ -2497,6 +2498,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
24972498
return -EINVAL;
24982499

24992500
attr->in_rep = rpriv->rep;
2501+
attr->in_mdev = priv->mdev;
25002502

25012503
tcf_exts_to_list(exts, &actions);
25022504
list_for_each_entry(a, &actions, list) {
@@ -2539,6 +2541,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
25392541
out_priv = netdev_priv(out_dev);
25402542
rpriv = out_priv->ppriv;
25412543
attr->out_rep = rpriv->rep;
2544+
attr->out_mdev = out_priv->mdev;
25422545
} else if (encap) {
25432546
parse_attr->mirred_ifindex = out_dev->ifindex;
25442547
parse_attr->tun_info = *info;

drivers/net/ethernet/mellanox/mlx5/core/eswitch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ __esw_fdb_set_vport_rule(struct mlx5_eswitch *esw, u32 vport, bool rx_rule,
192192
}
193193

194194
dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
195-
dest.vport_num = vport;
195+
dest.vport.num = vport;
196196

197197
esw_debug(esw->dev,
198198
"\tFDB add rule dmac_v(%pM) dmac_c(%pM) -> vport(%d)\n",

drivers/net/ethernet/mellanox/mlx5/core/eswitch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ enum mlx5_flow_match_level {
237237
struct mlx5_esw_flow_attr {
238238
struct mlx5_eswitch_rep *in_rep;
239239
struct mlx5_eswitch_rep *out_rep;
240+
struct mlx5_core_dev *out_mdev;
241+
struct mlx5_core_dev *in_mdev;
240242

241243
int action;
242244
__be16 vlan_proto;

drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,12 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
7171

7272
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) {
7373
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+
}
7580
i++;
7681
}
7782
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_COUNT) {
@@ -88,8 +93,16 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
8893
misc = MLX5_ADDR_OF(fte_match_param, spec->match_value, misc_parameters);
8994
MLX5_SET(fte_match_set_misc, misc, source_port, attr->in_rep->vport);
9095

96+
if (MLX5_CAP_ESW(esw->dev, merged_eswitch))
97+
MLX5_SET(fte_match_set_misc, misc,
98+
source_eswitch_owner_vhca_id,
99+
MLX5_CAP_GEN(attr->in_mdev, vhca_id));
100+
91101
misc = MLX5_ADDR_OF(fte_match_param, spec->match_criteria, misc_parameters);
92102
MLX5_SET_TO_ONES(fte_match_set_misc, misc, source_port);
103+
if (MLX5_CAP_ESW(esw->dev, merged_eswitch))
104+
MLX5_SET_TO_ONES(fte_match_set_misc, misc,
105+
source_eswitch_owner_vhca_id);
93106

94107
if (attr->match_level == MLX5_MATCH_NONE)
95108
spec->match_criteria_enable = MLX5_MATCH_MISC_PARAMETERS;
@@ -347,7 +360,7 @@ mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *esw, int vport, u32 sqn
347360

348361
spec->match_criteria_enable = MLX5_MATCH_MISC_PARAMETERS;
349362
dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
350-
dest.vport_num = vport;
363+
dest.vport.num = vport;
351364
flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
352365

353366
flow_rule = mlx5_add_flow_rules(esw->fdb_table.offloads.fdb, spec,
@@ -391,7 +404,7 @@ static int esw_add_fdb_miss_rule(struct mlx5_eswitch *esw)
391404
dmac_c[0] = 0x01;
392405

393406
dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
394-
dest.vport_num = 0;
407+
dest.vport.num = 0;
395408
flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
396409

397410
flow_rule = mlx5_add_flow_rules(esw->fdb_table.offloads.fdb, spec,
@@ -667,7 +680,7 @@ static int esw_create_vport_rx_group(struct mlx5_eswitch *esw)
667680

668681
esw->offloads.vport_rx_group = g;
669682
out:
670-
kfree(flow_group_in);
683+
kvfree(flow_group_in);
671684
return err;
672685
}
673686

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,15 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,
372372
if (dst->dest_attr.type ==
373373
MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE) {
374374
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);
375384
} else {
376385
id = dst->dest_attr.tir_num;
377386
}

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1374,6 +1374,8 @@ static int create_auto_flow_group(struct mlx5_flow_table *ft,
13741374
struct mlx5_core_dev *dev = get_dev(&ft->node);
13751375
int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in);
13761376
void *match_criteria_addr;
1377+
u8 src_esw_owner_mask_on;
1378+
void *misc;
13771379
int err;
13781380
u32 *in;
13791381

@@ -1386,6 +1388,14 @@ static int create_auto_flow_group(struct mlx5_flow_table *ft,
13861388
MLX5_SET(create_flow_group_in, in, start_flow_index, fg->start_index);
13871389
MLX5_SET(create_flow_group_in, in, end_flow_index, fg->start_index +
13881390
fg->max_ftes - 1);
1391+
1392+
misc = MLX5_ADDR_OF(fte_match_param, fg->mask.match_criteria,
1393+
misc_parameters);
1394+
src_esw_owner_mask_on = !!MLX5_GET(fte_match_set_misc, misc,
1395+
source_eswitch_owner_vhca_id);
1396+
MLX5_SET(create_flow_group_in, in,
1397+
source_eswitch_owner_vhca_id_valid, src_esw_owner_mask_on);
1398+
13891399
match_criteria_addr = MLX5_ADDR_OF(create_flow_group_in,
13901400
in, match_criteria);
13911401
memcpy(match_criteria_addr, fg->mask.match_criteria,
@@ -1406,7 +1416,7 @@ static bool mlx5_flow_dests_cmp(struct mlx5_flow_destination *d1,
14061416
{
14071417
if (d1->type == d2->type) {
14081418
if ((d1->type == MLX5_FLOW_DESTINATION_TYPE_VPORT &&
1409-
d1->vport_num == d2->vport_num) ||
1419+
d1->vport.num == d2->vport.num) ||
14101420
(d1->type == MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE &&
14111421
d1->ft == d2->ft) ||
14121422
(d1->type == MLX5_FLOW_DESTINATION_TYPE_TIR &&

drivers/net/ethernet/mellanox/mlx5/core/vport.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev,
511511
*system_image_guid = MLX5_GET64(query_nic_vport_context_out, out,
512512
nic_vport_context.system_image_guid);
513513

514-
kfree(out);
514+
kvfree(out);
515515

516516
return 0;
517517
}
@@ -531,7 +531,7 @@ int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid)
531531
*node_guid = MLX5_GET64(query_nic_vport_context_out, out,
532532
nic_vport_context.node_guid);
533533

534-
kfree(out);
534+
kvfree(out);
535535

536536
return 0;
537537
}
@@ -587,7 +587,7 @@ int mlx5_query_nic_vport_qkey_viol_cntr(struct mlx5_core_dev *mdev,
587587
*qkey_viol_cntr = MLX5_GET(query_nic_vport_context_out, out,
588588
nic_vport_context.qkey_violation_counter);
589589

590-
kfree(out);
590+
kvfree(out);
591591

592592
return 0;
593593
}

include/linux/mlx5/fs.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,12 @@ struct mlx5_flow_destination {
9090
union {
9191
u32 tir_num;
9292
struct mlx5_flow_table *ft;
93-
u32 vport_num;
9493
struct mlx5_fc *counter;
94+
struct {
95+
u16 num;
96+
u16 vhca_id;
97+
bool vhca_id_valid;
98+
} vport;
9599
};
96100
};
97101

0 commit comments

Comments
 (0)