Skip to content

Commit 01c8d80

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
Pull rdma fixes from Jason Gunthorpe: "Several driver bug fixes post in the last three weeks - first part of a race condition fix in mlx4 with CATAS errors - bad interaction with FW causing resource leaks in the mlx5 DCT flow - bad reporting of link speed/width in new mlx5 devices - user triggable OOPS in i40iw" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: i40iw: Avoid panic when handling the inetdev event IB/mlx5: Fix mapping of link-mode to IB width and speed IB/mlx5: Use mlx5 core to create/destroy a DEVX DCT net/mlx5: Fix DCT creation bad flow IB/mlx4: Fix race condition between catas error reset and aliasguid flows
2 parents 9e98c67 + ec4fe4b commit 01c8d80

File tree

7 files changed

+89
-45
lines changed

7 files changed

+89
-45
lines changed

drivers/infiniband/hw/i40iw/i40iw_utils.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,12 @@ int i40iw_inetaddr_event(struct notifier_block *notifier,
173173

174174
rcu_read_lock();
175175
in = __in_dev_get_rcu(upper_dev);
176-
local_ipaddr = ntohl(in->ifa_list->ifa_address);
176+
177+
if (!in->ifa_list)
178+
local_ipaddr = 0;
179+
else
180+
local_ipaddr = ntohl(in->ifa_list->ifa_address);
181+
177182
rcu_read_unlock();
178183
} else {
179184
local_ipaddr = ntohl(ifa->ifa_address);
@@ -185,6 +190,11 @@ int i40iw_inetaddr_event(struct notifier_block *notifier,
185190
case NETDEV_UP:
186191
/* Fall through */
187192
case NETDEV_CHANGEADDR:
193+
194+
/* Just skip if no need to handle ARP cache */
195+
if (!local_ipaddr)
196+
break;
197+
188198
i40iw_manage_arp_cache(iwdev,
189199
netdev->dev_addr,
190200
&local_ipaddr,

drivers/infiniband/hw/mlx4/alias_GUID.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,8 +804,8 @@ void mlx4_ib_destroy_alias_guid_service(struct mlx4_ib_dev *dev)
804804
unsigned long flags;
805805

806806
for (i = 0 ; i < dev->num_ports; i++) {
807-
cancel_delayed_work(&dev->sriov.alias_guid.ports_guid[i].alias_guid_work);
808807
det = &sriov->alias_guid.ports_guid[i];
808+
cancel_delayed_work_sync(&det->alias_guid_work);
809809
spin_lock_irqsave(&sriov->alias_guid.ag_work_lock, flags);
810810
while (!list_empty(&det->cb_list)) {
811811
cb_ctx = list_entry(det->cb_list.next,

drivers/infiniband/hw/mlx5/devx.c

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
enum devx_obj_flags {
2222
DEVX_OBJ_FLAGS_INDIRECT_MKEY = 1 << 0,
23+
DEVX_OBJ_FLAGS_DCT = 1 << 1,
2324
};
2425

2526
struct devx_async_data {
@@ -39,7 +40,10 @@ struct devx_obj {
3940
u32 dinlen; /* destroy inbox length */
4041
u32 dinbox[MLX5_MAX_DESTROY_INBOX_SIZE_DW];
4142
u32 flags;
42-
struct mlx5_ib_devx_mr devx_mr;
43+
union {
44+
struct mlx5_ib_devx_mr devx_mr;
45+
struct mlx5_core_dct core_dct;
46+
};
4347
};
4448

4549
struct devx_umem {
@@ -347,7 +351,6 @@ static u64 devx_get_obj_id(const void *in)
347351
obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_RQ,
348352
MLX5_GET(arm_rq_in, in, srq_number));
349353
break;
350-
case MLX5_CMD_OP_DRAIN_DCT:
351354
case MLX5_CMD_OP_ARM_DCT_FOR_KEY_VIOLATION:
352355
obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_DCT,
353356
MLX5_GET(drain_dct_in, in, dctn));
@@ -618,7 +621,6 @@ static bool devx_is_obj_modify_cmd(const void *in)
618621
case MLX5_CMD_OP_2RST_QP:
619622
case MLX5_CMD_OP_ARM_XRC_SRQ:
620623
case MLX5_CMD_OP_ARM_RQ:
621-
case MLX5_CMD_OP_DRAIN_DCT:
622624
case MLX5_CMD_OP_ARM_DCT_FOR_KEY_VIOLATION:
623625
case MLX5_CMD_OP_ARM_XRQ:
624626
case MLX5_CMD_OP_SET_XRQ_DC_PARAMS_ENTRY:
@@ -1124,7 +1126,11 @@ static int devx_obj_cleanup(struct ib_uobject *uobject,
11241126
if (obj->flags & DEVX_OBJ_FLAGS_INDIRECT_MKEY)
11251127
devx_cleanup_mkey(obj);
11261128

1127-
ret = mlx5_cmd_exec(obj->mdev, obj->dinbox, obj->dinlen, out, sizeof(out));
1129+
if (obj->flags & DEVX_OBJ_FLAGS_DCT)
1130+
ret = mlx5_core_destroy_dct(obj->mdev, &obj->core_dct);
1131+
else
1132+
ret = mlx5_cmd_exec(obj->mdev, obj->dinbox, obj->dinlen, out,
1133+
sizeof(out));
11281134
if (ib_is_destroy_retryable(ret, why, uobject))
11291135
return ret;
11301136

@@ -1185,9 +1191,17 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)(
11851191
devx_set_umem_valid(cmd_in);
11861192
}
11871193

1188-
err = mlx5_cmd_exec(dev->mdev, cmd_in,
1189-
cmd_in_len,
1190-
cmd_out, cmd_out_len);
1194+
if (opcode == MLX5_CMD_OP_CREATE_DCT) {
1195+
obj->flags |= DEVX_OBJ_FLAGS_DCT;
1196+
err = mlx5_core_create_dct(dev->mdev, &obj->core_dct,
1197+
cmd_in, cmd_in_len,
1198+
cmd_out, cmd_out_len);
1199+
} else {
1200+
err = mlx5_cmd_exec(dev->mdev, cmd_in,
1201+
cmd_in_len,
1202+
cmd_out, cmd_out_len);
1203+
}
1204+
11911205
if (err)
11921206
goto obj_free;
11931207

@@ -1214,7 +1228,11 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)(
12141228
if (obj->flags & DEVX_OBJ_FLAGS_INDIRECT_MKEY)
12151229
devx_cleanup_mkey(obj);
12161230
obj_destroy:
1217-
mlx5_cmd_exec(obj->mdev, obj->dinbox, obj->dinlen, out, sizeof(out));
1231+
if (obj->flags & DEVX_OBJ_FLAGS_DCT)
1232+
mlx5_core_destroy_dct(obj->mdev, &obj->core_dct);
1233+
else
1234+
mlx5_cmd_exec(obj->mdev, obj->dinbox, obj->dinlen, out,
1235+
sizeof(out));
12181236
obj_free:
12191237
kfree(obj);
12201238
return err;

drivers/infiniband/hw/mlx5/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,17 @@ static int translate_eth_ext_proto_oper(u32 eth_proto_oper, u8 *active_speed,
415415
*active_speed = IB_SPEED_EDR;
416416
break;
417417
case MLX5E_PROT_MASK(MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2):
418+
*active_width = IB_WIDTH_2X;
419+
*active_speed = IB_SPEED_EDR;
420+
break;
418421
case MLX5E_PROT_MASK(MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR):
419422
*active_width = IB_WIDTH_1X;
420423
*active_speed = IB_SPEED_HDR;
421424
break;
425+
case MLX5E_PROT_MASK(MLX5E_CAUI_4_100GBASE_CR4_KR4):
426+
*active_width = IB_WIDTH_4X;
427+
*active_speed = IB_SPEED_EDR;
428+
break;
422429
case MLX5E_PROT_MASK(MLX5E_100GAUI_2_100GBASE_CR2_KR2):
423430
*active_width = IB_WIDTH_2X;
424431
*active_speed = IB_SPEED_HDR;

drivers/infiniband/hw/mlx5/qp.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3729,6 +3729,7 @@ static int mlx5_ib_modify_dct(struct ib_qp *ibqp, struct ib_qp_attr *attr,
37293729

37303730
} else if (cur_state == IB_QPS_INIT && new_state == IB_QPS_RTR) {
37313731
struct mlx5_ib_modify_qp_resp resp = {};
3732+
u32 out[MLX5_ST_SZ_DW(create_dct_out)] = {0};
37323733
u32 min_resp_len = offsetof(typeof(resp), dctn) +
37333734
sizeof(resp.dctn);
37343735

@@ -3747,7 +3748,8 @@ static int mlx5_ib_modify_dct(struct ib_qp *ibqp, struct ib_qp_attr *attr,
37473748
MLX5_SET(dctc, dctc, hop_limit, attr->ah_attr.grh.hop_limit);
37483749

37493750
err = mlx5_core_create_dct(dev->mdev, &qp->dct.mdct, qp->dct.in,
3750-
MLX5_ST_SZ_BYTES(create_dct_in));
3751+
MLX5_ST_SZ_BYTES(create_dct_in), out,
3752+
sizeof(out));
37513753
if (err)
37523754
return err;
37533755
resp.dctn = qp->dct.mdct.mqp.qpn;

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

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
#include "mlx5_core.h"
4141
#include "lib/eq.h"
4242

43+
static int mlx5_core_drain_dct(struct mlx5_core_dev *dev,
44+
struct mlx5_core_dct *dct);
45+
4346
static struct mlx5_core_rsc_common *
4447
mlx5_get_rsc(struct mlx5_qp_table *table, u32 rsn)
4548
{
@@ -227,20 +230,49 @@ static void destroy_resource_common(struct mlx5_core_dev *dev,
227230
wait_for_completion(&qp->common.free);
228231
}
229232

233+
static int _mlx5_core_destroy_dct(struct mlx5_core_dev *dev,
234+
struct mlx5_core_dct *dct, bool need_cleanup)
235+
{
236+
u32 out[MLX5_ST_SZ_DW(destroy_dct_out)] = {0};
237+
u32 in[MLX5_ST_SZ_DW(destroy_dct_in)] = {0};
238+
struct mlx5_core_qp *qp = &dct->mqp;
239+
int err;
240+
241+
err = mlx5_core_drain_dct(dev, dct);
242+
if (err) {
243+
if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) {
244+
goto destroy;
245+
} else {
246+
mlx5_core_warn(
247+
dev, "failed drain DCT 0x%x with error 0x%x\n",
248+
qp->qpn, err);
249+
return err;
250+
}
251+
}
252+
wait_for_completion(&dct->drained);
253+
destroy:
254+
if (need_cleanup)
255+
destroy_resource_common(dev, &dct->mqp);
256+
MLX5_SET(destroy_dct_in, in, opcode, MLX5_CMD_OP_DESTROY_DCT);
257+
MLX5_SET(destroy_dct_in, in, dctn, qp->qpn);
258+
MLX5_SET(destroy_dct_in, in, uid, qp->uid);
259+
err = mlx5_cmd_exec(dev, (void *)&in, sizeof(in),
260+
(void *)&out, sizeof(out));
261+
return err;
262+
}
263+
230264
int mlx5_core_create_dct(struct mlx5_core_dev *dev,
231265
struct mlx5_core_dct *dct,
232-
u32 *in, int inlen)
266+
u32 *in, int inlen,
267+
u32 *out, int outlen)
233268
{
234-
u32 out[MLX5_ST_SZ_DW(create_dct_out)] = {0};
235-
u32 din[MLX5_ST_SZ_DW(destroy_dct_in)] = {0};
236-
u32 dout[MLX5_ST_SZ_DW(destroy_dct_out)] = {0};
237269
struct mlx5_core_qp *qp = &dct->mqp;
238270
int err;
239271

240272
init_completion(&dct->drained);
241273
MLX5_SET(create_dct_in, in, opcode, MLX5_CMD_OP_CREATE_DCT);
242274

243-
err = mlx5_cmd_exec(dev, in, inlen, &out, sizeof(out));
275+
err = mlx5_cmd_exec(dev, in, inlen, out, outlen);
244276
if (err) {
245277
mlx5_core_warn(dev, "create DCT failed, ret %d\n", err);
246278
return err;
@@ -254,11 +286,7 @@ int mlx5_core_create_dct(struct mlx5_core_dev *dev,
254286

255287
return 0;
256288
err_cmd:
257-
MLX5_SET(destroy_dct_in, din, opcode, MLX5_CMD_OP_DESTROY_DCT);
258-
MLX5_SET(destroy_dct_in, din, dctn, qp->qpn);
259-
MLX5_SET(destroy_dct_in, din, uid, qp->uid);
260-
mlx5_cmd_exec(dev, (void *)&in, sizeof(din),
261-
(void *)&out, sizeof(dout));
289+
_mlx5_core_destroy_dct(dev, dct, false);
262290
return err;
263291
}
264292
EXPORT_SYMBOL_GPL(mlx5_core_create_dct);
@@ -323,29 +351,7 @@ static int mlx5_core_drain_dct(struct mlx5_core_dev *dev,
323351
int mlx5_core_destroy_dct(struct mlx5_core_dev *dev,
324352
struct mlx5_core_dct *dct)
325353
{
326-
u32 out[MLX5_ST_SZ_DW(destroy_dct_out)] = {0};
327-
u32 in[MLX5_ST_SZ_DW(destroy_dct_in)] = {0};
328-
struct mlx5_core_qp *qp = &dct->mqp;
329-
int err;
330-
331-
err = mlx5_core_drain_dct(dev, dct);
332-
if (err) {
333-
if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) {
334-
goto destroy;
335-
} else {
336-
mlx5_core_warn(dev, "failed drain DCT 0x%x with error 0x%x\n", qp->qpn, err);
337-
return err;
338-
}
339-
}
340-
wait_for_completion(&dct->drained);
341-
destroy:
342-
destroy_resource_common(dev, &dct->mqp);
343-
MLX5_SET(destroy_dct_in, in, opcode, MLX5_CMD_OP_DESTROY_DCT);
344-
MLX5_SET(destroy_dct_in, in, dctn, qp->qpn);
345-
MLX5_SET(destroy_dct_in, in, uid, qp->uid);
346-
err = mlx5_cmd_exec(dev, (void *)&in, sizeof(in),
347-
(void *)&out, sizeof(out));
348-
return err;
354+
return _mlx5_core_destroy_dct(dev, dct, true);
349355
}
350356
EXPORT_SYMBOL_GPL(mlx5_core_destroy_dct);
351357

include/linux/mlx5/qp.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,8 @@ static inline struct mlx5_core_mkey *__mlx5_mr_lookup(struct mlx5_core_dev *dev,
557557

558558
int mlx5_core_create_dct(struct mlx5_core_dev *dev,
559559
struct mlx5_core_dct *qp,
560-
u32 *in, int inlen);
560+
u32 *in, int inlen,
561+
u32 *out, int outlen);
561562
int mlx5_core_create_qp(struct mlx5_core_dev *dev,
562563
struct mlx5_core_qp *qp,
563564
u32 *in,

0 commit comments

Comments
 (0)