Lines Matching refs:cmd

47 int ibv_cmd_get_context(struct ibv_context *context, struct ibv_get_context *cmd,  in ibv_cmd_get_context()  argument
54 IBV_INIT_CMD_RESP(cmd, cmd_size, GET_CONTEXT, resp, resp_size); in ibv_cmd_get_context()
56 if (write(context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_get_context()
116 struct ibv_query_device *cmd, size_t cmd_size) in ibv_cmd_query_device() argument
120 IBV_INIT_CMD_RESP(cmd, cmd_size, QUERY_DEVICE, &resp, sizeof resp); in ibv_cmd_query_device()
122 if (write(context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_query_device()
137 struct ibv_query_device_ex *cmd, in ibv_cmd_query_device_ex() argument
158 IBV_INIT_CMD_RESP_EX_V(cmd, cmd_core_size, cmd_size, in ibv_cmd_query_device_ex()
161 cmd->comp_mask = 0; in ibv_cmd_query_device_ex()
162 cmd->reserved = 0; in ibv_cmd_query_device_ex()
165 err = write(context->cmd_fd, cmd, cmd_size); in ibv_cmd_query_device_ex()
246 struct ibv_query_port *cmd, size_t cmd_size) in ibv_cmd_query_port() argument
250 IBV_INIT_CMD_RESP(cmd, cmd_size, QUERY_PORT, &resp, sizeof resp); in ibv_cmd_query_port()
251 cmd->port_num = port_num; in ibv_cmd_query_port()
252 memset(cmd->reserved, 0, sizeof cmd->reserved); in ibv_cmd_query_port()
254 if (write(context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_query_port()
284 struct ibv_alloc_pd *cmd, size_t cmd_size, in ibv_cmd_alloc_pd() argument
287 IBV_INIT_CMD_RESP(cmd, cmd_size, ALLOC_PD, resp, resp_size); in ibv_cmd_alloc_pd()
289 if (write(context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_alloc_pd()
302 struct ibv_dealloc_pd cmd; in ibv_cmd_dealloc_pd() local
304 IBV_INIT_CMD(&cmd, sizeof cmd, DEALLOC_PD); in ibv_cmd_dealloc_pd()
305 cmd.pd_handle = pd->handle; in ibv_cmd_dealloc_pd()
307 if (write(pd->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd) in ibv_cmd_dealloc_pd()
316 struct ibv_open_xrcd *cmd, size_t cmd_size, in ibv_cmd_open_xrcd() argument
319 IBV_INIT_CMD_RESP(cmd, cmd_size, OPEN_XRCD, resp, resp_size); in ibv_cmd_open_xrcd()
328 cmd->fd = attr->fd; in ibv_cmd_open_xrcd()
329 cmd->oflags = attr->oflags; in ibv_cmd_open_xrcd()
330 if (write(context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_open_xrcd()
347 struct ibv_close_xrcd cmd; in ibv_cmd_close_xrcd() local
349 IBV_INIT_CMD(&cmd, sizeof cmd, CLOSE_XRCD); in ibv_cmd_close_xrcd()
350 cmd.xrcd_handle = xrcd->handle; in ibv_cmd_close_xrcd()
352 if (write(xrcd->xrcd.context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd) in ibv_cmd_close_xrcd()
360 struct ibv_mr *mr, struct ibv_reg_mr *cmd, in ibv_cmd_reg_mr() argument
365 IBV_INIT_CMD_RESP(cmd, cmd_size, REG_MR, resp, resp_size); in ibv_cmd_reg_mr()
367 cmd->start = (uintptr_t) addr; in ibv_cmd_reg_mr()
368 cmd->length = length; in ibv_cmd_reg_mr()
369 cmd->hca_va = hca_va; in ibv_cmd_reg_mr()
370 cmd->pd_handle = pd->handle; in ibv_cmd_reg_mr()
371 cmd->access_flags = access; in ibv_cmd_reg_mr()
373 if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_reg_mr()
388 struct ibv_pd *pd, struct ibv_rereg_mr *cmd, in ibv_cmd_rereg_mr() argument
392 IBV_INIT_CMD_RESP(cmd, cmd_sz, REREG_MR, resp, resp_sz); in ibv_cmd_rereg_mr()
394 cmd->mr_handle = mr->handle; in ibv_cmd_rereg_mr()
395 cmd->flags = flags; in ibv_cmd_rereg_mr()
396 cmd->start = (uintptr_t)addr; in ibv_cmd_rereg_mr()
397 cmd->length = length; in ibv_cmd_rereg_mr()
398 cmd->hca_va = hca_va; in ibv_cmd_rereg_mr()
399 cmd->pd_handle = (flags & IBV_REREG_MR_CHANGE_PD) ? pd->handle : 0; in ibv_cmd_rereg_mr()
400 cmd->access_flags = access; in ibv_cmd_rereg_mr()
402 if (write(mr->context->cmd_fd, cmd, cmd_sz) != cmd_sz) in ibv_cmd_rereg_mr()
417 struct ibv_dereg_mr cmd; in ibv_cmd_dereg_mr() local
419 IBV_INIT_CMD(&cmd, sizeof cmd, DEREG_MR); in ibv_cmd_dereg_mr()
420 cmd.mr_handle = mr->handle; in ibv_cmd_dereg_mr()
422 if (write(mr->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd) in ibv_cmd_dereg_mr()
429 struct ibv_mw *mw, struct ibv_alloc_mw *cmd, in ibv_cmd_alloc_mw() argument
433 IBV_INIT_CMD_RESP(cmd, cmd_size, ALLOC_MW, resp, resp_size); in ibv_cmd_alloc_mw()
434 cmd->pd_handle = pd->handle; in ibv_cmd_alloc_mw()
435 cmd->mw_type = type; in ibv_cmd_alloc_mw()
436 memset(cmd->reserved, 0, sizeof(cmd->reserved)); in ibv_cmd_alloc_mw()
438 if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_alloc_mw()
453 struct ibv_dealloc_mw *cmd, size_t cmd_size) in ibv_cmd_dealloc_mw() argument
455 IBV_INIT_CMD(cmd, cmd_size, DEALLOC_MW); in ibv_cmd_dealloc_mw()
456 cmd->mw_handle = mw->handle; in ibv_cmd_dealloc_mw()
457 cmd->reserved = 0; in ibv_cmd_dealloc_mw()
459 if (write(mw->context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_dealloc_mw()
468 struct ibv_create_cq *cmd, size_t cmd_size, in ibv_cmd_create_cq() argument
471 IBV_INIT_CMD_RESP(cmd, cmd_size, CREATE_CQ, resp, resp_size); in ibv_cmd_create_cq()
472 cmd->user_handle = (uintptr_t) cq; in ibv_cmd_create_cq()
473 cmd->cqe = cqe; in ibv_cmd_create_cq()
474 cmd->comp_vector = comp_vector; in ibv_cmd_create_cq()
475 cmd->comp_channel = channel ? channel->fd : -1; in ibv_cmd_create_cq()
476 cmd->reserved = 0; in ibv_cmd_create_cq()
478 if (write(context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_create_cq()
493 struct ibv_create_cq_ex *cmd, in ibv_cmd_create_cq_ex() argument
502 memset(cmd, 0, cmd_core_size); in ibv_cmd_create_cq_ex()
503 IBV_INIT_CMD_RESP_EX_V(cmd, cmd_core_size, cmd_size, CREATE_CQ_EX, resp, in ibv_cmd_create_cq_ex()
509 cmd->user_handle = (uintptr_t)cq; in ibv_cmd_create_cq_ex()
510 cmd->cqe = cq_attr->cqe; in ibv_cmd_create_cq_ex()
511 cmd->comp_vector = cq_attr->comp_vector; in ibv_cmd_create_cq_ex()
512 cmd->comp_channel = cq_attr->channel ? cq_attr->channel->fd : -1; in ibv_cmd_create_cq_ex()
513 cmd->comp_mask = 0; in ibv_cmd_create_cq_ex()
516 sizeof(cmd->flags)) { in ibv_cmd_create_cq_ex()
522 cmd->flags |= IBV_CREATE_CQ_EX_KERNEL_FLAG_COMPLETION_TIMESTAMP; in ibv_cmd_create_cq_ex()
525 err = write(context->cmd_fd, cmd, cmd_size); in ibv_cmd_create_cq_ex()
540 struct ibv_poll_cq cmd; in ibv_cmd_poll_cq() local
551 IBV_INIT_CMD_RESP(&cmd, sizeof cmd, POLL_CQ, resp, rsize); in ibv_cmd_poll_cq()
552 cmd.cq_handle = ibcq->handle; in ibv_cmd_poll_cq()
553 cmd.ne = ne; in ibv_cmd_poll_cq()
555 if (write(ibcq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd) { in ibv_cmd_poll_cq()
587 struct ibv_req_notify_cq cmd; in ibv_cmd_req_notify_cq() local
589 IBV_INIT_CMD(&cmd, sizeof cmd, REQ_NOTIFY_CQ); in ibv_cmd_req_notify_cq()
590 cmd.cq_handle = ibcq->handle; in ibv_cmd_req_notify_cq()
591 cmd.solicited = !!solicited_only; in ibv_cmd_req_notify_cq()
593 if (write(ibcq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd) in ibv_cmd_req_notify_cq()
600 struct ibv_resize_cq *cmd, size_t cmd_size, in ibv_cmd_resize_cq() argument
603 IBV_INIT_CMD_RESP(cmd, cmd_size, RESIZE_CQ, resp, resp_size); in ibv_cmd_resize_cq()
604 cmd->cq_handle = cq->handle; in ibv_cmd_resize_cq()
605 cmd->cqe = cqe; in ibv_cmd_resize_cq()
607 if (write(cq->context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_resize_cq()
619 struct ibv_destroy_cq cmd; in ibv_cmd_destroy_cq() local
622 IBV_INIT_CMD_RESP(&cmd, sizeof cmd, DESTROY_CQ, &resp, sizeof resp); in ibv_cmd_destroy_cq()
623 cmd.cq_handle = cq->handle; in ibv_cmd_destroy_cq()
624 cmd.reserved = 0; in ibv_cmd_destroy_cq()
626 if (write(cq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd) in ibv_cmd_destroy_cq()
642 struct ibv_create_srq *cmd, size_t cmd_size, in ibv_cmd_create_srq() argument
645 IBV_INIT_CMD_RESP(cmd, cmd_size, CREATE_SRQ, resp, resp_size); in ibv_cmd_create_srq()
646 cmd->user_handle = (uintptr_t) srq; in ibv_cmd_create_srq()
647 cmd->pd_handle = pd->handle; in ibv_cmd_create_srq()
648 cmd->max_wr = attr->attr.max_wr; in ibv_cmd_create_srq()
649 cmd->max_sge = attr->attr.max_sge; in ibv_cmd_create_srq()
650 cmd->srq_limit = attr->attr.srq_limit; in ibv_cmd_create_srq()
652 if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_create_srq()
678 struct ibv_create_xsrq *cmd, size_t cmd_size, in ibv_cmd_create_srq_ex() argument
683 IBV_INIT_CMD_RESP(cmd, cmd_size, CREATE_XSRQ, resp, resp_size); in ibv_cmd_create_srq_ex()
691 cmd->user_handle = (uintptr_t) srq; in ibv_cmd_create_srq_ex()
692 cmd->pd_handle = attr_ex->pd->handle; in ibv_cmd_create_srq_ex()
693 cmd->max_wr = attr_ex->attr.max_wr; in ibv_cmd_create_srq_ex()
694 cmd->max_sge = attr_ex->attr.max_sge; in ibv_cmd_create_srq_ex()
695 cmd->srq_limit = attr_ex->attr.srq_limit; in ibv_cmd_create_srq_ex()
697 cmd->srq_type = (attr_ex->comp_mask & IBV_SRQ_INIT_ATTR_TYPE) ? in ibv_cmd_create_srq_ex()
704 cmd->xrcd_handle = vxrcd->handle; in ibv_cmd_create_srq_ex()
705 cmd->cq_handle = attr_ex->cq->handle; in ibv_cmd_create_srq_ex()
708 if (write(context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_create_srq_ex()
756 struct ibv_modify_srq_v3 *cmd; in ibv_cmd_modify_srq_v3() local
759 cmd_size = sizeof *cmd + new_cmd_size - sizeof *new_cmd; in ibv_cmd_modify_srq_v3()
760 cmd = alloca(cmd_size); in ibv_cmd_modify_srq_v3()
761 memcpy(cmd->driver_data, new_cmd->driver_data, new_cmd_size - sizeof *new_cmd); in ibv_cmd_modify_srq_v3()
763 IBV_INIT_CMD(cmd, cmd_size, MODIFY_SRQ); in ibv_cmd_modify_srq_v3()
765 cmd->srq_handle = srq->handle; in ibv_cmd_modify_srq_v3()
766 cmd->attr_mask = srq_attr_mask; in ibv_cmd_modify_srq_v3()
767 cmd->max_wr = srq_attr->max_wr; in ibv_cmd_modify_srq_v3()
768 cmd->srq_limit = srq_attr->srq_limit; in ibv_cmd_modify_srq_v3()
769 cmd->max_sge = 0; in ibv_cmd_modify_srq_v3()
770 cmd->reserved = 0; in ibv_cmd_modify_srq_v3()
772 if (write(srq->context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_modify_srq_v3()
781 struct ibv_modify_srq *cmd, size_t cmd_size) in ibv_cmd_modify_srq() argument
785 cmd, cmd_size); in ibv_cmd_modify_srq()
787 IBV_INIT_CMD(cmd, cmd_size, MODIFY_SRQ); in ibv_cmd_modify_srq()
789 cmd->srq_handle = srq->handle; in ibv_cmd_modify_srq()
790 cmd->attr_mask = srq_attr_mask; in ibv_cmd_modify_srq()
791 cmd->max_wr = srq_attr->max_wr; in ibv_cmd_modify_srq()
792 cmd->srq_limit = srq_attr->srq_limit; in ibv_cmd_modify_srq()
794 if (write(srq->context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_modify_srq()
801 struct ibv_query_srq *cmd, size_t cmd_size) in ibv_cmd_query_srq() argument
805 IBV_INIT_CMD_RESP(cmd, cmd_size, QUERY_SRQ, &resp, sizeof resp); in ibv_cmd_query_srq()
806 cmd->srq_handle = srq->handle; in ibv_cmd_query_srq()
807 cmd->reserved = 0; in ibv_cmd_query_srq()
809 if (write(srq->context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_query_srq()
823 struct ibv_destroy_srq cmd; in ibv_cmd_destroy_srq() local
826 IBV_INIT_CMD_RESP(&cmd, sizeof cmd, DESTROY_SRQ, &resp, sizeof resp); in ibv_cmd_destroy_srq()
827 cmd.srq_handle = srq->handle; in ibv_cmd_destroy_srq()
828 cmd.reserved = 0; in ibv_cmd_destroy_srq()
830 if (write(srq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd) in ibv_cmd_destroy_srq()
846 struct ibv_create_qp_common *cmd) in create_qp_ex_common() argument
848 cmd->user_handle = (uintptr_t)qp; in create_qp_ex_common()
852 cmd->pd_handle = vxrcd->handle; in create_qp_ex_common()
857 cmd->pd_handle = qp_attr->pd->handle; in create_qp_ex_common()
859 if (cmd->max_recv_wr || cmd->max_recv_sge || in create_qp_ex_common()
860 cmd->recv_cq_handle || qp_attr->srq) in create_qp_ex_common()
865 cmd->send_cq_handle = qp_attr->send_cq->handle; in create_qp_ex_common()
867 cmd->send_cq_handle = qp_attr->send_cq->handle; in create_qp_ex_common()
870 cmd->recv_cq_handle = qp_attr->recv_cq->handle; in create_qp_ex_common()
871 cmd->srq_handle = qp_attr->srq ? qp_attr->srq->handle : in create_qp_ex_common()
877 cmd->max_send_wr = qp_attr->cap.max_send_wr; in create_qp_ex_common()
878 cmd->max_recv_wr = qp_attr->cap.max_recv_wr; in create_qp_ex_common()
879 cmd->max_send_sge = qp_attr->cap.max_send_sge; in create_qp_ex_common()
880 cmd->max_recv_sge = qp_attr->cap.max_recv_sge; in create_qp_ex_common()
881 cmd->max_inline_data = qp_attr->cap.max_inline_data; in create_qp_ex_common()
882 cmd->sq_sig_all = qp_attr->sq_sig_all; in create_qp_ex_common()
883 cmd->qp_type = qp_attr->qp_type; in create_qp_ex_common()
884 cmd->is_srq = !!qp_attr->srq; in create_qp_ex_common()
885 cmd->reserved = 0; in create_qp_ex_common()
936 struct ibv_create_qp_ex *cmd, in ibv_cmd_create_qp_ex2() argument
954 memset(cmd, 0, cmd_core_size); in ibv_cmd_create_qp_ex2()
956 IBV_INIT_CMD_RESP_EX_V(cmd, cmd_core_size, cmd_size, CREATE_QP_EX, resp, in ibv_cmd_create_qp_ex2()
959 err = create_qp_ex_common(qp, qp_attr, vxrcd, &cmd->base); in ibv_cmd_create_qp_ex2()
969 cmd->create_flags = qp_attr->create_flags; in ibv_cmd_create_qp_ex2()
974 sizeof(cmd->ind_tbl_handle)) in ibv_cmd_create_qp_ex2()
976 cmd->ind_tbl_handle = qp_attr->rwq_ind_tbl->ind_tbl_handle; in ibv_cmd_create_qp_ex2()
977 cmd->comp_mask = IBV_CREATE_QP_EX_KERNEL_MASK_IND_TABLE; in ibv_cmd_create_qp_ex2()
980 err = write(context->cmd_fd, cmd, cmd_size); in ibv_cmd_create_qp_ex2()
995 struct ibv_create_qp *cmd, size_t cmd_size, in ibv_cmd_create_qp_ex() argument
1001 IBV_INIT_CMD_RESP(cmd, cmd_size, CREATE_QP, resp, resp_size); in ibv_cmd_create_qp_ex()
1007 (struct ibv_create_qp_common *)&cmd->user_handle); in ibv_cmd_create_qp_ex()
1011 if (write(context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_create_qp_ex()
1039 struct ibv_create_qp *cmd, size_t cmd_size, in ibv_cmd_create_qp() argument
1042 IBV_INIT_CMD_RESP(cmd, cmd_size, CREATE_QP, resp, resp_size); in ibv_cmd_create_qp()
1044 cmd->user_handle = (uintptr_t) qp; in ibv_cmd_create_qp()
1045 cmd->pd_handle = pd->handle; in ibv_cmd_create_qp()
1046 cmd->send_cq_handle = attr->send_cq->handle; in ibv_cmd_create_qp()
1047 cmd->recv_cq_handle = attr->recv_cq->handle; in ibv_cmd_create_qp()
1048 cmd->srq_handle = attr->srq ? attr->srq->handle : 0; in ibv_cmd_create_qp()
1049 cmd->max_send_wr = attr->cap.max_send_wr; in ibv_cmd_create_qp()
1050 cmd->max_recv_wr = attr->cap.max_recv_wr; in ibv_cmd_create_qp()
1051 cmd->max_send_sge = attr->cap.max_send_sge; in ibv_cmd_create_qp()
1052 cmd->max_recv_sge = attr->cap.max_recv_sge; in ibv_cmd_create_qp()
1053 cmd->max_inline_data = attr->cap.max_inline_data; in ibv_cmd_create_qp()
1054 cmd->sq_sig_all = attr->sq_sig_all; in ibv_cmd_create_qp()
1055 cmd->qp_type = attr->qp_type; in ibv_cmd_create_qp()
1056 cmd->is_srq = !!attr->srq; in ibv_cmd_create_qp()
1057 cmd->reserved = 0; in ibv_cmd_create_qp()
1059 if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_create_qp()
1098 struct ibv_open_qp *cmd, size_t cmd_size, in ibv_cmd_open_qp() argument
1102 IBV_INIT_CMD_RESP(cmd, cmd_size, OPEN_QP, resp, resp_size); in ibv_cmd_open_qp()
1113 cmd->user_handle = (uintptr_t) qp; in ibv_cmd_open_qp()
1114 cmd->pd_handle = xrcd->handle; in ibv_cmd_open_qp()
1115 cmd->qpn = attr->qp_num; in ibv_cmd_open_qp()
1116 cmd->qp_type = attr->qp_type; in ibv_cmd_open_qp()
1118 if (write(context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_open_qp()
1148 struct ibv_query_qp *cmd, size_t cmd_size) in ibv_cmd_query_qp() argument
1159 IBV_INIT_CMD_RESP(cmd, cmd_size, QUERY_QP, &resp, sizeof resp); in ibv_cmd_query_qp()
1160 cmd->qp_handle = qp->handle; in ibv_cmd_query_qp()
1161 cmd->attr_mask = attr_mask; in ibv_cmd_query_qp()
1163 if (write(qp->context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_query_qp()
1236 struct ibv_modify_qp_common *cmd) in copy_modify_qp_fields() argument
1238 cmd->qp_handle = qp->handle; in copy_modify_qp_fields()
1239 cmd->attr_mask = attr_mask; in copy_modify_qp_fields()
1242 cmd->qp_state = attr->qp_state; in copy_modify_qp_fields()
1244 cmd->cur_qp_state = attr->cur_qp_state; in copy_modify_qp_fields()
1246 cmd->en_sqd_async_notify = attr->en_sqd_async_notify; in copy_modify_qp_fields()
1248 cmd->qp_access_flags = attr->qp_access_flags; in copy_modify_qp_fields()
1250 cmd->pkey_index = attr->pkey_index; in copy_modify_qp_fields()
1252 cmd->port_num = attr->port_num; in copy_modify_qp_fields()
1254 cmd->qkey = attr->qkey; in copy_modify_qp_fields()
1257 memcpy(cmd->dest.dgid, attr->ah_attr.grh.dgid.raw, 16); in copy_modify_qp_fields()
1258 cmd->dest.flow_label = attr->ah_attr.grh.flow_label; in copy_modify_qp_fields()
1259 cmd->dest.dlid = attr->ah_attr.dlid; in copy_modify_qp_fields()
1260 cmd->dest.reserved = 0; in copy_modify_qp_fields()
1261 cmd->dest.sgid_index = attr->ah_attr.grh.sgid_index; in copy_modify_qp_fields()
1262 cmd->dest.hop_limit = attr->ah_attr.grh.hop_limit; in copy_modify_qp_fields()
1263 cmd->dest.traffic_class = attr->ah_attr.grh.traffic_class; in copy_modify_qp_fields()
1264 cmd->dest.sl = attr->ah_attr.sl; in copy_modify_qp_fields()
1265 cmd->dest.src_path_bits = attr->ah_attr.src_path_bits; in copy_modify_qp_fields()
1266 cmd->dest.static_rate = attr->ah_attr.static_rate; in copy_modify_qp_fields()
1267 cmd->dest.is_global = attr->ah_attr.is_global; in copy_modify_qp_fields()
1268 cmd->dest.port_num = attr->ah_attr.port_num; in copy_modify_qp_fields()
1272 cmd->path_mtu = attr->path_mtu; in copy_modify_qp_fields()
1274 cmd->timeout = attr->timeout; in copy_modify_qp_fields()
1276 cmd->retry_cnt = attr->retry_cnt; in copy_modify_qp_fields()
1278 cmd->rnr_retry = attr->rnr_retry; in copy_modify_qp_fields()
1280 cmd->rq_psn = attr->rq_psn; in copy_modify_qp_fields()
1282 cmd->max_rd_atomic = attr->max_rd_atomic; in copy_modify_qp_fields()
1285 cmd->alt_pkey_index = attr->alt_pkey_index; in copy_modify_qp_fields()
1286 cmd->alt_port_num = attr->alt_port_num; in copy_modify_qp_fields()
1287 cmd->alt_timeout = attr->alt_timeout; in copy_modify_qp_fields()
1289 memcpy(cmd->alt_dest.dgid, attr->alt_ah_attr.grh.dgid.raw, 16); in copy_modify_qp_fields()
1290 cmd->alt_dest.flow_label = attr->alt_ah_attr.grh.flow_label; in copy_modify_qp_fields()
1291 cmd->alt_dest.dlid = attr->alt_ah_attr.dlid; in copy_modify_qp_fields()
1292 cmd->alt_dest.reserved = 0; in copy_modify_qp_fields()
1293 cmd->alt_dest.sgid_index = attr->alt_ah_attr.grh.sgid_index; in copy_modify_qp_fields()
1294 cmd->alt_dest.hop_limit = attr->alt_ah_attr.grh.hop_limit; in copy_modify_qp_fields()
1295 cmd->alt_dest.traffic_class = in copy_modify_qp_fields()
1297 cmd->alt_dest.sl = attr->alt_ah_attr.sl; in copy_modify_qp_fields()
1298 cmd->alt_dest.src_path_bits = attr->alt_ah_attr.src_path_bits; in copy_modify_qp_fields()
1299 cmd->alt_dest.static_rate = attr->alt_ah_attr.static_rate; in copy_modify_qp_fields()
1300 cmd->alt_dest.is_global = attr->alt_ah_attr.is_global; in copy_modify_qp_fields()
1301 cmd->alt_dest.port_num = attr->alt_ah_attr.port_num; in copy_modify_qp_fields()
1305 cmd->min_rnr_timer = attr->min_rnr_timer; in copy_modify_qp_fields()
1307 cmd->sq_psn = attr->sq_psn; in copy_modify_qp_fields()
1309 cmd->max_dest_rd_atomic = attr->max_dest_rd_atomic; in copy_modify_qp_fields()
1311 cmd->path_mig_state = attr->path_mig_state; in copy_modify_qp_fields()
1313 cmd->dest_qp_num = attr->dest_qp_num; in copy_modify_qp_fields()
1315 cmd->reserved[0] = cmd->reserved[1] = 0; in copy_modify_qp_fields()
1320 struct ibv_modify_qp *cmd, size_t cmd_size) in ibv_cmd_modify_qp() argument
1329 IBV_INIT_CMD(cmd, cmd_size, MODIFY_QP); in ibv_cmd_modify_qp()
1331 copy_modify_qp_fields(qp, attr, attr_mask, &cmd->base); in ibv_cmd_modify_qp()
1333 if (write(qp->context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_modify_qp()
1340 int attr_mask, struct ibv_modify_qp_ex *cmd, in ibv_cmd_modify_qp_ex() argument
1349 IBV_INIT_CMD_RESP_EX_V(cmd, cmd_core_size, cmd_size, MODIFY_QP_EX, in ibv_cmd_modify_qp_ex()
1352 copy_modify_qp_fields(qp, attr, attr_mask, &cmd->base); in ibv_cmd_modify_qp_ex()
1356 sizeof(cmd->rate_limit)) in ibv_cmd_modify_qp_ex()
1357 cmd->rate_limit = attr->rate_limit; in ibv_cmd_modify_qp_ex()
1362 if (write(qp->context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_modify_qp_ex()
1373 struct ibv_post_send *cmd; in ibv_cmd_post_send() local
1388 cmd_size = sizeof *cmd + wr_count * sizeof *n + sge_count * sizeof *s; in ibv_cmd_post_send()
1389 cmd = alloca(cmd_size); in ibv_cmd_post_send()
1391 IBV_INIT_CMD_RESP(cmd, cmd_size, POST_SEND, &resp, sizeof resp); in ibv_cmd_post_send()
1392 cmd->qp_handle = ibqp->handle; in ibv_cmd_post_send()
1393 cmd->wr_count = wr_count; in ibv_cmd_post_send()
1394 cmd->sge_count = sge_count; in ibv_cmd_post_send()
1395 cmd->wqe_size = sizeof *n; in ibv_cmd_post_send()
1397 n = (struct ibv_kern_send_wr *) ((void *) cmd + sizeof *cmd); in ibv_cmd_post_send()
1443 if (write(ibqp->context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_post_send()
1463 struct ibv_post_recv *cmd; in ibv_cmd_post_recv() local
1478 cmd_size = sizeof *cmd + wr_count * sizeof *n + sge_count * sizeof *s; in ibv_cmd_post_recv()
1479 cmd = alloca(cmd_size); in ibv_cmd_post_recv()
1481 IBV_INIT_CMD_RESP(cmd, cmd_size, POST_RECV, &resp, sizeof resp); in ibv_cmd_post_recv()
1482 cmd->qp_handle = ibqp->handle; in ibv_cmd_post_recv()
1483 cmd->wr_count = wr_count; in ibv_cmd_post_recv()
1484 cmd->sge_count = sge_count; in ibv_cmd_post_recv()
1485 cmd->wqe_size = sizeof *n; in ibv_cmd_post_recv()
1487 n = (struct ibv_kern_recv_wr *) ((void *) cmd + sizeof *cmd); in ibv_cmd_post_recv()
1504 if (write(ibqp->context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_post_recv()
1524 struct ibv_post_srq_recv *cmd; in ibv_cmd_post_srq_recv() local
1539 cmd_size = sizeof *cmd + wr_count * sizeof *n + sge_count * sizeof *s; in ibv_cmd_post_srq_recv()
1540 cmd = alloca(cmd_size); in ibv_cmd_post_srq_recv()
1542 IBV_INIT_CMD_RESP(cmd, cmd_size, POST_SRQ_RECV, &resp, sizeof resp); in ibv_cmd_post_srq_recv()
1543 cmd->srq_handle = srq->handle; in ibv_cmd_post_srq_recv()
1544 cmd->wr_count = wr_count; in ibv_cmd_post_srq_recv()
1545 cmd->sge_count = sge_count; in ibv_cmd_post_srq_recv()
1546 cmd->wqe_size = sizeof *n; in ibv_cmd_post_srq_recv()
1548 n = (struct ibv_kern_recv_wr *) ((void *) cmd + sizeof *cmd); in ibv_cmd_post_srq_recv()
1565 if (write(srq->context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_post_srq_recv()
1587 struct ibv_create_ah cmd; in ibv_cmd_create_ah() local
1589 IBV_INIT_CMD_RESP(&cmd, sizeof cmd, CREATE_AH, resp, resp_size); in ibv_cmd_create_ah()
1590 cmd.user_handle = (uintptr_t) ah; in ibv_cmd_create_ah()
1591 cmd.pd_handle = pd->handle; in ibv_cmd_create_ah()
1592 cmd.attr.dlid = attr->dlid; in ibv_cmd_create_ah()
1593 cmd.attr.sl = attr->sl; in ibv_cmd_create_ah()
1594 cmd.attr.src_path_bits = attr->src_path_bits; in ibv_cmd_create_ah()
1595 cmd.attr.static_rate = attr->static_rate; in ibv_cmd_create_ah()
1596 cmd.attr.is_global = attr->is_global; in ibv_cmd_create_ah()
1597 cmd.attr.port_num = attr->port_num; in ibv_cmd_create_ah()
1598 cmd.attr.grh.flow_label = attr->grh.flow_label; in ibv_cmd_create_ah()
1599 cmd.attr.grh.sgid_index = attr->grh.sgid_index; in ibv_cmd_create_ah()
1600 cmd.attr.grh.hop_limit = attr->grh.hop_limit; in ibv_cmd_create_ah()
1601 cmd.attr.grh.traffic_class = attr->grh.traffic_class; in ibv_cmd_create_ah()
1602 memcpy(cmd.attr.grh.dgid, attr->grh.dgid.raw, 16); in ibv_cmd_create_ah()
1604 if (write(pd->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd) in ibv_cmd_create_ah()
1617 struct ibv_destroy_ah cmd; in ibv_cmd_destroy_ah() local
1619 IBV_INIT_CMD(&cmd, sizeof cmd, DESTROY_AH); in ibv_cmd_destroy_ah()
1620 cmd.ah_handle = ah->handle; in ibv_cmd_destroy_ah()
1622 if (write(ah->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd) in ibv_cmd_destroy_ah()
1630 struct ibv_destroy_qp cmd; in ibv_cmd_destroy_qp() local
1633 IBV_INIT_CMD_RESP(&cmd, sizeof cmd, DESTROY_QP, &resp, sizeof resp); in ibv_cmd_destroy_qp()
1634 cmd.qp_handle = qp->handle; in ibv_cmd_destroy_qp()
1635 cmd.reserved = 0; in ibv_cmd_destroy_qp()
1637 if (write(qp->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd) in ibv_cmd_destroy_qp()
1652 struct ibv_attach_mcast cmd; in ibv_cmd_attach_mcast() local
1654 IBV_INIT_CMD(&cmd, sizeof cmd, ATTACH_MCAST); in ibv_cmd_attach_mcast()
1655 memcpy(cmd.gid, gid->raw, sizeof cmd.gid); in ibv_cmd_attach_mcast()
1656 cmd.qp_handle = qp->handle; in ibv_cmd_attach_mcast()
1657 cmd.mlid = lid; in ibv_cmd_attach_mcast()
1658 cmd.reserved = 0; in ibv_cmd_attach_mcast()
1660 if (write(qp->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd) in ibv_cmd_attach_mcast()
1668 struct ibv_detach_mcast cmd; in ibv_cmd_detach_mcast() local
1670 IBV_INIT_CMD(&cmd, sizeof cmd, DETACH_MCAST); in ibv_cmd_detach_mcast()
1671 memcpy(cmd.gid, gid->raw, sizeof cmd.gid); in ibv_cmd_detach_mcast()
1672 cmd.qp_handle = qp->handle; in ibv_cmd_detach_mcast()
1673 cmd.mlid = lid; in ibv_cmd_detach_mcast()
1674 cmd.reserved = 0; in ibv_cmd_detach_mcast()
1676 if (write(qp->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd) in ibv_cmd_detach_mcast()
1838 struct ibv_create_flow *cmd; in ibv_cmd_create_flow() local
1847 cmd_size = sizeof(*cmd) + (flow_attr->num_of_specs * in ibv_cmd_create_flow()
1849 cmd = alloca(cmd_size); in ibv_cmd_create_flow()
1853 memset(cmd, 0, cmd_size); in ibv_cmd_create_flow()
1855 cmd->qp_handle = qp->handle; in ibv_cmd_create_flow()
1857 cmd->flow_attr.type = flow_attr->type; in ibv_cmd_create_flow()
1858 cmd->flow_attr.priority = flow_attr->priority; in ibv_cmd_create_flow()
1859 cmd->flow_attr.num_of_specs = flow_attr->num_of_specs; in ibv_cmd_create_flow()
1860 cmd->flow_attr.port = flow_attr->port; in ibv_cmd_create_flow()
1861 cmd->flow_attr.flags = flow_attr->flags; in ibv_cmd_create_flow()
1863 kern_spec = cmd + 1; in ibv_cmd_create_flow()
1871 cmd->flow_attr.size += in ibv_cmd_create_flow()
1877 written_size = sizeof(*cmd) + cmd->flow_attr.size; in ibv_cmd_create_flow()
1878 IBV_INIT_CMD_RESP_EX_VCMD(cmd, written_size, written_size, CREATE_FLOW, in ibv_cmd_create_flow()
1880 if (write(qp->context->cmd_fd, cmd, written_size) != written_size) in ibv_cmd_create_flow()
1895 struct ibv_destroy_flow cmd; in ibv_cmd_destroy_flow() local
1898 memset(&cmd, 0, sizeof(cmd)); in ibv_cmd_destroy_flow()
1899 IBV_INIT_CMD_EX(&cmd, sizeof(cmd), DESTROY_FLOW); in ibv_cmd_destroy_flow()
1900 cmd.flow_handle = flow_id->handle; in ibv_cmd_destroy_flow()
1902 if (write(flow_id->context->cmd_fd, &cmd, sizeof(cmd)) != sizeof(cmd)) in ibv_cmd_destroy_flow()
1911 struct ibv_create_wq *cmd, in ibv_cmd_create_wq() argument
1923 IBV_INIT_CMD_RESP_EX_V(cmd, cmd_core_size, cmd_size, in ibv_cmd_create_wq()
1927 cmd->user_handle = (uintptr_t)wq; in ibv_cmd_create_wq()
1928 cmd->pd_handle = wq_init_attr->pd->handle; in ibv_cmd_create_wq()
1929 cmd->cq_handle = wq_init_attr->cq->handle; in ibv_cmd_create_wq()
1930 cmd->wq_type = wq_init_attr->wq_type; in ibv_cmd_create_wq()
1931 cmd->max_sge = wq_init_attr->max_sge; in ibv_cmd_create_wq()
1932 cmd->max_wr = wq_init_attr->max_wr; in ibv_cmd_create_wq()
1933 cmd->comp_mask = 0; in ibv_cmd_create_wq()
1936 sizeof(cmd->create_flags)) { in ibv_cmd_create_wq()
1940 cmd->create_flags = wq_init_attr->create_flags; in ibv_cmd_create_wq()
1944 err = write(context->cmd_fd, cmd, cmd_size); in ibv_cmd_create_wq()
1966 struct ibv_modify_wq *cmd, size_t cmd_core_size, in ibv_cmd_modify_wq() argument
1972 memset(cmd, 0, cmd_core_size); in ibv_cmd_modify_wq()
1973 IBV_INIT_CMD_EX(cmd, cmd_size, MODIFY_WQ); in ibv_cmd_modify_wq()
1975 cmd->curr_wq_state = attr->curr_wq_state; in ibv_cmd_modify_wq()
1976 cmd->wq_state = attr->wq_state; in ibv_cmd_modify_wq()
1978 sizeof(cmd->flags_mask)) { in ibv_cmd_modify_wq()
1982 cmd->flags = attr->flags; in ibv_cmd_modify_wq()
1983 cmd->flags_mask = attr->flags_mask; in ibv_cmd_modify_wq()
1986 cmd->wq_handle = wq->handle; in ibv_cmd_modify_wq()
1987 cmd->attr_mask = attr->attr_mask; in ibv_cmd_modify_wq()
1989 if (write(wq->context->cmd_fd, cmd, cmd_size) != cmd_size) in ibv_cmd_modify_wq()
2000 struct ibv_destroy_wq cmd; in ibv_cmd_destroy_wq() local
2004 memset(&cmd, 0, sizeof(cmd)); in ibv_cmd_destroy_wq()
2007 IBV_INIT_CMD_RESP_EX(&cmd, sizeof(cmd), DESTROY_WQ, &resp, sizeof(resp)); in ibv_cmd_destroy_wq()
2008 cmd.wq_handle = wq->handle; in ibv_cmd_destroy_wq()
2010 if (write(wq->context->cmd_fd, &cmd, sizeof(cmd)) != sizeof(cmd)) in ibv_cmd_destroy_wq()
2027 struct ibv_create_rwq_ind_table *cmd, in ibv_cmd_create_rwq_ind_table() argument
2042 alloc_tbl_size = cmd_core_size - sizeof(*cmd); in ibv_cmd_create_rwq_ind_table()
2052 tbl_start = (uint32_t *)((uint8_t *)cmd + sizeof(*cmd)); in ibv_cmd_create_rwq_ind_table()
2056 IBV_INIT_CMD_RESP_EX_V(cmd, cmd_core_size, cmd_size, in ibv_cmd_create_rwq_ind_table()
2059 cmd->log_ind_tbl_size = init_attr->log_ind_tbl_size; in ibv_cmd_create_rwq_ind_table()
2060 cmd->comp_mask = 0; in ibv_cmd_create_rwq_ind_table()
2062 err = write(context->cmd_fd, cmd, cmd_size); in ibv_cmd_create_rwq_ind_table()
2079 struct ibv_destroy_rwq_ind_table cmd; in ibv_cmd_destroy_rwq_ind_table() local
2082 memset(&cmd, 0, sizeof(cmd)); in ibv_cmd_destroy_rwq_ind_table()
2083 IBV_INIT_CMD_EX(&cmd, sizeof(cmd), DESTROY_RWQ_IND_TBL); in ibv_cmd_destroy_rwq_ind_table()
2084 cmd.ind_tbl_handle = rwq_ind_table->ind_tbl_handle; in ibv_cmd_destroy_rwq_ind_table()
2086 if (write(rwq_ind_table->context->cmd_fd, &cmd, sizeof(cmd)) != sizeof(cmd)) in ibv_cmd_destroy_rwq_ind_table()