Skip to content

Commit 722943a

Browse files
committed
Merge tag 'mlx5-fixes-2020-01-24' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== Mellanox, mlx5 fixes 2020-01-24 This series introduces some fixes to mlx5 driver. Please pull and let me know if there is any problem. Merge conflict: once merge with net-next, a contextual conflict will appear in drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c since the code moved in net-next. To resolve, just delete ALL of the conflicting hunk from net. So sorry for the small mess .. For -stable v5.4: ('net/mlx5: Update the list of the PCI supported devices') ('net/mlx5: Fix lowest FDB pool size') ('net/mlx5e: kTLS, Fix corner-case checks in TX resync flow') ('net/mlx5e: kTLS, Do not send decrypted-marked SKBs via non-accel path') ('net/mlx5: Eswitch, Prevent ingress rate configuration of uplink rep') ('net/mlx5e: kTLS, Remove redundant posts in TX resync flow') ('net/mlx5: DR, Enable counter on non-fwd-dest objects') ('net/mlx5: DR, use non preemptible call to get the current cpu number') ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 3546d8f + 342508c commit 722943a

File tree

7 files changed

+80
-41
lines changed

7 files changed

+80
-41
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ mlx5e_ktls_tx_post_param_wqes(struct mlx5e_txqsq *sq,
180180

181181
struct tx_sync_info {
182182
u64 rcd_sn;
183-
s32 sync_len;
183+
u32 sync_len;
184184
int nr_frags;
185185
skb_frag_t frags[MAX_SKB_FRAGS];
186186
};
@@ -193,13 +193,14 @@ enum mlx5e_ktls_sync_retval {
193193

194194
static enum mlx5e_ktls_sync_retval
195195
tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx,
196-
u32 tcp_seq, struct tx_sync_info *info)
196+
u32 tcp_seq, int datalen, struct tx_sync_info *info)
197197
{
198198
struct tls_offload_context_tx *tx_ctx = priv_tx->tx_ctx;
199199
enum mlx5e_ktls_sync_retval ret = MLX5E_KTLS_SYNC_DONE;
200200
struct tls_record_info *record;
201201
int remaining, i = 0;
202202
unsigned long flags;
203+
bool ends_before;
203204

204205
spin_lock_irqsave(&tx_ctx->lock, flags);
205206
record = tls_get_record(tx_ctx, tcp_seq, &info->rcd_sn);
@@ -209,9 +210,21 @@ tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx,
209210
goto out;
210211
}
211212

