diff options
Diffstat (limited to 'drivers/infiniband')
42 files changed, 262 insertions, 153 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 63a7cc00bae0..84f077b2b90a 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
| @@ -494,7 +494,10 @@ static void _cma_attach_to_dev(struct rdma_id_private *id_priv, | |||
| 494 | id_priv->id.route.addr.dev_addr.transport = | 494 | id_priv->id.route.addr.dev_addr.transport = |
| 495 | rdma_node_get_transport(cma_dev->device->node_type); | 495 | rdma_node_get_transport(cma_dev->device->node_type); |
| 496 | list_add_tail(&id_priv->list, &cma_dev->id_list); | 496 | list_add_tail(&id_priv->list, &cma_dev->id_list); |
| 497 | rdma_restrack_kadd(&id_priv->res); | 497 | if (id_priv->res.kern_name) |
| 498 | rdma_restrack_kadd(&id_priv->res); | ||
| 499 | else | ||
| 500 | rdma_restrack_uadd(&id_priv->res); | ||
| 498 | } | 501 | } |
| 499 | 502 | ||
| 500 | static void cma_attach_to_dev(struct rdma_id_private *id_priv, | 503 | static void cma_attach_to_dev(struct rdma_id_private *id_priv, |
diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h index 3cd830d52967..616734313f0c 100644 --- a/drivers/infiniband/core/core_priv.h +++ b/drivers/infiniband/core/core_priv.h | |||
| @@ -267,7 +267,6 @@ static inline int ib_mad_enforce_security(struct ib_mad_agent_private *map, | |||
| 267 | #endif | 267 | #endif |
| 268 | 268 | ||
| 269 | struct ib_device *ib_device_get_by_index(u32 ifindex); | 269 | struct ib_device *ib_device_get_by_index(u32 ifindex); |
| 270 | void ib_device_put(struct ib_device *device); | ||
| 271 | /* RDMA device netlink */ | 270 | /* RDMA device netlink */ |
| 272 | void nldev_init(void); | 271 | void nldev_init(void); |
| 273 | void nldev_exit(void); | 272 | void nldev_exit(void); |
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 8872453e26c0..238ec42778ef 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c | |||
| @@ -156,19 +156,26 @@ struct ib_device *ib_device_get_by_index(u32 index) | |||
| 156 | down_read(&lists_rwsem); | 156 | down_read(&lists_rwsem); |
| 157 | device = __ib_device_get_by_index(index); | 157 | device = __ib_device_get_by_index(index); |
| 158 | if (device) { | 158 | if (device) { |
| 159 | /* Do not return a device if unregistration has started. */ | 159 | if (!ib_device_try_get(device)) |
| 160 | if (!refcount_inc_not_zero(&device->refcount)) | ||
| 161 | device = NULL; | 160 | device = NULL; |
| 162 | } | 161 | } |
| 163 | up_read(&lists_rwsem); | 162 | up_read(&lists_rwsem); |
| 164 | return device; | 163 | return device; |
| 165 | } | 164 | } |
| 166 | 165 | ||
| 166 | /** | ||
| 167 | * ib_device_put - Release IB device reference | ||
| 168 | * @device: device whose reference to be released | ||
| 169 | * | ||
| 170 | * ib_device_put() releases reference to the IB device to allow it to be | ||
| 171 | * unregistered and eventually free. | ||
| 172 | */ | ||
| 167 | void ib_device_put(struct ib_device *device) | 173 | void ib_device_put(struct ib_device *device) |
| 168 | { | 174 | { |
| 169 | if (refcount_dec_and_test(&device->refcount)) | 175 | if (refcount_dec_and_test(&device->refcount)) |
| 170 | complete(&device->unreg_completion); | 176 | complete(&device->unreg_completion); |
| 171 | } | 177 | } |
| 178 | EXPORT_SYMBOL(ib_device_put); | ||
| 172 | 179 | ||
| 173 | static struct ib_device *__ib_device_get_by_name(const char *name) | 180 | static struct ib_device *__ib_device_get_by_name(const char *name) |
| 174 | { | 181 | { |
| @@ -303,7 +310,6 @@ struct ib_device *ib_alloc_device(size_t size) | |||
| 303 | rwlock_init(&device->client_data_lock); | 310 | rwlock_init(&device->client_data_lock); |
| 304 | INIT_LIST_HEAD(&device->client_data_list); | 311 | INIT_LIST_HEAD(&device->client_data_list); |
| 305 | INIT_LIST_HEAD(&device->port_list); | 312 | INIT_LIST_HEAD(&device->port_list); |
| 306 | refcount_set(&device->refcount, 1); | ||
| 307 | init_completion(&device->unreg_completion); | 313 | init_completion(&device->unreg_completion); |
| 308 | 314 | ||
| 309 | return device; | 315 | return device; |
| @@ -620,6 +626,7 @@ int ib_register_device(struct ib_device *device, const char *name, | |||
| 620 | goto cg_cleanup; | 626 | goto cg_cleanup; |
| 621 | } | 627 | } |
| 622 | 628 | ||
| 629 | refcount_set(&device->refcount, 1); | ||
| 623 | device->reg_state = IB_DEV_REGISTERED; | 630 | device->reg_state = IB_DEV_REGISTERED; |
| 624 | 631 | ||
| 625 | list_for_each_entry(client, &client_list, list) | 632 | list_for_each_entry(client, &client_list, list) |
diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c index e600fc23ae62..3c97a8b6bf1e 100644 --- a/drivers/infiniband/core/nldev.c +++ b/drivers/infiniband/core/nldev.c | |||
| @@ -584,10 +584,6 @@ static int fill_res_pd_entry(struct sk_buff *msg, struct netlink_callback *cb, | |||
| 584 | if (nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_RES_USECNT, | 584 | if (nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_RES_USECNT, |
| 585 | atomic_read(&pd->usecnt), RDMA_NLDEV_ATTR_PAD)) | 585 | atomic_read(&pd->usecnt), RDMA_NLDEV_ATTR_PAD)) |
| 586 | goto err; | 586 | goto err; |
| 587 | if ((pd->flags & IB_PD_UNSAFE_GLOBAL_RKEY) && | ||
| 588 | nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_UNSAFE_GLOBAL_RKEY, | ||
| 589 | pd->unsafe_global_rkey)) | ||
| 590 | goto err; | ||
| 591 | 587 | ||
| 592 | if (fill_res_name_pid(msg, res)) | 588 | if (fill_res_name_pid(msg, res)) |
| 593 | goto err; | 589 | goto err; |
diff --git a/drivers/infiniband/core/rdma_core.h b/drivers/infiniband/core/rdma_core.h index be6b8e1257d0..69f8db66925e 100644 --- a/drivers/infiniband/core/rdma_core.h +++ b/drivers/infiniband/core/rdma_core.h | |||
| @@ -106,6 +106,8 @@ int uverbs_finalize_object(struct ib_uobject *uobj, | |||
| 106 | enum uverbs_obj_access access, | 106 | enum uverbs_obj_access access, |
| 107 | bool commit); | 107 | bool commit); |
| 108 | 108 | ||
| 109 | int uverbs_output_written(const struct uverbs_attr_bundle *bundle, size_t idx); | ||
| 110 | |||
| 109 | void setup_ufile_idr_uobject(struct ib_uverbs_file *ufile); | 111 | void setup_ufile_idr_uobject(struct ib_uverbs_file *ufile); |
| 110 | void release_ufile_idr_uobject(struct ib_uverbs_file *ufile); | 112 | void release_ufile_idr_uobject(struct ib_uverbs_file *ufile); |
| 111 | 113 | ||
diff --git a/drivers/infiniband/core/umem_odp.c b/drivers/infiniband/core/umem_odp.c index a4ec43093cb3..acb882f279cb 100644 --- a/drivers/infiniband/core/umem_odp.c +++ b/drivers/infiniband/core/umem_odp.c | |||
| @@ -352,6 +352,8 @@ struct ib_umem_odp *ib_alloc_odp_umem(struct ib_ucontext_per_mm *per_mm, | |||
| 352 | umem->writable = 1; | 352 | umem->writable = 1; |
| 353 | umem->is_odp = 1; | 353 | umem->is_odp = 1; |
| 354 | odp_data->per_mm = per_mm; | 354 | odp_data->per_mm = per_mm; |
| 355 | umem->owning_mm = per_mm->mm; | ||
| 356 | mmgrab(umem->owning_mm); | ||
| 355 | 357 | ||
| 356 | mutex_init(&odp_data->umem_mutex); | 358 | mutex_init(&odp_data->umem_mutex); |
| 357 | init_completion(&odp_data->notifier_completion); | 359 | init_completion(&odp_data->notifier_completion); |
| @@ -384,6 +386,7 @@ struct ib_umem_odp *ib_alloc_odp_umem(struct ib_ucontext_per_mm *per_mm, | |||
| 384 | out_page_list: | 386 | out_page_list: |
| 385 | vfree(odp_data->page_list); | 387 | vfree(odp_data->page_list); |
| 386 | out_odp_data: | 388 | out_odp_data: |
| 389 | mmdrop(umem->owning_mm); | ||
| 387 | kfree(odp_data); | 390 | kfree(odp_data); |
| 388 | return ERR_PTR(ret); | 391 | return ERR_PTR(ret); |
| 389 | } | 392 | } |
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index 6b12cc5f97b2..3317300ab036 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c | |||
| @@ -60,6 +60,10 @@ static int uverbs_response(struct uverbs_attr_bundle *attrs, const void *resp, | |||
| 60 | { | 60 | { |
| 61 | int ret; | 61 | int ret; |
| 62 | 62 | ||
| 63 | if (uverbs_attr_is_valid(attrs, UVERBS_ATTR_CORE_OUT)) | ||
| 64 | return uverbs_copy_to_struct_or_zero( | ||
| 65 | attrs, UVERBS_ATTR_CORE_OUT, resp, resp_len); | ||
| 66 | |||
| 63 | if (copy_to_user(attrs->ucore.outbuf, resp, | 67 | if (copy_to_user(attrs->ucore.outbuf, resp, |
| 64 | min(attrs->ucore.outlen, resp_len))) | 68 | min(attrs->ucore.outlen, resp_len))) |
| 65 | return -EFAULT; | 69 | return -EFAULT; |
| @@ -1181,6 +1185,9 @@ static int ib_uverbs_poll_cq(struct uverbs_attr_bundle *attrs) | |||
| 1181 | goto out_put; | 1185 | goto out_put; |
| 1182 | } | 1186 | } |
| 1183 | 1187 | ||
| 1188 | if (uverbs_attr_is_valid(attrs, UVERBS_ATTR_CORE_OUT)) | ||
| 1189 | ret = uverbs_output_written(attrs, UVERBS_ATTR_CORE_OUT); | ||
| 1190 | |||
| 1184 | ret = 0; | 1191 | ret = 0; |
| 1185 | 1192 | ||
| 1186 | out_put: | 1193 | out_put: |
| @@ -2012,8 +2019,10 @@ static int ib_uverbs_post_send(struct uverbs_attr_bundle *attrs) | |||
| 2012 | return -ENOMEM; | 2019 | return -ENOMEM; |
| 2013 | 2020 | ||
| 2014 | qp = uobj_get_obj_read(qp, UVERBS_OBJECT_QP, cmd.qp_handle, attrs); | 2021 | qp = uobj_get_obj_read(qp, UVERBS_OBJECT_QP, cmd.qp_handle, attrs); |
| 2015 | if (!qp) | 2022 | if (!qp) { |
| 2023 | ret = -EINVAL; | ||
| 2016 | goto out; | 2024 | goto out; |
| 2025 | } | ||
| 2017 | 2026 | ||
| 2018 | is_ud = qp->qp_type == IB_QPT_UD; | 2027 | is_ud = qp->qp_type == IB_QPT_UD; |
| 2019 | sg_ind = 0; | 2028 | sg_ind = 0; |
diff --git a/drivers/infiniband/core/uverbs_ioctl.c b/drivers/infiniband/core/uverbs_ioctl.c index 8c81ff698052..0ca04d224015 100644 --- a/drivers/infiniband/core/uverbs_ioctl.c +++ b/drivers/infiniband/core/uverbs_ioctl.c | |||
| @@ -144,6 +144,21 @@ static bool uverbs_is_attr_cleared(const struct ib_uverbs_attr *uattr, | |||
| 144 | 0, uattr->len - len); | 144 | 0, uattr->len - len); |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | static int uverbs_set_output(const struct uverbs_attr_bundle *bundle, | ||
| 148 | const struct uverbs_attr *attr) | ||
| 149 | { | ||
| 150 | struct bundle_priv *pbundle = | ||
| 151 | container_of(bundle, struct bundle_priv, bundle); | ||
| 152 | u16 flags; | ||
| 153 | |||
| 154 | flags = pbundle->uattrs[attr->ptr_attr.uattr_idx].flags | | ||
| 155 | UVERBS_ATTR_F_VALID_OUTPUT; | ||
| 156 | if (put_user(flags, | ||
| 157 | &pbundle->user_attrs[attr->ptr_attr.uattr_idx].flags)) | ||
| 158 | return -EFAULT; | ||
| 159 | return 0; | ||
| 160 | } | ||
| 161 | |||
| 147 | static int uverbs_process_idrs_array(struct bundle_priv *pbundle, | 162 | static int uverbs_process_idrs_array(struct bundle_priv *pbundle, |
| 148 | const struct uverbs_api_attr *attr_uapi, | 163 | const struct uverbs_api_attr *attr_uapi, |
| 149 | struct uverbs_objs_arr_attr *attr, | 164 | struct uverbs_objs_arr_attr *attr, |
| @@ -456,6 +471,19 @@ static int ib_uverbs_run_method(struct bundle_priv *pbundle, | |||
| 456 | } | 471 | } |
| 457 | 472 | ||
| 458 | /* | 473 | /* |
| 474 | * Until the drivers are revised to use the bundle directly we have to | ||
| 475 | * assume that the driver wrote to its UHW_OUT and flag userspace | ||
| 476 | * appropriately. | ||
| 477 | */ | ||
| 478 | if (!ret && pbundle->method_elm->has_udata) { | ||
| 479 | const struct uverbs_attr *attr = | ||
| 480 | uverbs_attr_get(&pbundle->bundle, UVERBS_ATTR_UHW_OUT); | ||
| 481 | |||
| 482 | if (!IS_ERR(attr)) | ||
| 483 | ret = uverbs_set_output(&pbundle->bundle, attr); | ||
| 484 | } | ||
| 485 | |||
| 486 | /* | ||
| 459 | * EPROTONOSUPPORT is ONLY to be returned if the ioctl framework can | 487 | * EPROTONOSUPPORT is ONLY to be returned if the ioctl framework can |
| 460 | * not invoke the method because the request is not supported. No | 488 | * not invoke the method because the request is not supported. No |
| 461 | * other cases should return this code. | 489 | * other cases should return this code. |
| @@ -706,10 +734,7 @@ void uverbs_fill_udata(struct uverbs_attr_bundle *bundle, | |||
| 706 | int uverbs_copy_to(const struct uverbs_attr_bundle *bundle, size_t idx, | 734 | int uverbs_copy_to(const struct uverbs_attr_bundle *bundle, size_t idx, |
| 707 | const void *from, size_t size) | 735 | const void *from, size_t size) |
| 708 | { | 736 | { |
| 709 | struct bundle_priv *pbundle = | ||
| 710 | container_of(bundle, struct bundle_priv, bundle); | ||
| 711 | const struct uverbs_attr *attr = uverbs_attr_get(bundle, idx); | 737 | const struct uverbs_attr *attr = uverbs_attr_get(bundle, idx); |
| 712 | u16 flags; | ||
| 713 | size_t min_size; | 738 | size_t min_size; |
| 714 | 739 | ||
| 715 | if (IS_ERR(attr)) | 740 | if (IS_ERR(attr)) |
| @@ -719,16 +744,25 @@ int uverbs_copy_to(const struct uverbs_attr_bundle *bundle, size_t idx, | |||
| 719 | if (copy_to_user(u64_to_user_ptr(attr->ptr_attr.data), from, min_size)) | 744 | if (copy_to_user(u64_to_user_ptr(attr->ptr_attr.data), from, min_size)) |
| 720 | return -EFAULT; | 745 | return -EFAULT; |
| 721 | 746 | ||
| 722 | flags = pbundle->uattrs[attr->ptr_attr.uattr_idx].flags | | 747 | return uverbs_set_output(bundle, attr); |
| 723 | UVERBS_ATTR_F_VALID_OUTPUT; | ||
| 724 | if (put_user(flags, | ||
| 725 | &pbundle->user_attrs[attr->ptr_attr.uattr_idx].flags)) | ||
| 726 | return -EFAULT; | ||
| 727 | |||
| 728 | return 0; | ||
| 729 | } | 748 | } |
| 730 | EXPORT_SYMBOL(uverbs_copy_to); | 749 | EXPORT_SYMBOL(uverbs_copy_to); |
| 731 | 750 | ||
| 751 | |||
| 752 | /* | ||
| 753 | * This is only used if the caller has directly used copy_to_use to write the | ||
| 754 | * data. It signals to user space that the buffer is filled in. | ||
| 755 | */ | ||
| 756 | int uverbs_output_written(const struct uverbs_attr_bundle *bundle, size_t idx) | ||
| 757 | { | ||
| 758 | const struct uverbs_attr *attr = uverbs_attr_get(bundle, idx); | ||
| 759 | |||
| 760 | if (IS_ERR(attr)) | ||
| 761 | return PTR_ERR(attr); | ||
| 762 | |||
| 763 | return uverbs_set_output(bundle, attr); | ||
| 764 | } | ||
| 765 | |||
| 732 | int _uverbs_get_const(s64 *to, const struct uverbs_attr_bundle *attrs_bundle, | 766 | int _uverbs_get_const(s64 *to, const struct uverbs_attr_bundle *attrs_bundle, |
| 733 | size_t idx, s64 lower_bound, u64 upper_bound, | 767 | size_t idx, s64 lower_bound, u64 upper_bound, |
| 734 | s64 *def_val) | 768 | s64 *def_val) |
| @@ -757,8 +791,10 @@ int uverbs_copy_to_struct_or_zero(const struct uverbs_attr_bundle *bundle, | |||
| 757 | { | 791 | { |
| 758 | const struct uverbs_attr *attr = uverbs_attr_get(bundle, idx); | 792 | const struct uverbs_attr *attr = uverbs_attr_get(bundle, idx); |
| 759 | 793 | ||
| 760 | if (clear_user(u64_to_user_ptr(attr->ptr_attr.data), | 794 | if (size < attr->ptr_attr.len) { |
| 761 | attr->ptr_attr.len)) | 795 | if (clear_user(u64_to_user_ptr(attr->ptr_attr.data) + size, |
| 762 | return -EFAULT; | 796 | attr->ptr_attr.len - size)) |
| 797 | return -EFAULT; | ||
| 798 | } | ||
| 763 | return uverbs_copy_to(bundle, idx, from, size); | 799 | return uverbs_copy_to(bundle, idx, from, size); |
| 764 | } | 800 | } |
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index fb0007aa0c27..5f366838b7ff 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c | |||
| @@ -204,6 +204,9 @@ void ib_uverbs_release_file(struct kref *ref) | |||
| 204 | if (atomic_dec_and_test(&file->device->refcount)) | 204 | if (atomic_dec_and_test(&file->device->refcount)) |
| 205 | ib_uverbs_comp_dev(file->device); | 205 | ib_uverbs_comp_dev(file->device); |
| 206 | 206 | ||
| 207 | if (file->async_file) | ||
| 208 | kref_put(&file->async_file->ref, | ||
| 209 | ib_uverbs_release_async_event_file); | ||
| 207 | put_device(&file->device->dev); | 210 | put_device(&file->device->dev); |
| 208 | kfree(file); | 211 | kfree(file); |
| 209 | } | 212 | } |
| @@ -690,6 +693,7 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf, | |||
| 690 | 693 | ||
| 691 | buf += sizeof(hdr); | 694 | buf += sizeof(hdr); |
| 692 | 695 | ||
| 696 | memset(bundle.attr_present, 0, sizeof(bundle.attr_present)); | ||
| 693 | bundle.ufile = file; | 697 | bundle.ufile = file; |
| 694 | if (!method_elm->is_ex) { | 698 | if (!method_elm->is_ex) { |
| 695 | size_t in_len = hdr.in_words * 4 - sizeof(hdr); | 699 | size_t in_len = hdr.in_words * 4 - sizeof(hdr); |
| @@ -963,11 +967,19 @@ void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile) | |||
| 963 | 967 | ||
| 964 | /* Get an arbitrary mm pointer that hasn't been cleaned yet */ | 968 | /* Get an arbitrary mm pointer that hasn't been cleaned yet */ |
| 965 | mutex_lock(&ufile->umap_lock); | 969 | mutex_lock(&ufile->umap_lock); |
| 966 | if (!list_empty(&ufile->umaps)) { | 970 | while (!list_empty(&ufile->umaps)) { |
| 967 | mm = list_first_entry(&ufile->umaps, | 971 | int ret; |
| 968 | struct rdma_umap_priv, list) | 972 | |
| 969 | ->vma->vm_mm; | 973 | priv = list_first_entry(&ufile->umaps, |
| 970 | mmget(mm); | 974 | struct rdma_umap_priv, list); |
| 975 | mm = priv->vma->vm_mm; | ||
| 976 | ret = mmget_not_zero(mm); | ||
| 977 | if (!ret) { | ||
| 978 | list_del_init(&priv->list); | ||
| 979 | mm = NULL; | ||
| 980 | continue; | ||
| 981 | } | ||
| 982 | break; | ||
| 971 | } | 983 | } |
| 972 | mutex_unlock(&ufile->umap_lock); | 984 | mutex_unlock(&ufile->umap_lock); |
| 973 | if (!mm) | 985 | if (!mm) |
| @@ -1095,10 +1107,6 @@ static int ib_uverbs_close(struct inode *inode, struct file *filp) | |||
| 1095 | list_del_init(&file->list); | 1107 | list_del_init(&file->list); |
| 1096 | mutex_unlock(&file->device->lists_mutex); | 1108 | mutex_unlock(&file->device->lists_mutex); |
| 1097 | 1109 | ||
| 1098 | if (file->async_file) | ||
| 1099 | kref_put(&file->async_file->ref, | ||
| 1100 | ib_uverbs_release_async_event_file); | ||
| 1101 | |||
| 1102 | kref_put(&file->ref, ib_uverbs_release_file); | 1110 | kref_put(&file->ref, ib_uverbs_release_file); |
| 1103 | 1111 | ||
| 1104 | return 0; | 1112 | return 0; |
diff --git a/drivers/infiniband/core/uverbs_std_types_device.c b/drivers/infiniband/core/uverbs_std_types_device.c index 5030ec480370..2a3f2f01028d 100644 --- a/drivers/infiniband/core/uverbs_std_types_device.c +++ b/drivers/infiniband/core/uverbs_std_types_device.c | |||
| @@ -168,12 +168,18 @@ void copy_port_attr_to_resp(struct ib_port_attr *attr, | |||
| 168 | static int UVERBS_HANDLER(UVERBS_METHOD_QUERY_PORT)( | 168 | static int UVERBS_HANDLER(UVERBS_METHOD_QUERY_PORT)( |
| 169 | struct uverbs_attr_bundle *attrs) | 169 | struct uverbs_attr_bundle *attrs) |
| 170 | { | 170 | { |
| 171 | struct ib_device *ib_dev = attrs->ufile->device->ib_dev; | 171 | struct ib_device *ib_dev; |
| 172 | struct ib_port_attr attr = {}; | 172 | struct ib_port_attr attr = {}; |
| 173 | struct ib_uverbs_query_port_resp_ex resp = {}; | 173 | struct ib_uverbs_query_port_resp_ex resp = {}; |
| 174 | struct ib_ucontext *ucontext; | ||
| 174 | int ret; | 175 | int ret; |
| 175 | u8 port_num; | 176 | u8 port_num; |
| 176 | 177 | ||
| 178 | ucontext = ib_uverbs_get_ucontext(attrs); | ||
| 179 | if (IS_ERR(ucontext)) | ||
| 180 | return PTR_ERR(ucontext); | ||
| 181 | ib_dev = ucontext->device; | ||
| 182 | |||
| 177 | /* FIXME: Extend the UAPI_DEF_OBJ_NEEDS_FN stuff.. */ | 183 | /* FIXME: Extend the UAPI_DEF_OBJ_NEEDS_FN stuff.. */ |
| 178 | if (!ib_dev->ops.query_port) | 184 | if (!ib_dev->ops.query_port) |
| 179 | return -EOPNOTSUPP; | 185 | return -EOPNOTSUPP; |
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c index 326805461265..19551aa43850 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | |||
| @@ -766,8 +766,8 @@ struct bnxt_qplib_rcfw_sbuf *bnxt_qplib_rcfw_alloc_sbuf( | |||
| 766 | return NULL; | 766 | return NULL; |
| 767 | 767 | ||
| 768 | sbuf->size = size; | 768 | sbuf->size = size; |
| 769 | sbuf->sb = dma_zalloc_coherent(&rcfw->pdev->dev, sbuf->size, | 769 | sbuf->sb = dma_alloc_coherent(&rcfw->pdev->dev, sbuf->size, |
| 770 | &sbuf->dma_addr, GFP_ATOMIC); | 770 | &sbuf->dma_addr, GFP_ATOMIC); |
| 771 | if (!sbuf->sb) | 771 | if (!sbuf->sb) |
| 772 | goto bail; | 772 | goto bail; |
| 773 | 773 | ||
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.c b/drivers/infiniband/hw/bnxt_re/qplib_res.c index 59eeac55626f..57d4951679cb 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_res.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_res.c | |||
| @@ -105,10 +105,10 @@ static int __alloc_pbl(struct pci_dev *pdev, struct bnxt_qplib_pbl *pbl, | |||
| 105 | 105 | ||
| 106 | if (!sghead) { | 106 | if (!sghead) { |
| 107 | for (i = 0; i < pages; i++) { | 107 | for (i = 0; i < pages; i++) { |
| 108 | pbl->pg_arr[i] = dma_zalloc_coherent(&pdev->dev, | 108 | pbl->pg_arr[i] = dma_alloc_coherent(&pdev->dev, |
| 109 | pbl->pg_size, | 109 | pbl->pg_size, |
| 110 | &pbl->pg_map_arr[i], | 110 | &pbl->pg_map_arr[i], |
| 111 | GFP_KERNEL); | 111 | GFP_KERNEL); |
| 112 | if (!pbl->pg_arr[i]) | 112 | if (!pbl->pg_arr[i]) |
| 113 | goto fail; | 113 | goto fail; |
| 114 | pbl->pg_count++; | 114 | pbl->pg_count++; |
diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c index df4f7a3f043d..8ac72ac7cbac 100644 --- a/drivers/infiniband/hw/cxgb3/cxio_hal.c +++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c | |||
| @@ -291,9 +291,9 @@ int cxio_create_qp(struct cxio_rdev *rdev_p, u32 kernel_domain, | |||
| 291 | if (!wq->sq) | 291 | if (!wq->sq) |
| 292 | goto err3; | 292 | goto err3; |
| 293 | 293 | ||
| 294 | wq->queue = dma_zalloc_coherent(&(rdev_p->rnic_info.pdev->dev), | 294 | wq->queue = dma_alloc_coherent(&(rdev_p->rnic_info.pdev->dev), |
| 295 | depth * sizeof(union t3_wr), | 295 | depth * sizeof(union t3_wr), |
| 296 | &(wq->dma_addr), GFP_KERNEL); | 296 | &(wq->dma_addr), GFP_KERNEL); |
| 297 | if (!wq->queue) | 297 | if (!wq->queue) |
| 298 | goto err4; | 298 | goto err4; |
| 299 | 299 | ||
diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c index c13c0ba30f63..d499cd61c0e8 100644 --- a/drivers/infiniband/hw/cxgb4/device.c +++ b/drivers/infiniband/hw/cxgb4/device.c | |||
| @@ -783,6 +783,7 @@ void c4iw_init_dev_ucontext(struct c4iw_rdev *rdev, | |||
| 783 | static int c4iw_rdev_open(struct c4iw_rdev *rdev) | 783 | static int c4iw_rdev_open(struct c4iw_rdev *rdev) |
| 784 | { | 784 | { |
| 785 | int err; | 785 | int err; |
| 786 | unsigned int factor; | ||
| 786 | 787 | ||
| 787 | c4iw_init_dev_ucontext(rdev, &rdev->uctx); | 788 | c4iw_init_dev_ucontext(rdev, &rdev->uctx); |
| 788 | 789 | ||
| @@ -806,8 +807,18 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev) | |||
| 806 | return -EINVAL; | 807 | return -EINVAL; |
| 807 | } | 808 | } |
| 808 | 809 | ||
| 809 | rdev->qpmask = rdev->lldi.udb_density - 1; | 810 | /* This implementation requires a sge_host_page_size <= PAGE_SIZE. */ |
| 810 | rdev->cqmask = rdev->lldi.ucq_density - 1; | 811 | if (rdev->lldi.sge_host_page_size > PAGE_SIZE) { |
| 812 | pr_err("%s: unsupported sge host page size %u\n", | ||
| 813 | pci_name(rdev->lldi.pdev), | ||
| 814 | rdev->lldi.sge_host_page_size); | ||
| 815 | return -EINVAL; | ||
| 816 | } | ||
| 817 | |||
| 818 | factor = PAGE_SIZE / rdev->lldi.sge_host_page_size; | ||
| 819 | rdev->qpmask = (rdev->lldi.udb_density * factor) - 1; | ||
| 820 | rdev->cqmask = (rdev->lldi.ucq_density * factor) - 1; | ||
| 821 | |||
| 811 | pr_debug("dev %s stag start 0x%0x size 0x%0x num stags %d pbl start 0x%0x size 0x%0x rq start 0x%0x size 0x%0x qp qid start %u size %u cq qid start %u size %u srq size %u\n", | 822 | pr_debug("dev %s stag start 0x%0x size 0x%0x num stags %d pbl start 0x%0x size 0x%0x rq start 0x%0x size 0x%0x qp qid start %u size %u cq qid start %u size %u srq size %u\n", |
| 812 | pci_name(rdev->lldi.pdev), rdev->lldi.vr->stag.start, | 823 | pci_name(rdev->lldi.pdev), rdev->lldi.vr->stag.start, |
| 813 | rdev->lldi.vr->stag.size, c4iw_num_stags(rdev), | 824 | rdev->lldi.vr->stag.size, c4iw_num_stags(rdev), |
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c index 981ff5cfb5d1..504cf525508f 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c | |||
| @@ -2564,9 +2564,8 @@ static int alloc_srq_queue(struct c4iw_srq *srq, struct c4iw_dev_ucontext *uctx, | |||
| 2564 | wq->rqt_abs_idx = (wq->rqt_hwaddr - rdev->lldi.vr->rq.start) >> | 2564 | wq->rqt_abs_idx = (wq->rqt_hwaddr - rdev->lldi.vr->rq.start) >> |
| 2565 | T4_RQT_ENTRY_SHIFT; | 2565 | T4_RQT_ENTRY_SHIFT; |
| 2566 | 2566 | ||
| 2567 | wq->queue = dma_zalloc_coherent(&rdev->lldi.pdev->dev, | 2567 | wq->queue = dma_alloc_coherent(&rdev->lldi.pdev->dev, wq->memsize, |
| 2568 | wq->memsize, &wq->dma_addr, | 2568 | &wq->dma_addr, GFP_KERNEL); |
| 2569 | GFP_KERNEL); | ||
| 2570 | if (!wq->queue) | 2569 | if (!wq->queue) |
| 2571 | goto err_free_rqtpool; | 2570 | goto err_free_rqtpool; |
| 2572 | 2571 | ||
diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/hfi1/file_ops.c index c22ebc774a6a..f9a7e9d29c8b 100644 --- a/drivers/infiniband/hw/hfi1/file_ops.c +++ b/drivers/infiniband/hw/hfi1/file_ops.c | |||
| @@ -488,7 +488,7 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma) | |||
| 488 | vmf = 1; | 488 | vmf = 1; |
| 489 | break; | 489 | break; |
| 490 | case STATUS: | 490 | case STATUS: |
| 491 | if (flags & (unsigned long)(VM_WRITE | VM_EXEC)) { | 491 | if (flags & VM_WRITE) { |
| 492 | ret = -EPERM; | 492 | ret = -EPERM; |
| 493 | goto done; | 493 | goto done; |
| 494 | } | 494 | } |
diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c index 09044905284f..7835eb52e7c5 100644 --- a/drivers/infiniband/hw/hfi1/init.c +++ b/drivers/infiniband/hw/hfi1/init.c | |||
| @@ -899,10 +899,10 @@ int hfi1_init(struct hfi1_devdata *dd, int reinit) | |||
| 899 | goto done; | 899 | goto done; |
| 900 | 900 | ||
| 901 | /* allocate dummy tail memory for all receive contexts */ | 901 | /* allocate dummy tail memory for all receive contexts */ |
| 902 | dd->rcvhdrtail_dummy_kvaddr = dma_zalloc_coherent( | 902 | dd->rcvhdrtail_dummy_kvaddr = dma_alloc_coherent(&dd->pcidev->dev, |
| 903 | &dd->pcidev->dev, sizeof(u64), | 903 | sizeof(u64), |
| 904 | &dd->rcvhdrtail_dummy_dma, | 904 | &dd->rcvhdrtail_dummy_dma, |
| 905 | GFP_KERNEL); | 905 | GFP_KERNEL); |
| 906 | 906 | ||
| 907 | if (!dd->rcvhdrtail_dummy_kvaddr) { | 907 | if (!dd->rcvhdrtail_dummy_kvaddr) { |
| 908 | dd_dev_err(dd, "cannot allocate dummy tail memory\n"); | 908 | dd_dev_err(dd, "cannot allocate dummy tail memory\n"); |
| @@ -1863,9 +1863,9 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd) | |||
| 1863 | gfp_flags = GFP_KERNEL; | 1863 | gfp_flags = GFP_KERNEL; |
| 1864 | else | 1864 | else |
| 1865 | gfp_flags = GFP_USER; | 1865 | gfp_flags = GFP_USER; |
| 1866 | rcd->rcvhdrq = dma_zalloc_coherent( | 1866 | rcd->rcvhdrq = dma_alloc_coherent(&dd->pcidev->dev, amt, |
| 1867 | &dd->pcidev->dev, amt, &rcd->rcvhdrq_dma, | 1867 | &rcd->rcvhdrq_dma, |
| 1868 | gfp_flags | __GFP_COMP); | 1868 | gfp_flags | __GFP_COMP); |
| 1869 | 1869 | ||
| 1870 | if (!rcd->rcvhdrq) { | 1870 | if (!rcd->rcvhdrq) { |
| 1871 | dd_dev_err(dd, | 1871 | dd_dev_err(dd, |
| @@ -1876,9 +1876,10 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd) | |||
| 1876 | 1876 | ||
| 1877 | if (HFI1_CAP_KGET_MASK(rcd->flags, DMA_RTAIL) || | 1877 | if (HFI1_CAP_KGET_MASK(rcd->flags, DMA_RTAIL) || |
| 1878 | HFI1_CAP_UGET_MASK(rcd->flags, DMA_RTAIL)) { | 1878 | HFI1_CAP_UGET_MASK(rcd->flags, DMA_RTAIL)) { |
| 1879 | rcd->rcvhdrtail_kvaddr = dma_zalloc_coherent( | 1879 | rcd->rcvhdrtail_kvaddr = dma_alloc_coherent(&dd->pcidev->dev, |
| 1880 | &dd->pcidev->dev, PAGE_SIZE, | 1880 | PAGE_SIZE, |
| 1881 | &rcd->rcvhdrqtailaddr_dma, gfp_flags); | 1881 | &rcd->rcvhdrqtailaddr_dma, |
| 1882 | gfp_flags); | ||
| 1882 | if (!rcd->rcvhdrtail_kvaddr) | 1883 | if (!rcd->rcvhdrtail_kvaddr) |
| 1883 | goto bail_free; | 1884 | goto bail_free; |
| 1884 | } | 1885 | } |
| @@ -1974,10 +1975,10 @@ int hfi1_setup_eagerbufs(struct hfi1_ctxtdata *rcd) | |||
| 1974 | while (alloced_bytes < rcd->egrbufs.size && | 1975 | while (alloced_bytes < rcd->egrbufs.size && |
| 1975 | rcd->egrbufs.alloced < rcd->egrbufs.count) { | 1976 | rcd->egrbufs.alloced < rcd->egrbufs.count) { |
| 1976 | rcd->egrbufs.buffers[idx].addr = | 1977 | rcd->egrbufs.buffers[idx].addr = |
| 1977 | dma_zalloc_coherent(&dd->pcidev->dev, | 1978 | dma_alloc_coherent(&dd->pcidev->dev, |
| 1978 | rcd->egrbufs.rcvtid_size, | 1979 | rcd->egrbufs.rcvtid_size, |
| 1979 | &rcd->egrbufs.buffers[idx].dma, | 1980 | &rcd->egrbufs.buffers[idx].dma, |
| 1980 | gfp_flags); | 1981 | gfp_flags); |
| 1981 | if (rcd->egrbufs.buffers[idx].addr) { | 1982 | if (rcd->egrbufs.buffers[idx].addr) { |
| 1982 | rcd->egrbufs.buffers[idx].len = | 1983 | rcd->egrbufs.buffers[idx].len = |
| 1983 | rcd->egrbufs.rcvtid_size; | 1984 | rcd->egrbufs.rcvtid_size; |
diff --git a/drivers/infiniband/hw/hfi1/pio.c b/drivers/infiniband/hw/hfi1/pio.c index dd5a5c030066..04126d7e318d 100644 --- a/drivers/infiniband/hw/hfi1/pio.c +++ b/drivers/infiniband/hw/hfi1/pio.c | |||
| @@ -2098,11 +2098,10 @@ int init_credit_return(struct hfi1_devdata *dd) | |||
| 2098 | int bytes = TXE_NUM_CONTEXTS * sizeof(struct credit_return); | 2098 | int bytes = TXE_NUM_CONTEXTS * sizeof(struct credit_return); |
| 2099 | 2099 | ||
| 2100 | set_dev_node(&dd->pcidev->dev, i); | 2100 | set_dev_node(&dd->pcidev->dev, i); |
| 2101 | dd->cr_base[i].va = dma_zalloc_coherent( | 2101 | dd->cr_base[i].va = dma_alloc_coherent(&dd->pcidev->dev, |
| 2102 | &dd->pcidev->dev, | 2102 | bytes, |
| 2103 | bytes, | 2103 | &dd->cr_base[i].dma, |
| 2104 | &dd->cr_base[i].dma, | 2104 | GFP_KERNEL); |
| 2105 | GFP_KERNEL); | ||
| 2106 | if (!dd->cr_base[i].va) { | 2105 | if (!dd->cr_base[i].va) { |
| 2107 | set_dev_node(&dd->pcidev->dev, dd->node); | 2106 | set_dev_node(&dd->pcidev->dev, dd->node); |
| 2108 | dd_dev_err(dd, | 2107 | dd_dev_err(dd, |
diff --git a/drivers/infiniband/hw/hfi1/sdma.c b/drivers/infiniband/hw/hfi1/sdma.c index b84356e1a4c1..96897a91fb0a 100644 --- a/drivers/infiniband/hw/hfi1/sdma.c +++ b/drivers/infiniband/hw/hfi1/sdma.c | |||
| @@ -1453,12 +1453,9 @@ int sdma_init(struct hfi1_devdata *dd, u8 port) | |||
| 1453 | timer_setup(&sde->err_progress_check_timer, | 1453 | timer_setup(&sde->err_progress_check_timer, |
| 1454 | sdma_err_progress_check, 0); | 1454 | sdma_err_progress_check, 0); |
| 1455 | 1455 | ||
| 1456 | sde->descq = dma_zalloc_coherent( | 1456 | sde->descq = dma_alloc_coherent(&dd->pcidev->dev, |
| 1457 | &dd->pcidev->dev, | 1457 | descq_cnt * sizeof(u64[2]), |
| 1458 | descq_cnt * sizeof(u64[2]), | 1458 | &sde->descq_phys, GFP_KERNEL); |
| 1459 | &sde->descq_phys, | ||
| 1460 | GFP_KERNEL | ||
| 1461 | ); | ||
| 1462 | if (!sde->descq) | 1459 | if (!sde->descq) |
| 1463 | goto bail; | 1460 | goto bail; |
| 1464 | sde->tx_ring = | 1461 | sde->tx_ring = |
| @@ -1471,24 +1468,18 @@ int sdma_init(struct hfi1_devdata *dd, u8 port) | |||
| 1471 | 1468 | ||
| 1472 | dd->sdma_heads_size = L1_CACHE_BYTES * num_engines; | 1469 | dd->sdma_heads_size = L1_CACHE_BYTES * num_engines; |
| 1473 | /* Allocate memory for DMA of head registers to memory */ | 1470 | /* Allocate memory for DMA of head registers to memory */ |
| 1474 | dd->sdma_heads_dma = dma_zalloc_coherent( | 1471 | dd->sdma_heads_dma = dma_alloc_coherent(&dd->pcidev->dev, |
| 1475 | &dd->pcidev->dev, | 1472 | dd->sdma_heads_size, |
| 1476 | dd->sdma_heads_size, | 1473 | &dd->sdma_heads_phys, |
| 1477 | &dd->sdma_heads_phys, | 1474 | GFP_KERNEL); |
| 1478 | GFP_KERNEL | ||
| 1479 | ); | ||
| 1480 | if (!dd->sdma_heads_dma) { | 1475 | if (!dd->sdma_heads_dma) { |
| 1481 | dd_dev_err(dd, "failed to allocate SendDMA head memory\n"); | 1476 | dd_dev_err(dd, "failed to allocate SendDMA head memory\n"); |
| 1482 | goto bail; | 1477 | goto bail; |
| 1483 | } | 1478 | } |
| 1484 | 1479 | ||
| 1485 | /* Allocate memory for pad */ | 1480 | /* Allocate memory for pad */ |
| 1486 | dd->sdma_pad_dma = dma_zalloc_coherent( | 1481 | dd->sdma_pad_dma = dma_alloc_coherent(&dd->pcidev->dev, sizeof(u32), |
| 1487 | &dd->pcidev->dev, | 1482 | &dd->sdma_pad_phys, GFP_KERNEL); |
| 1488 | sizeof(u32), | ||
| 1489 | &dd->sdma_pad_phys, | ||
| 1490 | GFP_KERNEL | ||
| 1491 | ); | ||
| 1492 | if (!dd->sdma_pad_dma) { | 1483 | if (!dd->sdma_pad_dma) { |
| 1493 | dd_dev_err(dd, "failed to allocate SendDMA pad memory\n"); | 1484 | dd_dev_err(dd, "failed to allocate SendDMA pad memory\n"); |
| 1494 | goto bail; | 1485 | goto bail; |
diff --git a/drivers/infiniband/hw/hfi1/ud.c b/drivers/infiniband/hw/hfi1/ud.c index 88242fe95eaa..bf96067876c9 100644 --- a/drivers/infiniband/hw/hfi1/ud.c +++ b/drivers/infiniband/hw/hfi1/ud.c | |||
| @@ -987,7 +987,6 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) | |||
| 987 | opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { | 987 | opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { |
| 988 | wc.ex.imm_data = packet->ohdr->u.ud.imm_data; | 988 | wc.ex.imm_data = packet->ohdr->u.ud.imm_data; |
| 989 | wc.wc_flags = IB_WC_WITH_IMM; | 989 | wc.wc_flags = IB_WC_WITH_IMM; |
| 990 | tlen -= sizeof(u32); | ||
| 991 | } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { | 990 | } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { |
| 992 | wc.ex.imm_data = 0; | 991 | wc.ex.imm_data = 0; |
| 993 | wc.wc_flags = 0; | 992 | wc.wc_flags = 0; |
diff --git a/drivers/infiniband/hw/hns/hns_roce_alloc.c b/drivers/infiniband/hw/hns/hns_roce_alloc.c index 6300033a448f..dac058d3df53 100644 --- a/drivers/infiniband/hw/hns/hns_roce_alloc.c +++ b/drivers/infiniband/hw/hns/hns_roce_alloc.c | |||
| @@ -197,8 +197,8 @@ int hns_roce_buf_alloc(struct hns_roce_dev *hr_dev, u32 size, u32 max_direct, | |||
| 197 | buf->npages = 1 << order; | 197 | buf->npages = 1 << order; |
| 198 | buf->page_shift = page_shift; | 198 | buf->page_shift = page_shift; |
| 199 | /* MTT PA must be recorded in 4k alignment, t is 4k aligned */ | 199 | /* MTT PA must be recorded in 4k alignment, t is 4k aligned */ |
| 200 | buf->direct.buf = dma_zalloc_coherent(dev, | 200 | buf->direct.buf = dma_alloc_coherent(dev, size, &t, |
| 201 | size, &t, GFP_KERNEL); | 201 | GFP_KERNEL); |
| 202 | if (!buf->direct.buf) | 202 | if (!buf->direct.buf) |
| 203 | return -ENOMEM; | 203 | return -ENOMEM; |
| 204 | 204 | ||
| @@ -219,9 +219,10 @@ int hns_roce_buf_alloc(struct hns_roce_dev *hr_dev, u32 size, u32 max_direct, | |||
| 219 | return -ENOMEM; | 219 | return -ENOMEM; |
| 220 | 220 | ||
| 221 | for (i = 0; i < buf->nbufs; ++i) { | 221 | for (i = 0; i < buf->nbufs; ++i) { |
| 222 | buf->page_list[i].buf = dma_zalloc_coherent(dev, | 222 | buf->page_list[i].buf = dma_alloc_coherent(dev, |
| 223 | page_size, &t, | 223 | page_size, |
| 224 | GFP_KERNEL); | 224 | &t, |
| 225 | GFP_KERNEL); | ||
| 225 | 226 | ||
| 226 | if (!buf->page_list[i].buf) | 227 | if (!buf->page_list[i].buf) |
| 227 | goto err_free; | 228 | goto err_free; |
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index 3a669451cf86..543fa1504cd3 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c | |||
| @@ -5091,7 +5091,7 @@ static int hns_roce_mhop_alloc_eq(struct hns_roce_dev *hr_dev, | |||
| 5091 | eqe_alloc = i * (buf_chk_sz / eq->eqe_size); | 5091 | eqe_alloc = i * (buf_chk_sz / eq->eqe_size); |
| 5092 | size = (eq->entries - eqe_alloc) * eq->eqe_size; | 5092 | size = (eq->entries - eqe_alloc) * eq->eqe_size; |
| 5093 | } | 5093 | } |
| 5094 | eq->buf[i] = dma_zalloc_coherent(dev, size, | 5094 | eq->buf[i] = dma_alloc_coherent(dev, size, |
| 5095 | &(eq->buf_dma[i]), | 5095 | &(eq->buf_dma[i]), |
| 5096 | GFP_KERNEL); | 5096 | GFP_KERNEL); |
| 5097 | if (!eq->buf[i]) | 5097 | if (!eq->buf[i]) |
| @@ -5126,9 +5126,9 @@ static int hns_roce_mhop_alloc_eq(struct hns_roce_dev *hr_dev, | |||
| 5126 | size = (eq->entries - eqe_alloc) | 5126 | size = (eq->entries - eqe_alloc) |
| 5127 | * eq->eqe_size; | 5127 | * eq->eqe_size; |
| 5128 | } | 5128 | } |
| 5129 | eq->buf[idx] = dma_zalloc_coherent(dev, size, | 5129 | eq->buf[idx] = dma_alloc_coherent(dev, size, |
| 5130 | &(eq->buf_dma[idx]), | 5130 | &(eq->buf_dma[idx]), |
| 5131 | GFP_KERNEL); | 5131 | GFP_KERNEL); |
| 5132 | if (!eq->buf[idx]) | 5132 | if (!eq->buf[idx]) |
| 5133 | goto err_dma_alloc_buf; | 5133 | goto err_dma_alloc_buf; |
| 5134 | 5134 | ||
| @@ -5241,7 +5241,7 @@ static int hns_roce_v2_create_eq(struct hns_roce_dev *hr_dev, | |||
| 5241 | goto free_cmd_mbox; | 5241 | goto free_cmd_mbox; |
| 5242 | } | 5242 | } |
| 5243 | 5243 | ||
| 5244 | eq->buf_list->buf = dma_zalloc_coherent(dev, buf_chk_sz, | 5244 | eq->buf_list->buf = dma_alloc_coherent(dev, buf_chk_sz, |
| 5245 | &(eq->buf_list->map), | 5245 | &(eq->buf_list->map), |
| 5246 | GFP_KERNEL); | 5246 | GFP_KERNEL); |
| 5247 | if (!eq->buf_list->buf) { | 5247 | if (!eq->buf_list->buf) { |
diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c index 960b1946c365..12deacf442cf 100644 --- a/drivers/infiniband/hw/hns/hns_roce_srq.c +++ b/drivers/infiniband/hw/hns/hns_roce_srq.c | |||
| @@ -210,6 +210,7 @@ struct ib_srq *hns_roce_create_srq(struct ib_pd *pd, | |||
| 210 | struct ib_udata *udata) | 210 | struct ib_udata *udata) |
| 211 | { | 211 | { |
| 212 | struct hns_roce_dev *hr_dev = to_hr_dev(pd->device); | 212 | struct hns_roce_dev *hr_dev = to_hr_dev(pd->device); |
| 213 | struct hns_roce_ib_create_srq_resp resp = {}; | ||
| 213 | struct hns_roce_srq *srq; | 214 | struct hns_roce_srq *srq; |
| 214 | int srq_desc_size; | 215 | int srq_desc_size; |
| 215 | int srq_buf_size; | 216 | int srq_buf_size; |
| @@ -378,16 +379,21 @@ struct ib_srq *hns_roce_create_srq(struct ib_pd *pd, | |||
| 378 | 379 | ||
| 379 | srq->event = hns_roce_ib_srq_event; | 380 | srq->event = hns_roce_ib_srq_event; |
| 380 | srq->ibsrq.ext.xrc.srq_num = srq->srqn; | 381 | srq->ibsrq.ext.xrc.srq_num = srq->srqn; |
| 382 | resp.srqn = srq->srqn; | ||
| 381 | 383 | ||
| 382 | if (udata) { | 384 | if (udata) { |
| 383 | if (ib_copy_to_udata(udata, &srq->srqn, sizeof(__u32))) { | 385 | if (ib_copy_to_udata(udata, &resp, |
| 386 | min(udata->outlen, sizeof(resp)))) { | ||
| 384 | ret = -EFAULT; | 387 | ret = -EFAULT; |
| 385 | goto err_wrid; | 388 | goto err_srqc_alloc; |
| 386 | } | 389 | } |
| 387 | } | 390 | } |
| 388 | 391 | ||
| 389 | return &srq->ibsrq; | 392 | return &srq->ibsrq; |
| 390 | 393 | ||
| 394 | err_srqc_alloc: | ||
| 395 | hns_roce_srq_free(hr_dev, srq); | ||
| 396 | |||
| 391 | err_wrid: | 397 | err_wrid: |
| 392 | kvfree(srq->wrid); | 398 | kvfree(srq->wrid); |
| 393 | 399 | ||
diff --git a/drivers/infiniband/hw/i40iw/i40iw_utils.c b/drivers/infiniband/hw/i40iw/i40iw_utils.c index a9ea966877f2..59e978141ad4 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_utils.c +++ b/drivers/infiniband/hw/i40iw/i40iw_utils.c | |||
| @@ -745,8 +745,8 @@ enum i40iw_status_code i40iw_allocate_dma_mem(struct i40iw_hw *hw, | |||
| 745 | if (!mem) | 745 | if (!mem) |
| 746 | return I40IW_ERR_PARAM; | 746 | return I40IW_ERR_PARAM; |
| 747 | mem->size = ALIGN(size, alignment); | 747 | mem->size = ALIGN(size, alignment); |
| 748 | mem->va = dma_zalloc_coherent(&pcidev->dev, mem->size, | 748 | mem->va = dma_alloc_coherent(&pcidev->dev, mem->size, |
| 749 | (dma_addr_t *)&mem->pa, GFP_KERNEL); | 749 | (dma_addr_t *)&mem->pa, GFP_KERNEL); |
| 750 | if (!mem->va) | 750 | if (!mem->va) |
| 751 | return I40IW_ERR_NO_MEMORY; | 751 | return I40IW_ERR_NO_MEMORY; |
| 752 | return 0; | 752 | return 0; |
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index 25439da8976c..936ee1314bcd 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c | |||
| @@ -1411,7 +1411,7 @@ int mlx4_ib_send_to_wire(struct mlx4_ib_dev *dev, int slave, u8 port, | |||
| 1411 | 1411 | ||
| 1412 | sqp_mad = (struct mlx4_mad_snd_buf *) (sqp->tx_ring[wire_tx_ix].buf.addr); | 1412 | sqp_mad = (struct mlx4_mad_snd_buf *) (sqp->tx_ring[wire_tx_ix].buf.addr); |
| 1413 | if (sqp->tx_ring[wire_tx_ix].ah) | 1413 | if (sqp->tx_ring[wire_tx_ix].ah) |
| 1414 | rdma_destroy_ah(sqp->tx_ring[wire_tx_ix].ah, 0); | 1414 | mlx4_ib_destroy_ah(sqp->tx_ring[wire_tx_ix].ah, 0); |
| 1415 | sqp->tx_ring[wire_tx_ix].ah = ah; | 1415 | sqp->tx_ring[wire_tx_ix].ah = ah; |
| 1416 | ib_dma_sync_single_for_cpu(&dev->ib_dev, | 1416 | ib_dma_sync_single_for_cpu(&dev->ib_dev, |
| 1417 | sqp->tx_ring[wire_tx_ix].buf.map, | 1417 | sqp->tx_ring[wire_tx_ix].buf.map, |
| @@ -1902,7 +1902,7 @@ static void mlx4_ib_sqp_comp_worker(struct work_struct *work) | |||
| 1902 | if (wc.status == IB_WC_SUCCESS) { | 1902 | if (wc.status == IB_WC_SUCCESS) { |
| 1903 | switch (wc.opcode) { | 1903 | switch (wc.opcode) { |
| 1904 | case IB_WC_SEND: | 1904 | case IB_WC_SEND: |
| 1905 | rdma_destroy_ah(sqp->tx_ring[wc.wr_id & | 1905 | mlx4_ib_destroy_ah(sqp->tx_ring[wc.wr_id & |
| 1906 | (MLX4_NUM_TUNNEL_BUFS - 1)].ah, 0); | 1906 | (MLX4_NUM_TUNNEL_BUFS - 1)].ah, 0); |
| 1907 | sqp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah | 1907 | sqp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah |
| 1908 | = NULL; | 1908 | = NULL; |
| @@ -1931,7 +1931,7 @@ static void mlx4_ib_sqp_comp_worker(struct work_struct *work) | |||
| 1931 | " status = %d, wrid = 0x%llx\n", | 1931 | " status = %d, wrid = 0x%llx\n", |
| 1932 | ctx->slave, wc.status, wc.wr_id); | 1932 | ctx->slave, wc.status, wc.wr_id); |
| 1933 | if (!MLX4_TUN_IS_RECV(wc.wr_id)) { | 1933 | if (!MLX4_TUN_IS_RECV(wc.wr_id)) { |
| 1934 | rdma_destroy_ah(sqp->tx_ring[wc.wr_id & | 1934 | mlx4_ib_destroy_ah(sqp->tx_ring[wc.wr_id & |
| 1935 | (MLX4_NUM_TUNNEL_BUFS - 1)].ah, 0); | 1935 | (MLX4_NUM_TUNNEL_BUFS - 1)].ah, 0); |
| 1936 | sqp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah | 1936 | sqp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah |
| 1937 | = NULL; | 1937 | = NULL; |
diff --git a/drivers/infiniband/hw/mlx5/flow.c b/drivers/infiniband/hw/mlx5/flow.c index e8a1e4498e3f..798591a18484 100644 --- a/drivers/infiniband/hw/mlx5/flow.c +++ b/drivers/infiniband/hw/mlx5/flow.c | |||
| @@ -630,8 +630,7 @@ const struct uapi_definition mlx5_ib_flow_defs[] = { | |||
| 630 | UAPI_DEF_IS_OBJ_SUPPORTED(flow_is_supported)), | 630 | UAPI_DEF_IS_OBJ_SUPPORTED(flow_is_supported)), |
| 631 | UAPI_DEF_CHAIN_OBJ_TREE( | 631 | UAPI_DEF_CHAIN_OBJ_TREE( |
| 632 | UVERBS_OBJECT_FLOW, | 632 | UVERBS_OBJECT_FLOW, |
| 633 | &mlx5_ib_fs, | 633 | &mlx5_ib_fs), |
| 634 | UAPI_DEF_IS_OBJ_SUPPORTED(flow_is_supported)), | ||
| 635 | UAPI_DEF_CHAIN_OBJ_TREE(UVERBS_OBJECT_FLOW_ACTION, | 634 | UAPI_DEF_CHAIN_OBJ_TREE(UVERBS_OBJECT_FLOW_ACTION, |
| 636 | &mlx5_ib_flow_actions), | 635 | &mlx5_ib_flow_actions), |
| 637 | {}, | 636 | {}, |
diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c index 01e0f6200631..4ee32964e1dd 100644 --- a/drivers/infiniband/hw/mlx5/odp.c +++ b/drivers/infiniband/hw/mlx5/odp.c | |||
| @@ -1595,10 +1595,12 @@ static void mlx5_ib_prefetch_mr_work(struct work_struct *work) | |||
| 1595 | struct prefetch_mr_work *w = | 1595 | struct prefetch_mr_work *w = |
| 1596 | container_of(work, struct prefetch_mr_work, work); | 1596 | container_of(work, struct prefetch_mr_work, work); |
| 1597 | 1597 | ||
| 1598 | if (w->dev->ib_dev.reg_state == IB_DEV_REGISTERED) | 1598 | if (ib_device_try_get(&w->dev->ib_dev)) { |
| 1599 | mlx5_ib_prefetch_sg_list(w->dev, w->pf_flags, w->sg_list, | 1599 | mlx5_ib_prefetch_sg_list(w->dev, w->pf_flags, w->sg_list, |
| 1600 | w->num_sge); | 1600 | w->num_sge); |
| 1601 | 1601 | ib_device_put(&w->dev->ib_dev); | |
| 1602 | } | ||
| 1603 | put_device(&w->dev->ib_dev.dev); | ||
| 1602 | kfree(w); | 1604 | kfree(w); |
| 1603 | } | 1605 | } |
| 1604 | 1606 | ||
| @@ -1617,15 +1619,13 @@ int mlx5_ib_advise_mr_prefetch(struct ib_pd *pd, | |||
| 1617 | return mlx5_ib_prefetch_sg_list(dev, pf_flags, sg_list, | 1619 | return mlx5_ib_prefetch_sg_list(dev, pf_flags, sg_list, |
| 1618 | num_sge); | 1620 | num_sge); |
| 1619 | 1621 | ||
| 1620 | if (dev->ib_dev.reg_state != IB_DEV_REGISTERED) | ||
| 1621 | return -ENODEV; | ||
| 1622 | |||
| 1623 | work = kvzalloc(struct_size(work, sg_list, num_sge), GFP_KERNEL); | 1622 | work = kvzalloc(struct_size(work, sg_list, num_sge), GFP_KERNEL); |
| 1624 | if (!work) | 1623 | if (!work) |
| 1625 | return -ENOMEM; | 1624 | return -ENOMEM; |
| 1626 | 1625 | ||
| 1627 | memcpy(work->sg_list, sg_list, num_sge * sizeof(struct ib_sge)); | 1626 | memcpy(work->sg_list, sg_list, num_sge * sizeof(struct ib_sge)); |
| 1628 | 1627 | ||
| 1628 | get_device(&dev->ib_dev.dev); | ||
| 1629 | work->dev = dev; | 1629 | work->dev = dev; |
| 1630 | work->pf_flags = pf_flags; | 1630 | work->pf_flags = pf_flags; |
| 1631 | work->num_sge = num_sge; | 1631 | work->num_sge = num_sge; |
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index dd2ae640bc84..7db778d96ef5 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c | |||
| @@ -1912,14 +1912,16 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, | |||
| 1912 | } | 1912 | } |
| 1913 | 1913 | ||
| 1914 | if (!check_flags_mask(ucmd.flags, | 1914 | if (!check_flags_mask(ucmd.flags, |
| 1915 | MLX5_QP_FLAG_ALLOW_SCATTER_CQE | | ||
| 1916 | MLX5_QP_FLAG_BFREG_INDEX | | ||
| 1917 | MLX5_QP_FLAG_PACKET_BASED_CREDIT_MODE | | ||
| 1918 | MLX5_QP_FLAG_SCATTER_CQE | | ||
| 1915 | MLX5_QP_FLAG_SIGNATURE | | 1919 | MLX5_QP_FLAG_SIGNATURE | |
| 1916 | MLX5_QP_FLAG_SCATTER_CQE | | 1920 | MLX5_QP_FLAG_TIR_ALLOW_SELF_LB_MC | |
| 1917 | MLX5_QP_FLAG_TUNNEL_OFFLOADS | | 1921 | MLX5_QP_FLAG_TIR_ALLOW_SELF_LB_UC | |
| 1918 | MLX5_QP_FLAG_BFREG_INDEX | | 1922 | MLX5_QP_FLAG_TUNNEL_OFFLOADS | |
| 1919 | MLX5_QP_FLAG_TYPE_DCT | | 1923 | MLX5_QP_FLAG_TYPE_DCI | |
| 1920 | MLX5_QP_FLAG_TYPE_DCI | | 1924 | MLX5_QP_FLAG_TYPE_DCT)) |
| 1921 | MLX5_QP_FLAG_ALLOW_SCATTER_CQE | | ||
| 1922 | MLX5_QP_FLAG_PACKET_BASED_CREDIT_MODE)) | ||
| 1923 | return -EINVAL; | 1925 | return -EINVAL; |
| 1924 | 1926 | ||
| 1925 | err = get_qp_user_index(to_mucontext(pd->uobject->context), | 1927 | err = get_qp_user_index(to_mucontext(pd->uobject->context), |
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c index cc9c0c8ccba3..112d2f38e0de 100644 --- a/drivers/infiniband/hw/mthca/mthca_memfree.c +++ b/drivers/infiniband/hw/mthca/mthca_memfree.c | |||
| @@ -623,8 +623,9 @@ int mthca_alloc_db(struct mthca_dev *dev, enum mthca_db_type type, | |||
| 623 | page = dev->db_tab->page + end; | 623 | page = dev->db_tab->page + end; |
| 624 | 624 | ||
| 625 | alloc: | 625 | alloc: |
| 626 | page->db_rec = dma_zalloc_coherent(&dev->pdev->dev, MTHCA_ICM_PAGE_SIZE, | 626 | page->db_rec = dma_alloc_coherent(&dev->pdev->dev, |
| 627 | &page->mapping, GFP_KERNEL); | 627 | MTHCA_ICM_PAGE_SIZE, &page->mapping, |
| 628 | GFP_KERNEL); | ||
| 628 | if (!page->db_rec) { | 629 | if (!page->db_rec) { |
| 629 | ret = -ENOMEM; | 630 | ret = -ENOMEM; |
| 630 | goto out; | 631 | goto out; |
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c index 82cb6b71ac7c..e3e9dd54caa2 100644 --- a/drivers/infiniband/hw/mthca/mthca_provider.c +++ b/drivers/infiniband/hw/mthca/mthca_provider.c | |||
| @@ -534,7 +534,7 @@ static struct ib_qp *mthca_create_qp(struct ib_pd *pd, | |||
| 534 | { | 534 | { |
| 535 | struct mthca_ucontext *context; | 535 | struct mthca_ucontext *context; |
| 536 | 536 | ||
| 537 | qp = kmalloc(sizeof *qp, GFP_KERNEL); | 537 | qp = kzalloc(sizeof(*qp), GFP_KERNEL); |
| 538 | if (!qp) | 538 | if (!qp) |
| 539 | return ERR_PTR(-ENOMEM); | 539 | return ERR_PTR(-ENOMEM); |
| 540 | 540 | ||
| @@ -600,7 +600,7 @@ static struct ib_qp *mthca_create_qp(struct ib_pd *pd, | |||
| 600 | if (udata) | 600 | if (udata) |
| 601 | return ERR_PTR(-EINVAL); | 601 | return ERR_PTR(-EINVAL); |
| 602 | 602 | ||
| 603 | qp = kmalloc(sizeof (struct mthca_sqp), GFP_KERNEL); | 603 | qp = kzalloc(sizeof(struct mthca_sqp), GFP_KERNEL); |
| 604 | if (!qp) | 604 | if (!qp) |
| 605 | return ERR_PTR(-ENOMEM); | 605 | return ERR_PTR(-ENOMEM); |
| 606 | 606 | ||
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c index 241a57a07485..097e5ab2a19f 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c | |||
| @@ -380,8 +380,8 @@ static int ocrdma_alloc_q(struct ocrdma_dev *dev, | |||
| 380 | q->len = len; | 380 | q->len = len; |
| 381 | q->entry_size = entry_size; | 381 | q->entry_size = entry_size; |
| 382 | q->size = len * entry_size; | 382 | q->size = len * entry_size; |
| 383 | q->va = dma_zalloc_coherent(&dev->nic_info.pdev->dev, q->size, | 383 | q->va = dma_alloc_coherent(&dev->nic_info.pdev->dev, q->size, &q->dma, |
| 384 | &q->dma, GFP_KERNEL); | 384 | GFP_KERNEL); |
| 385 | if (!q->va) | 385 | if (!q->va) |
| 386 | return -ENOMEM; | 386 | return -ENOMEM; |
| 387 | return 0; | 387 | return 0; |
| @@ -1819,7 +1819,7 @@ int ocrdma_mbx_create_cq(struct ocrdma_dev *dev, struct ocrdma_cq *cq, | |||
| 1819 | return -ENOMEM; | 1819 | return -ENOMEM; |
| 1820 | ocrdma_init_mch(&cmd->cmd.req, OCRDMA_CMD_CREATE_CQ, | 1820 | ocrdma_init_mch(&cmd->cmd.req, OCRDMA_CMD_CREATE_CQ, |
| 1821 | OCRDMA_SUBSYS_COMMON, sizeof(*cmd)); | 1821 | OCRDMA_SUBSYS_COMMON, sizeof(*cmd)); |
| 1822 | cq->va = dma_zalloc_coherent(&pdev->dev, cq->len, &cq->pa, GFP_KERNEL); | 1822 | cq->va = dma_alloc_coherent(&pdev->dev, cq->len, &cq->pa, GFP_KERNEL); |
| 1823 | if (!cq->va) { | 1823 | if (!cq->va) { |
| 1824 | status = -ENOMEM; | 1824 | status = -ENOMEM; |
| 1825 | goto mem_err; | 1825 | goto mem_err; |
| @@ -2209,7 +2209,7 @@ static int ocrdma_set_create_qp_sq_cmd(struct ocrdma_create_qp_req *cmd, | |||
| 2209 | qp->sq.max_cnt = max_wqe_allocated; | 2209 | qp->sq.max_cnt = max_wqe_allocated; |
| 2210 | len = (hw_pages * hw_page_size); | 2210 | len = (hw_pages * hw_page_size); |
| 2211 | 2211 | ||
| 2212 | qp->sq.va = dma_zalloc_coherent(&pdev->dev, len, &pa, GFP_KERNEL); | 2212 | qp->sq.va = dma_alloc_coherent(&pdev->dev, len, &pa, GFP_KERNEL); |
| 2213 | if (!qp->sq.va) | 2213 | if (!qp->sq.va) |
| 2214 | return -EINVAL; | 2214 | return -EINVAL; |
| 2215 | qp->sq.len = len; | 2215 | qp->sq.len = len; |
| @@ -2259,7 +2259,7 @@ static int ocrdma_set_create_qp_rq_cmd(struct ocrdma_create_qp_req *cmd, | |||
| 2259 | qp->rq.max_cnt = max_rqe_allocated; | 2259 | qp->rq.max_cnt = max_rqe_allocated; |
| 2260 | len = (hw_pages * hw_page_size); | 2260 | len = (hw_pages * hw_page_size); |
| 2261 | 2261 | ||
| 2262 | qp->rq.va = dma_zalloc_coherent(&pdev->dev, len, &pa, GFP_KERNEL); | 2262 | qp->rq.va = dma_alloc_coherent(&pdev->dev, len, &pa, GFP_KERNEL); |
| 2263 | if (!qp->rq.va) | 2263 | if (!qp->rq.va) |
| 2264 | return -ENOMEM; | 2264 | return -ENOMEM; |
| 2265 | qp->rq.pa = pa; | 2265 | qp->rq.pa = pa; |
| @@ -2315,8 +2315,8 @@ static int ocrdma_set_create_qp_ird_cmd(struct ocrdma_create_qp_req *cmd, | |||
| 2315 | if (dev->attr.ird == 0) | 2315 | if (dev->attr.ird == 0) |
| 2316 | return 0; | 2316 | return 0; |
| 2317 | 2317 | ||
| 2318 | qp->ird_q_va = dma_zalloc_coherent(&pdev->dev, ird_q_len, &pa, | 2318 | qp->ird_q_va = dma_alloc_coherent(&pdev->dev, ird_q_len, &pa, |
| 2319 | GFP_KERNEL); | 2319 | GFP_KERNEL); |
| 2320 | if (!qp->ird_q_va) | 2320 | if (!qp->ird_q_va) |
| 2321 | return -ENOMEM; | 2321 | return -ENOMEM; |
| 2322 | ocrdma_build_q_pages(&cmd->ird_addr[0], dev->attr.num_ird_pages, | 2322 | ocrdma_build_q_pages(&cmd->ird_addr[0], dev->attr.num_ird_pages, |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c index dd15474b19b7..6be0ea109138 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c | |||
| @@ -73,8 +73,8 @@ bool ocrdma_alloc_stats_resources(struct ocrdma_dev *dev) | |||
| 73 | mem->size = max_t(u32, sizeof(struct ocrdma_rdma_stats_req), | 73 | mem->size = max_t(u32, sizeof(struct ocrdma_rdma_stats_req), |
| 74 | sizeof(struct ocrdma_rdma_stats_resp)); | 74 | sizeof(struct ocrdma_rdma_stats_resp)); |
| 75 | 75 | ||
| 76 | mem->va = dma_zalloc_coherent(&dev->nic_info.pdev->dev, mem->size, | 76 | mem->va = dma_alloc_coherent(&dev->nic_info.pdev->dev, mem->size, |
| 77 | &mem->pa, GFP_KERNEL); | 77 | &mem->pa, GFP_KERNEL); |
| 78 | if (!mem->va) { | 78 | if (!mem->va) { |
| 79 | pr_err("%s: stats mbox allocation failed\n", __func__); | 79 | pr_err("%s: stats mbox allocation failed\n", __func__); |
| 80 | return false; | 80 | return false; |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index c46bed0c5513..287c332ff0e6 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | |||
| @@ -504,8 +504,8 @@ struct ib_ucontext *ocrdma_alloc_ucontext(struct ib_device *ibdev, | |||
| 504 | INIT_LIST_HEAD(&ctx->mm_head); | 504 | INIT_LIST_HEAD(&ctx->mm_head); |
| 505 | mutex_init(&ctx->mm_list_lock); | 505 | mutex_init(&ctx->mm_list_lock); |
| 506 | 506 | ||
| 507 | ctx->ah_tbl.va = dma_zalloc_coherent(&pdev->dev, map_len, | 507 | ctx->ah_tbl.va = dma_alloc_coherent(&pdev->dev, map_len, |
| 508 | &ctx->ah_tbl.pa, GFP_KERNEL); | 508 | &ctx->ah_tbl.pa, GFP_KERNEL); |
| 509 | if (!ctx->ah_tbl.va) { | 509 | if (!ctx->ah_tbl.va) { |
| 510 | kfree(ctx); | 510 | kfree(ctx); |
| 511 | return ERR_PTR(-ENOMEM); | 511 | return ERR_PTR(-ENOMEM); |
| @@ -838,7 +838,7 @@ static int ocrdma_build_pbl_tbl(struct ocrdma_dev *dev, struct ocrdma_hw_mr *mr) | |||
| 838 | return -ENOMEM; | 838 | return -ENOMEM; |
| 839 | 839 | ||
| 840 | for (i = 0; i < mr->num_pbls; i++) { | 840 | for (i = 0; i < mr->num_pbls; i++) { |
| 841 | va = dma_zalloc_coherent(&pdev->dev, dma_len, &pa, GFP_KERNEL); | 841 | va = dma_alloc_coherent(&pdev->dev, dma_len, &pa, GFP_KERNEL); |
| 842 | if (!va) { | 842 | if (!va) { |
| 843 | ocrdma_free_mr_pbl_tbl(dev, mr); | 843 | ocrdma_free_mr_pbl_tbl(dev, mr); |
| 844 | status = -ENOMEM; | 844 | status = -ENOMEM; |
diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c index b342a70e2814..e1ccf32b1c3d 100644 --- a/drivers/infiniband/hw/qedr/verbs.c +++ b/drivers/infiniband/hw/qedr/verbs.c | |||
| @@ -556,8 +556,8 @@ static struct qedr_pbl *qedr_alloc_pbl_tbl(struct qedr_dev *dev, | |||
| 556 | return ERR_PTR(-ENOMEM); | 556 | return ERR_PTR(-ENOMEM); |
| 557 | 557 | ||
| 558 | for (i = 0; i < pbl_info->num_pbls; i++) { | 558 | for (i = 0; i < pbl_info->num_pbls; i++) { |
| 559 | va = dma_zalloc_coherent(&pdev->dev, pbl_info->pbl_size, | 559 | va = dma_alloc_coherent(&pdev->dev, pbl_info->pbl_size, &pa, |
| 560 | &pa, flags); | 560 | flags); |
| 561 | if (!va) | 561 | if (!va) |
| 562 | goto err; | 562 | goto err; |
| 563 | 563 | ||
diff --git a/drivers/infiniband/hw/qib/qib_ud.c b/drivers/infiniband/hw/qib/qib_ud.c index 868da0ece7ba..445ea19a2ec8 100644 --- a/drivers/infiniband/hw/qib/qib_ud.c +++ b/drivers/infiniband/hw/qib/qib_ud.c | |||
| @@ -512,7 +512,6 @@ void qib_ud_rcv(struct qib_ibport *ibp, struct ib_header *hdr, | |||
| 512 | opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { | 512 | opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { |
| 513 | wc.ex.imm_data = ohdr->u.ud.imm_data; | 513 | wc.ex.imm_data = ohdr->u.ud.imm_data; |
| 514 | wc.wc_flags = IB_WC_WITH_IMM; | 514 | wc.wc_flags = IB_WC_WITH_IMM; |
| 515 | tlen -= sizeof(u32); | ||
| 516 | } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { | 515 | } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { |
| 517 | wc.ex.imm_data = 0; | 516 | wc.ex.imm_data = 0; |
| 518 | wc.wc_flags = 0; | 517 | wc.wc_flags = 0; |
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h index 42b8685c997e..3c633ab58052 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h | |||
| @@ -427,7 +427,40 @@ static inline enum ib_qp_state pvrdma_qp_state_to_ib(enum pvrdma_qp_state state) | |||
| 427 | 427 | ||
| 428 | static inline enum pvrdma_wr_opcode ib_wr_opcode_to_pvrdma(enum ib_wr_opcode op) | 428 | static inline enum pvrdma_wr_opcode ib_wr_opcode_to_pvrdma(enum ib_wr_opcode op) |
| 429 | { | 429 | { |
| 430 | return (enum pvrdma_wr_opcode)op; | 430 | switch (op) { |
| 431 | case IB_WR_RDMA_WRITE: | ||
| 432 | return PVRDMA_WR_RDMA_WRITE; | ||
| 433 | case IB_WR_RDMA_WRITE_WITH_IMM: | ||
| 434 | return PVRDMA_WR_RDMA_WRITE_WITH_IMM; | ||
| 435 | case IB_WR_SEND: | ||
| 436 | return PVRDMA_WR_SEND; | ||
| 437 | case IB_WR_SEND_WITH_IMM: | ||
| 438 | return PVRDMA_WR_SEND_WITH_IMM; | ||
| 439 | case IB_WR_RDMA_READ: | ||
| 440 | return PVRDMA_WR_RDMA_READ; | ||
| 441 | case IB_WR_ATOMIC_CMP_AND_SWP: | ||
| 442 | return PVRDMA_WR_ATOMIC_CMP_AND_SWP; | ||
| 443 | case IB_WR_ATOMIC_FETCH_AND_ADD: | ||
| 444 | return PVRDMA_WR_ATOMIC_FETCH_AND_ADD; | ||
| 445 | case IB_WR_LSO: | ||
| 446 | return PVRDMA_WR_LSO; | ||
| 447 | case IB_WR_SEND_WITH_INV: | ||
| 448 | return PVRDMA_WR_SEND_WITH_INV; | ||
| 449 | case IB_WR_RDMA_READ_WITH_INV: | ||
| 450 | return PVRDMA_WR_RDMA_READ_WITH_INV; | ||
| 451 | case IB_WR_LOCAL_INV: | ||
| 452 | return PVRDMA_WR_LOCAL_INV; | ||
| 453 | case IB_WR_REG_MR: | ||
| 454 | return PVRDMA_WR_FAST_REG_MR; | ||
| 455 | case IB_WR_MASKED_ATOMIC_CMP_AND_SWP: | ||
| 456 | return PVRDMA_WR_MASKED_ATOMIC_CMP_AND_SWP; | ||
| 457 | case IB_WR_MASKED_ATOMIC_FETCH_AND_ADD: | ||
| 458 | return PVRDMA_WR_MASKED_ATOMIC_FETCH_AND_ADD; | ||
| 459 | case IB_WR_REG_SIG_MR: | ||
| 460 | return PVRDMA_WR_REG_SIG_MR; | ||
| 461 | default: | ||
| 462 | return PVRDMA_WR_ERROR; | ||
| 463 | } | ||
| 431 | } | 464 | } |
| 432 | 465 | ||
| 433 | static inline enum ib_wc_status pvrdma_wc_status_to_ib( | 466 | static inline enum ib_wc_status pvrdma_wc_status_to_ib( |
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c index eaa109dbc96a..39c37b6fd715 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c | |||
| @@ -890,8 +890,8 @@ static int pvrdma_pci_probe(struct pci_dev *pdev, | |||
| 890 | dev_info(&pdev->dev, "device version %d, driver version %d\n", | 890 | dev_info(&pdev->dev, "device version %d, driver version %d\n", |
| 891 | dev->dsr_version, PVRDMA_VERSION); | 891 | dev->dsr_version, PVRDMA_VERSION); |
| 892 | 892 | ||
| 893 | dev->dsr = dma_zalloc_coherent(&pdev->dev, sizeof(*dev->dsr), | 893 | dev->dsr = dma_alloc_coherent(&pdev->dev, sizeof(*dev->dsr), |
| 894 | &dev->dsrbase, GFP_KERNEL); | 894 | &dev->dsrbase, GFP_KERNEL); |
| 895 | if (!dev->dsr) { | 895 | if (!dev->dsr) { |
| 896 | dev_err(&pdev->dev, "failed to allocate shared region\n"); | 896 | dev_err(&pdev->dev, "failed to allocate shared region\n"); |
| 897 | ret = -ENOMEM; | 897 | ret = -ENOMEM; |
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c index 3acf74cbe266..1ec3646087ba 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c | |||
| @@ -721,6 +721,12 @@ int pvrdma_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, | |||
| 721 | wr->opcode == IB_WR_RDMA_WRITE_WITH_IMM) | 721 | wr->opcode == IB_WR_RDMA_WRITE_WITH_IMM) |
| 722 | wqe_hdr->ex.imm_data = wr->ex.imm_data; | 722 | wqe_hdr->ex.imm_data = wr->ex.imm_data; |
| 723 | 723 | ||
| 724 | if (unlikely(wqe_hdr->opcode == PVRDMA_WR_ERROR)) { | ||
| 725 | *bad_wr = wr; | ||
| 726 | ret = -EINVAL; | ||
| 727 | goto out; | ||
| 728 | } | ||
| 729 | |||
| 724 | switch (qp->ibqp.qp_type) { | 730 | switch (qp->ibqp.qp_type) { |
| 725 | case IB_QPT_GSI: | 731 | case IB_QPT_GSI: |
| 726 | case IB_QPT_UD: | 732 | case IB_QPT_UD: |
diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c index a1bd8cfc2c25..c6cc3e4ab71d 100644 --- a/drivers/infiniband/sw/rdmavt/qp.c +++ b/drivers/infiniband/sw/rdmavt/qp.c | |||
| @@ -2910,6 +2910,8 @@ send: | |||
| 2910 | goto op_err; | 2910 | goto op_err; |
| 2911 | if (!ret) | 2911 | if (!ret) |
| 2912 | goto rnr_nak; | 2912 | goto rnr_nak; |
| 2913 | if (wqe->length > qp->r_len) | ||
| 2914 | goto inv_err; | ||
| 2913 | break; | 2915 | break; |
| 2914 | 2916 | ||
| 2915 | case IB_WR_RDMA_WRITE_WITH_IMM: | 2917 | case IB_WR_RDMA_WRITE_WITH_IMM: |
| @@ -3078,7 +3080,10 @@ op_err: | |||
| 3078 | goto err; | 3080 | goto err; |
| 3079 | 3081 | ||
| 3080 | inv_err: | 3082 | inv_err: |
| 3081 | send_status = IB_WC_REM_INV_REQ_ERR; | 3083 | send_status = |
| 3084 | sqp->ibqp.qp_type == IB_QPT_RC ? | ||
| 3085 | IB_WC_REM_INV_REQ_ERR : | ||
| 3086 | IB_WC_SUCCESS; | ||
| 3082 | wc.status = IB_WC_LOC_QP_OP_ERR; | 3087 | wc.status = IB_WC_LOC_QP_OP_ERR; |
| 3083 | goto err; | 3088 | goto err; |
| 3084 | 3089 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 1da119d901a9..73e808c1e6ad 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h | |||
| @@ -248,7 +248,6 @@ struct ipoib_cm_tx { | |||
| 248 | struct list_head list; | 248 | struct list_head list; |
| 249 | struct net_device *dev; | 249 | struct net_device *dev; |
| 250 | struct ipoib_neigh *neigh; | 250 | struct ipoib_neigh *neigh; |
| 251 | struct ipoib_path *path; | ||
| 252 | struct ipoib_tx_buf *tx_ring; | 251 | struct ipoib_tx_buf *tx_ring; |
| 253 | unsigned int tx_head; | 252 | unsigned int tx_head; |
| 254 | unsigned int tx_tail; | 253 | unsigned int tx_tail; |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 0428e01e8f69..aa9dcfc36cd3 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c | |||
| @@ -1312,7 +1312,6 @@ struct ipoib_cm_tx *ipoib_cm_create_tx(struct net_device *dev, struct ipoib_path | |||
| 1312 | 1312 | ||
| 1313 | neigh->cm = tx; | 1313 | neigh->cm = tx; |
| 1314 | tx->neigh = neigh; | 1314 | tx->neigh = neigh; |
| 1315 | tx->path = path; | ||
| 1316 | tx->dev = dev; | 1315 | tx->dev = dev; |
| 1317 | list_add(&tx->list, &priv->cm.start_list); | 1316 | list_add(&tx->list, &priv->cm.start_list); |
| 1318 | set_bit(IPOIB_FLAG_INITIALIZED, &tx->flags); | 1317 | set_bit(IPOIB_FLAG_INITIALIZED, &tx->flags); |
| @@ -1371,7 +1370,7 @@ static void ipoib_cm_tx_start(struct work_struct *work) | |||
| 1371 | neigh->daddr + QPN_AND_OPTIONS_OFFSET); | 1370 | neigh->daddr + QPN_AND_OPTIONS_OFFSET); |
| 1372 | goto free_neigh; | 1371 | goto free_neigh; |
| 1373 | } | 1372 | } |
| 1374 | memcpy(&pathrec, &p->path->pathrec, sizeof(pathrec)); | 1373 | memcpy(&pathrec, &path->pathrec, sizeof(pathrec)); |
| 1375 | 1374 | ||
| 1376 | spin_unlock_irqrestore(&priv->lock, flags); | 1375 | spin_unlock_irqrestore(&priv->lock, flags); |
| 1377 | netif_tx_unlock_bh(dev); | 1376 | netif_tx_unlock_bh(dev); |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 31d91538bbf4..694324b37480 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
| @@ -3032,7 +3032,6 @@ static int srp_reset_device(struct scsi_cmnd *scmnd) | |||
| 3032 | { | 3032 | { |
| 3033 | struct srp_target_port *target = host_to_target(scmnd->device->host); | 3033 | struct srp_target_port *target = host_to_target(scmnd->device->host); |
| 3034 | struct srp_rdma_ch *ch; | 3034 | struct srp_rdma_ch *ch; |
| 3035 | int i, j; | ||
| 3036 | u8 status; | 3035 | u8 status; |
| 3037 | 3036 | ||
| 3038 | shost_printk(KERN_ERR, target->scsi_host, "SRP reset_device called\n"); | 3037 | shost_printk(KERN_ERR, target->scsi_host, "SRP reset_device called\n"); |
| @@ -3044,15 +3043,6 @@ static int srp_reset_device(struct scsi_cmnd *scmnd) | |||
| 3044 | if (status) | 3043 | if (status) |
| 3045 | return FAILED; | 3044 | return FAILED; |
| 3046 | 3045 | ||
| 3047 | for (i = 0; i < target->ch_count; i++) { | ||
| 3048 | ch = &target->ch[i]; | ||
| 3049 | for (j = 0; j < target->req_ring_size; ++j) { | ||
| 3050 | struct srp_request *req = &ch->req_ring[j]; | ||
| 3051 | |||
| 3052 | srp_finish_req(ch, req, scmnd->device, DID_RESET << 16); | ||
| 3053 | } | ||
| 3054 | } | ||
| 3055 | |||
| 3056 | return SUCCESS; | 3046 | return SUCCESS; |
| 3057 | } | 3047 | } |
| 3058 | 3048 | ||
