Skip to content

Commit e535d87

Browse files
committed
Merge tag 'mlx5-fixes-2020-07-30' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== Mellanox, mlx5 fixes 2020-07-30 This small patchset introduces some fixes to mlx5 driver. Please pull and let me know if there is any problem. For -stable v4.18: ('net/mlx5e: fix bpf_prog reference count leaks in mlx5e_alloc_rq') For -stable v5.7: ('net/mlx5e: E-Switch, Add misc bit when misc fields changed for mirroring') ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents bbc8a99 + e692139 commit e535d87

File tree

7 files changed

+42
-18
lines changed

7 files changed

+42
-18
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -551,19 +551,31 @@ static bool mlx5e_restore_tunnel(struct mlx5e_priv *priv, struct sk_buff *skb,
551551
}
552552
}
553553

554-
tun_dst = tun_rx_dst(enc_opts.key.len);
554+
if (key.enc_control.addr_type == FLOW_DISSECTOR_KEY_IPV4_ADDRS) {
555+
tun_dst = __ip_tun_set_dst(key.enc_ipv4.src, key.enc_ipv4.dst,
556+
key.enc_ip.tos, key.enc_ip.ttl,
557+
key.enc_tp.dst, TUNNEL_KEY,
558+
key32_to_tunnel_id(key.enc_key_id.keyid),
559+
enc_opts.key.len);
560+
} else if (key.enc_control.addr_type == FLOW_DISSECTOR_KEY_IPV6_ADDRS) {
561+
tun_dst = __ipv6_tun_set_dst(&key.enc_ipv6.src, &key.enc_ipv6.dst,
562+
key.enc_ip.tos, key.enc_ip.ttl,
563+
key.enc_tp.dst, 0, TUNNEL_KEY,
564+
key32_to_tunnel_id(key.enc_key_id.keyid),
565+
enc_opts.key.len);
566+
} else {
567+
netdev_dbg(priv->netdev,
568+
"Couldn't restore tunnel, unsupported addr_type: %d\n",
569+
key.enc_control.addr_type);
570+
return false;
571+
}
572+
555573
if (!tun_dst) {
556-
WARN_ON_ONCE(true);
574+
netdev_dbg(priv->netdev, "Couldn't restore tunnel, no tun_dst\n");
557575
return false;
558576
}
559577

560-
ip_tunnel_key_init(&tun_dst->u.tun_info.key,
561-
key.enc_ipv4.src, key.enc_ipv4.dst,
562-
key.enc_ip.tos, key.enc_ip.ttl,
563-
0, /* label */
564-
key.enc_tp.src, key.enc_tp.dst,
565-
key32_to_tunnel_id(key.enc_key_id.keyid),
566-
TUNNEL_KEY);
578+
tun_dst->u.tun_info.key.tp_src = key.enc_tp.src;
567579

568580
if (enc_opts.key.len)
569581
ip_tunnel_info_opts_set(&tun_dst->u.tun_info,

drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_geneve.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@ static int mlx5e_tc_tun_parse_geneve_params(struct mlx5e_priv *priv,
301301
MLX5_SET(fte_match_set_misc, misc_v, geneve_protocol_type, ETH_P_TEB);
302302
}
303303

304+
spec->match_criteria_enable |= MLX5_MATCH_MISC_PARAMETERS;
305+
304306
return 0;
305307
}
306308

drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_gre.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ static int mlx5e_tc_tun_parse_gretap(struct mlx5e_priv *priv,
8080
gre_key.key, be32_to_cpu(enc_keyid.key->keyid));
8181
}
8282

83+
spec->match_criteria_enable |= MLX5_MATCH_MISC_PARAMETERS;
84+
8385
return 0;
8486
}
8587

drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ static int mlx5e_tc_tun_parse_vxlan(struct mlx5e_priv *priv,
136136
MLX5_SET(fte_match_set_misc, misc_v, vxlan_vni,
137137
be32_to_cpu(enc_keyid.key->keyid));
138138

139+
spec->match_criteria_enable |= MLX5_MATCH_MISC_PARAMETERS;
140+
139141
return 0;
140142
}
141143

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c,
419419
err = mlx5_wq_ll_create(mdev, &rqp->wq, rqc_wq, &rq->mpwqe.wq,
420420
&rq->wq_ctrl);
421421
if (err)
422-
return err;
422+
goto err_rq_wq_destroy;
423423

