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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma

Pull rdma fixes from Doug Ledford:
"Additional 4.5-rc6 fixes.

I have four patches today. I had previously thought I had submitted
two of them last week, but they were accidentally skipped :-(.

- One fix to an error path in the core
- One fix for RoCE in the core
- Two related fixes for the core/mlx5"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma:
IB/core: Use GRH when the path hop-limit > 0
IB/{core, mlx5}: Fix input len in vendor part of create_qp/srq
IB/mlx5: Avoid using user-index for SRQs
IB/core: Fix missed clean call in registration path

+30 -23
+1
drivers/infiniband/core/device.c
··· 358 358 ret = device->query_device(device, &device->attrs, &uhw); 359 359 if (ret) { 360 360 printk(KERN_WARNING "Couldn't query the device attributes\n"); 361 + ib_cache_cleanup_one(device); 361 362 goto out; 362 363 } 363 364
+1 -1
drivers/infiniband/core/sa_query.c
··· 1071 1071 } 1072 1072 } 1073 1073 1074 - if (rec->hop_limit > 1 || use_roce) { 1074 + if (rec->hop_limit > 0 || use_roce) { 1075 1075 ah_attr->ah_flags = IB_AH_GRH; 1076 1076 ah_attr->grh.dgid = rec->dgid; 1077 1077
+6 -3
drivers/infiniband/core/uverbs_cmd.c
··· 1970 1970 resp_size); 1971 1971 INIT_UDATA(&uhw, buf + sizeof(cmd), 1972 1972 (unsigned long)cmd.response + resp_size, 1973 - in_len - sizeof(cmd), out_len - resp_size); 1973 + in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr), 1974 + out_len - resp_size); 1974 1975 1975 1976 memset(&cmd_ex, 0, sizeof(cmd_ex)); 1976 1977 cmd_ex.user_handle = cmd.user_handle; ··· 3414 3413 3415 3414 INIT_UDATA(&udata, buf + sizeof cmd, 3416 3415 (unsigned long) cmd.response + sizeof resp, 3417 - in_len - sizeof cmd, out_len - sizeof resp); 3416 + in_len - sizeof cmd - sizeof(struct ib_uverbs_cmd_hdr), 3417 + out_len - sizeof resp); 3418 3418 3419 3419 ret = __uverbs_create_xsrq(file, ib_dev, &xcmd, &udata); 3420 3420 if (ret) ··· 3441 3439 3442 3440 INIT_UDATA(&udata, buf + sizeof cmd, 3443 3441 (unsigned long) cmd.response + sizeof resp, 3444 - in_len - sizeof cmd, out_len - sizeof resp); 3442 + in_len - sizeof cmd - sizeof(struct ib_uverbs_cmd_hdr), 3443 + out_len - sizeof resp); 3445 3444 3446 3445 ret = __uverbs_create_xsrq(file, ib_dev, &cmd, &udata); 3447 3446 if (ret)
+22 -19
drivers/infiniband/hw/mlx5/srq.c
··· 75 75 76 76 static int create_srq_user(struct ib_pd *pd, struct mlx5_ib_srq *srq, 77 77 struct mlx5_create_srq_mbox_in **in, 78 - struct ib_udata *udata, int buf_size, int *inlen) 78 + struct ib_udata *udata, int buf_size, int *inlen, 79 + int is_xrc) 79 80 { 80 81 struct mlx5_ib_dev *dev = to_mdev(pd->device); 81 82 struct mlx5_ib_create_srq ucmd = {}; ··· 88 87 int ncont; 89 88 u32 offset; 90 89 u32 uidx = MLX5_IB_DEFAULT_UIDX; 91 - int drv_data = udata->inlen - sizeof(struct ib_uverbs_cmd_hdr); 92 90 93 - if (drv_data < 0) 94 - return -EINVAL; 95 - 96 - ucmdlen = (drv_data < sizeof(ucmd)) ? 97 - drv_data : sizeof(ucmd); 91 + ucmdlen = min(udata->inlen, sizeof(ucmd)); 98 92 99 93 if (ib_copy_from_udata(&ucmd, udata, ucmdlen)) { 100 94 mlx5_ib_dbg(dev, "failed copy udata\n"); ··· 99 103 if (ucmd.reserved0 || ucmd.reserved1) 100 104 return -EINVAL; 101 105 102 - if (drv_data > sizeof(ucmd) && 106 + if (udata->inlen > sizeof(ucmd) && 103 107 !ib_is_udata_cleared(udata, sizeof(ucmd), 104 - drv_data - sizeof(ucmd))) 108 + udata->inlen - sizeof(ucmd))) 105 109 return -EINVAL; 106 110 107 - err = get_srq_user_index(to_mucontext(pd->uobject->context), 108 - &ucmd, udata->inlen, &uidx); 109 - if (err) 110 - return err; 111 + if (is_xrc) { 112 + err = get_srq_user_index(to_mucontext(pd->uobject->context), 113 + &ucmd, udata->inlen, &uidx); 114 + if (err) 115 + return err; 116 + } 111 117 112 118 srq->wq_sig = !!(ucmd.flags & MLX5_SRQ_FLAG_SIGNATURE); 113 119 ··· 149 151 (*in)->ctx.log_pg_sz = page_shift - MLX5_ADAPTER_PAGE_SHIFT; 150 152 (*in)->ctx.pgoff_cqn = cpu_to_be32(offset << 26); 151 153 152 - if (MLX5_CAP_GEN(dev->mdev, cqe_version) == MLX5_CQE_VERSION_V1) { 154 + if ((MLX5_CAP_GEN(dev->mdev, cqe_version) == MLX5_CQE_VERSION_V1) && 155 + is_xrc){ 153 156 xsrqc = MLX5_ADDR_OF(create_xrc_srq_in, *in, 154 157 xrc_srq_context_entry); 155 158 MLX5_SET(xrc_srqc, xsrqc, user_index, uidx); ··· 169 170 170 171 static int create_srq_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_srq *srq, 171 172 struct mlx5_create_srq_mbox_in **in, int buf_size, 172 - int *inlen) 173 + int *inlen, int is_xrc) 173 174 { 174 175 int err; 175 176 int i; ··· 223 224 224 225 (*in)->ctx.log_pg_sz = page_shift - MLX5_ADAPTER_PAGE_SHIFT; 225 226 226 - if (MLX5_CAP_GEN(dev->mdev, cqe_version) == MLX5_CQE_VERSION_V1) { 227 + if ((MLX5_CAP_GEN(dev->mdev, cqe_version) == MLX5_CQE_VERSION_V1) && 228 + is_xrc){ 227 229 xsrqc = MLX5_ADDR_OF(create_xrc_srq_in, *in, 228 230 xrc_srq_context_entry); 229 231 /* 0xffffff means we ask to work with cqe version 0 */ ··· 302 302 desc_size, init_attr->attr.max_wr, srq->msrq.max, srq->msrq.max_gs, 303 303 srq->msrq.max_avail_gather); 304 304 305 + is_xrc = (init_attr->srq_type == IB_SRQT_XRC); 306 + 305 307 if (pd->uobject) 306 - err = create_srq_user(pd, srq, &in, udata, buf_size, &inlen); 308 + err = create_srq_user(pd, srq, &in, udata, buf_size, &inlen, 309 + is_xrc); 307 310 else 308 - err = create_srq_kernel(dev, srq, &in, buf_size, &inlen); 311 + err = create_srq_kernel(dev, srq, &in, buf_size, &inlen, 312 + is_xrc); 309 313 310 314 if (err) { 311 315 mlx5_ib_warn(dev, "create srq %s failed, err %d\n", ··· 317 313 goto err_srq; 318 314 } 319 315 320 - is_xrc = (init_attr->srq_type == IB_SRQT_XRC); 321 316 in->ctx.state_log_sz = ilog2(srq->msrq.max); 322 317 flgs = ((srq->msrq.wqe_shift - 4) | (is_xrc << 5) | (srq->wq_sig << 7)) << 24; 323 318 xrcdn = 0;