212-
if (unlikely(tcp_seq < tls_record_start_seq(record))) {
213-
ret = tls_record_is_start_marker(record) ?
214-
MLX5E_KTLS_SYNC_SKIP_NO_DATA : MLX5E_KTLS_SYNC_FAIL;
213+
/* There are the following cases:
214+
* 1. packet ends before start marker: bypass offload.
215+
* 2. packet starts before start marker and ends after it: drop,
216+
* not supported, breaks contract with kernel.
217+
* 3. packet ends before tls record info starts: drop,
218+
* this packet was already acknowledged and its record info
219+
* was released.
220+
*/
221+
ends_before = before(tcp_seq + datalen, tls_record_start_seq(record));
222+
223+
if (unlikely(tls_record_is_start_marker(record))) {
224+
ret = ends_before ? MLX5E_KTLS_SYNC_SKIP_NO_DATA : MLX5E_KTLS_SYNC_FAIL;
225+
goto out;
226+
} else if (ends_before) {
227+
ret = MLX5E_KTLS_SYNC_FAIL;
215228
goto out;
216229
}
217230

@@ -337,7 +350,7 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx,
337350
u8 num_wqebbs;
338351
int i = 0;
339352

340-
ret = tx_sync_info_get(priv_tx, seq, &info);
353+
ret = tx_sync_info_get(priv_tx, seq, datalen, &info);
341354
if (unlikely(ret != MLX5E_KTLS_SYNC_DONE)) {
342355
if (ret == MLX5E_KTLS_SYNC_SKIP_NO_DATA) {
343356
stats->tls_skip_no_sync_data++;
@@ -351,14 +364,6 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx,
351364
goto err_out;
352365
}
353366

354-
if (unlikely(info.sync_len < 0)) {
355-
if (likely(datalen <= -info.sync_len))
356-
return MLX5E_KTLS_SYNC_DONE;
357-
358-
stats->tls_drop_bypass_req++;
359-
goto err_out;
360-
}
361-
362367
stats->tls_ooo++;
363368

364369
tx_post_resync_params(sq, priv_tx, info.rcd_sn);
@@ -378,8 +383,6 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx,
378383
if (unlikely(contig_wqebbs_room < num_wqebbs))
379384
mlx5e_fill_sq_frag_edge(sq, wq, pi, contig_wqebbs_room);
380385

381-
tx_post_resync_params(sq, priv_tx, info.rcd_sn);
382-
383386
for (; i < info.nr_frags; i++) {
384387
unsigned int orig_fsz, frag_offset = 0, n = 0;
385388
skb_frag_t *f = &info.frags[i];
@@ -455,12 +458,18 @@ struct sk_buff *mlx5e_ktls_handle_tx_skb(struct net_device *netdev,
455458
enum mlx5e_ktls_sync_retval ret =
456459
mlx5e_ktls_tx_handle_ooo(priv_tx, sq, datalen, seq);
457460

458-
if (likely(ret == MLX5E_KTLS_SYNC_DONE))
461+
switch (ret) {
462+
case MLX5E_KTLS_SYNC_DONE:
459463
*wqe = mlx5e_sq_fetch_wqe(sq, sizeof(**wqe), pi);
460-
else if (ret == MLX5E_KTLS_SYNC_FAIL)
464+
break;
465+
case MLX5E_KTLS_SYNC_SKIP_NO_DATA:
466+
if (likely(!skb->decrypted))
467+
goto out;
468+
WARN_ON_ONCE(1);
469+
/* fall-through */
470+
default: /* MLX5E_KTLS_SYNC_FAIL */
461471
goto err_out;
462-
else /* ret == MLX5E_KTLS_SYNC_SKIP_NO_DATA */
463-
goto out;
472+
}
464473
}
465474

466475
priv_tx->expected_seq = seq + datalen;

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4036,6 +4036,13 @@ static int apply_police_params(struct mlx5e_priv *priv, u32 rate,
40364036
u32 rate_mbps;
40374037
int err;
40384038

4039+
vport_num = rpriv->rep->vport;
4040+
if (vport_num >= MLX5_VPORT_ECPF) {
4041+
NL_SET_ERR_MSG_MOD(extack,
4042+
"Ingress rate limit is supported only for Eswitch ports connected to VFs");
4043+
return -EOPNOTSUPP;
4044+
}
4045+
40394046
esw = priv->mdev->priv.eswitch;
40404047
/* rate is given in bytes/sec.
40414048
* First convert to bits/sec and then round to the nearest mbit/secs.
@@ -4044,8 +4051,6 @@ static int apply_police_params(struct mlx5e_priv *priv, u32 rate,
40444051
* 1 mbit/sec.
40454052
*/
40464053
rate_mbps = rate ? max_t(u32, (rate * 8 + 500000) / 1000000, 1) : 0;
4047-
vport_num = rpriv->rep->vport;
4048-
40494054
err = mlx5_esw_modify_vport_rate(esw, vport_num, rate_mbps);
40504055
if (err)
40514056
NL_SET_ERR_MSG_MOD(extack, "failed applying action to hardware");

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1928,8 +1928,10 @@ static void mlx5_eswitch_clear_vf_vports_info(struct mlx5_eswitch *esw)
19281928
struct mlx5_vport *vport;
19291929
int i;
19301930

1931-
mlx5_esw_for_each_vf_vport(esw, i, vport, esw->esw_funcs.num_vfs)
1931+
mlx5_esw_for_each_vf_vport(esw, i, vport, esw->esw_funcs.num_vfs) {
19321932
memset(&vport->info, 0, sizeof(vport->info));
1933+
vport->info.link_state = MLX5_VPORT_ADMIN_STATE_AUTO;
1934+
}
19331935
}
19341936

19351937
/* Public E-Switch API */

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ static int esw_add_fdb_miss_rule(struct mlx5_eswitch *esw)
866866
*/
867867
#define ESW_SIZE (16 * 1024 * 1024)
868868
const unsigned int ESW_POOLS[4] = { 4 * 1024 * 1024, 1 * 1024 * 1024,
869-
64 * 1024, 4 * 1024 };
869+
64 * 1024, 128 };
870870

871871
static int
872872
get_sz_from_pool(struct mlx5_eswitch *esw)
@@ -1377,7 +1377,7 @@ static int esw_offloads_start(struct mlx5_eswitch *esw,
13771377
return -EINVAL;
13781378
}
13791379

1380-
mlx5_eswitch_disable(esw, false);
1380+
mlx5_eswitch_disable(esw, true);
13811381
mlx5_eswitch_update_num_of_vfs(esw, esw->dev->priv.sriov.num_vfs);
13821382
err = mlx5_eswitch_enable(esw, MLX5_ESWITCH_OFFLOADS);
13831383
if (err) {
@@ -2220,7 +2220,8 @@ int mlx5_esw_funcs_changed_handler(struct notifier_block *nb, unsigned long type
22202220

22212221
int esw_offloads_enable(struct mlx5_eswitch *esw)
22222222
{
2223-
int err;
2223+
struct mlx5_vport *vport;
2224+
int err, i;
22242225

22252226
if (MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, reformat) &&
22262227
MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, decap))
@@ -2237,6 +2238,10 @@ int esw_offloads_enable(struct mlx5_eswitch *esw)
22372238
if (err)
22382239
goto err_vport_metadata;
22392240

2241+
/* Representor will control the vport link state */
2242+
mlx5_esw_for_each_vf_vport(esw, i, vport, esw->esw_funcs.num_vfs)
2243+
vport->info.link_state = MLX5_VPORT_ADMIN_STATE_DOWN;
2244+
22402245
err = mlx5_eswitch_enable_pf_vf_vports(esw, MLX5_VPORT_UC_ADDR_CHANGE);
22412246
if (err)
22422247
goto err_vports;
@@ -2266,7 +2271,7 @@ static int esw_offloads_stop(struct mlx5_eswitch *esw,
22662271
{
22672272
int err, err1;
22682273

2269-
mlx5_eswitch_disable(esw, false);
2274+
mlx5_eswitch_disable(esw, true);
22702275
err = mlx5_eswitch_enable(esw, MLX5_ESWITCH_LEGACY);
22712276
if (err) {
22722277
NL_SET_ERR_MSG_MOD(extack, "Failed setting eswitch to legacy");

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,6 +1563,7 @@ static const struct pci_device_id mlx5_core_pci_table[] = {
15631563
{ PCI_VDEVICE(MELLANOX, 0x101d) }, /* ConnectX-6 Dx */
15641564
{ PCI_VDEVICE(MELLANOX, 0x101e), MLX5_PCI_DEV_IS_VF}, /* ConnectX Family mlx5Gen Virtual Function */
15651565
{ PCI_VDEVICE(MELLANOX, 0x101f) }, /* ConnectX-6 LX */
1566+
{ PCI_VDEVICE(MELLANOX, 0x1021) }, /* ConnectX-7 */
15661567
{ PCI_VDEVICE(MELLANOX, 0xa2d2) }, /* BlueField integrated ConnectX-5 network controller */
15671568
{ PCI_VDEVICE(MELLANOX, 0xa2d3), MLX5_PCI_DEV_IS_VF}, /* BlueField integrated ConnectX-5 network controller VF */
15681569
{ PCI_VDEVICE(MELLANOX, 0xa2d6) }, /* BlueField-2 integrated ConnectX-6 Dx network controller */

drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
22
/* Copyright (c) 2019 Mellanox Technologies. */
33

4+
#include <linux/smp.h>
45
#include "dr_types.h"
56

67
#define QUEUE_SIZE 128
@@ -729,7 +730,7 @@ static struct mlx5dr_cq *dr_create_cq(struct mlx5_core_dev *mdev,
729730
if (!in)
730731
goto err_cqwq;
731732

732-
vector = smp_processor_id() % mlx5_comp_vectors_count(mdev);
733+
vector = raw_smp_processor_id() % mlx5_comp_vectors_count(mdev);
733734
err = mlx5_vector2eqn(mdev, vector, &eqn, &irqn);
734735
if (err) {
735736
kvfree(in);

drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -352,26 +352,16 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,
352352
if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) {
353353
list_for_each_entry(dst, &fte->node.children, node.list) {
354354
enum mlx5_flow_destination_type type = dst->dest_attr.type;
355-
u32 id;
356355

357356
if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX) {
358357
err = -ENOSPC;
359358
goto free_actions;
360359
}
361360

362-
switch (type) {
363-
case MLX5_FLOW_DESTINATION_TYPE_COUNTER:
364-
id = dst->dest_attr.counter_id;
361+
if (type == MLX5_FLOW_DESTINATION_TYPE_COUNTER)
362+
continue;
365363

366-
tmp_action =
367-
mlx5dr_action_create_flow_counter(id);
368-
if (!tmp_action) {
369-
err = -ENOMEM;
370-
goto free_actions;
371-
}
372-
fs_dr_actions[fs_dr_num_actions++] = tmp_action;
373-
actions[num_actions++] = tmp_action;
374-
break;
364+
switch (type) {
375365
case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE:
376366
tmp_action = create_ft_action(dev, dst);
377367
if (!tmp_action) {
@@ -397,6 +387,32 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,
397387
}
398388
}
399389

390+
if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_COUNT) {
391+
list_for_each_entry(dst, &fte->node.children, node.list) {
392+
u32 id;
393+
394+
if (dst->dest_attr.type !=
395+
MLX5_FLOW_DESTINATION_TYPE_COUNTER)
396+
continue;
397+
398+
if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX) {
399+
err = -ENOSPC;
400+
goto free_actions;
401+
}
402+
403+
id = dst->dest_attr.counter_id;
404+
tmp_action =
405+
mlx5dr_action_create_flow_counter(id);
406+
if (!tmp_action) {
407+
err = -ENOMEM;
408+
goto free_actions;
409+
}
410+
411+
fs_dr_actions[fs_dr_num_actions++] = tmp_action;
412+
actions[num_actions++] = tmp_action;
413+
}
414+
}
415+
400416
params.match_sz = match_sz;
401417
params.match_buf = (u64 *)fte->val;
402418

0 commit comments

Comments
 (0)