diff --git a/include/hermit/ibv.h b/include/hermit/ibv.h index 5ebc5b4d7..d48475b12 100644 --- a/include/hermit/ibv.h +++ b/include/hermit/ibv.h @@ -118,6 +118,13 @@ int ibv_is_qpt_supported(uint32_t caps, enum ibv_qp_type qpt); uint32_t ibv_get_mr_lkey(struct ibv_mr * mr); uint32_t ibv_get_qp_num(struct ibv_qp * qp); +struct ibv_cq * ibv_cq_ex_to_cq(struct ibv_cq_ex * cq); +int ibv_start_poll(struct ibv_cq_ex * cq, struct ibv_poll_cq_attr * attr); +int ibv_next_poll(struct ibv_cq_ex * cq); +void ibv_end_poll(struct ibv_cq_ex * cq); +uint64_t ibv_wc_read_completion_ts(struct ibv_cq_ex * cq); +struct ibv_cq_ex * ibv_create_cq_ex(struct ibv_context * context, struct ibv_cq_init_attr_ex * cq_attr); + // void kernel_ibv_log(); diff --git a/include/hermit/stddef.h b/include/hermit/stddef.h index 71a7415ec..210261257 100644 --- a/include/hermit/stddef.h +++ b/include/hermit/stddef.h @@ -67,76 +67,83 @@ extern const size_t image_size; #define UHYVE_PORT_LSEEK 0x504 // InfiniBand uhyve port IDs -#define UHYVE_PORT_IBV_WC_STATUS_STR 0x510 -#define UHYVE_PORT_IBV_RATE_TO_MULT 0x511 -#define UHYVE_PORT_MULT_TO_IBV_RATE 0x512 -#define UHYVE_PORT_IBV_RATE_TO_MBPS 0x513 -#define UHYVE_PORT_MBPS_TO_IBV_RATE 0x514 -#define UHYVE_PORT_VERBS_GET_CTX 0x528 -#define UHYVE_PORT_IBV_GET_DEVICE_LIST 0x529 -#define UHYVE_PORT_IBV_FREE_DEVICE_LIST 0x52A -#define UHYVE_PORT_IBV_GET_DEVICE_NAME 0x52B -#define UHYVE_PORT_IBV_GET_DEVICE_GUID 0x52C -#define UHYVE_PORT_IBV_OPEN_DEVICE 0x52D -#define UHYVE_PORT_IBV_CLOSE_DEVICE 0x52E -#define UHYVE_PORT_IBV_GET_ASYNC_EVENT 0x52F -#define UHYVE_PORT_IBV_ACK_ASYNC_EVENT 0x530 -#define UHYVE_PORT_IBV_QUERY_DEVICE 0x531 -#define UHYVE_PORT_IBV_QUERY_PORT 0x532 -#define UHYVE_PORT____IBV_QUERY_PORT 0x533 -#define UHYVE_PORT_IBV_QUERY_GID 0x534 -#define UHYVE_PORT_IBV_QUERY_PKEY 0x535 -#define UHYVE_PORT_IBV_ALLOC_PD 0x536 -#define UHYVE_PORT_IBV_DEALLOC_PD 0x537 -#define UHYVE_PORT_IBV_CREATE_FLOW 0x538 -#define UHYVE_PORT_IBV_DESTROY_FLOW 0x539 -#define UHYVE_PORT_IBV_OPEN_XRCD 0x53A -#define UHYVE_PORT_IBV_CLOSE_XRCD 0x53B -#define UHYVE_PORT_IBV_REG_MR 0x53C -#define UHYVE_PORT_IBV_REREG_MR 0x53D -#define UHYVE_PORT_IBV_DEREG_MR 0x53E -#define UHYVE_PORT_IBV_ALLOC_MW 0x53F -#define UHYVE_PORT_IBV_DEALLOC_MW 0x540 -#define UHYVE_PORT_IBV_INC_RKEY 0x541 -#define UHYVE_PORT_IBV_BIND_MW 0x542 -#define UHYVE_PORT_IBV_CREATE_COMP_CHANNEL 0x543 -#define UHYVE_PORT_IBV_DESTROY_COMP_CHANNEL 0x544 -#define UHYVE_PORT_IBV_CREATE_CQ 0x545 -#define UHYVE_PORT_IBV_RESIZE_CQ 0x547 -#define UHYVE_PORT_IBV_DESTROY_CQ 0x548 -#define UHYVE_PORT_IBV_GET_CQ_EVENT 0x549 -#define UHYVE_PORT_IBV_ACK_CQ_EVENTS 0x54A -#define UHYVE_PORT_IBV_POLL_CQ 0x54B -#define UHYVE_PORT_IBV_REQ_NOTIFY_CQ 0x54C -#define UHYVE_PORT_IBV_CREATE_SRQ 0x54D -#define UHYVE_PORT_IBV_CREATE_SRQ_EX 0x54E -#define UHYVE_PORT_IBV_MODIFY_SRQ 0x54F -#define UHYVE_PORT_IBV_QUERY_SRQ 0x550 -#define UHYVE_PORT_IBV_GET_SRQ_NUM 0x551 -#define UHYVE_PORT_IBV_DESTROY_SRQ 0x552 -#define UHYVE_PORT_IBV_POST_SRQ_RECV 0x553 -#define UHYVE_PORT_IBV_CREATE_QP 0x554 -#define UHYVE_PORT_IBV_CREATE_QP_EX 0x555 -#define UHYVE_PORT_IBV_QUERY_DEVICE_EX 0x557 -#define UHYVE_PORT_IBV_OPEN_QP 0x558 -#define UHYVE_PORT_IBV_MODIFY_QP 0x559 -#define UHYVE_PORT_IBV_QUERY_QP 0x55A -#define UHYVE_PORT_IBV_DESTROY_QP 0x55B -#define UHYVE_PORT_IBV_POST_SEND 0x561 -#define UHYVE_PORT_IBV_POST_RECV 0x562 -#define UHYVE_PORT_IBV_CREATE_AH 0x563 -#define UHYVE_PORT_IBV_INIT_AH_FROM_WC 0x564 -#define UHYVE_PORT_IBV_CREATE_AH_FROM_WC 0x565 -#define UHYVE_PORT_IBV_DESTROY_AH 0x566 -#define UHYVE_PORT_IBV_ATTACH_MCAST 0x567 -#define UHYVE_PORT_IBV_DETACH_MCAST 0x568 -#define UHYVE_PORT_IBV_FORK_INIT 0x569 -#define UHYVE_PORT_IBV_NODE_TYPE_STR 0x56A -#define UHYVE_PORT_IBV_PORT_STATE_STR 0x56B -#define UHYVE_PORT_IBV_EVENT_TYPE_STR 0x56C -#define UHYVE_PORT_IBV_IS_QPT_SUPPORTED 0x56E -#define UHYVE_PORT_IBV_GET_MR_LKEY 0x56F // ! -#define UHYVE_PORT_IBV_GET_QP_NUM 0x570 // ! +#define UHYVE_PORT_IBV_WC_STATUS_STR 0x510 +#define UHYVE_PORT_IBV_RATE_TO_MULT 0x511 +#define UHYVE_PORT_MULT_TO_IBV_RATE 0x512 +#define UHYVE_PORT_IBV_RATE_TO_MBPS 0x513 +#define UHYVE_PORT_MBPS_TO_IBV_RATE 0x514 +#define UHYVE_PORT_VERBS_GET_CTX 0x528 +#define UHYVE_PORT_IBV_GET_DEVICE_LIST 0x529 +#define UHYVE_PORT_IBV_FREE_DEVICE_LIST 0x52A +#define UHYVE_PORT_IBV_GET_DEVICE_NAME 0x52B +#define UHYVE_PORT_IBV_GET_DEVICE_GUID 0x52C +#define UHYVE_PORT_IBV_OPEN_DEVICE 0x52D +#define UHYVE_PORT_IBV_CLOSE_DEVICE 0x52E +#define UHYVE_PORT_IBV_GET_ASYNC_EVENT 0x52F +#define UHYVE_PORT_IBV_ACK_ASYNC_EVENT 0x530 +#define UHYVE_PORT_IBV_QUERY_DEVICE 0x531 +#define UHYVE_PORT_IBV_QUERY_PORT 0x532 +#define UHYVE_PORT____IBV_QUERY_PORT 0x533 +#define UHYVE_PORT_IBV_QUERY_GID 0x534 +#define UHYVE_PORT_IBV_QUERY_PKEY 0x535 +#define UHYVE_PORT_IBV_ALLOC_PD 0x536 +#define UHYVE_PORT_IBV_DEALLOC_PD 0x537 +#define UHYVE_PORT_IBV_CREATE_FLOW 0x538 +#define UHYVE_PORT_IBV_DESTROY_FLOW 0x539 +#define UHYVE_PORT_IBV_OPEN_XRCD 0x53A +#define UHYVE_PORT_IBV_CLOSE_XRCD 0x53B +#define UHYVE_PORT_IBV_REG_MR 0x53C +#define UHYVE_PORT_IBV_REREG_MR 0x53D +#define UHYVE_PORT_IBV_DEREG_MR 0x53E +#define UHYVE_PORT_IBV_ALLOC_MW 0x53F +#define UHYVE_PORT_IBV_DEALLOC_MW 0x540 +#define UHYVE_PORT_IBV_INC_RKEY 0x541 +#define UHYVE_PORT_IBV_BIND_MW 0x542 +#define UHYVE_PORT_IBV_CREATE_COMP_CHANNEL 0x543 +#define UHYVE_PORT_IBV_DESTROY_COMP_CHANNEL 0x544 +#define UHYVE_PORT_IBV_CREATE_CQ 0x545 +#define UHYVE_PORT_IBV_RESIZE_CQ 0x547 +#define UHYVE_PORT_IBV_DESTROY_CQ 0x548 +#define UHYVE_PORT_IBV_GET_CQ_EVENT 0x549 +#define UHYVE_PORT_IBV_ACK_CQ_EVENTS 0x54A +#define UHYVE_PORT_IBV_POLL_CQ 0x54B +#define UHYVE_PORT_IBV_REQ_NOTIFY_CQ 0x54C +#define UHYVE_PORT_IBV_CREATE_SRQ 0x54D +#define UHYVE_PORT_IBV_CREATE_SRQ_EX 0x54E +#define UHYVE_PORT_IBV_MODIFY_SRQ 0x54F +#define UHYVE_PORT_IBV_QUERY_SRQ 0x550 +#define UHYVE_PORT_IBV_GET_SRQ_NUM 0x551 +#define UHYVE_PORT_IBV_DESTROY_SRQ 0x552 +#define UHYVE_PORT_IBV_POST_SRQ_RECV 0x553 +#define UHYVE_PORT_IBV_CREATE_QP 0x554 +#define UHYVE_PORT_IBV_CREATE_QP_EX 0x555 +#define UHYVE_PORT_IBV_QUERY_DEVICE_EX 0x557 +#define UHYVE_PORT_IBV_OPEN_QP 0x558 +#define UHYVE_PORT_IBV_MODIFY_QP 0x559 +#define UHYVE_PORT_IBV_QUERY_QP 0x55A +#define UHYVE_PORT_IBV_DESTROY_QP 0x55B +#define UHYVE_PORT_IBV_POST_SEND 0x561 +#define UHYVE_PORT_IBV_POST_RECV 0x562 +#define UHYVE_PORT_IBV_CREATE_AH 0x563 +#define UHYVE_PORT_IBV_INIT_AH_FROM_WC 0x564 +#define UHYVE_PORT_IBV_CREATE_AH_FROM_WC 0x565 +#define UHYVE_PORT_IBV_DESTROY_AH 0x566 +#define UHYVE_PORT_IBV_ATTACH_MCAST 0x567 +#define UHYVE_PORT_IBV_DETACH_MCAST 0x568 +#define UHYVE_PORT_IBV_FORK_INIT 0x569 +#define UHYVE_PORT_IBV_NODE_TYPE_STR 0x56A +#define UHYVE_PORT_IBV_PORT_STATE_STR 0x56B +#define UHYVE_PORT_IBV_EVENT_TYPE_STR 0x56C +#define UHYVE_PORT_IBV_IS_QPT_SUPPORTED 0x56E +#define UHYVE_PORT_IBV_GET_MR_LKEY 0x56F // ! +#define UHYVE_PORT_IBV_GET_QP_NUM 0x570 // ! + +#define UHYVE_PORT_IBV_CQ_EX_TO_CQ 0x571 +#define UHYVE_PORT_IBV_START_POLL 0x572 +#define UHYVE_PORT_IBV_NEXT_POLL 0x573 +#define UHYVE_PORT_IBV_END_POLL 0x574 +#define UHYVE_PORT_IBV_WC_READ_COMPLETION_TS 0x575 +#define UHYVE_PORT_IBV_CREATE_CQ_EX 0x576 // #define UHYVE_PORT_KERNEL_IBV_LOG 0x56F diff --git a/kernel/ibv.c b/kernel/ibv.c index 2510fd5ef..4d850b189 100644 --- a/kernel/ibv.c +++ b/kernel/ibv.c @@ -1303,7 +1303,6 @@ int ibv_destroy_qp(struct ibv_qp * qp) { return uhyve_args.ret; } - /* * ibv_post_send */ @@ -1660,3 +1659,131 @@ uint32_t ibv_get_qp_num(struct ibv_qp * qp) { return uhyve_args.ret; } + + +/* + * ibv_cq_ex_to_cq + */ + +typedef struct { + // Parameters: + struct ibv_cq_ex * cq; + // Return value: + struct ibv_cq * ret; +} __attribute__((packed)) uhyve_ibv_cq_ex_to_cq_t; + +struct ibv_cq * ibv_cq_ex_to_cq(struct ibv_cq_ex * cq) { + uhyve_ibv_cq_ex_to_cq_t uhyve_args; + uhyve_args.cq = cq; + + uhyve_send(UHYVE_PORT_IBV_CQ_EX_TO_CQ, (unsigned) virt_to_phys((size_t) &uhyve_args)); + + return uhyve_args.ret; +} + + +/* + * ibv_start_poll + */ + +typedef struct { + // Parameters: + struct ibv_cq_ex * cq; + struct ibv_poll_cq_attr * attr; + // Return value: + int ret; +} __attribute__((packed)) uhyve_ibv_start_poll_t; + +int ibv_start_poll(struct ibv_cq_ex * cq, struct ibv_poll_cq_attr * attr) { + uhyve_ibv_start_poll_t uhyve_args; + uhyve_args.cq = cq; + uhyve_args.attr = attr; + + uhyve_send(UHYVE_PORT_IBV_START_POLL, (unsigned) virt_to_phys((size_t) &uhyve_args)); + + return uhyve_args.ret; +} + + +/* + * ibv_next_poll + */ + +typedef struct { + // Parameters: + struct ibv_cq_ex * cq; + // Return value: + int ret; +} __attribute__((packed)) uhyve_ibv_next_poll_t; + +int ibv_next_poll(struct ibv_cq_ex * cq) { + uhyve_ibv_next_poll_t uhyve_args; + uhyve_args.cq = cq; + + uhyve_send(UHYVE_PORT_IBV_NEXT_POLL, (unsigned) virt_to_phys((size_t) &uhyve_args)); + + return uhyve_args.ret; +} + + +/* + * ibv_end_poll + */ + +typedef struct { + // Parameters: + struct ibv_cq_ex * cq; +} __attribute__((packed)) uhyve_ibv_end_poll_t; + +void ibv_end_poll(struct ibv_cq_ex * cq) { + uhyve_ibv_end_poll_t uhyve_args; + uhyve_args.cq = cq; + + uhyve_send(UHYVE_PORT_IBV_END_POLL, (unsigned) virt_to_phys((size_t) &uhyve_args)); +} + + +/* + * ibv_wc_read_completion_ts + */ + +typedef struct { + // Parameters: + struct ibv_cq_ex * cq; + // Return value: + uint64_t ret; +} __attribute__((packed)) uhyve_ibv_wc_read_completion_ts_t; + +uint64_t ibv_wc_read_completion_ts(struct ibv_cq_ex * cq) { + uhyve_ibv_wc_read_completion_ts_t uhyve_args; + uhyve_args.cq = cq; + + uhyve_send(UHYVE_PORT_IBV_WC_READ_COMPLETION_TS, (unsigned) virt_to_phys((size_t) &uhyve_args)); + + return uhyve_args.ret; +} + + +/* + * ibv_create_cq_ex + */ + +typedef struct { + // Parameters: + struct ibv_context * context; + struct ibv_cq_init_attr_ex * cq_attr; + // Return value: + struct ibv_cq_ex * ret; +} __attribute__((packed)) uhyve_ibv_create_cq_ex_t; + +struct ibv_cq_ex * ibv_create_cq_ex(struct ibv_context * context, struct ibv_cq_init_attr_ex * cq_attr) { + uhyve_ibv_create_cq_ex_t uhyve_args; + uhyve_args.context = context; + uhyve_args.cq_attr = cq_attr; + + uhyve_send(UHYVE_PORT_IBV_CREATE_CQ_EX, (unsigned) virt_to_phys((size_t) &uhyve_args)); + + return uhyve_args.ret; +} + + diff --git a/tools/ibv_code_generator/GEN-include-hermit-stddef.h b/tools/ibv_code_generator/GEN-include-hermit-stddef.h index 91d60757a..77e1c5520 100644 --- a/tools/ibv_code_generator/GEN-include-hermit-stddef.h +++ b/tools/ibv_code_generator/GEN-include-hermit-stddef.h @@ -1,77 +1,6 @@ -#define UHYVE_PORT_IBV_WC_STATUS_STR 0x510 -#define UHYVE_PORT_IBV_RATE_TO_MULT 0x511 -#define UHYVE_PORT_MULT_TO_IBV_RATE 0x512 -#define UHYVE_PORT_IBV_RATE_TO_MBPS 0x513 -#define UHYVE_PORT_MBPS_TO_IBV_RATE 0x514 -#define UHYVE_PORT_IBV_POST_WQ_RECV 0x515 -#define UHYVE_PORT_VERBS_GET_CTX 0x516 -#define UHYVE_PORT_IBV_GET_DEVICE_LIST 0x517 -#define UHYVE_PORT_IBV_FREE_DEVICE_LIST 0x518 -#define UHYVE_PORT_IBV_GET_DEVICE_NAME 0x519 -#define UHYVE_PORT_IBV_GET_DEVICE_GUID 0x51A -#define UHYVE_PORT_IBV_OPEN_DEVICE 0x51B -#define UHYVE_PORT_IBV_CLOSE_DEVICE 0x51C -#define UHYVE_PORT_IBV_GET_ASYNC_EVENT 0x51D -#define UHYVE_PORT_IBV_ACK_ASYNC_EVENT 0x51E -#define UHYVE_PORT_IBV_QUERY_DEVICE 0x51F -#define UHYVE_PORT_IBV_QUERY_PORT 0x520 -#define UHYVE_PORT____IBV_QUERY_PORT 0x521 -#define UHYVE_PORT_IBV_QUERY_GID 0x522 -#define UHYVE_PORT_IBV_QUERY_PKEY 0x523 -#define UHYVE_PORT_IBV_ALLOC_PD 0x524 -#define UHYVE_PORT_IBV_DEALLOC_PD 0x525 -#define UHYVE_PORT_IBV_CREATE_FLOW 0x526 -#define UHYVE_PORT_IBV_DESTROY_FLOW 0x527 -#define UHYVE_PORT_IBV_OPEN_XRCD 0x528 -#define UHYVE_PORT_IBV_CLOSE_XRCD 0x529 -#define UHYVE_PORT_IBV_REG_MR 0x52A -#define UHYVE_PORT_IBV_REREG_MR 0x52B -#define UHYVE_PORT_IBV_DEREG_MR 0x52C -#define UHYVE_PORT_IBV_ALLOC_MW 0x52D -#define UHYVE_PORT_IBV_DEALLOC_MW 0x52E -#define UHYVE_PORT_IBV_INC_RKEY 0x52F -#define UHYVE_PORT_IBV_BIND_MW 0x530 -#define UHYVE_PORT_IBV_CREATE_COMP_CHANNEL 0x531 -#define UHYVE_PORT_IBV_DESTROY_COMP_CHANNEL 0x532 -#define UHYVE_PORT_IBV_CREATE_CQ 0x533 -#define UHYVE_PORT_IBV_CREATE_CQ_EX 0x534 -#define UHYVE_PORT_IBV_RESIZE_CQ 0x535 -#define UHYVE_PORT_IBV_DESTROY_CQ 0x536 -#define UHYVE_PORT_IBV_GET_CQ_EVENT 0x537 -#define UHYVE_PORT_IBV_ACK_CQ_EVENTS 0x538 -#define UHYVE_PORT_IBV_POLL_CQ 0x539 -#define UHYVE_PORT_IBV_REQ_NOTIFY_CQ 0x53A -#define UHYVE_PORT_IBV_CREATE_SRQ 0x53B -#define UHYVE_PORT_IBV_CREATE_SRQ_EX 0x53C -#define UHYVE_PORT_IBV_MODIFY_SRQ 0x53D -#define UHYVE_PORT_IBV_QUERY_SRQ 0x53E -#define UHYVE_PORT_IBV_GET_SRQ_NUM 0x53F -#define UHYVE_PORT_IBV_DESTROY_SRQ 0x540 -#define UHYVE_PORT_IBV_POST_SRQ_RECV 0x541 -#define UHYVE_PORT_IBV_CREATE_QP 0x542 -#define UHYVE_PORT_IBV_CREATE_QP_EX 0x543 -#define UHYVE_PORT_IBV_QUERY_RT_VALUES_EX 0x544 -#define UHYVE_PORT_IBV_QUERY_DEVICE_EX 0x545 -#define UHYVE_PORT_IBV_OPEN_QP 0x546 -#define UHYVE_PORT_IBV_MODIFY_QP 0x547 -#define UHYVE_PORT_IBV_QUERY_QP 0x548 -#define UHYVE_PORT_IBV_DESTROY_QP 0x549 -#define UHYVE_PORT_IBV_CREATE_WQ 0x54A -#define UHYVE_PORT_IBV_MODIFY_WQ 0x54B -#define UHYVE_PORT_IBV_DESTROY_WQ 0x54C -#define UHYVE_PORT_IBV_CREATE_RWQ_IND_TABLE 0x54D -#define UHYVE_PORT_IBV_DESTROY_RWQ_IND_TABLE 0x54E -#define UHYVE_PORT_IBV_POST_SEND 0x54F -#define UHYVE_PORT_IBV_POST_RECV 0x550 -#define UHYVE_PORT_IBV_CREATE_AH 0x551 -#define UHYVE_PORT_IBV_INIT_AH_FROM_WC 0x552 -#define UHYVE_PORT_IBV_CREATE_AH_FROM_WC 0x553 -#define UHYVE_PORT_IBV_DESTROY_AH 0x554 -#define UHYVE_PORT_IBV_ATTACH_MCAST 0x555 -#define UHYVE_PORT_IBV_DETACH_MCAST 0x556 -#define UHYVE_PORT_IBV_FORK_INIT 0x557 -#define UHYVE_PORT_IBV_NODE_TYPE_STR 0x558 -#define UHYVE_PORT_IBV_PORT_STATE_STR 0x559 -#define UHYVE_PORT_IBV_EVENT_TYPE_STR 0x55A -#define UHYVE_PORT_IBV_RESOLVE_ETH_L2_FROM_GID 0x55B -#define UHYVE_PORT_IBV_IS_QPT_SUPPORTED 0x55C +#define UHYVE_PORT_IBV_CQ_EX_TO_CQ 0x510 +#define UHYVE_PORT_IBV_START_POLL 0x511 +#define UHYVE_PORT_IBV_NEXT_POLL 0x512 +#define UHYVE_PORT_IBV_END_POLL 0x513 +#define UHYVE_PORT_IBV_WC_READ_COMPLETION_TS 0x514 +#define UHYVE_PORT_IBV_CREATE_CQ_EX 0x515 diff --git a/tools/ibv_code_generator/GEN-kernel-header.h b/tools/ibv_code_generator/GEN-kernel-header.h index 7fc03e5ff..e9471a959 100644 --- a/tools/ibv_code_generator/GEN-kernel-header.h +++ b/tools/ibv_code_generator/GEN-kernel-header.h @@ -1,77 +1,6 @@ -const char * ibv_wc_status_str(enum ibv_wc_status status); -int ibv_rate_to_mult(enum ibv_rate rate); -enum ibv_rate mult_to_ibv_rate(int mult); -int ibv_rate_to_mbps(enum ibv_rate rate); -enum ibv_rate mbps_to_ibv_rate(int mbps); -int ibv_post_wq_recv(struct ibv_wq * wq, struct ibv_recv_wr * recv_wr, struct ibv_recv_wr ** bad_recv_wr); -struct verbs_context * verbs_get_ctx(struct ibv_context * ctx); -struct ibv_device ** ibv_get_device_list(int * num_devices); -void ibv_free_device_list(struct ibv_device ** list); -const char * ibv_get_device_name(struct ibv_device * device); -__be64 ibv_get_device_guid(struct ibv_device * device); -struct ibv_context * ibv_open_device(struct ibv_device * device); -int ibv_close_device(struct ibv_context * context); -int ibv_get_async_event(struct ibv_context * context, struct ibv_async_event * event); -void ibv_ack_async_event(struct ibv_async_event * event); -int ibv_query_device(struct ibv_context * context, struct ibv_device_attr * device_attr); -int ibv_query_port(struct ibv_context * context, uint8_t port_num, struct ibv_port_attr * port_attr); -int ___ibv_query_port(struct ibv_context * context, uint8_t port_num, struct ibv_port_attr * port_attr); -int ibv_query_gid(struct ibv_context * context, uint8_t port_num, int index, union ibv_gid * gid); -int ibv_query_pkey(struct ibv_context * context, uint8_t port_num, int index, __be16 * pkey); -struct ibv_pd * ibv_alloc_pd(struct ibv_context * context); -int ibv_dealloc_pd(struct ibv_pd * pd); -struct ibv_flow * ibv_create_flow(struct ibv_qp * qp, struct ibv_flow_attr * flow); -int ibv_destroy_flow(struct ibv_flow * flow_id); -struct ibv_xrcd * ibv_open_xrcd(struct ibv_context * context, struct ibv_xrcd_init_attr * xrcd_init_attr); -int ibv_close_xrcd(struct ibv_xrcd * xrcd); -struct ibv_mr * ibv_reg_mr(struct ibv_pd * pd, void * addr, int length, int access); -int ibv_rereg_mr(struct ibv_mr * mr, int flags, struct ibv_pd * pd, void * addr, int length, int access); -int ibv_dereg_mr(struct ibv_mr * mr); -struct ibv_mw * ibv_alloc_mw(struct ibv_pd * pd, enum ibv_mw_type type); -int ibv_dealloc_mw(struct ibv_mw * mw); -uint32_t ibv_inc_rkey(uint32_t rkey); -int ibv_bind_mw(struct ibv_qp * qp, struct ibv_mw * mw, struct ibv_mw_bind * mw_bind); -struct ibv_comp_channel * ibv_create_comp_channel(struct ibv_context * context); -int ibv_destroy_comp_channel(struct ibv_comp_channel * channel); -struct ibv_cq * ibv_create_cq(struct ibv_context * context, int cqe, void * cq_context, struct ibv_comp_channel * channel, int comp_vector); +struct ibv_cq * ibv_cq_ex_to_cq(struct ibv_cq_ex * cq); +int ibv_start_poll(struct ibv_cq_ex * cq, struct ibv_poll_cq_attr * attr); +int ibv_next_poll(struct ibv_cq_ex * cq); +void ibv_end_poll(struct ibv_cq_ex * cq); +uint64_t ibv_wc_read_completion_ts(struct ibv_cq_ex * cq); struct ibv_cq_ex * ibv_create_cq_ex(struct ibv_context * context, struct ibv_cq_init_attr_ex * cq_attr); -int ibv_resize_cq(struct ibv_cq * cq, int cqe); -int ibv_destroy_cq(struct ibv_cq * cq); -int ibv_get_cq_event(struct ibv_comp_channel * channel, struct ibv_cq ** cq, void ** cq_context); -void ibv_ack_cq_events(struct ibv_cq * cq, unsigned int nevents); -int ibv_poll_cq(struct ibv_cq * cq, int num_entries, struct ibv_wc * wc); -int ibv_req_notify_cq(struct ibv_cq * cq, int solicited_only); -struct ibv_srq * ibv_create_srq(struct ibv_pd * pd, struct ibv_srq_init_attr * srq_init_attr); -struct ibv_srq * ibv_create_srq_ex(struct ibv_context * context, struct ibv_srq_init_attr_ex * srq_init_attr_ex); -int ibv_modify_srq(struct ibv_srq * srq, struct ibv_srq_attr * srq_attr, int srq_attr_mask); -int ibv_query_srq(struct ibv_srq * srq, struct ibv_srq_attr * srq_attr); -int ibv_get_srq_num(struct ibv_srq * srq, uint32_t * srq_num); -int ibv_destroy_srq(struct ibv_srq * srq); -int ibv_post_srq_recv(struct ibv_srq * srq, struct ibv_recv_wr * recv_wr, struct ibv_recv_wr ** bad_recv_wr); -struct ibv_qp * ibv_create_qp(struct ibv_pd * pd, struct ibv_qp_init_attr * qp_init_attr); -struct ibv_qp * ibv_create_qp_ex(struct ibv_context * context, struct ibv_qp_init_attr_ex * qp_init_attr_ex); -int ibv_query_rt_values_ex(struct ibv_context * context, struct ibv_values_ex * values); -int ibv_query_device_ex(struct ibv_context * context, const struct ibv_query_device_ex_input * input, struct ibv_device_attr_ex * attr); -struct ibv_qp * ibv_open_qp(struct ibv_context * context, struct ibv_qp_open_attr * qp_open_attr); -int ibv_modify_qp(struct ibv_qp * qp, struct ibv_qp_attr * attr, int attr_mask); -int ibv_query_qp(struct ibv_qp * qp, struct ibv_qp_attr * attr, int attr_mask, struct ibv_qp_init_attr * init_attr); -int ibv_destroy_qp(struct ibv_qp * qp); -struct ibv_wq * ibv_create_wq(struct ibv_context * context, struct ibv_wq_init_attr * wq_init_attr); -int ibv_modify_wq(struct ibv_wq * wq, struct ibv_wq_attr * wq_attr); -int ibv_destroy_wq(struct ibv_wq * wq); -struct ibv_rwq_ind_table * ibv_create_rwq_ind_table(struct ibv_context * context, struct ibv_rwq_ind_table_init_attr * init_attr); -int ibv_destroy_rwq_ind_table(struct ibv_rwq_ind_table * rwq_ind_table); -int ibv_post_send(struct ibv_qp * qp, struct ibv_send_wr * wr, struct ibv_send_wr ** bad_wr); -int ibv_post_recv(struct ibv_qp * qp, struct ibv_recv_wr * wr, struct ibv_recv_wr ** bad_wr); -struct ibv_ah * ibv_create_ah(struct ibv_pd * pd, struct ibv_ah_attr * attr); -int ibv_init_ah_from_wc(struct ibv_context * context, uint8_t port_num, struct ibv_wc * wc, struct ibv_grh * grh, struct ibv_ah_attr * ah_attr); -struct ibv_ah * ibv_create_ah_from_wc(struct ibv_pd * pd, struct ibv_wc * wc, struct ibv_grh * grh, uint8_t port_num); -int ibv_destroy_ah(struct ibv_ah * ah); -int ibv_attach_mcast(struct ibv_qp * qp, const union ibv_gid * gid, uint16_t lid); -int ibv_detach_mcast(struct ibv_qp * qp, const union ibv_gid * gid, uint16_t lid); -int ibv_fork_init( ); -const char * ibv_node_type_str(enum ibv_node_type node_type); -const char * ibv_port_state_str(enum ibv_port_state port_state); -const char * ibv_event_type_str(enum ibv_event_type event); -int ibv_resolve_eth_l2_from_gid(struct ibv_context * context, struct ibv_ah_attr * attr, uint8_t eth_mac[6], uint16_t * vid); -int ibv_is_qpt_supported(uint32_t caps, enum ibv_qp_type qpt); diff --git a/tools/ibv_code_generator/GEN-kernel.c b/tools/ibv_code_generator/GEN-kernel.c index 009bbd5f6..f52398f50 100644 --- a/tools/ibv_code_generator/GEN-kernel.c +++ b/tools/ibv_code_generator/GEN-kernel.c @@ -1,808 +1,101 @@ /* - * ibv_wc_status_str + * ibv_cq_ex_to_cq */ typedef struct { // Parameters: - enum ibv_wc_status status; - // Return value: - const char * ret; -} __attribute__((packed)) uhyve_ibv_wc_status_str_t; - -const char * ibv_wc_status_str(enum ibv_wc_status status) { - uhyve_ibv_wc_status_str_t uhyve_args; - uhyve_args.status = status; - - uhyve_send(UHYVE_PORT_IBV_WC_STATUS_STR, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_rate_to_mult - */ - -typedef struct { - // Parameters: - enum ibv_rate rate; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_rate_to_mult_t; - -int ibv_rate_to_mult(enum ibv_rate rate) { - uhyve_ibv_rate_to_mult_t uhyve_args; - uhyve_args.rate = rate; - - uhyve_send(UHYVE_PORT_IBV_RATE_TO_MULT, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * mult_to_ibv_rate - */ - -typedef struct { - // Parameters: - int mult; - // Return value: - enum ibv_rate ret; -} __attribute__((packed)) uhyve_mult_to_ibv_rate_t; - -enum ibv_rate mult_to_ibv_rate(int mult) { - uhyve_mult_to_ibv_rate_t uhyve_args; - uhyve_args.mult = mult; - - uhyve_send(UHYVE_PORT_MULT_TO_IBV_RATE, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_rate_to_mbps - */ - -typedef struct { - // Parameters: - enum ibv_rate rate; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_rate_to_mbps_t; - -int ibv_rate_to_mbps(enum ibv_rate rate) { - uhyve_ibv_rate_to_mbps_t uhyve_args; - uhyve_args.rate = rate; - - uhyve_send(UHYVE_PORT_IBV_RATE_TO_MBPS, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * mbps_to_ibv_rate - */ - -typedef struct { - // Parameters: - int mbps; - // Return value: - enum ibv_rate ret; -} __attribute__((packed)) uhyve_mbps_to_ibv_rate_t; - -enum ibv_rate mbps_to_ibv_rate(int mbps) { - uhyve_mbps_to_ibv_rate_t uhyve_args; - uhyve_args.mbps = mbps; - - uhyve_send(UHYVE_PORT_MBPS_TO_IBV_RATE, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_post_wq_recv - */ - -typedef struct { - // Parameters: - struct ibv_wq * wq; - struct ibv_recv_wr * recv_wr; - struct ibv_recv_wr ** bad_recv_wr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_post_wq_recv_t; - -int ibv_post_wq_recv(struct ibv_wq * wq, struct ibv_recv_wr * recv_wr, struct ibv_recv_wr ** bad_recv_wr) { - uhyve_ibv_post_wq_recv_t uhyve_args; - uhyve_args.wq = wq; - uhyve_args.recv_wr = recv_wr; - // TODO: Take care of ** parameter. - - uhyve_send(UHYVE_PORT_IBV_POST_WQ_RECV, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * verbs_get_ctx - */ - -typedef struct { - // Parameters: - struct ibv_context * ctx; - // Return value: - struct verbs_context * ret; -} __attribute__((packed)) uhyve_verbs_get_ctx_t; - -struct verbs_context * verbs_get_ctx(struct ibv_context * ctx) { - uhyve_verbs_get_ctx_t uhyve_args; - uhyve_args.ctx = ctx; - - uhyve_send(UHYVE_PORT_VERBS_GET_CTX, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_get_device_list - */ - -typedef struct { - // Parameters: - int * num_devices; - // Return value: - struct ibv_device ** ret; -} __attribute__((packed)) uhyve_ibv_get_device_list_t; - -struct ibv_device ** ibv_get_device_list(int * num_devices) { - uhyve_ibv_get_device_list_t uhyve_args; - uhyve_args.num_devices = num_devices; - - uhyve_send(UHYVE_PORT_IBV_GET_DEVICE_LIST, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_free_device_list - */ - -typedef struct { - // Parameters: - struct ibv_device ** list; -} __attribute__((packed)) uhyve_ibv_free_device_list_t; - -void ibv_free_device_list(struct ibv_device ** list) { - uhyve_ibv_free_device_list_t uhyve_args; - // TODO: Take care of ** parameter. - - uhyve_send(UHYVE_PORT_IBV_FREE_DEVICE_LIST, (unsigned) virt_to_phys((size_t) &uhyve_args)); -} - - -/* - * ibv_get_device_name - */ - -typedef struct { - // Parameters: - struct ibv_device * device; - // Return value: - const char * ret; -} __attribute__((packed)) uhyve_ibv_get_device_name_t; - -const char * ibv_get_device_name(struct ibv_device * device) { - uhyve_ibv_get_device_name_t uhyve_args; - uhyve_args.device = device; - - uhyve_send(UHYVE_PORT_IBV_GET_DEVICE_NAME, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_get_device_guid - */ - -typedef struct { - // Parameters: - struct ibv_device * device; - // Return value: - __be64 ret; -} __attribute__((packed)) uhyve_ibv_get_device_guid_t; - -__be64 ibv_get_device_guid(struct ibv_device * device) { - uhyve_ibv_get_device_guid_t uhyve_args; - uhyve_args.device = device; - - uhyve_send(UHYVE_PORT_IBV_GET_DEVICE_GUID, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_open_device - */ - -typedef struct { - // Parameters: - struct ibv_device * device; - // Return value: - struct ibv_context * ret; -} __attribute__((packed)) uhyve_ibv_open_device_t; - -struct ibv_context * ibv_open_device(struct ibv_device * device) { - uhyve_ibv_open_device_t uhyve_args; - uhyve_args.device = device; - - uhyve_send(UHYVE_PORT_IBV_OPEN_DEVICE, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_close_device - */ - -typedef struct { - // Parameters: - struct ibv_context * context; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_close_device_t; - -int ibv_close_device(struct ibv_context * context) { - uhyve_ibv_close_device_t uhyve_args; - uhyve_args.context = context; - - uhyve_send(UHYVE_PORT_IBV_CLOSE_DEVICE, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_get_async_event - */ - -typedef struct { - // Parameters: - struct ibv_context * context; - struct ibv_async_event * event; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_get_async_event_t; - -int ibv_get_async_event(struct ibv_context * context, struct ibv_async_event * event) { - uhyve_ibv_get_async_event_t uhyve_args; - uhyve_args.context = context; - uhyve_args.event = event; - - uhyve_send(UHYVE_PORT_IBV_GET_ASYNC_EVENT, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_ack_async_event - */ - -typedef struct { - // Parameters: - struct ibv_async_event * event; -} __attribute__((packed)) uhyve_ibv_ack_async_event_t; - -void ibv_ack_async_event(struct ibv_async_event * event) { - uhyve_ibv_ack_async_event_t uhyve_args; - uhyve_args.event = event; - - uhyve_send(UHYVE_PORT_IBV_ACK_ASYNC_EVENT, (unsigned) virt_to_phys((size_t) &uhyve_args)); -} - - -/* - * ibv_query_device - */ - -typedef struct { - // Parameters: - struct ibv_context * context; - struct ibv_device_attr * device_attr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_query_device_t; - -int ibv_query_device(struct ibv_context * context, struct ibv_device_attr * device_attr) { - uhyve_ibv_query_device_t uhyve_args; - uhyve_args.context = context; - uhyve_args.device_attr = device_attr; - - uhyve_send(UHYVE_PORT_IBV_QUERY_DEVICE, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_query_port - */ - -typedef struct { - // Parameters: - struct ibv_context * context; - uint8_t port_num; - struct ibv_port_attr * port_attr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_query_port_t; - -int ibv_query_port(struct ibv_context * context, uint8_t port_num, struct ibv_port_attr * port_attr) { - uhyve_ibv_query_port_t uhyve_args; - uhyve_args.context = context; - uhyve_args.port_num = port_num; - uhyve_args.port_attr = port_attr; - - uhyve_send(UHYVE_PORT_IBV_QUERY_PORT, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ___ibv_query_port - */ - -typedef struct { - // Parameters: - struct ibv_context * context; - uint8_t port_num; - struct ibv_port_attr * port_attr; - // Return value: - int ret; -} __attribute__((packed)) uhyve____ibv_query_port_t; - -int ___ibv_query_port(struct ibv_context * context, uint8_t port_num, struct ibv_port_attr * port_attr) { - uhyve____ibv_query_port_t uhyve_args; - uhyve_args.context = context; - uhyve_args.port_num = port_num; - uhyve_args.port_attr = port_attr; - - uhyve_send(UHYVE_PORT____IBV_QUERY_PORT, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_query_gid - */ - -typedef struct { - // Parameters: - struct ibv_context * context; - uint8_t port_num; - int index; - union ibv_gid * gid; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_query_gid_t; - -int ibv_query_gid(struct ibv_context * context, uint8_t port_num, int index, union ibv_gid * gid) { - uhyve_ibv_query_gid_t uhyve_args; - uhyve_args.context = context; - uhyve_args.port_num = port_num; - uhyve_args.index = index; - uhyve_args.gid = gid; - - uhyve_send(UHYVE_PORT_IBV_QUERY_GID, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_query_pkey - */ - -typedef struct { - // Parameters: - struct ibv_context * context; - uint8_t port_num; - int index; - __be16 * pkey; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_query_pkey_t; - -int ibv_query_pkey(struct ibv_context * context, uint8_t port_num, int index, __be16 * pkey) { - uhyve_ibv_query_pkey_t uhyve_args; - uhyve_args.context = context; - uhyve_args.port_num = port_num; - uhyve_args.index = index; - uhyve_args.pkey = pkey; - - uhyve_send(UHYVE_PORT_IBV_QUERY_PKEY, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_alloc_pd - */ - -typedef struct { - // Parameters: - struct ibv_context * context; - // Return value: - struct ibv_pd * ret; -} __attribute__((packed)) uhyve_ibv_alloc_pd_t; - -struct ibv_pd * ibv_alloc_pd(struct ibv_context * context) { - uhyve_ibv_alloc_pd_t uhyve_args; - uhyve_args.context = context; - - uhyve_send(UHYVE_PORT_IBV_ALLOC_PD, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_dealloc_pd - */ - -typedef struct { - // Parameters: - struct ibv_pd * pd; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_dealloc_pd_t; - -int ibv_dealloc_pd(struct ibv_pd * pd) { - uhyve_ibv_dealloc_pd_t uhyve_args; - uhyve_args.pd = pd; - - uhyve_send(UHYVE_PORT_IBV_DEALLOC_PD, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_create_flow - */ - -typedef struct { - // Parameters: - struct ibv_qp * qp; - struct ibv_flow_attr * flow; - // Return value: - struct ibv_flow * ret; -} __attribute__((packed)) uhyve_ibv_create_flow_t; - -struct ibv_flow * ibv_create_flow(struct ibv_qp * qp, struct ibv_flow_attr * flow) { - uhyve_ibv_create_flow_t uhyve_args; - uhyve_args.qp = qp; - uhyve_args.flow = flow; - - uhyve_send(UHYVE_PORT_IBV_CREATE_FLOW, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_destroy_flow - */ - -typedef struct { - // Parameters: - struct ibv_flow * flow_id; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_destroy_flow_t; - -int ibv_destroy_flow(struct ibv_flow * flow_id) { - uhyve_ibv_destroy_flow_t uhyve_args; - uhyve_args.flow_id = flow_id; - - uhyve_send(UHYVE_PORT_IBV_DESTROY_FLOW, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_open_xrcd - */ - -typedef struct { - // Parameters: - struct ibv_context * context; - struct ibv_xrcd_init_attr * xrcd_init_attr; - // Return value: - struct ibv_xrcd * ret; -} __attribute__((packed)) uhyve_ibv_open_xrcd_t; - -struct ibv_xrcd * ibv_open_xrcd(struct ibv_context * context, struct ibv_xrcd_init_attr * xrcd_init_attr) { - uhyve_ibv_open_xrcd_t uhyve_args; - uhyve_args.context = context; - uhyve_args.xrcd_init_attr = xrcd_init_attr; - - uhyve_send(UHYVE_PORT_IBV_OPEN_XRCD, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_close_xrcd - */ - -typedef struct { - // Parameters: - struct ibv_xrcd * xrcd; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_close_xrcd_t; - -int ibv_close_xrcd(struct ibv_xrcd * xrcd) { - uhyve_ibv_close_xrcd_t uhyve_args; - uhyve_args.xrcd = xrcd; - - uhyve_send(UHYVE_PORT_IBV_CLOSE_XRCD, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_reg_mr - */ - -typedef struct { - // Parameters: - struct ibv_pd * pd; - void * addr; - int length; - int access; - // Return value: - struct ibv_mr * ret; -} __attribute__((packed)) uhyve_ibv_reg_mr_t; - -struct ibv_mr * ibv_reg_mr(struct ibv_pd * pd, void * addr, int length, int access) { - uhyve_ibv_reg_mr_t uhyve_args; - uhyve_args.pd = pd; - uhyve_args.addr = addr; - uhyve_args.length = length; - uhyve_args.access = access; - - uhyve_send(UHYVE_PORT_IBV_REG_MR, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_rereg_mr - */ - -typedef struct { - // Parameters: - struct ibv_mr * mr; - int flags; - struct ibv_pd * pd; - void * addr; - int length; - int access; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_rereg_mr_t; - -int ibv_rereg_mr(struct ibv_mr * mr, int flags, struct ibv_pd * pd, void * addr, int length, int access) { - uhyve_ibv_rereg_mr_t uhyve_args; - uhyve_args.mr = mr; - uhyve_args.flags = flags; - uhyve_args.pd = pd; - uhyve_args.addr = addr; - uhyve_args.length = length; - uhyve_args.access = access; - - uhyve_send(UHYVE_PORT_IBV_REREG_MR, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_dereg_mr - */ - -typedef struct { - // Parameters: - struct ibv_mr * mr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_dereg_mr_t; - -int ibv_dereg_mr(struct ibv_mr * mr) { - uhyve_ibv_dereg_mr_t uhyve_args; - uhyve_args.mr = mr; - - uhyve_send(UHYVE_PORT_IBV_DEREG_MR, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_alloc_mw - */ - -typedef struct { - // Parameters: - struct ibv_pd * pd; - enum ibv_mw_type type; - // Return value: - struct ibv_mw * ret; -} __attribute__((packed)) uhyve_ibv_alloc_mw_t; - -struct ibv_mw * ibv_alloc_mw(struct ibv_pd * pd, enum ibv_mw_type type) { - uhyve_ibv_alloc_mw_t uhyve_args; - uhyve_args.pd = pd; - uhyve_args.type = type; - - uhyve_send(UHYVE_PORT_IBV_ALLOC_MW, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_dealloc_mw - */ - -typedef struct { - // Parameters: - struct ibv_mw * mw; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_dealloc_mw_t; - -int ibv_dealloc_mw(struct ibv_mw * mw) { - uhyve_ibv_dealloc_mw_t uhyve_args; - uhyve_args.mw = mw; - - uhyve_send(UHYVE_PORT_IBV_DEALLOC_MW, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_inc_rkey - */ - -typedef struct { - // Parameters: - uint32_t rkey; - // Return value: - uint32_t ret; -} __attribute__((packed)) uhyve_ibv_inc_rkey_t; - -uint32_t ibv_inc_rkey(uint32_t rkey) { - uhyve_ibv_inc_rkey_t uhyve_args; - uhyve_args.rkey = rkey; - - uhyve_send(UHYVE_PORT_IBV_INC_RKEY, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_bind_mw - */ - -typedef struct { - // Parameters: - struct ibv_qp * qp; - struct ibv_mw * mw; - struct ibv_mw_bind * mw_bind; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_bind_mw_t; - -int ibv_bind_mw(struct ibv_qp * qp, struct ibv_mw * mw, struct ibv_mw_bind * mw_bind) { - uhyve_ibv_bind_mw_t uhyve_args; - uhyve_args.qp = qp; - uhyve_args.mw = mw; - uhyve_args.mw_bind = mw_bind; - - uhyve_send(UHYVE_PORT_IBV_BIND_MW, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_create_comp_channel - */ - -typedef struct { - // Parameters: - struct ibv_context * context; - // Return value: - struct ibv_comp_channel * ret; -} __attribute__((packed)) uhyve_ibv_create_comp_channel_t; - -struct ibv_comp_channel * ibv_create_comp_channel(struct ibv_context * context) { - uhyve_ibv_create_comp_channel_t uhyve_args; - uhyve_args.context = context; - - uhyve_send(UHYVE_PORT_IBV_CREATE_COMP_CHANNEL, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_destroy_comp_channel - */ - -typedef struct { - // Parameters: - struct ibv_comp_channel * channel; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_destroy_comp_channel_t; - -int ibv_destroy_comp_channel(struct ibv_comp_channel * channel) { - uhyve_ibv_destroy_comp_channel_t uhyve_args; - uhyve_args.channel = channel; - - uhyve_send(UHYVE_PORT_IBV_DESTROY_COMP_CHANNEL, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_create_cq - */ - -typedef struct { - // Parameters: - struct ibv_context * context; - int cqe; - void * cq_context; - struct ibv_comp_channel * channel; - int comp_vector; + struct ibv_cq_ex * cq; // Return value: struct ibv_cq * ret; -} __attribute__((packed)) uhyve_ibv_create_cq_t; +} __attribute__((packed)) uhyve_ibv_cq_ex_to_cq_t; -struct ibv_cq * ibv_create_cq(struct ibv_context * context, int cqe, void * cq_context, struct ibv_comp_channel * channel, int comp_vector) { - uhyve_ibv_create_cq_t uhyve_args; - uhyve_args.context = context; - uhyve_args.cqe = cqe; - uhyve_args.cq_context = cq_context; - uhyve_args.channel = channel; - uhyve_args.comp_vector = comp_vector; +struct ibv_cq * ibv_cq_ex_to_cq(struct ibv_cq_ex * cq) { + uhyve_ibv_cq_ex_to_cq_t uhyve_args; + uhyve_args.cq = cq; - uhyve_send(UHYVE_PORT_IBV_CREATE_CQ, (unsigned) virt_to_phys((size_t) &uhyve_args)); + uhyve_send(UHYVE_PORT_IBV_CQ_EX_TO_CQ, (unsigned) virt_to_phys((size_t) &uhyve_args)); + + return uhyve_args.ret; +} + + +/* + * ibv_start_poll + */ + +typedef struct { + // Parameters: + struct ibv_cq_ex * cq; + struct ibv_poll_cq_attr * attr; + // Return value: + int ret; +} __attribute__((packed)) uhyve_ibv_start_poll_t; + +int ibv_start_poll(struct ibv_cq_ex * cq, struct ibv_poll_cq_attr * attr) { + uhyve_ibv_start_poll_t uhyve_args; + uhyve_args.cq = cq; + uhyve_args.attr = attr; + + uhyve_send(UHYVE_PORT_IBV_START_POLL, (unsigned) virt_to_phys((size_t) &uhyve_args)); + + return uhyve_args.ret; +} + + +/* + * ibv_next_poll + */ + +typedef struct { + // Parameters: + struct ibv_cq_ex * cq; + // Return value: + int ret; +} __attribute__((packed)) uhyve_ibv_next_poll_t; + +int ibv_next_poll(struct ibv_cq_ex * cq) { + uhyve_ibv_next_poll_t uhyve_args; + uhyve_args.cq = cq; + + uhyve_send(UHYVE_PORT_IBV_NEXT_POLL, (unsigned) virt_to_phys((size_t) &uhyve_args)); + + return uhyve_args.ret; +} + + +/* + * ibv_end_poll + */ + +typedef struct { + // Parameters: + struct ibv_cq_ex * cq; +} __attribute__((packed)) uhyve_ibv_end_poll_t; + +void ibv_end_poll(struct ibv_cq_ex * cq) { + uhyve_ibv_end_poll_t uhyve_args; + uhyve_args.cq = cq; + + uhyve_send(UHYVE_PORT_IBV_END_POLL, (unsigned) virt_to_phys((size_t) &uhyve_args)); +} + + +/* + * ibv_wc_read_completion_ts + */ + +typedef struct { + // Parameters: + struct ibv_cq_ex * cq; + // Return value: + uint64_t ret; +} __attribute__((packed)) uhyve_ibv_wc_read_completion_ts_t; + +uint64_t ibv_wc_read_completion_ts(struct ibv_cq_ex * cq) { + uhyve_ibv_wc_read_completion_ts_t uhyve_args; + uhyve_args.cq = cq; + + uhyve_send(UHYVE_PORT_IBV_WC_READ_COMPLETION_TS, (unsigned) virt_to_phys((size_t) &uhyve_args)); return uhyve_args.ret; } @@ -831,937 +124,3 @@ struct ibv_cq_ex * ibv_create_cq_ex(struct ibv_context * context, struct ibv_cq_ } -/* - * ibv_resize_cq - */ - -typedef struct { - // Parameters: - struct ibv_cq * cq; - int cqe; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_resize_cq_t; - -int ibv_resize_cq(struct ibv_cq * cq, int cqe) { - uhyve_ibv_resize_cq_t uhyve_args; - uhyve_args.cq = cq; - uhyve_args.cqe = cqe; - - uhyve_send(UHYVE_PORT_IBV_RESIZE_CQ, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_destroy_cq - */ - -typedef struct { - // Parameters: - struct ibv_cq * cq; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_destroy_cq_t; - -int ibv_destroy_cq(struct ibv_cq * cq) { - uhyve_ibv_destroy_cq_t uhyve_args; - uhyve_args.cq = cq; - - uhyve_send(UHYVE_PORT_IBV_DESTROY_CQ, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_get_cq_event - */ - -typedef struct { - // Parameters: - struct ibv_comp_channel * channel; - struct ibv_cq ** cq; - void ** cq_context; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_get_cq_event_t; - -int ibv_get_cq_event(struct ibv_comp_channel * channel, struct ibv_cq ** cq, void ** cq_context) { - uhyve_ibv_get_cq_event_t uhyve_args; - uhyve_args.channel = channel; - // TODO: Take care of ** parameter. - // TODO: Take care of ** parameter. - - uhyve_send(UHYVE_PORT_IBV_GET_CQ_EVENT, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_ack_cq_events - */ - -typedef struct { - // Parameters: - struct ibv_cq * cq; - unsigned int nevents; -} __attribute__((packed)) uhyve_ibv_ack_cq_events_t; - -void ibv_ack_cq_events(struct ibv_cq * cq, unsigned int nevents) { - uhyve_ibv_ack_cq_events_t uhyve_args; - uhyve_args.cq = cq; - uhyve_args.nevents = nevents; - - uhyve_send(UHYVE_PORT_IBV_ACK_CQ_EVENTS, (unsigned) virt_to_phys((size_t) &uhyve_args)); -} - - -/* - * ibv_poll_cq - */ - -typedef struct { - // Parameters: - struct ibv_cq * cq; - int num_entries; - struct ibv_wc * wc; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_poll_cq_t; - -int ibv_poll_cq(struct ibv_cq * cq, int num_entries, struct ibv_wc * wc) { - uhyve_ibv_poll_cq_t uhyve_args; - uhyve_args.cq = cq; - uhyve_args.num_entries = num_entries; - uhyve_args.wc = wc; - - uhyve_send(UHYVE_PORT_IBV_POLL_CQ, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_req_notify_cq - */ - -typedef struct { - // Parameters: - struct ibv_cq * cq; - int solicited_only; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_req_notify_cq_t; - -int ibv_req_notify_cq(struct ibv_cq * cq, int solicited_only) { - uhyve_ibv_req_notify_cq_t uhyve_args; - uhyve_args.cq = cq; - uhyve_args.solicited_only = solicited_only; - - uhyve_send(UHYVE_PORT_IBV_REQ_NOTIFY_CQ, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_create_srq - */ - -typedef struct { - // Parameters: - struct ibv_pd * pd; - struct ibv_srq_init_attr * srq_init_attr; - // Return value: - struct ibv_srq * ret; -} __attribute__((packed)) uhyve_ibv_create_srq_t; - -struct ibv_srq * ibv_create_srq(struct ibv_pd * pd, struct ibv_srq_init_attr * srq_init_attr) { - uhyve_ibv_create_srq_t uhyve_args; - uhyve_args.pd = pd; - uhyve_args.srq_init_attr = srq_init_attr; - - uhyve_send(UHYVE_PORT_IBV_CREATE_SRQ, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_create_srq_ex - */ - -typedef struct { - // Parameters: - struct ibv_context * context; - struct ibv_srq_init_attr_ex * srq_init_attr_ex; - // Return value: - struct ibv_srq * ret; -} __attribute__((packed)) uhyve_ibv_create_srq_ex_t; - -struct ibv_srq * ibv_create_srq_ex(struct ibv_context * context, struct ibv_srq_init_attr_ex * srq_init_attr_ex) { - uhyve_ibv_create_srq_ex_t uhyve_args; - uhyve_args.context = context; - uhyve_args.srq_init_attr_ex = srq_init_attr_ex; - - uhyve_send(UHYVE_PORT_IBV_CREATE_SRQ_EX, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_modify_srq - */ - -typedef struct { - // Parameters: - struct ibv_srq * srq; - struct ibv_srq_attr * srq_attr; - int srq_attr_mask; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_modify_srq_t; - -int ibv_modify_srq(struct ibv_srq * srq, struct ibv_srq_attr * srq_attr, int srq_attr_mask) { - uhyve_ibv_modify_srq_t uhyve_args; - uhyve_args.srq = srq; - uhyve_args.srq_attr = srq_attr; - uhyve_args.srq_attr_mask = srq_attr_mask; - - uhyve_send(UHYVE_PORT_IBV_MODIFY_SRQ, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_query_srq - */ - -typedef struct { - // Parameters: - struct ibv_srq * srq; - struct ibv_srq_attr * srq_attr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_query_srq_t; - -int ibv_query_srq(struct ibv_srq * srq, struct ibv_srq_attr * srq_attr) { - uhyve_ibv_query_srq_t uhyve_args; - uhyve_args.srq = srq; - uhyve_args.srq_attr = srq_attr; - - uhyve_send(UHYVE_PORT_IBV_QUERY_SRQ, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_get_srq_num - */ - -typedef struct { - // Parameters: - struct ibv_srq * srq; - uint32_t * srq_num; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_get_srq_num_t; - -int ibv_get_srq_num(struct ibv_srq * srq, uint32_t * srq_num) { - uhyve_ibv_get_srq_num_t uhyve_args; - uhyve_args.srq = srq; - uhyve_args.srq_num = srq_num; - - uhyve_send(UHYVE_PORT_IBV_GET_SRQ_NUM, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_destroy_srq - */ - -typedef struct { - // Parameters: - struct ibv_srq * srq; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_destroy_srq_t; - -int ibv_destroy_srq(struct ibv_srq * srq) { - uhyve_ibv_destroy_srq_t uhyve_args; - uhyve_args.srq = srq; - - uhyve_send(UHYVE_PORT_IBV_DESTROY_SRQ, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_post_srq_recv - */ - -typedef struct { - // Parameters: - struct ibv_srq * srq; - struct ibv_recv_wr * recv_wr; - struct ibv_recv_wr ** bad_recv_wr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_post_srq_recv_t; - -int ibv_post_srq_recv(struct ibv_srq * srq, struct ibv_recv_wr * recv_wr, struct ibv_recv_wr ** bad_recv_wr) { - uhyve_ibv_post_srq_recv_t uhyve_args; - uhyve_args.srq = srq; - uhyve_args.recv_wr = recv_wr; - // TODO: Take care of ** parameter. - - uhyve_send(UHYVE_PORT_IBV_POST_SRQ_RECV, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_create_qp - */ - -typedef struct { - // Parameters: - struct ibv_pd * pd; - struct ibv_qp_init_attr * qp_init_attr; - // Return value: - struct ibv_qp * ret; -} __attribute__((packed)) uhyve_ibv_create_qp_t; - -struct ibv_qp * ibv_create_qp(struct ibv_pd * pd, struct ibv_qp_init_attr * qp_init_attr) { - uhyve_ibv_create_qp_t uhyve_args; - uhyve_args.pd = pd; - uhyve_args.qp_init_attr = qp_init_attr; - - uhyve_send(UHYVE_PORT_IBV_CREATE_QP, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_create_qp_ex - */ - -typedef struct { - // Parameters: - struct ibv_context * context; - struct ibv_qp_init_attr_ex * qp_init_attr_ex; - // Return value: - struct ibv_qp * ret; -} __attribute__((packed)) uhyve_ibv_create_qp_ex_t; - -struct ibv_qp * ibv_create_qp_ex(struct ibv_context * context, struct ibv_qp_init_attr_ex * qp_init_attr_ex) { - uhyve_ibv_create_qp_ex_t uhyve_args; - uhyve_args.context = context; - uhyve_args.qp_init_attr_ex = qp_init_attr_ex; - - uhyve_send(UHYVE_PORT_IBV_CREATE_QP_EX, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_query_rt_values_ex - */ - -typedef struct { - // Parameters: - struct ibv_context * context; - struct ibv_values_ex * values; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_query_rt_values_ex_t; - -int ibv_query_rt_values_ex(struct ibv_context * context, struct ibv_values_ex * values) { - uhyve_ibv_query_rt_values_ex_t uhyve_args; - uhyve_args.context = context; - uhyve_args.values = values; - - uhyve_send(UHYVE_PORT_IBV_QUERY_RT_VALUES_EX, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_query_device_ex - */ - -typedef struct { - // Parameters: - struct ibv_context * context; - const struct ibv_query_device_ex_input * input; - struct ibv_device_attr_ex * attr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_query_device_ex_t; - -int ibv_query_device_ex(struct ibv_context * context, const struct ibv_query_device_ex_input * input, struct ibv_device_attr_ex * attr) { - uhyve_ibv_query_device_ex_t uhyve_args; - uhyve_args.context = context; - uhyve_args.input = input; - uhyve_args.attr = attr; - - uhyve_send(UHYVE_PORT_IBV_QUERY_DEVICE_EX, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_open_qp - */ - -typedef struct { - // Parameters: - struct ibv_context * context; - struct ibv_qp_open_attr * qp_open_attr; - // Return value: - struct ibv_qp * ret; -} __attribute__((packed)) uhyve_ibv_open_qp_t; - -struct ibv_qp * ibv_open_qp(struct ibv_context * context, struct ibv_qp_open_attr * qp_open_attr) { - uhyve_ibv_open_qp_t uhyve_args; - uhyve_args.context = context; - uhyve_args.qp_open_attr = qp_open_attr; - - uhyve_send(UHYVE_PORT_IBV_OPEN_QP, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_modify_qp - */ - -typedef struct { - // Parameters: - struct ibv_qp * qp; - struct ibv_qp_attr * attr; - int attr_mask; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_modify_qp_t; - -int ibv_modify_qp(struct ibv_qp * qp, struct ibv_qp_attr * attr, int attr_mask) { - uhyve_ibv_modify_qp_t uhyve_args; - uhyve_args.qp = qp; - uhyve_args.attr = attr; - uhyve_args.attr_mask = attr_mask; - - uhyve_send(UHYVE_PORT_IBV_MODIFY_QP, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_query_qp - */ - -typedef struct { - // Parameters: - struct ibv_qp * qp; - struct ibv_qp_attr * attr; - int attr_mask; - struct ibv_qp_init_attr * init_attr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_query_qp_t; - -int ibv_query_qp(struct ibv_qp * qp, struct ibv_qp_attr * attr, int attr_mask, struct ibv_qp_init_attr * init_attr) { - uhyve_ibv_query_qp_t uhyve_args; - uhyve_args.qp = qp; - uhyve_args.attr = attr; - uhyve_args.attr_mask = attr_mask; - uhyve_args.init_attr = init_attr; - - uhyve_send(UHYVE_PORT_IBV_QUERY_QP, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_destroy_qp - */ - -typedef struct { - // Parameters: - struct ibv_qp * qp; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_destroy_qp_t; - -int ibv_destroy_qp(struct ibv_qp * qp) { - uhyve_ibv_destroy_qp_t uhyve_args; - uhyve_args.qp = qp; - - uhyve_send(UHYVE_PORT_IBV_DESTROY_QP, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_create_wq - */ - -typedef struct { - // Parameters: - struct ibv_context * context; - struct ibv_wq_init_attr * wq_init_attr; - // Return value: - struct ibv_wq * ret; -} __attribute__((packed)) uhyve_ibv_create_wq_t; - -struct ibv_wq * ibv_create_wq(struct ibv_context * context, struct ibv_wq_init_attr * wq_init_attr) { - uhyve_ibv_create_wq_t uhyve_args; - uhyve_args.context = context; - uhyve_args.wq_init_attr = wq_init_attr; - - uhyve_send(UHYVE_PORT_IBV_CREATE_WQ, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_modify_wq - */ - -typedef struct { - // Parameters: - struct ibv_wq * wq; - struct ibv_wq_attr * wq_attr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_modify_wq_t; - -int ibv_modify_wq(struct ibv_wq * wq, struct ibv_wq_attr * wq_attr) { - uhyve_ibv_modify_wq_t uhyve_args; - uhyve_args.wq = wq; - uhyve_args.wq_attr = wq_attr; - - uhyve_send(UHYVE_PORT_IBV_MODIFY_WQ, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_destroy_wq - */ - -typedef struct { - // Parameters: - struct ibv_wq * wq; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_destroy_wq_t; - -int ibv_destroy_wq(struct ibv_wq * wq) { - uhyve_ibv_destroy_wq_t uhyve_args; - uhyve_args.wq = wq; - - uhyve_send(UHYVE_PORT_IBV_DESTROY_WQ, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_create_rwq_ind_table - */ - -typedef struct { - // Parameters: - struct ibv_context * context; - struct ibv_rwq_ind_table_init_attr * init_attr; - // Return value: - struct ibv_rwq_ind_table * ret; -} __attribute__((packed)) uhyve_ibv_create_rwq_ind_table_t; - -struct ibv_rwq_ind_table * ibv_create_rwq_ind_table(struct ibv_context * context, struct ibv_rwq_ind_table_init_attr * init_attr) { - uhyve_ibv_create_rwq_ind_table_t uhyve_args; - uhyve_args.context = context; - uhyve_args.init_attr = init_attr; - - uhyve_send(UHYVE_PORT_IBV_CREATE_RWQ_IND_TABLE, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_destroy_rwq_ind_table - */ - -typedef struct { - // Parameters: - struct ibv_rwq_ind_table * rwq_ind_table; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_destroy_rwq_ind_table_t; - -int ibv_destroy_rwq_ind_table(struct ibv_rwq_ind_table * rwq_ind_table) { - uhyve_ibv_destroy_rwq_ind_table_t uhyve_args; - uhyve_args.rwq_ind_table = rwq_ind_table; - - uhyve_send(UHYVE_PORT_IBV_DESTROY_RWQ_IND_TABLE, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_post_send - */ - -typedef struct { - // Parameters: - struct ibv_qp * qp; - struct ibv_send_wr * wr; - struct ibv_send_wr ** bad_wr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_post_send_t; - -int ibv_post_send(struct ibv_qp * qp, struct ibv_send_wr * wr, struct ibv_send_wr ** bad_wr) { - uhyve_ibv_post_send_t uhyve_args; - uhyve_args.qp = qp; - uhyve_args.wr = wr; - // TODO: Take care of ** parameter. - - uhyve_send(UHYVE_PORT_IBV_POST_SEND, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_post_recv - */ - -typedef struct { - // Parameters: - struct ibv_qp * qp; - struct ibv_recv_wr * wr; - struct ibv_recv_wr ** bad_wr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_post_recv_t; - -int ibv_post_recv(struct ibv_qp * qp, struct ibv_recv_wr * wr, struct ibv_recv_wr ** bad_wr) { - uhyve_ibv_post_recv_t uhyve_args; - uhyve_args.qp = qp; - uhyve_args.wr = wr; - // TODO: Take care of ** parameter. - - uhyve_send(UHYVE_PORT_IBV_POST_RECV, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_create_ah - */ - -typedef struct { - // Parameters: - struct ibv_pd * pd; - struct ibv_ah_attr * attr; - // Return value: - struct ibv_ah * ret; -} __attribute__((packed)) uhyve_ibv_create_ah_t; - -struct ibv_ah * ibv_create_ah(struct ibv_pd * pd, struct ibv_ah_attr * attr) { - uhyve_ibv_create_ah_t uhyve_args; - uhyve_args.pd = pd; - uhyve_args.attr = attr; - - uhyve_send(UHYVE_PORT_IBV_CREATE_AH, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_init_ah_from_wc - */ - -typedef struct { - // Parameters: - struct ibv_context * context; - uint8_t port_num; - struct ibv_wc * wc; - struct ibv_grh * grh; - struct ibv_ah_attr * ah_attr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_init_ah_from_wc_t; - -int ibv_init_ah_from_wc(struct ibv_context * context, uint8_t port_num, struct ibv_wc * wc, struct ibv_grh * grh, struct ibv_ah_attr * ah_attr) { - uhyve_ibv_init_ah_from_wc_t uhyve_args; - uhyve_args.context = context; - uhyve_args.port_num = port_num; - uhyve_args.wc = wc; - uhyve_args.grh = grh; - uhyve_args.ah_attr = ah_attr; - - uhyve_send(UHYVE_PORT_IBV_INIT_AH_FROM_WC, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_create_ah_from_wc - */ - -typedef struct { - // Parameters: - struct ibv_pd * pd; - struct ibv_wc * wc; - struct ibv_grh * grh; - uint8_t port_num; - // Return value: - struct ibv_ah * ret; -} __attribute__((packed)) uhyve_ibv_create_ah_from_wc_t; - -struct ibv_ah * ibv_create_ah_from_wc(struct ibv_pd * pd, struct ibv_wc * wc, struct ibv_grh * grh, uint8_t port_num) { - uhyve_ibv_create_ah_from_wc_t uhyve_args; - uhyve_args.pd = pd; - uhyve_args.wc = wc; - uhyve_args.grh = grh; - uhyve_args.port_num = port_num; - - uhyve_send(UHYVE_PORT_IBV_CREATE_AH_FROM_WC, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_destroy_ah - */ - -typedef struct { - // Parameters: - struct ibv_ah * ah; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_destroy_ah_t; - -int ibv_destroy_ah(struct ibv_ah * ah) { - uhyve_ibv_destroy_ah_t uhyve_args; - uhyve_args.ah = ah; - - uhyve_send(UHYVE_PORT_IBV_DESTROY_AH, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_attach_mcast - */ - -typedef struct { - // Parameters: - struct ibv_qp * qp; - const union ibv_gid * gid; - uint16_t lid; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_attach_mcast_t; - -int ibv_attach_mcast(struct ibv_qp * qp, const union ibv_gid * gid, uint16_t lid) { - uhyve_ibv_attach_mcast_t uhyve_args; - uhyve_args.qp = qp; - uhyve_args.gid = gid; - uhyve_args.lid = lid; - - uhyve_send(UHYVE_PORT_IBV_ATTACH_MCAST, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_detach_mcast - */ - -typedef struct { - // Parameters: - struct ibv_qp * qp; - const union ibv_gid * gid; - uint16_t lid; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_detach_mcast_t; - -int ibv_detach_mcast(struct ibv_qp * qp, const union ibv_gid * gid, uint16_t lid) { - uhyve_ibv_detach_mcast_t uhyve_args; - uhyve_args.qp = qp; - uhyve_args.gid = gid; - uhyve_args.lid = lid; - - uhyve_send(UHYVE_PORT_IBV_DETACH_MCAST, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_fork_init - */ - -typedef struct { - // Parameters: - ; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_fork_init_t; - -int ibv_fork_init( ) { - uhyve_ibv_fork_init_t uhyve_args; - uhyve_args. = ; - - uhyve_send(UHYVE_PORT_IBV_FORK_INIT, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_node_type_str - */ - -typedef struct { - // Parameters: - enum ibv_node_type node_type; - // Return value: - const char * ret; -} __attribute__((packed)) uhyve_ibv_node_type_str_t; - -const char * ibv_node_type_str(enum ibv_node_type node_type) { - uhyve_ibv_node_type_str_t uhyve_args; - uhyve_args.node_type = node_type; - - uhyve_send(UHYVE_PORT_IBV_NODE_TYPE_STR, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_port_state_str - */ - -typedef struct { - // Parameters: - enum ibv_port_state port_state; - // Return value: - const char * ret; -} __attribute__((packed)) uhyve_ibv_port_state_str_t; - -const char * ibv_port_state_str(enum ibv_port_state port_state) { - uhyve_ibv_port_state_str_t uhyve_args; - uhyve_args.port_state = port_state; - - uhyve_send(UHYVE_PORT_IBV_PORT_STATE_STR, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_event_type_str - */ - -typedef struct { - // Parameters: - enum ibv_event_type event; - // Return value: - const char * ret; -} __attribute__((packed)) uhyve_ibv_event_type_str_t; - -const char * ibv_event_type_str(enum ibv_event_type event) { - uhyve_ibv_event_type_str_t uhyve_args; - uhyve_args.event = event; - - uhyve_send(UHYVE_PORT_IBV_EVENT_TYPE_STR, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_resolve_eth_l2_from_gid - */ - -typedef struct { - // Parameters: - struct ibv_context * context; - struct ibv_ah_attr * attr; - uint8_t eth_mac[6]; - uint16_t * vid; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_resolve_eth_l2_from_gid_t; - -int ibv_resolve_eth_l2_from_gid(struct ibv_context * context, struct ibv_ah_attr * attr, uint8_t eth_mac[6], uint16_t * vid) { - uhyve_ibv_resolve_eth_l2_from_gid_t uhyve_args; - uhyve_args.context = context; - uhyve_args.attr = attr; - uhyve_args.eth_mac[6] = eth_mac[6]; - uhyve_args.vid = vid; - - uhyve_send(UHYVE_PORT_IBV_RESOLVE_ETH_L2_FROM_GID, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - -/* - * ibv_is_qpt_supported - */ - -typedef struct { - // Parameters: - uint32_t caps; - enum ibv_qp_type qpt; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_is_qpt_supported_t; - -int ibv_is_qpt_supported(uint32_t caps, enum ibv_qp_type qpt) { - uhyve_ibv_is_qpt_supported_t uhyve_args; - uhyve_args.caps = caps; - uhyve_args.qpt = qpt; - - uhyve_send(UHYVE_PORT_IBV_IS_QPT_SUPPORTED, (unsigned) virt_to_phys((size_t) &uhyve_args)); - - return uhyve_args.ret; -} - - diff --git a/tools/ibv_code_generator/GEN-tools-uhyve-ibv-ports.h b/tools/ibv_code_generator/GEN-tools-uhyve-ibv-ports.h index 481ce6165..e7131c52e 100644 --- a/tools/ibv_code_generator/GEN-tools-uhyve-ibv-ports.h +++ b/tools/ibv_code_generator/GEN-tools-uhyve-ibv-ports.h @@ -1,361 +1,45 @@ typedef enum { - UHYVE_PORT_IBV_WC_STATUS_STR = 0x510, - UHYVE_PORT_IBV_RATE_TO_MULT = 0x511, - UHYVE_PORT_MULT_TO_IBV_RATE = 0x512, - UHYVE_PORT_IBV_RATE_TO_MBPS = 0x513, - UHYVE_PORT_MBPS_TO_IBV_RATE = 0x514, - UHYVE_PORT_IBV_POST_WQ_RECV = 0x515, - UHYVE_PORT_VERBS_GET_CTX = 0x516, - UHYVE_PORT_IBV_GET_DEVICE_LIST = 0x517, - UHYVE_PORT_IBV_FREE_DEVICE_LIST = 0x518, - UHYVE_PORT_IBV_GET_DEVICE_NAME = 0x519, - UHYVE_PORT_IBV_GET_DEVICE_GUID = 0x51A, - UHYVE_PORT_IBV_OPEN_DEVICE = 0x51B, - UHYVE_PORT_IBV_CLOSE_DEVICE = 0x51C, - UHYVE_PORT_IBV_GET_ASYNC_EVENT = 0x51D, - UHYVE_PORT_IBV_ACK_ASYNC_EVENT = 0x51E, - UHYVE_PORT_IBV_QUERY_DEVICE = 0x51F, - UHYVE_PORT_IBV_QUERY_PORT = 0x520, - UHYVE_PORT____IBV_QUERY_PORT = 0x521, - UHYVE_PORT_IBV_QUERY_GID = 0x522, - UHYVE_PORT_IBV_QUERY_PKEY = 0x523, - UHYVE_PORT_IBV_ALLOC_PD = 0x524, - UHYVE_PORT_IBV_DEALLOC_PD = 0x525, - UHYVE_PORT_IBV_CREATE_FLOW = 0x526, - UHYVE_PORT_IBV_DESTROY_FLOW = 0x527, - UHYVE_PORT_IBV_OPEN_XRCD = 0x528, - UHYVE_PORT_IBV_CLOSE_XRCD = 0x529, - UHYVE_PORT_IBV_REG_MR = 0x52A, - UHYVE_PORT_IBV_REREG_MR = 0x52B, - UHYVE_PORT_IBV_DEREG_MR = 0x52C, - UHYVE_PORT_IBV_ALLOC_MW = 0x52D, - UHYVE_PORT_IBV_DEALLOC_MW = 0x52E, - UHYVE_PORT_IBV_INC_RKEY = 0x52F, - UHYVE_PORT_IBV_BIND_MW = 0x530, - UHYVE_PORT_IBV_CREATE_COMP_CHANNEL = 0x531, - UHYVE_PORT_IBV_DESTROY_COMP_CHANNEL = 0x532, - UHYVE_PORT_IBV_CREATE_CQ = 0x533, - UHYVE_PORT_IBV_CREATE_CQ_EX = 0x534, - UHYVE_PORT_IBV_RESIZE_CQ = 0x535, - UHYVE_PORT_IBV_DESTROY_CQ = 0x536, - UHYVE_PORT_IBV_GET_CQ_EVENT = 0x537, - UHYVE_PORT_IBV_ACK_CQ_EVENTS = 0x538, - UHYVE_PORT_IBV_POLL_CQ = 0x539, - UHYVE_PORT_IBV_REQ_NOTIFY_CQ = 0x53A, - UHYVE_PORT_IBV_CREATE_SRQ = 0x53B, - UHYVE_PORT_IBV_CREATE_SRQ_EX = 0x53C, - UHYVE_PORT_IBV_MODIFY_SRQ = 0x53D, - UHYVE_PORT_IBV_QUERY_SRQ = 0x53E, - UHYVE_PORT_IBV_GET_SRQ_NUM = 0x53F, - UHYVE_PORT_IBV_DESTROY_SRQ = 0x540, - UHYVE_PORT_IBV_POST_SRQ_RECV = 0x541, - UHYVE_PORT_IBV_CREATE_QP = 0x542, - UHYVE_PORT_IBV_CREATE_QP_EX = 0x543, - UHYVE_PORT_IBV_QUERY_RT_VALUES_EX = 0x544, - UHYVE_PORT_IBV_QUERY_DEVICE_EX = 0x545, - UHYVE_PORT_IBV_OPEN_QP = 0x546, - UHYVE_PORT_IBV_MODIFY_QP = 0x547, - UHYVE_PORT_IBV_QUERY_QP = 0x548, - UHYVE_PORT_IBV_DESTROY_QP = 0x549, - UHYVE_PORT_IBV_CREATE_WQ = 0x54A, - UHYVE_PORT_IBV_MODIFY_WQ = 0x54B, - UHYVE_PORT_IBV_DESTROY_WQ = 0x54C, - UHYVE_PORT_IBV_CREATE_RWQ_IND_TABLE = 0x54D, - UHYVE_PORT_IBV_DESTROY_RWQ_IND_TABLE = 0x54E, - UHYVE_PORT_IBV_POST_SEND = 0x54F, - UHYVE_PORT_IBV_POST_RECV = 0x550, - UHYVE_PORT_IBV_CREATE_AH = 0x551, - UHYVE_PORT_IBV_INIT_AH_FROM_WC = 0x552, - UHYVE_PORT_IBV_CREATE_AH_FROM_WC = 0x553, - UHYVE_PORT_IBV_DESTROY_AH = 0x554, - UHYVE_PORT_IBV_ATTACH_MCAST = 0x555, - UHYVE_PORT_IBV_DETACH_MCAST = 0x556, - UHYVE_PORT_IBV_FORK_INIT = 0x557, - UHYVE_PORT_IBV_NODE_TYPE_STR = 0x558, - UHYVE_PORT_IBV_PORT_STATE_STR = 0x559, - UHYVE_PORT_IBV_EVENT_TYPE_STR = 0x55A, - UHYVE_PORT_IBV_RESOLVE_ETH_L2_FROM_GID = 0x55B, - UHYVE_PORT_IBV_IS_QPT_SUPPORTED = 0x55C, + UHYVE_PORT_IBV_CQ_EX_TO_CQ = 0x510, + UHYVE_PORT_IBV_START_POLL = 0x511, + UHYVE_PORT_IBV_NEXT_POLL = 0x512, + UHYVE_PORT_IBV_END_POLL = 0x513, + UHYVE_PORT_IBV_WC_READ_COMPLETION_TS = 0x514, + UHYVE_PORT_IBV_CREATE_CQ_EX = 0x515, } uhyve_ibv_t; typedef struct { // Parameters: - enum ibv_wc_status status; - // Return value: - const char * ret; -} __attribute__((packed)) uhyve_ibv_wc_status_str_t; - -typedef struct { - // Parameters: - enum ibv_rate rate; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_rate_to_mult_t; - -typedef struct { - // Parameters: - int mult; - // Return value: - enum ibv_rate ret; -} __attribute__((packed)) uhyve_mult_to_ibv_rate_t; - -typedef struct { - // Parameters: - enum ibv_rate rate; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_rate_to_mbps_t; - -typedef struct { - // Parameters: - int mbps; - // Return value: - enum ibv_rate ret; -} __attribute__((packed)) uhyve_mbps_to_ibv_rate_t; - -typedef struct { - // Parameters: - struct ibv_wq * wq; - struct ibv_recv_wr * recv_wr; - struct ibv_recv_wr ** bad_recv_wr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_post_wq_recv_t; - -typedef struct { - // Parameters: - struct ibv_context * ctx; - // Return value: - struct verbs_context * ret; -} __attribute__((packed)) uhyve_verbs_get_ctx_t; - -typedef struct { - // Parameters: - int * num_devices; - // Return value: - struct ibv_device ** ret; -} __attribute__((packed)) uhyve_ibv_get_device_list_t; - -typedef struct { - // Parameters: - struct ibv_device ** list; -} __attribute__((packed)) uhyve_ibv_free_device_list_t; - -typedef struct { - // Parameters: - struct ibv_device * device; - // Return value: - const char * ret; -} __attribute__((packed)) uhyve_ibv_get_device_name_t; - -typedef struct { - // Parameters: - struct ibv_device * device; - // Return value: - __be64 ret; -} __attribute__((packed)) uhyve_ibv_get_device_guid_t; - -typedef struct { - // Parameters: - struct ibv_device * device; - // Return value: - struct ibv_context * ret; -} __attribute__((packed)) uhyve_ibv_open_device_t; - -typedef struct { - // Parameters: - struct ibv_context * context; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_close_device_t; - -typedef struct { - // Parameters: - struct ibv_context * context; - struct ibv_async_event * event; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_get_async_event_t; - -typedef struct { - // Parameters: - struct ibv_async_event * event; -} __attribute__((packed)) uhyve_ibv_ack_async_event_t; - -typedef struct { - // Parameters: - struct ibv_context * context; - struct ibv_device_attr * device_attr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_query_device_t; - -typedef struct { - // Parameters: - struct ibv_context * context; - uint8_t port_num; - struct ibv_port_attr * port_attr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_query_port_t; - -typedef struct { - // Parameters: - struct ibv_context * context; - uint8_t port_num; - struct ibv_port_attr * port_attr; - // Return value: - int ret; -} __attribute__((packed)) uhyve____ibv_query_port_t; - -typedef struct { - // Parameters: - struct ibv_context * context; - uint8_t port_num; - int index; - union ibv_gid * gid; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_query_gid_t; - -typedef struct { - // Parameters: - struct ibv_context * context; - uint8_t port_num; - int index; - __be16 * pkey; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_query_pkey_t; - -typedef struct { - // Parameters: - struct ibv_context * context; - // Return value: - struct ibv_pd * ret; -} __attribute__((packed)) uhyve_ibv_alloc_pd_t; - -typedef struct { - // Parameters: - struct ibv_pd * pd; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_dealloc_pd_t; - -typedef struct { - // Parameters: - struct ibv_qp * qp; - struct ibv_flow_attr * flow; - // Return value: - struct ibv_flow * ret; -} __attribute__((packed)) uhyve_ibv_create_flow_t; - -typedef struct { - // Parameters: - struct ibv_flow * flow_id; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_destroy_flow_t; - -typedef struct { - // Parameters: - struct ibv_context * context; - struct ibv_xrcd_init_attr * xrcd_init_attr; - // Return value: - struct ibv_xrcd * ret; -} __attribute__((packed)) uhyve_ibv_open_xrcd_t; - -typedef struct { - // Parameters: - struct ibv_xrcd * xrcd; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_close_xrcd_t; - -typedef struct { - // Parameters: - struct ibv_pd * pd; - void * addr; - int length; - int access; - // Return value: - struct ibv_mr * ret; -} __attribute__((packed)) uhyve_ibv_reg_mr_t; - -typedef struct { - // Parameters: - struct ibv_mr * mr; - int flags; - struct ibv_pd * pd; - void * addr; - int length; - int access; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_rereg_mr_t; - -typedef struct { - // Parameters: - struct ibv_mr * mr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_dereg_mr_t; - -typedef struct { - // Parameters: - struct ibv_pd * pd; - enum ibv_mw_type type; - // Return value: - struct ibv_mw * ret; -} __attribute__((packed)) uhyve_ibv_alloc_mw_t; - -typedef struct { - // Parameters: - struct ibv_mw * mw; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_dealloc_mw_t; - -typedef struct { - // Parameters: - uint32_t rkey; - // Return value: - uint32_t ret; -} __attribute__((packed)) uhyve_ibv_inc_rkey_t; - -typedef struct { - // Parameters: - struct ibv_qp * qp; - struct ibv_mw * mw; - struct ibv_mw_bind * mw_bind; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_bind_mw_t; - -typedef struct { - // Parameters: - struct ibv_context * context; - // Return value: - struct ibv_comp_channel * ret; -} __attribute__((packed)) uhyve_ibv_create_comp_channel_t; - -typedef struct { - // Parameters: - struct ibv_comp_channel * channel; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_destroy_comp_channel_t; - -typedef struct { - // Parameters: - struct ibv_context * context; - int cqe; - void * cq_context; - struct ibv_comp_channel * channel; - int comp_vector; + struct ibv_cq_ex * cq; // Return value: struct ibv_cq * ret; -} __attribute__((packed)) uhyve_ibv_create_cq_t; +} __attribute__((packed)) uhyve_ibv_cq_ex_to_cq_t; + +typedef struct { + // Parameters: + struct ibv_cq_ex * cq; + struct ibv_poll_cq_attr * attr; + // Return value: + int ret; +} __attribute__((packed)) uhyve_ibv_start_poll_t; + +typedef struct { + // Parameters: + struct ibv_cq_ex * cq; + // Return value: + int ret; +} __attribute__((packed)) uhyve_ibv_next_poll_t; + +typedef struct { + // Parameters: + struct ibv_cq_ex * cq; +} __attribute__((packed)) uhyve_ibv_end_poll_t; + +typedef struct { + // Parameters: + struct ibv_cq_ex * cq; + // Return value: + uint64_t ret; +} __attribute__((packed)) uhyve_ibv_wc_read_completion_ts_t; typedef struct { // Parameters: @@ -365,409 +49,11 @@ typedef struct { struct ibv_cq_ex * ret; } __attribute__((packed)) uhyve_ibv_create_cq_ex_t; -typedef struct { - // Parameters: - struct ibv_cq * cq; - int cqe; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_resize_cq_t; - -typedef struct { - // Parameters: - struct ibv_cq * cq; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_destroy_cq_t; - -typedef struct { - // Parameters: - struct ibv_comp_channel * channel; - struct ibv_cq ** cq; - void ** cq_context; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_get_cq_event_t; - -typedef struct { - // Parameters: - struct ibv_cq * cq; - unsigned int nevents; -} __attribute__((packed)) uhyve_ibv_ack_cq_events_t; - -typedef struct { - // Parameters: - struct ibv_cq * cq; - int num_entries; - struct ibv_wc * wc; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_poll_cq_t; - -typedef struct { - // Parameters: - struct ibv_cq * cq; - int solicited_only; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_req_notify_cq_t; - -typedef struct { - // Parameters: - struct ibv_pd * pd; - struct ibv_srq_init_attr * srq_init_attr; - // Return value: - struct ibv_srq * ret; -} __attribute__((packed)) uhyve_ibv_create_srq_t; - -typedef struct { - // Parameters: - struct ibv_context * context; - struct ibv_srq_init_attr_ex * srq_init_attr_ex; - // Return value: - struct ibv_srq * ret; -} __attribute__((packed)) uhyve_ibv_create_srq_ex_t; - -typedef struct { - // Parameters: - struct ibv_srq * srq; - struct ibv_srq_attr * srq_attr; - int srq_attr_mask; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_modify_srq_t; - -typedef struct { - // Parameters: - struct ibv_srq * srq; - struct ibv_srq_attr * srq_attr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_query_srq_t; - -typedef struct { - // Parameters: - struct ibv_srq * srq; - uint32_t * srq_num; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_get_srq_num_t; - -typedef struct { - // Parameters: - struct ibv_srq * srq; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_destroy_srq_t; - -typedef struct { - // Parameters: - struct ibv_srq * srq; - struct ibv_recv_wr * recv_wr; - struct ibv_recv_wr ** bad_recv_wr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_post_srq_recv_t; - -typedef struct { - // Parameters: - struct ibv_pd * pd; - struct ibv_qp_init_attr * qp_init_attr; - // Return value: - struct ibv_qp * ret; -} __attribute__((packed)) uhyve_ibv_create_qp_t; - -typedef struct { - // Parameters: - struct ibv_context * context; - struct ibv_qp_init_attr_ex * qp_init_attr_ex; - // Return value: - struct ibv_qp * ret; -} __attribute__((packed)) uhyve_ibv_create_qp_ex_t; - -typedef struct { - // Parameters: - struct ibv_context * context; - struct ibv_values_ex * values; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_query_rt_values_ex_t; - -typedef struct { - // Parameters: - struct ibv_context * context; - const struct ibv_query_device_ex_input * input; - struct ibv_device_attr_ex * attr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_query_device_ex_t; - -typedef struct { - // Parameters: - struct ibv_context * context; - struct ibv_qp_open_attr * qp_open_attr; - // Return value: - struct ibv_qp * ret; -} __attribute__((packed)) uhyve_ibv_open_qp_t; - -typedef struct { - // Parameters: - struct ibv_qp * qp; - struct ibv_qp_attr * attr; - int attr_mask; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_modify_qp_t; - -typedef struct { - // Parameters: - struct ibv_qp * qp; - struct ibv_qp_attr * attr; - int attr_mask; - struct ibv_qp_init_attr * init_attr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_query_qp_t; - -typedef struct { - // Parameters: - struct ibv_qp * qp; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_destroy_qp_t; - -typedef struct { - // Parameters: - struct ibv_context * context; - struct ibv_wq_init_attr * wq_init_attr; - // Return value: - struct ibv_wq * ret; -} __attribute__((packed)) uhyve_ibv_create_wq_t; - -typedef struct { - // Parameters: - struct ibv_wq * wq; - struct ibv_wq_attr * wq_attr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_modify_wq_t; - -typedef struct { - // Parameters: - struct ibv_wq * wq; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_destroy_wq_t; - -typedef struct { - // Parameters: - struct ibv_context * context; - struct ibv_rwq_ind_table_init_attr * init_attr; - // Return value: - struct ibv_rwq_ind_table * ret; -} __attribute__((packed)) uhyve_ibv_create_rwq_ind_table_t; - -typedef struct { - // Parameters: - struct ibv_rwq_ind_table * rwq_ind_table; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_destroy_rwq_ind_table_t; - -typedef struct { - // Parameters: - struct ibv_qp * qp; - struct ibv_send_wr * wr; - struct ibv_send_wr ** bad_wr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_post_send_t; - -typedef struct { - // Parameters: - struct ibv_qp * qp; - struct ibv_recv_wr * wr; - struct ibv_recv_wr ** bad_wr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_post_recv_t; - -typedef struct { - // Parameters: - struct ibv_pd * pd; - struct ibv_ah_attr * attr; - // Return value: - struct ibv_ah * ret; -} __attribute__((packed)) uhyve_ibv_create_ah_t; - -typedef struct { - // Parameters: - struct ibv_context * context; - uint8_t port_num; - struct ibv_wc * wc; - struct ibv_grh * grh; - struct ibv_ah_attr * ah_attr; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_init_ah_from_wc_t; - -typedef struct { - // Parameters: - struct ibv_pd * pd; - struct ibv_wc * wc; - struct ibv_grh * grh; - uint8_t port_num; - // Return value: - struct ibv_ah * ret; -} __attribute__((packed)) uhyve_ibv_create_ah_from_wc_t; - -typedef struct { - // Parameters: - struct ibv_ah * ah; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_destroy_ah_t; - -typedef struct { - // Parameters: - struct ibv_qp * qp; - const union ibv_gid * gid; - uint16_t lid; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_attach_mcast_t; - -typedef struct { - // Parameters: - struct ibv_qp * qp; - const union ibv_gid * gid; - uint16_t lid; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_detach_mcast_t; - -typedef struct { - // Parameters: - ; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_fork_init_t; - -typedef struct { - // Parameters: - enum ibv_node_type node_type; - // Return value: - const char * ret; -} __attribute__((packed)) uhyve_ibv_node_type_str_t; - -typedef struct { - // Parameters: - enum ibv_port_state port_state; - // Return value: - const char * ret; -} __attribute__((packed)) uhyve_ibv_port_state_str_t; - -typedef struct { - // Parameters: - enum ibv_event_type event; - // Return value: - const char * ret; -} __attribute__((packed)) uhyve_ibv_event_type_str_t; - -typedef struct { - // Parameters: - struct ibv_context * context; - struct ibv_ah_attr * attr; - uint8_t eth_mac[6]; - uint16_t * vid; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_resolve_eth_l2_from_gid_t; - -typedef struct { - // Parameters: - uint32_t caps; - enum ibv_qp_type qpt; - // Return value: - int ret; -} __attribute__((packed)) uhyve_ibv_is_qpt_supported_t; - -void call_ibv_wc_status_str(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_rate_to_mult(struct kvm_run * run, uint8_t * guest_mem); -void call_mult_to_ibv_rate(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_rate_to_mbps(struct kvm_run * run, uint8_t * guest_mem); -void call_mbps_to_ibv_rate(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_post_wq_recv(struct kvm_run * run, uint8_t * guest_mem); -void call_verbs_get_ctx(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_get_device_list(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_free_device_list(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_get_device_name(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_get_device_guid(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_open_device(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_close_device(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_get_async_event(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_ack_async_event(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_query_device(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_query_port(struct kvm_run * run, uint8_t * guest_mem); -void call____ibv_query_port(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_query_gid(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_query_pkey(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_alloc_pd(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_dealloc_pd(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_create_flow(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_destroy_flow(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_open_xrcd(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_close_xrcd(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_reg_mr(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_rereg_mr(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_dereg_mr(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_alloc_mw(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_dealloc_mw(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_inc_rkey(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_bind_mw(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_create_comp_channel(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_destroy_comp_channel(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_create_cq(struct kvm_run * run, uint8_t * guest_mem); +void call_ibv_cq_ex_to_cq(struct kvm_run * run, uint8_t * guest_mem); +void call_ibv_start_poll(struct kvm_run * run, uint8_t * guest_mem); +void call_ibv_next_poll(struct kvm_run * run, uint8_t * guest_mem); +void call_ibv_end_poll(struct kvm_run * run, uint8_t * guest_mem); +void call_ibv_wc_read_completion_ts(struct kvm_run * run, uint8_t * guest_mem); void call_ibv_create_cq_ex(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_resize_cq(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_destroy_cq(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_get_cq_event(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_ack_cq_events(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_poll_cq(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_req_notify_cq(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_create_srq(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_create_srq_ex(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_modify_srq(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_query_srq(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_get_srq_num(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_destroy_srq(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_post_srq_recv(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_create_qp(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_create_qp_ex(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_query_rt_values_ex(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_query_device_ex(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_open_qp(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_modify_qp(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_query_qp(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_destroy_qp(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_create_wq(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_modify_wq(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_destroy_wq(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_create_rwq_ind_table(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_destroy_rwq_ind_table(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_post_send(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_post_recv(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_create_ah(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_init_ah_from_wc(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_create_ah_from_wc(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_destroy_ah(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_attach_mcast(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_detach_mcast(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_fork_init(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_node_type_str(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_port_state_str(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_event_type_str(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_resolve_eth_l2_from_gid(struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_is_qpt_supported(struct kvm_run * run, uint8_t * guest_mem); diff --git a/tools/ibv_code_generator/GEN-tools-uhyve-ibv.c b/tools/ibv_code_generator/GEN-tools-uhyve-ibv.c index d822f28e6..71ad17354 100644 --- a/tools/ibv_code_generator/GEN-tools-uhyve-ibv.c +++ b/tools/ibv_code_generator/GEN-tools-uhyve-ibv.c @@ -1,539 +1,42 @@ -void call_ibv_wc_status_str(struct kvm_run * run, uint8_t * guest_mem) { +void call_ibv_cq_ex_to_cq(struct kvm_run * run, uint8_t * guest_mem) { unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_wc_status_str_t * args = (uhyve_ibv_wc_status_str_t *) (guest_mem + data); + uhyve_ibv_cq_ex_to_cq_t * args = (uhyve_ibv_cq_ex_to_cq_t *) (guest_mem + data); - const char * host_ret = ibv_wc_status_str(args->status); -);memcpy(args->ret, host_ret, sizeof(host_ret));} - -void call_ibv_rate_to_mult(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_rate_to_mult_t * args = (uhyve_ibv_rate_to_mult_t *) (guest_mem + data); - - args.ret = ibv_rate_to_mult(args->rate); -);} - -void call_mult_to_ibv_rate(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_mult_to_ibv_rate_t * args = (uhyve_mult_to_ibv_rate_t *) (guest_mem + data); - - args.ret = mult_to_ibv_rate(args->mult); -);} - -void call_ibv_rate_to_mbps(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_rate_to_mbps_t * args = (uhyve_ibv_rate_to_mbps_t *) (guest_mem + data); - - args.ret = ibv_rate_to_mbps(args->rate); -);} - -void call_mbps_to_ibv_rate(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_mbps_to_ibv_rate_t * args = (uhyve_mbps_to_ibv_rate_t *) (guest_mem + data); - - args.ret = mbps_to_ibv_rate(args->mbps); -);} - -void call_ibv_post_wq_recv(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_post_wq_recv_t * args = (uhyve_ibv_post_wq_recv_t *) (guest_mem + data); - - args.ret = ibv_post_wq_recv(args->wq, args->recv_wr, args->bad_recv_wr); -);} - -void call_verbs_get_ctx(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_verbs_get_ctx_t * args = (uhyve_verbs_get_ctx_t *) (guest_mem + data); - - args.ret = verbs_get_ctx(args->ctx); -);} - -void call_ibv_get_device_list(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_get_device_list_t * args = (uhyve_ibv_get_device_list_t *) (guest_mem + data); - - // TODO: Take care of ** here. + args.ret = ibv_cq_ex_to_cq(args->cq); } -void call_ibv_free_device_list(struct kvm_run * run, uint8_t * guest_mem) { +void call_ibv_start_poll(struct kvm_run * run, uint8_t * guest_mem) { unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_free_device_list_t * args = (uhyve_ibv_free_device_list_t *) (guest_mem + data); + uhyve_ibv_start_poll_t * args = (uhyve_ibv_start_poll_t *) (guest_mem + data); - ibv_free_device_list(args->list); -);} + args.ret = ibv_start_poll(args->cq, args->attr); +} -void call_ibv_get_device_name(struct kvm_run * run, uint8_t * guest_mem) { +void call_ibv_next_poll(struct kvm_run * run, uint8_t * guest_mem) { unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_get_device_name_t * args = (uhyve_ibv_get_device_name_t *) (guest_mem + data); + uhyve_ibv_next_poll_t * args = (uhyve_ibv_next_poll_t *) (guest_mem + data); - const char * host_ret = ibv_get_device_name(args->device); -);memcpy(args->ret, host_ret, sizeof(host_ret));} + args.ret = ibv_next_poll(args->cq); +} -void call_ibv_get_device_guid(struct kvm_run * run, uint8_t * guest_mem) { +void call_ibv_end_poll(struct kvm_run * run, uint8_t * guest_mem) { unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_get_device_guid_t * args = (uhyve_ibv_get_device_guid_t *) (guest_mem + data); + uhyve_ibv_end_poll_t * args = (uhyve_ibv_end_poll_t *) (guest_mem + data); - args.ret = ibv_get_device_guid(args->device); -);} + ibv_end_poll(args->cq); +} -void call_ibv_open_device(struct kvm_run * run, uint8_t * guest_mem) { +void call_ibv_wc_read_completion_ts(struct kvm_run * run, uint8_t * guest_mem) { unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_open_device_t * args = (uhyve_ibv_open_device_t *) (guest_mem + data); + uhyve_ibv_wc_read_completion_ts_t * args = (uhyve_ibv_wc_read_completion_ts_t *) (guest_mem + data); - args.ret = ibv_open_device(args->device); -);} - -void call_ibv_close_device(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_close_device_t * args = (uhyve_ibv_close_device_t *) (guest_mem + data); - - args.ret = ibv_close_device(args->context); -);} - -void call_ibv_get_async_event(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_get_async_event_t * args = (uhyve_ibv_get_async_event_t *) (guest_mem + data); - - args.ret = ibv_get_async_event(args->context, args->event); -);} - -void call_ibv_ack_async_event(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_ack_async_event_t * args = (uhyve_ibv_ack_async_event_t *) (guest_mem + data); - - ibv_ack_async_event(args->event); -);} - -void call_ibv_query_device(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_query_device_t * args = (uhyve_ibv_query_device_t *) (guest_mem + data); - - args.ret = ibv_query_device(args->context, args->device_attr); -);} - -void call_ibv_query_port(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_query_port_t * args = (uhyve_ibv_query_port_t *) (guest_mem + data); - - args.ret = ibv_query_port(args->context, args->port_num, args->port_attr); -);} - -void call____ibv_query_port(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve____ibv_query_port_t * args = (uhyve____ibv_query_port_t *) (guest_mem + data); - - args.ret = ___ibv_query_port(args->context, args->port_num, args->port_attr); -);} - -void call_ibv_query_gid(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_query_gid_t * args = (uhyve_ibv_query_gid_t *) (guest_mem + data); - - args.ret = ibv_query_gid(args->context, args->port_num, args->index, args->gid); -);} - -void call_ibv_query_pkey(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_query_pkey_t * args = (uhyve_ibv_query_pkey_t *) (guest_mem + data); - - args.ret = ibv_query_pkey(args->context, args->port_num, args->index, args->pkey); -);} - -void call_ibv_alloc_pd(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_alloc_pd_t * args = (uhyve_ibv_alloc_pd_t *) (guest_mem + data); - - args.ret = ibv_alloc_pd(args->context); -);} - -void call_ibv_dealloc_pd(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_dealloc_pd_t * args = (uhyve_ibv_dealloc_pd_t *) (guest_mem + data); - - args.ret = ibv_dealloc_pd(args->pd); -);} - -void call_ibv_create_flow(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_create_flow_t * args = (uhyve_ibv_create_flow_t *) (guest_mem + data); - - args.ret = ibv_create_flow(args->qp, args->flow); -);} - -void call_ibv_destroy_flow(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_destroy_flow_t * args = (uhyve_ibv_destroy_flow_t *) (guest_mem + data); - - args.ret = ibv_destroy_flow(args->flow_id); -);} - -void call_ibv_open_xrcd(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_open_xrcd_t * args = (uhyve_ibv_open_xrcd_t *) (guest_mem + data); - - args.ret = ibv_open_xrcd(args->context, args->xrcd_init_attr); -);} - -void call_ibv_close_xrcd(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_close_xrcd_t * args = (uhyve_ibv_close_xrcd_t *) (guest_mem + data); - - args.ret = ibv_close_xrcd(args->xrcd); -);} - -void call_ibv_reg_mr(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_reg_mr_t * args = (uhyve_ibv_reg_mr_t *) (guest_mem + data); - - args.ret = ibv_reg_mr(args->pd, args->addr, args->length, args->access); -);} - -void call_ibv_rereg_mr(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_rereg_mr_t * args = (uhyve_ibv_rereg_mr_t *) (guest_mem + data); - - args.ret = ibv_rereg_mr(args->mr, args->flags, args->pd, args->addr, args->length, args->access); -);} - -void call_ibv_dereg_mr(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_dereg_mr_t * args = (uhyve_ibv_dereg_mr_t *) (guest_mem + data); - - args.ret = ibv_dereg_mr(args->mr); -);} - -void call_ibv_alloc_mw(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_alloc_mw_t * args = (uhyve_ibv_alloc_mw_t *) (guest_mem + data); - - args.ret = ibv_alloc_mw(args->pd, args->type); -);} - -void call_ibv_dealloc_mw(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_dealloc_mw_t * args = (uhyve_ibv_dealloc_mw_t *) (guest_mem + data); - - args.ret = ibv_dealloc_mw(args->mw); -);} - -void call_ibv_inc_rkey(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_inc_rkey_t * args = (uhyve_ibv_inc_rkey_t *) (guest_mem + data); - - args.ret = ibv_inc_rkey(args->rkey); -);} - -void call_ibv_bind_mw(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_bind_mw_t * args = (uhyve_ibv_bind_mw_t *) (guest_mem + data); - - args.ret = ibv_bind_mw(args->qp, args->mw, args->mw_bind); -);} - -void call_ibv_create_comp_channel(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_create_comp_channel_t * args = (uhyve_ibv_create_comp_channel_t *) (guest_mem + data); - - args.ret = ibv_create_comp_channel(args->context); -);} - -void call_ibv_destroy_comp_channel(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_destroy_comp_channel_t * args = (uhyve_ibv_destroy_comp_channel_t *) (guest_mem + data); - - args.ret = ibv_destroy_comp_channel(args->channel); -);} - -void call_ibv_create_cq(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_create_cq_t * args = (uhyve_ibv_create_cq_t *) (guest_mem + data); - - args.ret = ibv_create_cq(args->context, args->cqe, args->cq_context, args->channel, args->comp_vector); -);} + args.ret = ibv_wc_read_completion_ts(args->cq); +} void call_ibv_create_cq_ex(struct kvm_run * run, uint8_t * guest_mem) { unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); uhyve_ibv_create_cq_ex_t * args = (uhyve_ibv_create_cq_ex_t *) (guest_mem + data); args.ret = ibv_create_cq_ex(args->context, args->cq_attr); -);} - -void call_ibv_resize_cq(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_resize_cq_t * args = (uhyve_ibv_resize_cq_t *) (guest_mem + data); - - args.ret = ibv_resize_cq(args->cq, args->cqe); -);} - -void call_ibv_destroy_cq(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_destroy_cq_t * args = (uhyve_ibv_destroy_cq_t *) (guest_mem + data); - - args.ret = ibv_destroy_cq(args->cq); -);} - -void call_ibv_get_cq_event(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_get_cq_event_t * args = (uhyve_ibv_get_cq_event_t *) (guest_mem + data); - - args.ret = ibv_get_cq_event(args->channel, args->cq, args->cq_context); -);} - -void call_ibv_ack_cq_events(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_ack_cq_events_t * args = (uhyve_ibv_ack_cq_events_t *) (guest_mem + data); - - ibv_ack_cq_events(args->cq, args->nevents); -);} - -void call_ibv_poll_cq(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_poll_cq_t * args = (uhyve_ibv_poll_cq_t *) (guest_mem + data); - - args.ret = ibv_poll_cq(args->cq, args->num_entries, args->wc); -);} - -void call_ibv_req_notify_cq(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_req_notify_cq_t * args = (uhyve_ibv_req_notify_cq_t *) (guest_mem + data); - - args.ret = ibv_req_notify_cq(args->cq, args->solicited_only); -);} - -void call_ibv_create_srq(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_create_srq_t * args = (uhyve_ibv_create_srq_t *) (guest_mem + data); - - args.ret = ibv_create_srq(args->pd, args->srq_init_attr); -);} - -void call_ibv_create_srq_ex(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_create_srq_ex_t * args = (uhyve_ibv_create_srq_ex_t *) (guest_mem + data); - - args.ret = ibv_create_srq_ex(args->context, args->srq_init_attr_ex); -);} - -void call_ibv_modify_srq(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_modify_srq_t * args = (uhyve_ibv_modify_srq_t *) (guest_mem + data); - - args.ret = ibv_modify_srq(args->srq, args->srq_attr, args->srq_attr_mask); -);} - -void call_ibv_query_srq(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_query_srq_t * args = (uhyve_ibv_query_srq_t *) (guest_mem + data); - - args.ret = ibv_query_srq(args->srq, args->srq_attr); -);} - -void call_ibv_get_srq_num(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_get_srq_num_t * args = (uhyve_ibv_get_srq_num_t *) (guest_mem + data); - - args.ret = ibv_get_srq_num(args->srq, args->srq_num); -);} - -void call_ibv_destroy_srq(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_destroy_srq_t * args = (uhyve_ibv_destroy_srq_t *) (guest_mem + data); - - args.ret = ibv_destroy_srq(args->srq); -);} - -void call_ibv_post_srq_recv(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_post_srq_recv_t * args = (uhyve_ibv_post_srq_recv_t *) (guest_mem + data); - - args.ret = ibv_post_srq_recv(args->srq, args->recv_wr, args->bad_recv_wr); -);} - -void call_ibv_create_qp(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_create_qp_t * args = (uhyve_ibv_create_qp_t *) (guest_mem + data); - - args.ret = ibv_create_qp(args->pd, args->qp_init_attr); -);} - -void call_ibv_create_qp_ex(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_create_qp_ex_t * args = (uhyve_ibv_create_qp_ex_t *) (guest_mem + data); - - args.ret = ibv_create_qp_ex(args->context, args->qp_init_attr_ex); -);} - -void call_ibv_query_rt_values_ex(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_query_rt_values_ex_t * args = (uhyve_ibv_query_rt_values_ex_t *) (guest_mem + data); - - args.ret = ibv_query_rt_values_ex(args->context, args->values); -);} - -void call_ibv_query_device_ex(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_query_device_ex_t * args = (uhyve_ibv_query_device_ex_t *) (guest_mem + data); - - args.ret = ibv_query_device_ex(args->context, args->input, args->attr); -);} - -void call_ibv_open_qp(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_open_qp_t * args = (uhyve_ibv_open_qp_t *) (guest_mem + data); - - args.ret = ibv_open_qp(args->context, args->qp_open_attr); -);} - -void call_ibv_modify_qp(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_modify_qp_t * args = (uhyve_ibv_modify_qp_t *) (guest_mem + data); - - args.ret = ibv_modify_qp(args->qp, args->attr, args->attr_mask); -);} - -void call_ibv_query_qp(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_query_qp_t * args = (uhyve_ibv_query_qp_t *) (guest_mem + data); - - args.ret = ibv_query_qp(args->qp, args->attr, args->attr_mask, args->init_attr); -);} - -void call_ibv_destroy_qp(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_destroy_qp_t * args = (uhyve_ibv_destroy_qp_t *) (guest_mem + data); - - args.ret = ibv_destroy_qp(args->qp); -);} - -void call_ibv_create_wq(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_create_wq_t * args = (uhyve_ibv_create_wq_t *) (guest_mem + data); - - args.ret = ibv_create_wq(args->context, args->wq_init_attr); -);} - -void call_ibv_modify_wq(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_modify_wq_t * args = (uhyve_ibv_modify_wq_t *) (guest_mem + data); - - args.ret = ibv_modify_wq(args->wq, args->wq_attr); -);} - -void call_ibv_destroy_wq(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_destroy_wq_t * args = (uhyve_ibv_destroy_wq_t *) (guest_mem + data); - - args.ret = ibv_destroy_wq(args->wq); -);} - -void call_ibv_create_rwq_ind_table(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_create_rwq_ind_table_t * args = (uhyve_ibv_create_rwq_ind_table_t *) (guest_mem + data); - - args.ret = ibv_create_rwq_ind_table(args->context, args->init_attr); -);} - -void call_ibv_destroy_rwq_ind_table(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_destroy_rwq_ind_table_t * args = (uhyve_ibv_destroy_rwq_ind_table_t *) (guest_mem + data); - - args.ret = ibv_destroy_rwq_ind_table(args->rwq_ind_table); -);} - -void call_ibv_post_send(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_post_send_t * args = (uhyve_ibv_post_send_t *) (guest_mem + data); - - args.ret = ibv_post_send(args->qp, args->wr, args->bad_wr); -);} - -void call_ibv_post_recv(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_post_recv_t * args = (uhyve_ibv_post_recv_t *) (guest_mem + data); - - args.ret = ibv_post_recv(args->qp, args->wr, args->bad_wr); -);} - -void call_ibv_create_ah(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_create_ah_t * args = (uhyve_ibv_create_ah_t *) (guest_mem + data); - - args.ret = ibv_create_ah(args->pd, args->attr); -);} - -void call_ibv_init_ah_from_wc(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_init_ah_from_wc_t * args = (uhyve_ibv_init_ah_from_wc_t *) (guest_mem + data); - - args.ret = ibv_init_ah_from_wc(args->context, args->port_num, args->wc, args->grh, args->ah_attr); -);} - -void call_ibv_create_ah_from_wc(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_create_ah_from_wc_t * args = (uhyve_ibv_create_ah_from_wc_t *) (guest_mem + data); - - args.ret = ibv_create_ah_from_wc(args->pd, args->wc, args->grh, args->port_num); -);} - -void call_ibv_destroy_ah(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_destroy_ah_t * args = (uhyve_ibv_destroy_ah_t *) (guest_mem + data); - - args.ret = ibv_destroy_ah(args->ah); -);} - -void call_ibv_attach_mcast(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_attach_mcast_t * args = (uhyve_ibv_attach_mcast_t *) (guest_mem + data); - - args.ret = ibv_attach_mcast(args->qp, args->gid, args->lid); -);} - -void call_ibv_detach_mcast(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_detach_mcast_t * args = (uhyve_ibv_detach_mcast_t *) (guest_mem + data); - - args.ret = ibv_detach_mcast(args->qp, args->gid, args->lid); -);} - -void call_ibv_fork_init(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_fork_init_t * args = (uhyve_ibv_fork_init_t *) (guest_mem + data); - - args.ret = ibv_fork_init(args->); -);} - -void call_ibv_node_type_str(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_node_type_str_t * args = (uhyve_ibv_node_type_str_t *) (guest_mem + data); - - const char * host_ret = ibv_node_type_str(args->node_type); -);memcpy(args->ret, host_ret, sizeof(host_ret));} - -void call_ibv_port_state_str(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_port_state_str_t * args = (uhyve_ibv_port_state_str_t *) (guest_mem + data); - - const char * host_ret = ibv_port_state_str(args->port_state); -);memcpy(args->ret, host_ret, sizeof(host_ret));} - -void call_ibv_event_type_str(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_event_type_str_t * args = (uhyve_ibv_event_type_str_t *) (guest_mem + data); - - const char * host_ret = ibv_event_type_str(args->event); -);memcpy(args->ret, host_ret, sizeof(host_ret));} - -void call_ibv_resolve_eth_l2_from_gid(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_resolve_eth_l2_from_gid_t * args = (uhyve_ibv_resolve_eth_l2_from_gid_t *) (guest_mem + data); - - args.ret = ibv_resolve_eth_l2_from_gid(args->context, args->attr, args->eth_mac[6], args->vid); -);} - -void call_ibv_is_qpt_supported(struct kvm_run * run, uint8_t * guest_mem) { - unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); - uhyve_ibv_is_qpt_supported_t * args = (uhyve_ibv_is_qpt_supported_t *) (guest_mem + data); - - args.ret = ibv_is_qpt_supported(args->caps, args->qpt); -);} +} diff --git a/tools/ibv_code_generator/GEN-tools-uhyve.c b/tools/ibv_code_generator/GEN-tools-uhyve.c index abe792cf8..51ceb3c51 100644 --- a/tools/ibv_code_generator/GEN-tools-uhyve.c +++ b/tools/ibv_code_generator/GEN-tools-uhyve.c @@ -1,231 +1,18 @@ - case UHYVE_PORT_IBV_WC_STATUS_STR: - call_ibv_wc_status_str(run, guest_mem); + case UHYVE_PORT_IBV_CQ_EX_TO_CQ: + call_ibv_cq_ex_to_cq(run, guest_mem); break; - case UHYVE_PORT_IBV_RATE_TO_MULT: - call_ibv_rate_to_mult(run, guest_mem); + case UHYVE_PORT_IBV_START_POLL: + call_ibv_start_poll(run, guest_mem); break; - case UHYVE_PORT_MULT_TO_IBV_RATE: - call_mult_to_ibv_rate(run, guest_mem); + case UHYVE_PORT_IBV_NEXT_POLL: + call_ibv_next_poll(run, guest_mem); break; - case UHYVE_PORT_IBV_RATE_TO_MBPS: - call_ibv_rate_to_mbps(run, guest_mem); + case UHYVE_PORT_IBV_END_POLL: + call_ibv_end_poll(run, guest_mem); break; - case UHYVE_PORT_MBPS_TO_IBV_RATE: - call_mbps_to_ibv_rate(run, guest_mem); - break; - case UHYVE_PORT_IBV_POST_WQ_RECV: - call_ibv_post_wq_recv(run, guest_mem); - break; - case UHYVE_PORT_VERBS_GET_CTX: - call_verbs_get_ctx(run, guest_mem); - break; - case UHYVE_PORT_IBV_GET_DEVICE_LIST: - call_ibv_get_device_list(run, guest_mem); - break; - case UHYVE_PORT_IBV_FREE_DEVICE_LIST: - call_ibv_free_device_list(run, guest_mem); - break; - case UHYVE_PORT_IBV_GET_DEVICE_NAME: - call_ibv_get_device_name(run, guest_mem); - break; - case UHYVE_PORT_IBV_GET_DEVICE_GUID: - call_ibv_get_device_guid(run, guest_mem); - break; - case UHYVE_PORT_IBV_OPEN_DEVICE: - call_ibv_open_device(run, guest_mem); - break; - case UHYVE_PORT_IBV_CLOSE_DEVICE: - call_ibv_close_device(run, guest_mem); - break; - case UHYVE_PORT_IBV_GET_ASYNC_EVENT: - call_ibv_get_async_event(run, guest_mem); - break; - case UHYVE_PORT_IBV_ACK_ASYNC_EVENT: - call_ibv_ack_async_event(run, guest_mem); - break; - case UHYVE_PORT_IBV_QUERY_DEVICE: - call_ibv_query_device(run, guest_mem); - break; - case UHYVE_PORT_IBV_QUERY_PORT: - call_ibv_query_port(run, guest_mem); - break; - case UHYVE_PORT____IBV_QUERY_PORT: - call____ibv_query_port(run, guest_mem); - break; - case UHYVE_PORT_IBV_QUERY_GID: - call_ibv_query_gid(run, guest_mem); - break; - case UHYVE_PORT_IBV_QUERY_PKEY: - call_ibv_query_pkey(run, guest_mem); - break; - case UHYVE_PORT_IBV_ALLOC_PD: - call_ibv_alloc_pd(run, guest_mem); - break; - case UHYVE_PORT_IBV_DEALLOC_PD: - call_ibv_dealloc_pd(run, guest_mem); - break; - case UHYVE_PORT_IBV_CREATE_FLOW: - call_ibv_create_flow(run, guest_mem); - break; - case UHYVE_PORT_IBV_DESTROY_FLOW: - call_ibv_destroy_flow(run, guest_mem); - break; - case UHYVE_PORT_IBV_OPEN_XRCD: - call_ibv_open_xrcd(run, guest_mem); - break; - case UHYVE_PORT_IBV_CLOSE_XRCD: - call_ibv_close_xrcd(run, guest_mem); - break; - case UHYVE_PORT_IBV_REG_MR: - call_ibv_reg_mr(run, guest_mem); - break; - case UHYVE_PORT_IBV_REREG_MR: - call_ibv_rereg_mr(run, guest_mem); - break; - case UHYVE_PORT_IBV_DEREG_MR: - call_ibv_dereg_mr(run, guest_mem); - break; - case UHYVE_PORT_IBV_ALLOC_MW: - call_ibv_alloc_mw(run, guest_mem); - break; - case UHYVE_PORT_IBV_DEALLOC_MW: - call_ibv_dealloc_mw(run, guest_mem); - break; - case UHYVE_PORT_IBV_INC_RKEY: - call_ibv_inc_rkey(run, guest_mem); - break; - case UHYVE_PORT_IBV_BIND_MW: - call_ibv_bind_mw(run, guest_mem); - break; - case UHYVE_PORT_IBV_CREATE_COMP_CHANNEL: - call_ibv_create_comp_channel(run, guest_mem); - break; - case UHYVE_PORT_IBV_DESTROY_COMP_CHANNEL: - call_ibv_destroy_comp_channel(run, guest_mem); - break; - case UHYVE_PORT_IBV_CREATE_CQ: - call_ibv_create_cq(run, guest_mem); + case UHYVE_PORT_IBV_WC_READ_COMPLETION_TS: + call_ibv_wc_read_completion_ts(run, guest_mem); break; case UHYVE_PORT_IBV_CREATE_CQ_EX: call_ibv_create_cq_ex(run, guest_mem); break; - case UHYVE_PORT_IBV_RESIZE_CQ: - call_ibv_resize_cq(run, guest_mem); - break; - case UHYVE_PORT_IBV_DESTROY_CQ: - call_ibv_destroy_cq(run, guest_mem); - break; - case UHYVE_PORT_IBV_GET_CQ_EVENT: - call_ibv_get_cq_event(run, guest_mem); - break; - case UHYVE_PORT_IBV_ACK_CQ_EVENTS: - call_ibv_ack_cq_events(run, guest_mem); - break; - case UHYVE_PORT_IBV_POLL_CQ: - call_ibv_poll_cq(run, guest_mem); - break; - case UHYVE_PORT_IBV_REQ_NOTIFY_CQ: - call_ibv_req_notify_cq(run, guest_mem); - break; - case UHYVE_PORT_IBV_CREATE_SRQ: - call_ibv_create_srq(run, guest_mem); - break; - case UHYVE_PORT_IBV_CREATE_SRQ_EX: - call_ibv_create_srq_ex(run, guest_mem); - break; - case UHYVE_PORT_IBV_MODIFY_SRQ: - call_ibv_modify_srq(run, guest_mem); - break; - case UHYVE_PORT_IBV_QUERY_SRQ: - call_ibv_query_srq(run, guest_mem); - break; - case UHYVE_PORT_IBV_GET_SRQ_NUM: - call_ibv_get_srq_num(run, guest_mem); - break; - case UHYVE_PORT_IBV_DESTROY_SRQ: - call_ibv_destroy_srq(run, guest_mem); - break; - case UHYVE_PORT_IBV_POST_SRQ_RECV: - call_ibv_post_srq_recv(run, guest_mem); - break; - case UHYVE_PORT_IBV_CREATE_QP: - call_ibv_create_qp(run, guest_mem); - break; - case UHYVE_PORT_IBV_CREATE_QP_EX: - call_ibv_create_qp_ex(run, guest_mem); - break; - case UHYVE_PORT_IBV_QUERY_RT_VALUES_EX: - call_ibv_query_rt_values_ex(run, guest_mem); - break; - case UHYVE_PORT_IBV_QUERY_DEVICE_EX: - call_ibv_query_device_ex(run, guest_mem); - break; - case UHYVE_PORT_IBV_OPEN_QP: - call_ibv_open_qp(run, guest_mem); - break; - case UHYVE_PORT_IBV_MODIFY_QP: - call_ibv_modify_qp(run, guest_mem); - break; - case UHYVE_PORT_IBV_QUERY_QP: - call_ibv_query_qp(run, guest_mem); - break; - case UHYVE_PORT_IBV_DESTROY_QP: - call_ibv_destroy_qp(run, guest_mem); - break; - case UHYVE_PORT_IBV_CREATE_WQ: - call_ibv_create_wq(run, guest_mem); - break; - case UHYVE_PORT_IBV_MODIFY_WQ: - call_ibv_modify_wq(run, guest_mem); - break; - case UHYVE_PORT_IBV_DESTROY_WQ: - call_ibv_destroy_wq(run, guest_mem); - break; - case UHYVE_PORT_IBV_CREATE_RWQ_IND_TABLE: - call_ibv_create_rwq_ind_table(run, guest_mem); - break; - case UHYVE_PORT_IBV_DESTROY_RWQ_IND_TABLE: - call_ibv_destroy_rwq_ind_table(run, guest_mem); - break; - case UHYVE_PORT_IBV_POST_SEND: - call_ibv_post_send(run, guest_mem); - break; - case UHYVE_PORT_IBV_POST_RECV: - call_ibv_post_recv(run, guest_mem); - break; - case UHYVE_PORT_IBV_CREATE_AH: - call_ibv_create_ah(run, guest_mem); - break; - case UHYVE_PORT_IBV_INIT_AH_FROM_WC: - call_ibv_init_ah_from_wc(run, guest_mem); - break; - case UHYVE_PORT_IBV_CREATE_AH_FROM_WC: - call_ibv_create_ah_from_wc(run, guest_mem); - break; - case UHYVE_PORT_IBV_DESTROY_AH: - call_ibv_destroy_ah(run, guest_mem); - break; - case UHYVE_PORT_IBV_ATTACH_MCAST: - call_ibv_attach_mcast(run, guest_mem); - break; - case UHYVE_PORT_IBV_DETACH_MCAST: - call_ibv_detach_mcast(run, guest_mem); - break; - case UHYVE_PORT_IBV_FORK_INIT: - call_ibv_fork_init(run, guest_mem); - break; - case UHYVE_PORT_IBV_NODE_TYPE_STR: - call_ibv_node_type_str(run, guest_mem); - break; - case UHYVE_PORT_IBV_PORT_STATE_STR: - call_ibv_port_state_str(run, guest_mem); - break; - case UHYVE_PORT_IBV_EVENT_TYPE_STR: - call_ibv_event_type_str(run, guest_mem); - break; - case UHYVE_PORT_IBV_RESOLVE_ETH_L2_FROM_GID: - call_ibv_resolve_eth_l2_from_gid(run, guest_mem); - break; - case UHYVE_PORT_IBV_IS_QPT_SUPPORTED: - call_ibv_is_qpt_supported(run, guest_mem); - break; diff --git a/tools/ibv_code_generator/function-prototypes-1.txt b/tools/ibv_code_generator/function-prototypes-1.txt index fe4a06dea..9a2345c23 100644 --- a/tools/ibv_code_generator/function-prototypes-1.txt +++ b/tools/ibv_code_generator/function-prototypes-1.txt @@ -1,19 +1,6 @@ -struct ibv_context * ibv_open_device(struct ibv_device * device) -const char * ibv_get_device_name(struct ibv_device * device) -struct ibv_comp_channel * ibv_create_comp_channel(struct ibv_context * context) -int ibv_query_port(struct ibv_context * context,uint8_t port_num,struct ibv_port_attr * port_attr) - -struct ibv_device ** ibv_get_device_list(int * num_devices) -struct ibv_comp_channel * ibv_create_comp_channel(struct ibv_context * context) -struct ibv_pd * ibv_alloc_pd(struct ibv_context * context) -struct ibv_mr * ibv_reg_mr(struct ibv_pd * pd,void * addr,int length,int access) -struct ibv_cq * ibv_create_cq(struct ibv_context * context,int cqe,void * cq_context,struct ibv_comp_channel * channel,int comp_vector) -struct ibv_qp * ibv_create_qp(struct ibv_pd * pd,struct ibv_qp_init_attr * qp_init_attr) -int ibv_query_qp(struct ibv_qp * qp,struct ibv_qp_attr * attr,int attr_mask,struct ibv_qp_init_attr * init_attr) -int ibv_modify_qp(struct ibv_qp * qp,struct ibv_qp_attr * attr,int attr_mask) -int ibv_destroy_qp(struct ibv_qp * qp) -int ibv_destroy_cq(struct ibv_cq * cq) -int ibv_dereg_mr(struct ibv_mr * mr) -int ibv_dealloc_pd(struct ibv_pd * pd) -int ibv_destroy_comp_channel(struct ibv_comp_channel * channel) -int ibv_close_device(struct ibv_context * context) +struct ibv_cq * ibv_cq_ex_to_cq(struct ibv_cq_ex * cq) +int ibv_start_poll(struct ibv_cq_ex * cq,struct ibv_poll_cq_attr * attr) +int ibv_next_poll(struct ibv_cq_ex * cq) +void ibv_end_poll(struct ibv_cq_ex * cq) +uint64_t ibv_wc_read_completion_ts(struct ibv_cq_ex * cq) +struct ibv_cq_ex * ibv_create_cq_ex(struct ibv_context * context,struct ibv_cq_init_attr_ex * cq_attr) diff --git a/tools/ibv_code_generator/function-prototypes.txt b/tools/ibv_code_generator/function-prototypes.txt index 2824ca465..483b26222 100644 --- a/tools/ibv_code_generator/function-prototypes.txt +++ b/tools/ibv_code_generator/function-prototypes.txt @@ -1,70 +1,76 @@ -const char * ibv_wc_status_str(enum ibv_wc_status status) -int ibv_rate_to_mult(enum ibv_rate rate) -enum ibv_rate mult_to_ibv_rate(int mult) -int ibv_rate_to_mbps(enum ibv_rate rate) -enum ibv_rate mbps_to_ibv_rate(int mbps) -struct verbs_context * verbs_get_ctx(struct ibv_context * ctx) -struct ibv_device ** ibv_get_device_list(int * num_devices) -void ibv_free_device_list(struct ibv_device ** list) -const char * ibv_get_device_name(struct ibv_device * device) -__be64 ibv_get_device_guid(struct ibv_device * device) -struct ibv_context * ibv_open_device(struct ibv_device * device) -int ibv_close_device(struct ibv_context * context) -int ibv_get_async_event(struct ibv_context * context,struct ibv_async_event * event) -void ibv_ack_async_event(struct ibv_async_event * event) -int ibv_query_device(struct ibv_context * context,struct ibv_device_attr * device_attr) -int ibv_query_port(struct ibv_context * context,uint8_t port_num,struct ibv_port_attr * port_attr) -int ___ibv_query_port(struct ibv_context * context,uint8_t port_num,struct ibv_port_attr * port_attr) -int ibv_query_gid(struct ibv_context * context,uint8_t port_num,int index,union ibv_gid * gid) -int ibv_query_pkey(struct ibv_context * context,uint8_t port_num,int index,__be16 * pkey) -struct ibv_pd * ibv_alloc_pd(struct ibv_context * context) -int ibv_dealloc_pd(struct ibv_pd * pd) -struct ibv_flow * ibv_create_flow(struct ibv_qp * qp,struct ibv_flow_attr * flow) -int ibv_destroy_flow(struct ibv_flow * flow_id) -struct ibv_xrcd * ibv_open_xrcd(struct ibv_context * context,struct ibv_xrcd_init_attr * xrcd_init_attr) -int ibv_close_xrcd(struct ibv_xrcd * xrcd) -struct ibv_mr * ibv_reg_mr(struct ibv_pd * pd,void * addr,int length,int access) -int ibv_rereg_mr(struct ibv_mr * mr,int flags,struct ibv_pd * pd,void * addr,int length,int access) -int ibv_dereg_mr(struct ibv_mr * mr) -struct ibv_mw * ibv_alloc_mw(struct ibv_pd * pd,enum ibv_mw_type type) -int ibv_dealloc_mw(struct ibv_mw * mw) -uint32_t ibv_inc_rkey(uint32_t rkey) -int ibv_bind_mw(struct ibv_qp * qp,struct ibv_mw * mw,struct ibv_mw_bind * mw_bind) -struct ibv_comp_channel * ibv_create_comp_channel(struct ibv_context * context) -int ibv_destroy_comp_channel(struct ibv_comp_channel * channel) -struct ibv_cq * ibv_create_cq(struct ibv_context * context,int cqe,void * cq_context,struct ibv_comp_channel * channel,int comp_vector) -int ibv_resize_cq(struct ibv_cq * cq,int cqe) -int ibv_destroy_cq(struct ibv_cq * cq) -int ibv_get_cq_event(struct ibv_comp_channel * channel,struct ibv_cq ** cq,void ** cq_context) -void ibv_ack_cq_events(struct ibv_cq * cq,unsigned int nevents) -int ibv_poll_cq(struct ibv_cq * cq,int num_entries,struct ibv_wc * wc) -int ibv_req_notify_cq(struct ibv_cq * cq,int solicited_only) -struct ibv_srq * ibv_create_srq(struct ibv_pd * pd,struct ibv_srq_init_attr * srq_init_attr) -struct ibv_srq * ibv_create_srq_ex(struct ibv_context * context,struct ibv_srq_init_attr_ex * srq_init_attr_ex) -int ibv_modify_srq(struct ibv_srq * srq,struct ibv_srq_attr * srq_attr,int srq_attr_mask) -int ibv_query_srq(struct ibv_srq * srq,struct ibv_srq_attr * srq_attr) -int ibv_get_srq_num(struct ibv_srq * srq,uint32_t * srq_num) -int ibv_destroy_srq(struct ibv_srq * srq) -int ibv_post_srq_recv(struct ibv_srq * srq,struct ibv_recv_wr * recv_wr,struct ibv_recv_wr ** bad_recv_wr) -struct ibv_qp * ibv_create_qp(struct ibv_pd * pd,struct ibv_qp_init_attr * qp_init_attr) -struct ibv_qp * ibv_create_qp_ex(struct ibv_context * context,struct ibv_qp_init_attr_ex * qp_init_attr_ex) -int ibv_query_device_ex(struct ibv_context * context,const struct ibv_query_device_ex_input * input,struct ibv_device_attr_ex * attr) -struct ibv_qp * ibv_open_qp(struct ibv_context * context,struct ibv_qp_open_attr * qp_open_attr) -int ibv_modify_qp(struct ibv_qp * qp,struct ibv_qp_attr * attr,int attr_mask) -int ibv_query_qp(struct ibv_qp * qp,struct ibv_qp_attr * attr,int attr_mask,struct ibv_qp_init_attr * init_attr) -int ibv_destroy_qp(struct ibv_qp * qp) -int ibv_post_send(struct ibv_qp * qp,struct ibv_send_wr * wr,struct ibv_send_wr ** bad_wr) -int ibv_post_recv(struct ibv_qp * qp,struct ibv_recv_wr * wr,struct ibv_recv_wr ** bad_wr) -struct ibv_ah * ibv_create_ah(struct ibv_pd * pd,struct ibv_ah_attr * attr) -int ibv_init_ah_from_wc(struct ibv_context * context,uint8_t port_num,struct ibv_wc * wc,struct ibv_grh * grh,struct ibv_ah_attr * ah_attr) -struct ibv_ah * ibv_create_ah_from_wc(struct ibv_pd * pd,struct ibv_wc * wc,struct ibv_grh * grh,uint8_t port_num) -int ibv_destroy_ah(struct ibv_ah * ah) -int ibv_attach_mcast(struct ibv_qp * qp,const union ibv_gid * gid,uint16_t lid) -int ibv_detach_mcast(struct ibv_qp * qp,const union ibv_gid * gid,uint16_t lid) -int ibv_fork_init() -const char * ibv_node_type_str(enum ibv_node_type node_type) -const char * ibv_port_state_str(enum ibv_port_state port_state) -const char * ibv_event_type_str(enum ibv_event_type event) -int ibv_is_qpt_supported(uint32_t caps,enum ibv_qp_type qpt) -uint32_t ibv_get_mr_lkey(struct ibv_mr * mr) -uint32_t ibv_get_qp_num(struct ibv_qp * qp) +const char * ibv_wc_status_str(enum ibv_wc_status status) +int ibv_rate_to_mult(enum ibv_rate rate) +enum ibv_rate mult_to_ibv_rate(int mult) +int ibv_rate_to_mbps(enum ibv_rate rate) +enum ibv_rate mbps_to_ibv_rate(int mbps) +struct verbs_context * verbs_get_ctx(struct ibv_context * ctx) +struct ibv_device ** ibv_get_device_list(int * num_devices) +void ibv_free_device_list(struct ibv_device ** list) +const char * ibv_get_device_name(struct ibv_device * device) +__be64 ibv_get_device_guid(struct ibv_device * device) +struct ibv_context * ibv_open_device(struct ibv_device * device) +int ibv_close_device(struct ibv_context * context) +int ibv_get_async_event(struct ibv_context * context,struct ibv_async_event * event) +void ibv_ack_async_event(struct ibv_async_event * event) +int ibv_query_device(struct ibv_context * context,struct ibv_device_attr * device_attr) +int ibv_query_port(struct ibv_context * context,uint8_t port_num,struct ibv_port_attr * port_attr) +int ___ibv_query_port(struct ibv_context * context,uint8_t port_num,struct ibv_port_attr * port_attr) +int ibv_query_gid(struct ibv_context * context,uint8_t port_num,int index,union ibv_gid * gid) +int ibv_query_pkey(struct ibv_context * context,uint8_t port_num,int index,__be16 * pkey) +struct ibv_pd * ibv_alloc_pd(struct ibv_context * context) +int ibv_dealloc_pd(struct ibv_pd * pd) +struct ibv_flow * ibv_create_flow(struct ibv_qp * qp,struct ibv_flow_attr * flow) +int ibv_destroy_flow(struct ibv_flow * flow_id) +struct ibv_xrcd * ibv_open_xrcd(struct ibv_context * context,struct ibv_xrcd_init_attr * xrcd_init_attr) +int ibv_close_xrcd(struct ibv_xrcd * xrcd) +struct ibv_mr * ibv_reg_mr(struct ibv_pd * pd,void * addr,int length,int access) +int ibv_rereg_mr(struct ibv_mr * mr,int flags,struct ibv_pd * pd,void * addr,int length,int access) +int ibv_dereg_mr(struct ibv_mr * mr) +struct ibv_mw * ibv_alloc_mw(struct ibv_pd * pd,enum ibv_mw_type type) +int ibv_dealloc_mw(struct ibv_mw * mw) +uint32_t ibv_inc_rkey(uint32_t rkey) +int ibv_bind_mw(struct ibv_qp * qp,struct ibv_mw * mw,struct ibv_mw_bind * mw_bind) +struct ibv_comp_channel * ibv_create_comp_channel(struct ibv_context * context) +int ibv_destroy_comp_channel(struct ibv_comp_channel * channel) +struct ibv_cq * ibv_create_cq(struct ibv_context * context,int cqe,void * cq_context,struct ibv_comp_channel * channel,int comp_vector) +int ibv_resize_cq(struct ibv_cq * cq,int cqe) +int ibv_destroy_cq(struct ibv_cq * cq) +int ibv_get_cq_event(struct ibv_comp_channel * channel,struct ibv_cq ** cq,void ** cq_context) +void ibv_ack_cq_events(struct ibv_cq * cq,unsigned int nevents) +int ibv_poll_cq(struct ibv_cq * cq,int num_entries,struct ibv_wc * wc) +int ibv_req_notify_cq(struct ibv_cq * cq,int solicited_only) +struct ibv_srq * ibv_create_srq(struct ibv_pd * pd,struct ibv_srq_init_attr * srq_init_attr) +struct ibv_srq * ibv_create_srq_ex(struct ibv_context * context,struct ibv_srq_init_attr_ex * srq_init_attr_ex) +int ibv_modify_srq(struct ibv_srq * srq,struct ibv_srq_attr * srq_attr,int srq_attr_mask) +int ibv_query_srq(struct ibv_srq * srq,struct ibv_srq_attr * srq_attr) +int ibv_get_srq_num(struct ibv_srq * srq,uint32_t * srq_num) +int ibv_destroy_srq(struct ibv_srq * srq) +int ibv_post_srq_recv(struct ibv_srq * srq,struct ibv_recv_wr * recv_wr,struct ibv_recv_wr ** bad_recv_wr) +struct ibv_qp * ibv_create_qp(struct ibv_pd * pd,struct ibv_qp_init_attr * qp_init_attr) +struct ibv_qp * ibv_create_qp_ex(struct ibv_context * context,struct ibv_qp_init_attr_ex * qp_init_attr_ex) +int ibv_query_device_ex(struct ibv_context * context,const struct ibv_query_device_ex_input * input,struct ibv_device_attr_ex * attr) +struct ibv_qp * ibv_open_qp(struct ibv_context * context,struct ibv_qp_open_attr * qp_open_attr) +int ibv_modify_qp(struct ibv_qp * qp,struct ibv_qp_attr * attr,int attr_mask) +int ibv_query_qp(struct ibv_qp * qp,struct ibv_qp_attr * attr,int attr_mask,struct ibv_qp_init_attr * init_attr) +int ibv_destroy_qp(struct ibv_qp * qp) +int ibv_post_send(struct ibv_qp * qp,struct ibv_send_wr * wr,struct ibv_send_wr ** bad_wr) +int ibv_post_recv(struct ibv_qp * qp,struct ibv_recv_wr * wr,struct ibv_recv_wr ** bad_wr) +struct ibv_ah * ibv_create_ah(struct ibv_pd * pd,struct ibv_ah_attr * attr) +int ibv_init_ah_from_wc(struct ibv_context * context,uint8_t port_num,struct ibv_wc * wc,struct ibv_grh * grh,struct ibv_ah_attr * ah_attr) +struct ibv_ah * ibv_create_ah_from_wc(struct ibv_pd * pd,struct ibv_wc * wc,struct ibv_grh * grh,uint8_t port_num) +int ibv_destroy_ah(struct ibv_ah * ah) +int ibv_attach_mcast(struct ibv_qp * qp,const union ibv_gid * gid,uint16_t lid) +int ibv_detach_mcast(struct ibv_qp * qp,const union ibv_gid * gid,uint16_t lid) +int ibv_fork_init() +const char * ibv_node_type_str(enum ibv_node_type node_type) +const char * ibv_port_state_str(enum ibv_port_state port_state) +const char * ibv_event_type_str(enum ibv_event_type event) +int ibv_is_qpt_supported(uint32_t caps,enum ibv_qp_type qpt) +uint32_t ibv_get_mr_lkey(struct ibv_mr * mr) +uint32_t ibv_get_qp_num(struct ibv_qp * qp) +struct ibv_cq * ibv_cq_ex_to_cq(struct ibv_cq_ex * cq) +int ibv_start_poll(struct ibv_cq_ex * cq,struct ibv_poll_cq_attr * attr) +int ibv_next_poll(struct ibv_cq_ex * cq) +void ibv_end_poll(struct ibv_cq_ex * cq) +uint64_t ibv_wc_read_completion_ts(struct ibv_cq_ex * cq) +struct ibv_cq_ex * ibv_create_cq_ex(struct ibv_context * context,struct ibv_cq_init_attr_ex * cq_attr) diff --git a/tools/ibv_code_generator/generate-code.py b/tools/ibv_code_generator/generate-code.py index 3ecb3c761..50ff8c263 100755 --- a/tools/ibv_code_generator/generate-code.py +++ b/tools/ibv_code_generator/generate-code.py @@ -92,7 +92,7 @@ from parser import generate_struct_conversions # Path of the input file containing function prototypes. -SRC_PATH = "function-prototypes.txt" +SRC_PATH = "function-prototypes-1.txt" # Paths of the files that are generated by the script. KERNEL_GEN_PATH = "GEN-kernel.c" @@ -311,7 +311,7 @@ def generate_uhyve_function(prototype): if ret_type.is_char_arr(): code += "const char * host_ret = " else: - code += "args.ret = " + code += "args->ret = " code += "{0}(".format(fnc_name) if prototype.get_num_parameters() > 0: diff --git a/tools/uhyve-ibv.c b/tools/uhyve-ibv.c index fa92f759a..6730c3d13 100644 --- a/tools/uhyve-ibv.c +++ b/tools/uhyve-ibv.c @@ -459,6 +459,7 @@ void call_ibv_open_qp(struct kvm_run * run, uint8_t * guest_mem) { void call_ibv_modify_qp(struct kvm_run * run, uint8_t * guest_mem) { printf("UHYVE call: call_ibv_modify_qp\n"); + unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); uhyve_ibv_modify_qp_t * args = (uhyve_ibv_modify_qp_t *) (guest_mem + data); @@ -605,3 +606,47 @@ void call_ibv_get_qp_num(struct kvm_run * run, uint8_t * guest_mem) { args->ret = args->qp->qp_num; } + + +void call_ibv_cq_ex_to_cq(struct kvm_run * run, uint8_t * guest_mem) { + unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); + uhyve_ibv_cq_ex_to_cq_t * args = (uhyve_ibv_cq_ex_to_cq_t *) (guest_mem + data); + + args->ret = ibv_cq_ex_to_cq(args->cq); +} + +void call_ibv_start_poll(struct kvm_run * run, uint8_t * guest_mem) { + unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); + uhyve_ibv_start_poll_t * args = (uhyve_ibv_start_poll_t *) (guest_mem + data); + + args->ret = ibv_start_poll(args->cq, args->attr); +} + +void call_ibv_next_poll(struct kvm_run * run, uint8_t * guest_mem) { + unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); + uhyve_ibv_next_poll_t * args = (uhyve_ibv_next_poll_t *) (guest_mem + data); + + args->ret = ibv_next_poll(args->cq); +} + +void call_ibv_end_poll(struct kvm_run * run, uint8_t * guest_mem) { + unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); + uhyve_ibv_end_poll_t * args = (uhyve_ibv_end_poll_t *) (guest_mem + data); + + ibv_end_poll(args->cq); +} + +void call_ibv_wc_read_completion_ts(struct kvm_run * run, uint8_t * guest_mem) { + unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); + uhyve_ibv_wc_read_completion_ts_t * args = (uhyve_ibv_wc_read_completion_ts_t *) (guest_mem + data); + + args->ret = ibv_wc_read_completion_ts(args->cq); +} + +void call_ibv_create_cq_ex(struct kvm_run * run, uint8_t * guest_mem) { + unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset)); + uhyve_ibv_create_cq_ex_t * args = (uhyve_ibv_create_cq_ex_t *) (guest_mem + data); + + args->ret = ibv_create_cq_ex(args->context, args->cq_attr); +} + diff --git a/tools/uhyve-ibv.h b/tools/uhyve-ibv.h index d5debc278..dadec5a01 100644 --- a/tools/uhyve-ibv.h +++ b/tools/uhyve-ibv.h @@ -99,6 +99,12 @@ typedef enum { UHYVE_PORT_IBV_IS_QPT_SUPPORTED = 0x56E, UHYVE_PORT_IBV_GET_MR_LKEY = 0x56F, UHYVE_PORT_IBV_GET_QP_NUM = 0x570, + UHYVE_PORT_IBV_CQ_EX_TO_CQ = 0x571, + UHYVE_PORT_IBV_START_POLL = 0x572, + UHYVE_PORT_IBV_NEXT_POLL = 0x573, + UHYVE_PORT_IBV_END_POLL = 0x574, + UHYVE_PORT_IBV_WC_READ_COMPLETION_TS = 0x575, + UHYVE_PORT_IBV_CREATE_CQ_EX = 0x576, } uhyve_ibv_t; typedef struct { @@ -656,6 +662,49 @@ typedef struct { uint32_t ret; } __attribute__((packed)) uhyve_ibv_get_qp_num_t; +typedef struct { + // Parameters: + struct ibv_cq_ex * cq; + // Return value: + struct ibv_cq * ret; +} __attribute__((packed)) uhyve_ibv_cq_ex_to_cq_t; + +typedef struct { + // Parameters: + struct ibv_cq_ex * cq; + struct ibv_poll_cq_attr * attr; + // Return value: + int ret; +} __attribute__((packed)) uhyve_ibv_start_poll_t; + +typedef struct { + // Parameters: + struct ibv_cq_ex * cq; + // Return value: + int ret; +} __attribute__((packed)) uhyve_ibv_next_poll_t; + +typedef struct { + // Parameters: + struct ibv_cq_ex * cq; +} __attribute__((packed)) uhyve_ibv_end_poll_t; + +typedef struct { + // Parameters: + struct ibv_cq_ex * cq; + // Return value: + uint64_t ret; +} __attribute__((packed)) uhyve_ibv_wc_read_completion_ts_t; + +typedef struct { + // Parameters: + struct ibv_context * context; + struct ibv_cq_init_attr_ex * cq_attr; + // Return value: + struct ibv_cq_ex * ret; +} __attribute__((packed)) uhyve_ibv_create_cq_ex_t; + + void call_ibv_wc_status_str (struct kvm_run * run, uint8_t * guest_mem); void call_ibv_rate_to_mult (struct kvm_run * run, uint8_t * guest_mem); @@ -732,6 +781,13 @@ void call_ibv_event_type_str (struct kvm_run * run, uint8_t * guest_me void call_ibv_resolve_eth_l2_from_gid (struct kvm_run * run, uint8_t * guest_mem); void call_ibv_is_qpt_supported (struct kvm_run * run, uint8_t * guest_mem); void call_ibv_get_mr_lkey (struct kvm_run * run, uint8_t * guest_mem); -void call_ibv_get_qp_num (struct kvm_run * run, uint8_t * guest_mem); +void call_ibv_get_qp_num (struct kvm_run * run, uint8_t * guest_mem); + +void call_ibv_cq_ex_to_cq(struct kvm_run * run, uint8_t * guest_mem); +void call_ibv_start_poll(struct kvm_run * run, uint8_t * guest_mem); +void call_ibv_next_poll(struct kvm_run * run, uint8_t * guest_mem); +void call_ibv_end_poll(struct kvm_run * run, uint8_t * guest_mem); +void call_ibv_wc_read_completion_ts(struct kvm_run * run, uint8_t * guest_mem); +void call_ibv_create_cq_ex(struct kvm_run * run, uint8_t * guest_mem); #endif // UHYVE_IBV_H diff --git a/tools/uhyve.c b/tools/uhyve.c index c8f7cadf5..69f5c48b6 100644 --- a/tools/uhyve.c +++ b/tools/uhyve.c @@ -1120,6 +1120,25 @@ static int vcpu_loop(void) call_ibv_get_qp_num(run, guest_mem); break; + case UHYVE_PORT_IBV_CQ_EX_TO_CQ: + call_ibv_cq_ex_to_cq(run, guest_mem); + break; + case UHYVE_PORT_IBV_START_POLL: + call_ibv_start_poll(run, guest_mem); + break; + case UHYVE_PORT_IBV_NEXT_POLL: + call_ibv_next_poll(run, guest_mem); + break; + case UHYVE_PORT_IBV_END_POLL: + call_ibv_end_poll(run, guest_mem); + break; + case UHYVE_PORT_IBV_WC_READ_COMPLETION_TS: + call_ibv_wc_read_completion_ts(run, guest_mem); + break; + case UHYVE_PORT_IBV_CREATE_CQ_EX: + call_ibv_create_cq_ex(run, guest_mem); + break; + default: err(1, "KVM: unhandled KVM_EXIT_IO at port 0x%x, direction %d\n", run->io.port, run->io.direction); break; diff --git a/usr/tests/CMakeLists.txt b/usr/tests/CMakeLists.txt index aa181d30d..954f77e9a 100644 --- a/usr/tests/CMakeLists.txt +++ b/usr/tests/CMakeLists.txt @@ -11,8 +11,10 @@ add_executable(pi pi.go) add_executable(ib-test ib-test.c) #add_executable(ib-pingpong ib/pingpong.c ib/pingpong.h ib/pingpong-ud.c) + add_executable(ib-pingpong-ud ib/pingpong.c ib/pingpong-ud.c) add_executable(ib-pingpong-rc ib/pingpong.c ib/pingpong-rc.c) + #target_link_libraries(ib-test ibverbs) add_executable(test-malloc test-malloc.c) diff --git a/usr/tests/ib/pingpong-rc.c b/usr/tests/ib/pingpong-rc.c index fe445089b..7a64cfe92 100644 --- a/usr/tests/ib/pingpong-rc.c +++ b/usr/tests/ib/pingpong-rc.c @@ -29,8 +29,26 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ + #define _GNU_SOURCE -#include + +/* #include */ + +/* #include */ +/* #include */ +/* #include */ +/* #include */ +/* #include */ +/* #include */ +/* #include */ +/* #include */ +/* #include */ +/* #include */ +/* #include */ +/* #include */ +/* #include */ + +/* #include */ #include #include @@ -42,13 +60,15 @@ #include #include #include -#include +/* #include */ +#include #include #include #include "pingpong.h" -#include +/* #include */ + enum { PINGPONG_RECV_WRID = 1, @@ -61,10 +81,10 @@ static int use_ts; static int validate_buf; struct pingpong_context { - struct ibv_context *context; + struct ibv_context *context; struct ibv_comp_channel *channel; - struct ibv_pd *pd; - struct ibv_mr *mr; + struct ibv_pd *pd; + struct ibv_mr *mr; union { struct ibv_cq *cq; struct ibv_cq_ex *cq_ex; @@ -96,6 +116,7 @@ static int pp_connect_ctx(struct pingpong_context *ctx, int port, int my_psn, enum ibv_mtu mtu, int sl, struct pingpong_dest *dest, int sgid_idx) { + printf("Entered pp_connect_ctx().\n"); struct ibv_qp_attr attr = { .qp_state = IBV_QPS_RTR, .path_mtu = mtu, @@ -153,6 +174,7 @@ static int pp_connect_ctx(struct pingpong_context *ctx, int port, int my_psn, static struct pingpong_dest *pp_client_exch_dest(const char *servername, int port, const struct pingpong_dest *my_dest) { + printf("Entered pp_client_exch_dest().\n"); struct addrinfo *res, *t; struct addrinfo hints = { .ai_family = AF_UNSPEC, @@ -171,7 +193,8 @@ static struct pingpong_dest *pp_client_exch_dest(const char *servername, int por n = getaddrinfo(servername, service, &hints, &res); if (n < 0) { - fprintf(stderr, "%s for %s:%d\n", gai_strerror(n), servername, port); + /* fprintf(stderr, "%s for %s:%d\n", gai_strerror(n), servername, port); */ + fprintf(stderr, "Error for %s:%d\n", servername, port); free(service); return NULL; } @@ -228,6 +251,7 @@ static struct pingpong_dest *pp_server_exch_dest(struct pingpong_context *ctx, const struct pingpong_dest *my_dest, int sgid_idx) { + printf("Entered pp_server_exch_dest().\n"); struct addrinfo *res, *t; struct addrinfo hints = { .ai_flags = AI_PASSIVE, @@ -247,7 +271,8 @@ static struct pingpong_dest *pp_server_exch_dest(struct pingpong_context *ctx, n = getaddrinfo(NULL, service, &hints, &res); if (n < 0) { - fprintf(stderr, "%s for port %d\n", gai_strerror(n), port); + /* fprintf(stderr, "%s for port %d\n", gai_strerror(n), port); */ + fprintf(stderr, "Error for port %d\n", port); free(service); return NULL; } @@ -275,7 +300,9 @@ static struct pingpong_dest *pp_server_exch_dest(struct pingpong_context *ctx, } listen(sockfd, 1); + printf("\tServer listening.\n"); connfd = accept(sockfd, NULL, NULL); + printf("\tAccepted connection.\n"); close(sockfd); if (connfd < 0) { fprintf(stderr, "accept() failed\n"); @@ -327,6 +354,7 @@ static struct pingpong_context *pp_init_ctx(struct ibv_device *ib_dev, int size, int rx_depth, int port, int use_event) { + printf("Entered pp_init_ctx().\n"); struct pingpong_context *ctx; int access_flags = IBV_ACCESS_LOCAL_WRITE; @@ -499,6 +527,7 @@ clean_ctx: static int pp_close_ctx(struct pingpong_context *ctx) { + printf("Entered pp_close_ctx().\n"); if (ibv_destroy_qp(ctx->qp)) { fprintf(stderr, "Couldn't destroy QP\n"); return 1; @@ -537,34 +566,39 @@ static int pp_close_ctx(struct pingpong_context *ctx) return 0; } -static int pp_post_recv(struct pingpong_context *ctx, int n) +static int pp_post_recv(struct pingpong_context *ctx, int rx_depth) { - struct ibv_sge list = { - .addr = (uintptr_t) ctx->buf, - .length = ctx->size, - .lkey = ctx->mr->lkey - }; - struct ibv_recv_wr wr = { - .wr_id = PINGPONG_RECV_WRID, - .sg_list = &list, - .num_sge = 1, - }; - struct ibv_recv_wr *bad_wr; + /* printf("Entered pp_post_recv().\n"); */ int i; - for (i = 0; i < n; ++i) + for (i = 0; i < rx_depth; ++i) { + struct ibv_sge list = { + .addr = (uintptr_t) ctx->buf, + .length = ctx->size, + /* .lkey = ctx->mr->lkey */ + .lkey = ibv_get_mr_lkey(ctx->mr) // ! + }; + struct ibv_recv_wr wr = { + .wr_id = PINGPONG_RECV_WRID, + .sg_list = &list, + .num_sge = 1, + }; + struct ibv_recv_wr *bad_wr; + if (ibv_post_recv(ctx->qp, &wr, &bad_wr)) break; + } return i; } static int pp_post_send(struct pingpong_context *ctx) { + printf("Entered pp_post_send().\n"); struct ibv_sge list = { .addr = (uintptr_t) ctx->buf, .length = ctx->size, - .lkey = ctx->mr->lkey + .lkey = ibv_get_mr_lkey(ctx->mr) // ! }; struct ibv_send_wr wr = { .wr_id = PINGPONG_SEND_WRID, @@ -575,7 +609,11 @@ static int pp_post_send(struct pingpong_context *ctx) }; struct ibv_send_wr *bad_wr; - return ibv_post_send(ctx->qp, &wr, &bad_wr); + printf("pp_post_send().\n"); + /* return ibv_post_send(ctx->qp, &wr, &bad_wr); */ + int res = ibv_post_send(ctx->qp, &wr, &bad_wr); + printf("Finished pp_post_send().\n"); + return res; } struct ts_params { @@ -593,6 +631,7 @@ static inline int parse_single_wc(struct pingpong_context *ctx, int *scnt, uint64_t completion_timestamp, struct ts_params *ts) { + printf("Entered parse_single_wc().\n"); if (status != IBV_WC_SUCCESS) { fprintf(stderr, "Failed status %s (%d) for wr_id %d\n", ibv_wc_status_str(status), @@ -628,8 +667,12 @@ static inline int parse_single_wc(struct pingpong_context *ctx, int *scnt, delta = ctx->completion_timestamp_mask - ts->comp_recv_prev_time + completion_timestamp + 1; - ts->comp_recv_max_time_delta = max(ts->comp_recv_max_time_delta, delta); - ts->comp_recv_min_time_delta = min(ts->comp_recv_min_time_delta, delta); + ts->comp_recv_max_time_delta = ts->comp_recv_max_time_delta > delta + ? ts->comp_recv_max_time_delta + : delta; + ts->comp_recv_min_time_delta = ts->comp_recv_min_time_delta < delta + ? ts->comp_recv_min_time_delta + : delta; ts->comp_recv_total_time_delta += delta; ts->comp_with_time_iters++; } @@ -805,6 +848,9 @@ int main(int argc, char *argv[]) } } + servername = "10.0.5.3"; // ! + printf("Servername manually set.\n"); + if (optind == argc - 1) servername = strdupa(argv[optind]); else if (optind < argc) { @@ -821,7 +867,8 @@ int main(int argc, char *argv[]) ts.comp_with_time_iters = 0; } - page_size = sysconf(_SC_PAGESIZE); + /* page_size = sysconf(_SC_PAGESIZE); */ + page_size = 4092; // TODO dev_list = ibv_get_device_list(NULL); if (!dev_list) { @@ -884,13 +931,14 @@ int main(int argc, char *argv[]) } else memset(&my_dest.gid, 0, sizeof my_dest.gid); - my_dest.qpn = ctx->qp->qp_num; + /* my_dest.qpn = ctx->qp->qp_num; */ + my_dest.qpn = ibv_get_qp_num(ctx->qp); + my_dest.psn = lrand48() & 0xffffff; /* inet_ntop(AF_INET6, &my_dest.gid, gid, sizeof gid); */ /* printf(" local address: LID 0x%04x, QPN 0x%06x, PSN 0x%06x, GID %s\n", */ /* my_dest.lid, my_dest.qpn, my_dest.psn, gid); */ - if (servername) rem_dest = pp_client_exch_dest(servername, port, &my_dest); else diff --git a/usr/tests/ib/pingpong-ud.c b/usr/tests/ib/pingpong-ud.c index 708823012..1dd4401aa 100644 --- a/usr/tests/ib/pingpong-ud.c +++ b/usr/tests/ib/pingpong-ud.c @@ -31,6 +31,7 @@ */ #define _GNU_SOURCE + /*#include */ // #include @@ -160,7 +161,7 @@ static struct pingpong_dest *pp_client_exch_dest(const char *servername, int por n = getaddrinfo(servername, service, &hints, &res); if (n < 0) { - fprintf(stderr, "error for %s:%d\n", servername, port); + fprintf(stderr, "Error for %s:%d\n", servername, port); free(service); return NULL; } @@ -684,6 +685,7 @@ int main(int argc, char *argv[]) return 1; } + /* page_size = sysconf(_SC_PAGESIZE); */ page_size = 4092; // TODO dev_list = ibv_get_device_list(NULL); diff --git a/usr/tests/ib/pingpong.c b/usr/tests/ib/pingpong.c index 31230ddec..7160b93d2 100644 --- a/usr/tests/ib/pingpong.c +++ b/usr/tests/ib/pingpong.c @@ -38,6 +38,7 @@ #include #include + uint32_t htonl(uint32_t x) { #if BYTE_ORDER == BIG_ENDIAN return x;