pbundle 78 drivers/infiniband/core/uverbs_ioctl.c struct bundle_priv *pbundle; pbundle 81 drivers/infiniband/core/uverbs_ioctl.c sizeof(*pbundle->bundle.attrs) * method_elm->key_bitmap_len + pbundle 82 drivers/infiniband/core/uverbs_ioctl.c sizeof(*pbundle->uattrs) * num_attrs; pbundle 84 drivers/infiniband/core/uverbs_ioctl.c method_elm->use_stack = bundle_size <= sizeof(*pbundle); pbundle 86 drivers/infiniband/core/uverbs_ioctl.c ALIGN(bundle_size + 256, sizeof(*pbundle->internal_buffer)); pbundle 108 drivers/infiniband/core/uverbs_ioctl.c struct bundle_priv *pbundle = pbundle 113 drivers/infiniband/core/uverbs_ioctl.c if (check_add_overflow(size, pbundle->internal_used, &new_used)) pbundle 116 drivers/infiniband/core/uverbs_ioctl.c if (new_used > pbundle->internal_avail) { pbundle 122 drivers/infiniband/core/uverbs_ioctl.c buf->next = pbundle->allocated_mem; pbundle 123 drivers/infiniband/core/uverbs_ioctl.c pbundle->allocated_mem = buf; pbundle 127 drivers/infiniband/core/uverbs_ioctl.c res = (void *)pbundle->internal_buffer + pbundle->internal_used; pbundle 128 drivers/infiniband/core/uverbs_ioctl.c pbundle->internal_used = pbundle 129 drivers/infiniband/core/uverbs_ioctl.c ALIGN(new_used, sizeof(*pbundle->internal_buffer)); pbundle 150 drivers/infiniband/core/uverbs_ioctl.c struct bundle_priv *pbundle = pbundle 154 drivers/infiniband/core/uverbs_ioctl.c flags = pbundle->uattrs[attr->ptr_attr.uattr_idx].flags | pbundle 157 drivers/infiniband/core/uverbs_ioctl.c &pbundle->user_attrs[attr->ptr_attr.uattr_idx].flags)) pbundle 162 drivers/infiniband/core/uverbs_ioctl.c static int uverbs_process_idrs_array(struct bundle_priv *pbundle, pbundle 186 drivers/infiniband/core/uverbs_ioctl.c uverbs_alloc(&pbundle->bundle, pbundle 211 drivers/infiniband/core/uverbs_ioctl.c idr_vals[i], &pbundle->bundle); pbundle 219 drivers/infiniband/core/uverbs_ioctl.c __set_bit(attr_bkey, pbundle->spec_finalize); pbundle 243 drivers/infiniband/core/uverbs_ioctl.c static int uverbs_process_attr(struct bundle_priv *pbundle, pbundle 248 drivers/infiniband/core/uverbs_ioctl.c struct uverbs_attr *e = &pbundle->bundle.attrs[attr_bkey]; pbundle 290 drivers/infiniband/core/uverbs_ioctl.c e->ptr_attr.uattr_idx = uattr - pbundle->uattrs; pbundle 296 drivers/infiniband/core/uverbs_ioctl.c p = uverbs_alloc(&pbundle->bundle, uattr->len); pbundle 329 drivers/infiniband/core/uverbs_ioctl.c uattr->data_s64, &pbundle->bundle); pbundle 332 drivers/infiniband/core/uverbs_ioctl.c __set_bit(attr_bkey, pbundle->uobj_finalize); pbundle 335 drivers/infiniband/core/uverbs_ioctl.c unsigned int uattr_idx = uattr - pbundle->uattrs; pbundle 339 drivers/infiniband/core/uverbs_ioctl.c if (put_user(id, &pbundle->user_attrs[uattr_idx].data)) pbundle 346 drivers/infiniband/core/uverbs_ioctl.c return uverbs_process_idrs_array(pbundle, attr_uapi, pbundle 366 drivers/infiniband/core/uverbs_ioctl.c static void __rcu **uapi_get_attr_for_method(struct bundle_priv *pbundle, pbundle 371 drivers/infiniband/core/uverbs_ioctl.c if (likely(attr_key < pbundle->radix_slots_len)) { pbundle 374 drivers/infiniband/core/uverbs_ioctl.c slot = pbundle->radix_slots + attr_key; pbundle 380 drivers/infiniband/core/uverbs_ioctl.c return radix_tree_lookup_slot(pbundle->radix, pbundle 381 drivers/infiniband/core/uverbs_ioctl.c pbundle->method_key | attr_key); pbundle 384 drivers/infiniband/core/uverbs_ioctl.c static int uverbs_set_attr(struct bundle_priv *pbundle, pbundle 393 drivers/infiniband/core/uverbs_ioctl.c slot = uapi_get_attr_for_method(pbundle, attr_key); pbundle 406 drivers/infiniband/core/uverbs_ioctl.c if (test_bit(attr_bkey, pbundle->bundle.attr_present)) pbundle 409 drivers/infiniband/core/uverbs_ioctl.c ret = uverbs_process_attr(pbundle, attr, uattr, attr_bkey); pbundle 413 drivers/infiniband/core/uverbs_ioctl.c __set_bit(attr_bkey, pbundle->bundle.attr_present); pbundle 418 drivers/infiniband/core/uverbs_ioctl.c static int ib_uverbs_run_method(struct bundle_priv *pbundle, pbundle 422 drivers/infiniband/core/uverbs_ioctl.c size_t uattrs_size = array_size(sizeof(*pbundle->uattrs), num_attrs); pbundle 423 drivers/infiniband/core/uverbs_ioctl.c unsigned int destroy_bkey = pbundle->method_elm->destroy_bkey; pbundle 429 drivers/infiniband/core/uverbs_ioctl.c pbundle->method_elm->handler, pbundle 430 drivers/infiniband/core/uverbs_ioctl.c &pbundle->bundle.ufile->device->disassociate_srcu); pbundle 434 drivers/infiniband/core/uverbs_ioctl.c pbundle->uattrs = uverbs_alloc(&pbundle->bundle, uattrs_size); pbundle 435 drivers/infiniband/core/uverbs_ioctl.c if (IS_ERR(pbundle->uattrs)) pbundle 436 drivers/infiniband/core/uverbs_ioctl.c return PTR_ERR(pbundle->uattrs); pbundle 437 drivers/infiniband/core/uverbs_ioctl.c if (copy_from_user(pbundle->uattrs, pbundle->user_attrs, uattrs_size)) pbundle 441 drivers/infiniband/core/uverbs_ioctl.c ret = uverbs_set_attr(pbundle, &pbundle->uattrs[i]); pbundle 447 drivers/infiniband/core/uverbs_ioctl.c if (unlikely(!bitmap_subset(pbundle->method_elm->attr_mandatory, pbundle 448 drivers/infiniband/core/uverbs_ioctl.c pbundle->bundle.attr_present, pbundle 449 drivers/infiniband/core/uverbs_ioctl.c pbundle->method_elm->key_bitmap_len))) pbundle 452 drivers/infiniband/core/uverbs_ioctl.c if (pbundle->method_elm->has_udata) pbundle 453 drivers/infiniband/core/uverbs_ioctl.c uverbs_fill_udata(&pbundle->bundle, pbundle 454 drivers/infiniband/core/uverbs_ioctl.c &pbundle->bundle.driver_udata, pbundle 457 drivers/infiniband/core/uverbs_ioctl.c pbundle->bundle.driver_udata = (struct ib_udata){}; pbundle 461 drivers/infiniband/core/uverbs_ioctl.c &pbundle->bundle.attrs[destroy_bkey].obj_attr; pbundle 463 drivers/infiniband/core/uverbs_ioctl.c ret = uobj_destroy(destroy_attr->uobject, &pbundle->bundle); pbundle 466 drivers/infiniband/core/uverbs_ioctl.c __clear_bit(destroy_bkey, pbundle->uobj_finalize); pbundle 468 drivers/infiniband/core/uverbs_ioctl.c ret = handler(&pbundle->bundle); pbundle 471 drivers/infiniband/core/uverbs_ioctl.c ret = handler(&pbundle->bundle); pbundle 479 drivers/infiniband/core/uverbs_ioctl.c if (!ret && pbundle->method_elm->has_udata) { pbundle 481 drivers/infiniband/core/uverbs_ioctl.c uverbs_attr_get(&pbundle->bundle, UVERBS_ATTR_UHW_OUT); pbundle 484 drivers/infiniband/core/uverbs_ioctl.c ret = uverbs_set_output(&pbundle->bundle, attr); pbundle 498 drivers/infiniband/core/uverbs_ioctl.c static int bundle_destroy(struct bundle_priv *pbundle, bool commit) pbundle 500 drivers/infiniband/core/uverbs_ioctl.c unsigned int key_bitmap_len = pbundle->method_elm->key_bitmap_len; pbundle 507 drivers/infiniband/core/uverbs_ioctl.c while ((i = find_next_bit(pbundle->uobj_finalize, key_bitmap_len, pbundle 509 drivers/infiniband/core/uverbs_ioctl.c struct uverbs_attr *attr = &pbundle->bundle.attrs[i]; pbundle 515 drivers/infiniband/core/uverbs_ioctl.c &pbundle->bundle); pbundle 521 drivers/infiniband/core/uverbs_ioctl.c while ((i = find_next_bit(pbundle->spec_finalize, key_bitmap_len, pbundle 523 drivers/infiniband/core/uverbs_ioctl.c struct uverbs_attr *attr = &pbundle->bundle.attrs[i]; pbundle 529 drivers/infiniband/core/uverbs_ioctl.c pbundle, pbundle 530 drivers/infiniband/core/uverbs_ioctl.c pbundle->method_key | uapi_bkey_to_key_attr(i)); pbundle 539 drivers/infiniband/core/uverbs_ioctl.c &pbundle->bundle); pbundle 545 drivers/infiniband/core/uverbs_ioctl.c for (memblock = pbundle->allocated_mem; memblock;) { pbundle 562 drivers/infiniband/core/uverbs_ioctl.c struct bundle_priv *pbundle; pbundle 580 drivers/infiniband/core/uverbs_ioctl.c pbundle = kmalloc(method_elm->bundle_size, GFP_KERNEL); pbundle 581 drivers/infiniband/core/uverbs_ioctl.c if (!pbundle) pbundle 583 drivers/infiniband/core/uverbs_ioctl.c pbundle->internal_avail = pbundle 586 drivers/infiniband/core/uverbs_ioctl.c pbundle->alloc_head.next = NULL; pbundle 587 drivers/infiniband/core/uverbs_ioctl.c pbundle->allocated_mem = &pbundle->alloc_head; pbundle 589 drivers/infiniband/core/uverbs_ioctl.c pbundle = &onstack; pbundle 590 drivers/infiniband/core/uverbs_ioctl.c pbundle->internal_avail = sizeof(pbundle->internal_buffer); pbundle 591 drivers/infiniband/core/uverbs_ioctl.c pbundle->allocated_mem = NULL; pbundle 595 drivers/infiniband/core/uverbs_ioctl.c pbundle->method_elm = method_elm; pbundle 596 drivers/infiniband/core/uverbs_ioctl.c pbundle->method_key = attrs_iter.index; pbundle 597 drivers/infiniband/core/uverbs_ioctl.c pbundle->bundle.ufile = ufile; pbundle 598 drivers/infiniband/core/uverbs_ioctl.c pbundle->bundle.context = NULL; /* only valid if bundle has uobject */ pbundle 599 drivers/infiniband/core/uverbs_ioctl.c pbundle->radix = &uapi->radix; pbundle 600 drivers/infiniband/core/uverbs_ioctl.c pbundle->radix_slots = slot; pbundle 601 drivers/infiniband/core/uverbs_ioctl.c pbundle->radix_slots_len = radix_tree_chunk_size(&attrs_iter); pbundle 602 drivers/infiniband/core/uverbs_ioctl.c pbundle->user_attrs = user_attrs; pbundle 604 drivers/infiniband/core/uverbs_ioctl.c pbundle->internal_used = ALIGN(pbundle->method_elm->key_bitmap_len * pbundle 605 drivers/infiniband/core/uverbs_ioctl.c sizeof(*pbundle->bundle.attrs), pbundle 606 drivers/infiniband/core/uverbs_ioctl.c sizeof(*pbundle->internal_buffer)); pbundle 607 drivers/infiniband/core/uverbs_ioctl.c memset(pbundle->bundle.attr_present, 0, pbundle 608 drivers/infiniband/core/uverbs_ioctl.c sizeof(pbundle->bundle.attr_present)); pbundle 609 drivers/infiniband/core/uverbs_ioctl.c memset(pbundle->uobj_finalize, 0, sizeof(pbundle->uobj_finalize)); pbundle 610 drivers/infiniband/core/uverbs_ioctl.c memset(pbundle->spec_finalize, 0, sizeof(pbundle->spec_finalize)); pbundle 612 drivers/infiniband/core/uverbs_ioctl.c ret = ib_uverbs_run_method(pbundle, hdr->num_attrs); pbundle 613 drivers/infiniband/core/uverbs_ioctl.c destroy_ret = bundle_destroy(pbundle, ret == 0); pbundle 709 drivers/infiniband/core/uverbs_ioctl.c struct bundle_priv *pbundle = pbundle 712 drivers/infiniband/core/uverbs_ioctl.c uverbs_attr_get(&pbundle->bundle, attr_in); pbundle 714 drivers/infiniband/core/uverbs_ioctl.c uverbs_attr_get(&pbundle->bundle, attr_out); pbundle 720 drivers/infiniband/core/uverbs_ioctl.c &pbundle->user_attrs[in->ptr_attr.uattr_idx]