424424
rq->mpwqe.wq.db = &rq->mpwqe.wq.db[MLX5_RCV_DBR];
425425

@@ -470,7 +470,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c,
470470
err = mlx5_wq_cyc_create(mdev, &rqp->wq, rqc_wq, &rq->wqe.wq,
471471
&rq->wq_ctrl);
472472
if (err)
473-
return err;
473+
goto err_rq_wq_destroy;
474474

475475
rq->wqe.wq.db = &rq->wqe.wq.db[MLX5_RCV_DBR];
476476

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2356,6 +2356,7 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,
23562356
match.key->vlan_priority);
23572357

23582358
*match_level = MLX5_MATCH_L2;
2359+
spec->match_criteria_enable |= MLX5_MATCH_MISC_PARAMETERS;
23592360
}
23602361
}
23612362

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,15 @@ static struct mlx5_eswitch_rep *mlx5_eswitch_get_rep(struct mlx5_eswitch *esw,
236236
return &esw->offloads.vport_reps[idx];
237237
}
238238

239+
static void
240+
mlx5_eswitch_set_rule_flow_source(struct mlx5_eswitch *esw,
241+
struct mlx5_flow_spec *spec,
242+
struct mlx5_esw_flow_attr *attr)
243+
{
244+
if (MLX5_CAP_ESW_FLOWTABLE(esw->dev, flow_source) &&
245+
attr && attr->in_rep && attr->in_rep->vport == MLX5_VPORT_UPLINK)
246+
spec->flow_context.flow_source = MLX5_FLOW_CONTEXT_FLOW_SOURCE_UPLINK;
247+
}
239248

240249
static void
241250
mlx5_eswitch_set_rule_source_port(struct mlx5_eswitch *esw,
@@ -259,9 +268,6 @@ mlx5_eswitch_set_rule_source_port(struct mlx5_eswitch *esw,
259268
mlx5_eswitch_get_vport_metadata_mask());
260269

261270
spec->match_criteria_enable |= MLX5_MATCH_MISC_PARAMETERS_2;
262-
misc = MLX5_ADDR_OF(fte_match_param, spec->match_criteria, misc_parameters);
263-
if (memchr_inv(misc, 0, MLX5_ST_SZ_BYTES(fte_match_set_misc)))
264-
spec->match_criteria_enable |= MLX5_MATCH_MISC_PARAMETERS;
265271
} else {
266272
misc = MLX5_ADDR_OF(fte_match_param, spec->match_value, misc_parameters);
267273
MLX5_SET(fte_match_set_misc, misc, source_port, attr->in_rep->vport);
@@ -279,10 +285,6 @@ mlx5_eswitch_set_rule_source_port(struct mlx5_eswitch *esw,
279285

280286
spec->match_criteria_enable |= MLX5_MATCH_MISC_PARAMETERS;
281287
}
282-
283-
if (MLX5_CAP_ESW_FLOWTABLE(esw->dev, flow_source) &&
284-
attr->in_rep->vport == MLX5_VPORT_UPLINK)
285-
spec->flow_context.flow_source = MLX5_FLOW_CONTEXT_FLOW_SOURCE_UPLINK;
286288
}
287289

288290
struct mlx5_flow_handle *
@@ -396,6 +398,8 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
396398
goto err_esw_get;
397399
}
398400

401+
mlx5_eswitch_set_rule_flow_source(esw, spec, attr);
402+
399403
if (mlx5_eswitch_termtbl_required(esw, attr, &flow_act, spec))
400404
rule = mlx5_eswitch_add_termtbl_rule(esw, fdb, spec, attr,
401405
&flow_act, dest, i);
@@ -462,6 +466,7 @@ mlx5_eswitch_add_fwd_rule(struct mlx5_eswitch *esw,
462466
i++;
463467

464468
mlx5_eswitch_set_rule_source_port(esw, spec, attr);
469+
mlx5_eswitch_set_rule_flow_source(esw, spec, attr);
465470

466471
if (attr->outer_match_level != MLX5_MATCH_NONE)
467472
spec->match_criteria_enable |= MLX5_MATCH_OUTER_HEADERS;

0 commit comments

Comments
 (0)