Lines Matching full:resp

52  * Copy a response to userspace. If the provided 'resp' is larger than the
59 static int uverbs_response(struct uverbs_attr_bundle *attrs, const void *resp, in uverbs_response() argument
66 attrs, UVERBS_ATTR_CORE_OUT, resp, resp_len); in uverbs_response()
68 if (copy_to_user(attrs->ucore.outbuf, resp, in uverbs_response()
297 struct ib_uverbs_get_context_resp resp; in ib_uverbs_get_context() local
317 resp = (struct ib_uverbs_get_context_resp){ in ib_uverbs_get_context()
321 ret = uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_get_context()
344 struct ib_uverbs_query_device_resp *resp, in copy_query_dev_fields() argument
349 resp->fw_ver = attr->fw_ver; in copy_query_dev_fields()
350 resp->node_guid = ib_dev->node_guid; in copy_query_dev_fields()
351 resp->sys_image_guid = attr->sys_image_guid; in copy_query_dev_fields()
352 resp->max_mr_size = attr->max_mr_size; in copy_query_dev_fields()
353 resp->page_size_cap = attr->page_size_cap; in copy_query_dev_fields()
354 resp->vendor_id = attr->vendor_id; in copy_query_dev_fields()
355 resp->vendor_part_id = attr->vendor_part_id; in copy_query_dev_fields()
356 resp->hw_ver = attr->hw_ver; in copy_query_dev_fields()
357 resp->max_qp = attr->max_qp; in copy_query_dev_fields()
358 resp->max_qp_wr = attr->max_qp_wr; in copy_query_dev_fields()
359 resp->device_cap_flags = lower_32_bits(attr->device_cap_flags); in copy_query_dev_fields()
360 resp->max_sge = min(attr->max_send_sge, attr->max_recv_sge); in copy_query_dev_fields()
361 resp->max_sge_rd = attr->max_sge_rd; in copy_query_dev_fields()
362 resp->max_cq = attr->max_cq; in copy_query_dev_fields()
363 resp->max_cqe = attr->max_cqe; in copy_query_dev_fields()
364 resp->max_mr = attr->max_mr; in copy_query_dev_fields()
365 resp->max_pd = attr->max_pd; in copy_query_dev_fields()
366 resp->max_qp_rd_atom = attr->max_qp_rd_atom; in copy_query_dev_fields()
367 resp->max_ee_rd_atom = attr->max_ee_rd_atom; in copy_query_dev_fields()
368 resp->max_res_rd_atom = attr->max_res_rd_atom; in copy_query_dev_fields()
369 resp->max_qp_init_rd_atom = attr->max_qp_init_rd_atom; in copy_query_dev_fields()
370 resp->max_ee_init_rd_atom = attr->max_ee_init_rd_atom; in copy_query_dev_fields()
371 resp->atomic_cap = attr->atomic_cap; in copy_query_dev_fields()
372 resp->max_ee = attr->max_ee; in copy_query_dev_fields()
373 resp->max_rdd = attr->max_rdd; in copy_query_dev_fields()
374 resp->max_mw = attr->max_mw; in copy_query_dev_fields()
375 resp->max_raw_ipv6_qp = attr->max_raw_ipv6_qp; in copy_query_dev_fields()
376 resp->max_raw_ethy_qp = attr->max_raw_ethy_qp; in copy_query_dev_fields()
377 resp->max_mcast_grp = attr->max_mcast_grp; in copy_query_dev_fields()
378 resp->max_mcast_qp_attach = attr->max_mcast_qp_attach; in copy_query_dev_fields()
379 resp->max_total_mcast_qp_attach = attr->max_total_mcast_qp_attach; in copy_query_dev_fields()
380 resp->max_ah = attr->max_ah; in copy_query_dev_fields()
381 resp->max_srq = attr->max_srq; in copy_query_dev_fields()
382 resp->max_srq_wr = attr->max_srq_wr; in copy_query_dev_fields()
383 resp->max_srq_sge = attr->max_srq_sge; in copy_query_dev_fields()
384 resp->max_pkeys = attr->max_pkeys; in copy_query_dev_fields()
385 resp->local_ca_ack_delay = attr->local_ca_ack_delay; in copy_query_dev_fields()
386 resp->phys_port_cnt = min_t(u32, ib_dev->phys_port_cnt, U8_MAX); in copy_query_dev_fields()
392 struct ib_uverbs_query_device_resp resp; in ib_uverbs_query_device() local
404 memset(&resp, 0, sizeof resp); in ib_uverbs_query_device()
405 copy_query_dev_fields(ucontext, &resp, &ucontext->device->attrs); in ib_uverbs_query_device()
407 return uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_query_device()
413 struct ib_uverbs_query_port_resp resp; in ib_uverbs_query_port() local
432 memset(&resp, 0, sizeof resp); in ib_uverbs_query_port()
433 copy_port_attr_to_resp(&attr, &resp, ib_dev, cmd.port_num); in ib_uverbs_query_port()
435 return uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_query_port()
440 struct ib_uverbs_alloc_pd_resp resp = {}; in ib_uverbs_alloc_pd() local
476 resp.pd_handle = uobj->id; in ib_uverbs_alloc_pd()
477 return uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_alloc_pd()
587 struct ib_uverbs_open_xrcd_resp resp = {}; in ib_uverbs_open_xrcd() local
659 resp.xrcd_handle = obj->uobject.id; in ib_uverbs_open_xrcd()
660 return uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_open_xrcd()
714 struct ib_uverbs_reg_mr_resp resp = {}; in ib_uverbs_reg_mr() local
769 resp.lkey = mr->lkey; in ib_uverbs_reg_mr()
770 resp.rkey = mr->rkey; in ib_uverbs_reg_mr()
771 resp.mr_handle = uobj->id; in ib_uverbs_reg_mr()
772 return uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_reg_mr()
784 struct ib_uverbs_rereg_mr_resp resp; in ib_uverbs_rereg_mr() local
888 memset(&resp, 0, sizeof(resp)); in ib_uverbs_rereg_mr()
889 resp.lkey = mr->lkey; in ib_uverbs_rereg_mr()
890 resp.rkey = mr->rkey; in ib_uverbs_rereg_mr()
892 ret = uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_rereg_mr()
923 struct ib_uverbs_alloc_mw_resp resp = {}; in ib_uverbs_alloc_mw() local
970 resp.rkey = mw->rkey; in ib_uverbs_alloc_mw()
971 resp.mw_handle = uobj->id; in ib_uverbs_alloc_mw()
972 return uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_alloc_mw()
998 struct ib_uverbs_create_comp_channel_resp resp; in ib_uverbs_create_comp_channel() local
1017 resp.fd = uobj->id; in ib_uverbs_create_comp_channel()
1018 return uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_create_comp_channel()
1028 struct ib_uverbs_ex_create_cq_resp resp = {}; in create_cq() local
1082 resp.base.cq_handle = obj->uevent.uobject.id; in create_cq()
1083 resp.base.cqe = cq->cqe; in create_cq()
1084 resp.response_length = uverbs_response_length(attrs, sizeof(resp)); in create_cq()
1085 return uverbs_response(attrs, &resp, sizeof(resp)); in create_cq()
1138 struct ib_uverbs_resize_cq_resp resp = {}; in ib_uverbs_resize_cq() local
1154 resp.cqe = cq->cqe; in ib_uverbs_resize_cq()
1156 ret = uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_resize_cq()
1197 struct ib_uverbs_poll_cq_resp resp; in ib_uverbs_poll_cq() local
1214 data_ptr = header_ptr + sizeof resp; in ib_uverbs_poll_cq()
1216 memset(&resp, 0, sizeof resp); in ib_uverbs_poll_cq()
1217 while (resp.count < cmd.ne) { in ib_uverbs_poll_cq()
1229 ++resp.count; in ib_uverbs_poll_cq()
1232 if (copy_to_user(header_ptr, &resp, sizeof resp)) { in ib_uverbs_poll_cq()
1272 struct ib_uverbs_destroy_cq_resp resp; in ib_uverbs_destroy_cq() local
1286 memset(&resp, 0, sizeof(resp)); in ib_uverbs_destroy_cq()
1287 resp.comp_events_reported = obj->comp_events_reported; in ib_uverbs_destroy_cq()
1288 resp.async_events_reported = obj->uevent.events_reported; in ib_uverbs_destroy_cq()
1292 return uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_destroy_cq()
1307 struct ib_uverbs_ex_create_qp_resp resp = {}; in create_qp() local
1497 resp.base.qpn = qp->qp_num; in create_qp()
1498 resp.base.qp_handle = obj->uevent.uobject.id; in create_qp()
1499 resp.base.max_recv_sge = attr.cap.max_recv_sge; in create_qp()
1500 resp.base.max_send_sge = attr.cap.max_send_sge; in create_qp()
1501 resp.base.max_recv_wr = attr.cap.max_recv_wr; in create_qp()
1502 resp.base.max_send_wr = attr.cap.max_send_wr; in create_qp()
1503 resp.base.max_inline_data = attr.cap.max_inline_data; in create_qp()
1504 resp.response_length = uverbs_response_length(attrs, sizeof(resp)); in create_qp()
1505 return uverbs_response(attrs, &resp, sizeof(resp)); in create_qp()
1576 struct ib_uverbs_create_qp_resp resp = {}; in ib_uverbs_open_qp() local
1629 resp.qpn = qp->qp_num; in ib_uverbs_open_qp()
1630 resp.qp_handle = obj->uevent.uobject.id; in ib_uverbs_open_qp()
1631 return uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_open_qp()
1665 struct ib_uverbs_query_qp_resp resp; in ib_uverbs_query_qp() local
1696 memset(&resp, 0, sizeof resp); in ib_uverbs_query_qp()
1698 resp.qp_state = attr->qp_state; in ib_uverbs_query_qp()
1699 resp.cur_qp_state = attr->cur_qp_state; in ib_uverbs_query_qp()
1700 resp.path_mtu = attr->path_mtu; in ib_uverbs_query_qp()
1701 resp.path_mig_state = attr->path_mig_state; in ib_uverbs_query_qp()
1702 resp.qkey = attr->qkey; in ib_uverbs_query_qp()
1703 resp.rq_psn = attr->rq_psn; in ib_uverbs_query_qp()
1704 resp.sq_psn = attr->sq_psn; in ib_uverbs_query_qp()
1705 resp.dest_qp_num = attr->dest_qp_num; in ib_uverbs_query_qp()
1706 resp.qp_access_flags = attr->qp_access_flags; in ib_uverbs_query_qp()
1707 resp.pkey_index = attr->pkey_index; in ib_uverbs_query_qp()
1708 resp.alt_pkey_index = attr->alt_pkey_index; in ib_uverbs_query_qp()
1709 resp.sq_draining = attr->sq_draining; in ib_uverbs_query_qp()
1710 resp.max_rd_atomic = attr->max_rd_atomic; in ib_uverbs_query_qp()
1711 resp.max_dest_rd_atomic = attr->max_dest_rd_atomic; in ib_uverbs_query_qp()
1712 resp.min_rnr_timer = attr->min_rnr_timer; in ib_uverbs_query_qp()
1713 resp.port_num = attr->port_num; in ib_uverbs_query_qp()
1714 resp.timeout = attr->timeout; in ib_uverbs_query_qp()
1715 resp.retry_cnt = attr->retry_cnt; in ib_uverbs_query_qp()
1716 resp.rnr_retry = attr->rnr_retry; in ib_uverbs_query_qp()
1717 resp.alt_port_num = attr->alt_port_num; in ib_uverbs_query_qp()
1718 resp.alt_timeout = attr->alt_timeout; in ib_uverbs_query_qp()
1720 copy_ah_attr_to_uverbs(&resp.dest, &attr->ah_attr); in ib_uverbs_query_qp()
1721 copy_ah_attr_to_uverbs(&resp.alt_dest, &attr->alt_ah_attr); in ib_uverbs_query_qp()
1723 resp.max_send_wr = init_attr->cap.max_send_wr; in ib_uverbs_query_qp()
1724 resp.max_recv_wr = init_attr->cap.max_recv_wr; in ib_uverbs_query_qp()
1725 resp.max_send_sge = init_attr->cap.max_send_sge; in ib_uverbs_query_qp()
1726 resp.max_recv_sge = init_attr->cap.max_recv_sge; in ib_uverbs_query_qp()
1727 resp.max_inline_data = init_attr->cap.max_inline_data; in ib_uverbs_query_qp()
1728 resp.sq_sig_all = init_attr->sq_sig_type == IB_SIGNAL_ALL_WR; in ib_uverbs_query_qp()
1730 ret = uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_query_qp()
1960 struct ib_uverbs_ex_modify_qp_resp resp = { in ib_uverbs_ex_modify_qp() local
1961 .response_length = uverbs_response_length(attrs, sizeof(resp)) in ib_uverbs_ex_modify_qp()
1980 return uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_ex_modify_qp()
1986 struct ib_uverbs_destroy_qp_resp resp; in ib_uverbs_destroy_qp() local
2000 memset(&resp, 0, sizeof(resp)); in ib_uverbs_destroy_qp()
2001 resp.events_reported = obj->uevent.events_reported; in ib_uverbs_destroy_qp()
2005 return uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_destroy_qp()
2022 struct ib_uverbs_post_send_resp resp; in ib_uverbs_post_send() local
2184 resp.bad_wr = 0; in ib_uverbs_post_send()
2188 ++resp.bad_wr; in ib_uverbs_post_send()
2193 ret2 = uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_post_send()
2316 struct ib_uverbs_post_recv_resp resp; in ib_uverbs_post_recv() local
2338 resp.bad_wr = 0; in ib_uverbs_post_recv()
2345 ++resp.bad_wr; in ib_uverbs_post_recv()
2351 ret2 = uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_post_recv()
2367 struct ib_uverbs_post_srq_recv_resp resp; in ib_uverbs_post_srq_recv() local
2389 resp.bad_wr = 0; in ib_uverbs_post_srq_recv()
2397 ++resp.bad_wr; in ib_uverbs_post_srq_recv()
2402 ret2 = uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_post_srq_recv()
2419 struct ib_uverbs_create_ah_resp resp; in ib_uverbs_create_ah() local
2476 resp.ah_handle = uobj->id; in ib_uverbs_create_ah()
2477 return uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_create_ah()
2911 struct ib_uverbs_ex_create_wq_resp resp = {}; in ib_uverbs_ex_create_wq() local
2977 resp.wq_handle = obj->uevent.uobject.id; in ib_uverbs_ex_create_wq()
2978 resp.max_sge = wq_init_attr.max_sge; in ib_uverbs_ex_create_wq()
2979 resp.max_wr = wq_init_attr.max_wr; in ib_uverbs_ex_create_wq()
2980 resp.wqn = wq->wq_num; in ib_uverbs_ex_create_wq()
2981 resp.response_length = uverbs_response_length(attrs, sizeof(resp)); in ib_uverbs_ex_create_wq()
2982 return uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_ex_create_wq()
2998 struct ib_uverbs_ex_destroy_wq_resp resp = {}; in ib_uverbs_ex_destroy_wq() local
3010 resp.response_length = uverbs_response_length(attrs, sizeof(resp)); in ib_uverbs_ex_destroy_wq()
3016 resp.events_reported = obj->uevent.events_reported; in ib_uverbs_ex_destroy_wq()
3020 return uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_ex_destroy_wq()
3077 struct ib_uverbs_ex_create_rwq_ind_table_resp resp = {}; in ib_uverbs_ex_create_rwq_ind_table() local
3167 resp.ind_tbl_handle = uobj->id; in ib_uverbs_ex_create_rwq_ind_table()
3168 resp.ind_tbl_num = rwq_ind_tbl->ind_tbl_num; in ib_uverbs_ex_create_rwq_ind_table()
3169 resp.response_length = uverbs_response_length(attrs, sizeof(resp)); in ib_uverbs_ex_create_rwq_ind_table()
3170 return uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_ex_create_rwq_ind_table()
3207 struct ib_uverbs_create_flow_resp resp = {}; in ib_uverbs_ex_create_flow() local
3353 resp.flow_handle = uobj->id; in ib_uverbs_ex_create_flow()
3354 return uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_ex_create_flow()
3390 struct ib_uverbs_create_srq_resp resp = {}; in __uverbs_create_xsrq() local
3462 resp.srqn = srq->ext.xrc.srq_num; in __uverbs_create_xsrq()
3474 resp.srq_handle = obj->uevent.uobject.id; in __uverbs_create_xsrq()
3475 resp.max_wr = attr.attr.max_wr; in __uverbs_create_xsrq()
3476 resp.max_sge = attr.attr.max_sge; in __uverbs_create_xsrq()
3477 return uverbs_response(attrs, &resp, sizeof(resp)); in __uverbs_create_xsrq()
3561 struct ib_uverbs_query_srq_resp resp; in ib_uverbs_query_srq() local
3582 memset(&resp, 0, sizeof resp); in ib_uverbs_query_srq()
3584 resp.max_wr = attr.max_wr; in ib_uverbs_query_srq()
3585 resp.max_sge = attr.max_sge; in ib_uverbs_query_srq()
3586 resp.srq_limit = attr.srq_limit; in ib_uverbs_query_srq()
3588 return uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_query_srq()
3594 struct ib_uverbs_destroy_srq_resp resp; in ib_uverbs_destroy_srq() local
3608 memset(&resp, 0, sizeof(resp)); in ib_uverbs_destroy_srq()
3609 resp.events_reported = obj->events_reported; in ib_uverbs_destroy_srq()
3613 return uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_destroy_srq()
3618 struct ib_uverbs_ex_query_device_resp resp = {}; in ib_uverbs_ex_query_device() local
3644 copy_query_dev_fields(ucontext, &resp.base, &attr); in ib_uverbs_ex_query_device()
3646 resp.odp_caps.general_caps = attr.odp_caps.general_caps; in ib_uverbs_ex_query_device()
3647 resp.odp_caps.per_transport_caps.rc_odp_caps = in ib_uverbs_ex_query_device()
3649 resp.odp_caps.per_transport_caps.uc_odp_caps = in ib_uverbs_ex_query_device()
3651 resp.odp_caps.per_transport_caps.ud_odp_caps = in ib_uverbs_ex_query_device()
3653 resp.xrc_odp_caps = attr.odp_caps.per_transport_caps.xrc_odp_caps; in ib_uverbs_ex_query_device()
3655 resp.timestamp_mask = attr.timestamp_mask; in ib_uverbs_ex_query_device()
3656 resp.hca_core_clock = attr.hca_core_clock; in ib_uverbs_ex_query_device()
3657 resp.device_cap_flags_ex = attr.device_cap_flags; in ib_uverbs_ex_query_device()
3658 resp.rss_caps.supported_qpts = attr.rss_caps.supported_qpts; in ib_uverbs_ex_query_device()
3659 resp.rss_caps.max_rwq_indirection_tables = in ib_uverbs_ex_query_device()
3661 resp.rss_caps.max_rwq_indirection_table_size = in ib_uverbs_ex_query_device()
3663 resp.max_wq_type_rq = attr.max_wq_type_rq; in ib_uverbs_ex_query_device()
3664 resp.raw_packet_caps = attr.raw_packet_caps; in ib_uverbs_ex_query_device()
3665 resp.tm_caps.max_rndv_hdr_size = attr.tm_caps.max_rndv_hdr_size; in ib_uverbs_ex_query_device()
3666 resp.tm_caps.max_num_tags = attr.tm_caps.max_num_tags; in ib_uverbs_ex_query_device()
3667 resp.tm_caps.max_ops = attr.tm_caps.max_ops; in ib_uverbs_ex_query_device()
3668 resp.tm_caps.max_sge = attr.tm_caps.max_sge; in ib_uverbs_ex_query_device()
3669 resp.tm_caps.flags = attr.tm_caps.flags; in ib_uverbs_ex_query_device()
3670 resp.cq_moderation_caps.max_cq_moderation_count = in ib_uverbs_ex_query_device()
3672 resp.cq_moderation_caps.max_cq_moderation_period = in ib_uverbs_ex_query_device()
3674 resp.max_dm_size = attr.max_dm_size; in ib_uverbs_ex_query_device()
3675 resp.response_length = uverbs_response_length(attrs, sizeof(resp)); in ib_uverbs_ex_query_device()
3677 return uverbs_response(attrs, &resp, sizeof(resp)); in ib_uverbs_ex_query_device()
3716 #define UAPI_DEF_WRITE_IO(req, resp) \ argument
3721 .write.req_size = sizeof(req), .write.resp_size = sizeof(resp)
3725 #define UAPI_DEF_WRITE_UDATA_IO(req, resp) \ argument
3726 UAPI_DEF_WRITE_IO(req, resp), \
3731 BUILD_BUG_ON_ZERO(offsetof(resp, driver_data) != \
3732 sizeof(resp))
3744 #define UAPI_DEF_WRITE_IO_EX(req, req_last_member, resp, resp_last_member) \ argument
3747 .write.resp_size = offsetofend(resp, resp_last_member)