mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-09 00:00:03 +01:00
Finished transparent implementation. Benchmark implementation next.
This commit is contained in:
parent
ff134bfc27
commit
f0421c94ef
17 changed files with 688 additions and 602 deletions
|
@ -63,9 +63,8 @@ uint8_t ibv_wc_read_dlid_path_bits(struct ibv_cq_ex * cq);
|
|||
uint64_t ibv_wc_read_completion_ts(struct ibv_cq_ex * cq);
|
||||
uint16_t ibv_wc_read_cvlan(struct ibv_cq_ex * cq);
|
||||
uint32_t ibv_wc_read_flow_tag(struct ibv_cq_ex * cq);
|
||||
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);
|
||||
int ibv_post_wq_recv(struct ibv_wq * wq, struct ibv_recv_wr * recv_wr, struct ibv_recv_wr ** bad_recv_wr);
|
||||
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);
|
||||
|
@ -74,9 +73,8 @@ 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_port(struct ibv_context * context, uint8_t port_num, struct ibv_port_attr * port_attr);
|
||||
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);
|
||||
|
@ -133,7 +131,8 @@ 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 [6] eth_mac, uint16_t * vid);
|
||||
// int ibv_resolve_eth_l2_from_gid(struct ibv_context * context, struct ibv_ah_attr * attr,
|
||||
// uint8_t eth_mac[ETHERNET_LL_SIZE], uint16_t * vid);
|
||||
int ibv_is_qpt_supported(uint32_t caps, enum ibv_qp_type qpt);
|
||||
|
||||
void kernel_ibv_log();
|
||||
|
|
|
@ -92,77 +92,76 @@ extern const size_t image_size;
|
|||
#define UHYVE_PORT_IBV_WC_READ_CVLAN 0x625
|
||||
#define UHYVE_PORT_IBV_WC_READ_FLOW_TAG 0x626
|
||||
#define UHYVE_PORT_IBV_POST_WQ_RECV 0x627
|
||||
#define UHYVE_PORT_VERBS_GET_CTX 0x628
|
||||
#define UHYVE_PORT_IBV_GET_DEVICE_LIST 0x629
|
||||
#define UHYVE_PORT_IBV_FREE_DEVICE_LIST 0x62A
|
||||
#define UHYVE_PORT_IBV_GET_DEVICE_NAME 0x62B
|
||||
#define UHYVE_PORT_IBV_GET_DEVICE_GUID 0x62C
|
||||
#define UHYVE_PORT_IBV_OPEN_DEVICE 0x62D
|
||||
#define UHYVE_PORT_IBV_CLOSE_DEVICE 0x62E
|
||||
#define UHYVE_PORT_IBV_GET_ASYNC_EVENT 0x62F
|
||||
#define UHYVE_PORT_IBV_ACK_ASYNC_EVENT 0x630
|
||||
#define UHYVE_PORT_IBV_QUERY_DEVICE 0x631
|
||||
#define UHYVE_PORT_IBV_QUERY_PORT 0x632
|
||||
#define UHYVE_PORT____IBV_QUERY_PORT 0x633
|
||||
#define UHYVE_PORT_IBV_QUERY_GID 0x634
|
||||
#define UHYVE_PORT_IBV_QUERY_PKEY 0x635
|
||||
#define UHYVE_PORT_IBV_ALLOC_PD 0x636
|
||||
#define UHYVE_PORT_IBV_DEALLOC_PD 0x637
|
||||
#define UHYVE_PORT_IBV_CREATE_FLOW 0x638
|
||||
#define UHYVE_PORT_IBV_DESTROY_FLOW 0x639
|
||||
#define UHYVE_PORT_IBV_OPEN_XRCD 0x63A
|
||||
#define UHYVE_PORT_IBV_CLOSE_XRCD 0x63B
|
||||
#define UHYVE_PORT_IBV_REG_MR 0x63C
|
||||
#define UHYVE_PORT_IBV_REREG_MR 0x63D
|
||||
#define UHYVE_PORT_IBV_DEREG_MR 0x63E
|
||||
#define UHYVE_PORT_IBV_ALLOC_MW 0x63F
|
||||
#define UHYVE_PORT_IBV_DEALLOC_MW 0x640
|
||||
#define UHYVE_PORT_IBV_INC_RKEY 0x641
|
||||
#define UHYVE_PORT_IBV_BIND_MW 0x642
|
||||
#define UHYVE_PORT_IBV_CREATE_COMP_CHANNEL 0x643
|
||||
#define UHYVE_PORT_IBV_DESTROY_COMP_CHANNEL 0x644
|
||||
#define UHYVE_PORT_IBV_CREATE_CQ 0x645
|
||||
#define UHYVE_PORT_IBV_CREATE_CQ_EX 0x646
|
||||
#define UHYVE_PORT_IBV_RESIZE_CQ 0x647
|
||||
#define UHYVE_PORT_IBV_DESTROY_CQ 0x648
|
||||
#define UHYVE_PORT_IBV_GET_CQ_EVENT 0x649
|
||||
#define UHYVE_PORT_IBV_ACK_CQ_EVENTS 0x64A
|
||||
#define UHYVE_PORT_IBV_POLL_CQ 0x64B
|
||||
#define UHYVE_PORT_IBV_REQ_NOTIFY_CQ 0x64C
|
||||
#define UHYVE_PORT_IBV_CREATE_SRQ 0x64D
|
||||
#define UHYVE_PORT_IBV_CREATE_SRQ_EX 0x64E
|
||||
#define UHYVE_PORT_IBV_MODIFY_SRQ 0x64F
|
||||
#define UHYVE_PORT_IBV_QUERY_SRQ 0x650
|
||||
#define UHYVE_PORT_IBV_GET_SRQ_NUM 0x651
|
||||
#define UHYVE_PORT_IBV_DESTROY_SRQ 0x652
|
||||
#define UHYVE_PORT_IBV_POST_SRQ_RECV 0x653
|
||||
#define UHYVE_PORT_IBV_CREATE_QP 0x654
|
||||
#define UHYVE_PORT_IBV_CREATE_QP_EX 0x655
|
||||
#define UHYVE_PORT_IBV_QUERY_RT_VALUES_EX 0x656
|
||||
#define UHYVE_PORT_IBV_QUERY_DEVICE_EX 0x657
|
||||
#define UHYVE_PORT_IBV_OPEN_QP 0x658
|
||||
#define UHYVE_PORT_IBV_MODIFY_QP 0x659
|
||||
#define UHYVE_PORT_IBV_QUERY_QP 0x65A
|
||||
#define UHYVE_PORT_IBV_DESTROY_QP 0x65B
|
||||
#define UHYVE_PORT_IBV_CREATE_WQ 0x65C
|
||||
#define UHYVE_PORT_IBV_MODIFY_WQ 0x65D
|
||||
#define UHYVE_PORT_IBV_DESTROY_WQ 0x65E
|
||||
#define UHYVE_PORT_IBV_CREATE_RWQ_IND_TABLE 0x65F
|
||||
#define UHYVE_PORT_IBV_DESTROY_RWQ_IND_TABLE 0x660
|
||||
#define UHYVE_PORT_IBV_POST_SEND 0x661
|
||||
#define UHYVE_PORT_IBV_POST_RECV 0x662
|
||||
#define UHYVE_PORT_IBV_CREATE_AH 0x663
|
||||
#define UHYVE_PORT_IBV_INIT_AH_FROM_WC 0x664
|
||||
#define UHYVE_PORT_IBV_CREATE_AH_FROM_WC 0x665
|
||||
#define UHYVE_PORT_IBV_DESTROY_AH 0x666
|
||||
#define UHYVE_PORT_IBV_ATTACH_MCAST 0x667
|
||||
#define UHYVE_PORT_IBV_DETACH_MCAST 0x668
|
||||
#define UHYVE_PORT_IBV_FORK_INIT 0x669
|
||||
#define UHYVE_PORT_IBV_NODE_TYPE_STR 0x66A
|
||||
#define UHYVE_PORT_IBV_PORT_STATE_STR 0x66B
|
||||
#define UHYVE_PORT_IBV_EVENT_TYPE_STR 0x66C
|
||||
#define UHYVE_PORT_IBV_RESOLVE_ETH_L2_FROM_GID 0x66D
|
||||
#define UHYVE_PORT_IBV_IS_QPT_SUPPORTED 0x66E
|
||||
#define UHYVE_PORT_IBV_GET_DEVICE_LIST 0x628
|
||||
#define UHYVE_PORT_IBV_FREE_DEVICE_LIST 0x629
|
||||
#define UHYVE_PORT_IBV_GET_DEVICE_NAME 0x62A
|
||||
#define UHYVE_PORT_IBV_GET_DEVICE_GUID 0x62B
|
||||
#define UHYVE_PORT_IBV_OPEN_DEVICE 0x62C
|
||||
#define UHYVE_PORT_IBV_CLOSE_DEVICE 0x62D
|
||||
#define UHYVE_PORT_IBV_GET_ASYNC_EVENT 0x62E
|
||||
#define UHYVE_PORT_IBV_ACK_ASYNC_EVENT 0x62F
|
||||
#define UHYVE_PORT_IBV_QUERY_DEVICE 0x630
|
||||
#define UHYVE_PORT_IBV_QUERY_PORT 0x631
|
||||
#define UHYVE_PORT_IBV_QUERY_GID 0x632
|
||||
#define UHYVE_PORT_IBV_QUERY_PKEY 0x633
|
||||
#define UHYVE_PORT_IBV_ALLOC_PD 0x634
|
||||
#define UHYVE_PORT_IBV_DEALLOC_PD 0x635
|
||||
#define UHYVE_PORT_IBV_CREATE_FLOW 0x636
|
||||
#define UHYVE_PORT_IBV_DESTROY_FLOW 0x637
|
||||
#define UHYVE_PORT_IBV_OPEN_XRCD 0x638
|
||||
#define UHYVE_PORT_IBV_CLOSE_XRCD 0x639
|
||||
#define UHYVE_PORT_IBV_REG_MR 0x63A
|
||||
#define UHYVE_PORT_IBV_REREG_MR 0x63B
|
||||
#define UHYVE_PORT_IBV_DEREG_MR 0x63C
|
||||
#define UHYVE_PORT_IBV_ALLOC_MW 0x63D
|
||||
#define UHYVE_PORT_IBV_DEALLOC_MW 0x63E
|
||||
#define UHYVE_PORT_IBV_INC_RKEY 0x63F
|
||||
#define UHYVE_PORT_IBV_BIND_MW 0x640
|
||||
#define UHYVE_PORT_IBV_CREATE_COMP_CHANNEL 0x641
|
||||
#define UHYVE_PORT_IBV_DESTROY_COMP_CHANNEL 0x642
|
||||
#define UHYVE_PORT_IBV_CREATE_CQ 0x643
|
||||
#define UHYVE_PORT_IBV_CREATE_CQ_EX 0x644
|
||||
#define UHYVE_PORT_IBV_RESIZE_CQ 0x645
|
||||
#define UHYVE_PORT_IBV_DESTROY_CQ 0x646
|
||||
#define UHYVE_PORT_IBV_GET_CQ_EVENT 0x647
|
||||
#define UHYVE_PORT_IBV_ACK_CQ_EVENTS 0x648
|
||||
#define UHYVE_PORT_IBV_POLL_CQ 0x649
|
||||
#define UHYVE_PORT_IBV_REQ_NOTIFY_CQ 0x64A
|
||||
#define UHYVE_PORT_IBV_CREATE_SRQ 0x64B
|
||||
#define UHYVE_PORT_IBV_CREATE_SRQ_EX 0x64C
|
||||
#define UHYVE_PORT_IBV_MODIFY_SRQ 0x64D
|
||||
#define UHYVE_PORT_IBV_QUERY_SRQ 0x64E
|
||||
#define UHYVE_PORT_IBV_GET_SRQ_NUM 0x64F
|
||||
#define UHYVE_PORT_IBV_DESTROY_SRQ 0x650
|
||||
#define UHYVE_PORT_IBV_POST_SRQ_RECV 0x651
|
||||
#define UHYVE_PORT_IBV_CREATE_QP 0x652
|
||||
#define UHYVE_PORT_IBV_CREATE_QP_EX 0x653
|
||||
#define UHYVE_PORT_IBV_QUERY_RT_VALUES_EX 0x654
|
||||
#define UHYVE_PORT_IBV_QUERY_DEVICE_EX 0x655
|
||||
#define UHYVE_PORT_IBV_OPEN_QP 0x656
|
||||
#define UHYVE_PORT_IBV_MODIFY_QP 0x657
|
||||
#define UHYVE_PORT_IBV_QUERY_QP 0x658
|
||||
#define UHYVE_PORT_IBV_DESTROY_QP 0x659
|
||||
#define UHYVE_PORT_IBV_CREATE_WQ 0x65A
|
||||
#define UHYVE_PORT_IBV_MODIFY_WQ 0x65B
|
||||
#define UHYVE_PORT_IBV_DESTROY_WQ 0x65C
|
||||
#define UHYVE_PORT_IBV_CREATE_RWQ_IND_TABLE 0x65D
|
||||
#define UHYVE_PORT_IBV_DESTROY_RWQ_IND_TABLE 0x65E
|
||||
#define UHYVE_PORT_IBV_POST_SEND 0x65F
|
||||
#define UHYVE_PORT_IBV_POST_RECV 0x660
|
||||
#define UHYVE_PORT_IBV_CREATE_AH 0x661
|
||||
#define UHYVE_PORT_IBV_INIT_AH_FROM_WC 0x662
|
||||
#define UHYVE_PORT_IBV_CREATE_AH_FROM_WC 0x663
|
||||
#define UHYVE_PORT_IBV_DESTROY_AH 0x664
|
||||
#define UHYVE_PORT_IBV_ATTACH_MCAST 0x665
|
||||
#define UHYVE_PORT_IBV_DETACH_MCAST 0x666
|
||||
#define UHYVE_PORT_IBV_FORK_INIT 0x667
|
||||
#define UHYVE_PORT_IBV_NODE_TYPE_STR 0x668
|
||||
#define UHYVE_PORT_IBV_PORT_STATE_STR 0x669
|
||||
#define UHYVE_PORT_IBV_EVENT_TYPE_STR 0x66A
|
||||
// #define UHYVE_PORT_IBV_RESOLVE_ETH_L2_FROM_GID 0x66B
|
||||
#define UHYVE_PORT_IBV_IS_QPT_SUPPORTED 0x66C
|
||||
|
||||
#define UHYVE_PORT_KERNEL_IBV_LOG 0x66F
|
||||
|
||||
#define BUILTIN_EXPECT(exp, b) __builtin_expect((exp), (b))
|
||||
|
|
|
@ -1044,7 +1044,7 @@ struct ibv_send_wr {
|
|||
void *hdr;
|
||||
uint16_t hdr_sz;
|
||||
uint16_t mss;
|
||||
} tso; // TCP Segmentation Offload
|
||||
} tso;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -1606,43 +1606,43 @@ enum verbs_context_mask {
|
|||
VERBS_CONTEXT_RESERVED = 1 << 5
|
||||
};
|
||||
|
||||
// struct verbs_context {
|
||||
// /* "grows up" - new fields go here */
|
||||
// int (*destroy_rwq_ind_table)(struct ibv_rwq_ind_table *rwq_ind_table);
|
||||
// struct ibv_rwq_ind_table *(*create_rwq_ind_table)(struct ibv_context *context,
|
||||
// struct ibv_rwq_ind_table_init_attr *init_attr);
|
||||
// int (*destroy_wq)(struct ibv_wq *wq);
|
||||
// int (*modify_wq)(struct ibv_wq *wq, struct ibv_wq_attr *wq_attr);
|
||||
// struct ibv_wq * (*create_wq)(struct ibv_context *context,
|
||||
// struct ibv_wq_init_attr *wq_init_attr);
|
||||
// int (*query_rt_values)(struct ibv_context *context,
|
||||
// struct ibv_values_ex *values);
|
||||
// struct ibv_cq_ex *(*create_cq_ex)(struct ibv_context *context,
|
||||
// struct ibv_cq_init_attr_ex *init_attr);
|
||||
// struct verbs_ex_private *priv;
|
||||
// int (*query_device_ex)(struct ibv_context *context,
|
||||
// const struct ibv_query_device_ex_input *input,
|
||||
// struct ibv_device_attr_ex *attr,
|
||||
// size_t attr_size);
|
||||
// int (*ibv_destroy_flow) (struct ibv_flow *flow);
|
||||
// void (*ABI_placeholder2) (void); [> DO NOT COPY THIS GARBAGE <]
|
||||
// struct ibv_flow * (*ibv_create_flow) (struct ibv_qp *qp,
|
||||
// struct ibv_flow_attr *flow_attr);
|
||||
// void (*ABI_placeholder1) (void); [> DO NOT COPY THIS GARBAGE <]
|
||||
// struct ibv_qp *(*open_qp)(struct ibv_context *context,
|
||||
// struct ibv_qp_open_attr *attr);
|
||||
// struct ibv_qp *(*create_qp_ex)(struct ibv_context *context,
|
||||
// struct ibv_qp_init_attr_ex *qp_init_attr_ex);
|
||||
// int (*get_srq_num)(struct ibv_srq *srq, uint32_t *srq_num);
|
||||
// struct ibv_srq * (*create_srq_ex)(struct ibv_context *context,
|
||||
// struct ibv_srq_init_attr_ex *srq_init_attr_ex);
|
||||
// struct ibv_xrcd * (*open_xrcd)(struct ibv_context *context,
|
||||
// struct ibv_xrcd_init_attr *xrcd_init_attr);
|
||||
// int (*close_xrcd)(struct ibv_xrcd *xrcd);
|
||||
// uint64_t has_comp_mask;
|
||||
// size_t sz; [> Must be immediately before struct ibv_context <]
|
||||
// struct ibv_context context; [> Must be last field in the struct <]
|
||||
// };
|
||||
struct verbs_context {
|
||||
/* "grows up" - new fields go here */
|
||||
int (*destroy_rwq_ind_table)(struct ibv_rwq_ind_table *rwq_ind_table);
|
||||
struct ibv_rwq_ind_table *(*create_rwq_ind_table)(struct ibv_context *context,
|
||||
struct ibv_rwq_ind_table_init_attr *init_attr);
|
||||
int (*destroy_wq)(struct ibv_wq *wq);
|
||||
int (*modify_wq)(struct ibv_wq *wq, struct ibv_wq_attr *wq_attr);
|
||||
struct ibv_wq * (*create_wq)(struct ibv_context *context,
|
||||
struct ibv_wq_init_attr *wq_init_attr);
|
||||
int (*query_rt_values)(struct ibv_context *context,
|
||||
struct ibv_values_ex *values);
|
||||
struct ibv_cq_ex *(*create_cq_ex)(struct ibv_context *context,
|
||||
struct ibv_cq_init_attr_ex *init_attr);
|
||||
struct verbs_ex_private *priv;
|
||||
int (*query_device_ex)(struct ibv_context *context,
|
||||
const struct ibv_query_device_ex_input *input,
|
||||
struct ibv_device_attr_ex *attr,
|
||||
size_t attr_size);
|
||||
int (*ibv_destroy_flow) (struct ibv_flow *flow);
|
||||
void (*ABI_placeholder2) (void); /* DO NOT COPY THIS GARBAGE */
|
||||
struct ibv_flow * (*ibv_create_flow) (struct ibv_qp *qp,
|
||||
struct ibv_flow_attr *flow_attr);
|
||||
void (*ABI_placeholder1) (void); /* DO NOT COPY THIS GARBAGE */
|
||||
struct ibv_qp *(*open_qp)(struct ibv_context *context,
|
||||
struct ibv_qp_open_attr *attr);
|
||||
struct ibv_qp *(*create_qp_ex)(struct ibv_context *context,
|
||||
struct ibv_qp_init_attr_ex *qp_init_attr_ex);
|
||||
int (*get_srq_num)(struct ibv_srq *srq, uint32_t *srq_num);
|
||||
struct ibv_srq * (*create_srq_ex)(struct ibv_context *context,
|
||||
struct ibv_srq_init_attr_ex *srq_init_attr_ex);
|
||||
struct ibv_xrcd * (*open_xrcd)(struct ibv_context *context,
|
||||
struct ibv_xrcd_init_attr *xrcd_init_attr);
|
||||
int (*close_xrcd)(struct ibv_xrcd *xrcd);
|
||||
uint64_t has_comp_mask;
|
||||
size_t sz; /* Must be immediately before struct ibv_context */
|
||||
struct ibv_context context; /* Must be last field in the struct */
|
||||
};
|
||||
|
||||
//static inline struct verbs_context *verbs_get_ctx(struct ibv_context *ctx)
|
||||
//{
|
||||
|
@ -1655,10 +1655,10 @@ enum verbs_context_mask {
|
|||
// (!__vctx || (__vctx->sz < sizeof(*__vctx) - offsetof(struct verbs_context, op)) || \
|
||||
// !__vctx->op) ? NULL : __vctx; })
|
||||
|
||||
// #define verbs_set_ctx_op(_vctx, op, ptr) ({ \
|
||||
// struct verbs_context *vctx = _vctx; \
|
||||
// if (vctx && (vctx->sz >= sizeof(*vctx) - offsetof(struct verbs_context, op))) \
|
||||
// vctx->op = ptr; })
|
||||
#define verbs_set_ctx_op(_vctx, op, ptr) ({ \
|
||||
struct verbs_context *vctx = _vctx; \
|
||||
if (vctx && (vctx->sz >= sizeof(*vctx) - offsetof(struct verbs_context, op))) \
|
||||
vctx->op = ptr; })
|
||||
|
||||
///**
|
||||
// * ibv_get_device_list - Get list of IB devices currently available
|
||||
|
@ -1727,26 +1727,26 @@ enum verbs_context_mask {
|
|||
// */
|
||||
//int ibv_query_device(struct ibv_context *context,
|
||||
// struct ibv_device_attr *device_attr);
|
||||
//
|
||||
///**
|
||||
// * ibv_query_port - Get port properties
|
||||
// */
|
||||
//int ibv_query_port(struct ibv_context *context, uint8_t port_num,
|
||||
// struct ibv_port_attr *port_attr);
|
||||
//
|
||||
//static inline int ___ibv_query_port(struct ibv_context *context,
|
||||
// uint8_t port_num,
|
||||
// struct ibv_port_attr *port_attr)
|
||||
//{
|
||||
// /* For compatibility when running with old libibverbs */
|
||||
// port_attr->link_layer = IBV_LINK_LAYER_UNSPECIFIED;
|
||||
// port_attr->reserved = 0;
|
||||
//
|
||||
// return ibv_query_port(context, port_num, port_attr);
|
||||
//}
|
||||
|
||||
#define ibv_query_port(context, port_num, port_attr) \
|
||||
___ibv_query_port(context, port_num, port_attr)
|
||||
/**
|
||||
* ibv_query_port - Get port properties
|
||||
*/
|
||||
// int ibv_query_port(struct ibv_context *context, uint8_t port_num,
|
||||
// struct ibv_port_attr *port_attr);
|
||||
|
||||
// static inline int ___ibv_query_port(struct ibv_context *context,
|
||||
// uint8_t port_num,
|
||||
// struct ibv_port_attr *port_attr)
|
||||
// {
|
||||
// [> For compatibility when running with old libibverbs <]
|
||||
// port_attr->link_layer = IBV_LINK_LAYER_UNSPECIFIED;
|
||||
// port_attr->reserved = 0;
|
||||
|
||||
// return ibv_query_port(context, port_num, port_attr);
|
||||
// }
|
||||
|
||||
// #define ibv_query_port(context, port_num, port_attr) \
|
||||
// ___ibv_query_port(context, port_num, port_attr)
|
||||
|
||||
///**
|
||||
// * ibv_query_gid - Get a GID table entry
|
||||
|
@ -2444,7 +2444,7 @@ enum verbs_context_mask {
|
|||
// */
|
||||
//const char *ibv_event_type_str(enum ibv_event_type event);
|
||||
//
|
||||
//#define ETHERNET_LL_SIZE 6
|
||||
#define ETHERNET_LL_SIZE 6
|
||||
//int ibv_resolve_eth_l2_from_gid(struct ibv_context *context,
|
||||
// struct ibv_ah_attr *attr,
|
||||
// uint8_t eth_mac[ETHERNET_LL_SIZE],
|
||||
|
|
382
kernel/ibv.c
382
kernel/ibv.c
|
@ -539,34 +539,56 @@ typedef struct {
|
|||
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) {
|
||||
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_args.wq = wq;
|
||||
uhyve_args.recv_wr = (struct ibv_recv_wr *) guest_to_host((size_t) recv_wr);
|
||||
uhyve_args.bad_recv_wr = (struct ibv_recv_wr **) guest_to_host((size_t) bad_recv_wr);
|
||||
|
||||
struct ibv_recv_wr * curr_wr;
|
||||
int num_wrs;
|
||||
|
||||
// Number of work requests in linked list
|
||||
curr_wr = recv_wr->next;
|
||||
num_wrs = 1;
|
||||
while (curr_wr) {
|
||||
num_wrs++;
|
||||
curr_wr = curr_wr->next;
|
||||
}
|
||||
|
||||
// Backup arrays for original guest memory pointers
|
||||
struct ibv_recv_wr * wr__next[num_wrs];
|
||||
struct ibv_sge * wr__sg_list[num_wrs];
|
||||
|
||||
// Backup next ptrs and SGE array
|
||||
curr_wr = recv_wr;
|
||||
for (int i = 0; i < num_wrs; i++) {
|
||||
wr__next[i] = curr_wr->next;
|
||||
curr_wr->next = (struct ibv_recv_wr *) guest_to_host((size_t) curr_wr->next);
|
||||
|
||||
wr__sg_list[i] = curr_wr->sg_list;
|
||||
curr_wr->sg_list = (struct ibv_sge *) guest_to_host((size_t) curr_wr->sg_list);
|
||||
|
||||
curr_wr = curr_wr->next;
|
||||
}
|
||||
|
||||
uhyve_send(UHYVE_PORT_IBV_POST_WQ_RECV, (unsigned) virt_to_phys((size_t) &uhyve_args));
|
||||
|
||||
return uhyve_args.ret;
|
||||
}
|
||||
if (*bad_recv_wr && *bad_recv_wr == uhyve_args.recv_wr) {
|
||||
*bad_recv_wr = recv_wr;
|
||||
}
|
||||
|
||||
// Recover next ptrs and SGE array
|
||||
curr_wr = recv_wr;
|
||||
for (int i = 0; i < num_wrs; i++) {
|
||||
if (*bad_recv_wr && *bad_recv_wr == curr_wr->next) {
|
||||
*bad_recv_wr = wr__next[i];
|
||||
}
|
||||
curr_wr->next = wr__next[i];
|
||||
curr_wr->sg_list = wr__sg_list[i];
|
||||
|
||||
/*
|
||||
* 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));
|
||||
curr_wr = curr_wr->next;
|
||||
}
|
||||
|
||||
return uhyve_args.ret;
|
||||
}
|
||||
|
@ -782,31 +804,6 @@ int ibv_query_port(struct ibv_context * context, uint8_t port_num, struct ibv_po
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* ___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 = (struct ibv_port_attr *) guest_to_host((size_t) port_attr);
|
||||
|
||||
uhyve_send(UHYVE_PORT____IBV_QUERY_PORT, (unsigned) virt_to_phys((size_t) &uhyve_args));
|
||||
|
||||
return uhyve_args.ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ibv_query_gid
|
||||
*/
|
||||
|
@ -960,9 +957,11 @@ typedef struct {
|
|||
} __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) {
|
||||
// TODO: This will probably not work as xrcd_init_attr->fd is a file
|
||||
// descriptor opened in HermitCore.
|
||||
uhyve_ibv_open_xrcd_t uhyve_args;
|
||||
uhyve_args.context = context;
|
||||
uhyve_args.xrcd_init_attr = xrcd_init_attr;
|
||||
uhyve_args.xrcd_init_attr = (struct ibv_xrcd_init_attr *) guest_to_host((size_t) xrcd_init_attr);
|
||||
|
||||
uhyve_send(UHYVE_PORT_IBV_OPEN_XRCD, (unsigned) virt_to_phys((size_t) &uhyve_args));
|
||||
|
||||
|
@ -1155,7 +1154,7 @@ int ibv_bind_mw(struct ibv_qp * qp, struct ibv_mw * mw, struct ibv_mw_bind * mw_
|
|||
uhyve_args.mw_bind = (struct ibv_mw_bind *) guest_to_host((size_t) mw_bind);
|
||||
|
||||
uint64_t mw_bind__bind_info__addr = mw_bind->bind_info.addr; // !
|
||||
mw_bind->bind_info.addr = (uint64_t) guest_to_host((size_t) mw_bind->bind_info.addr)
|
||||
mw_bind->bind_info.addr = (uint64_t) guest_to_host((size_t) mw_bind->bind_info.addr);
|
||||
|
||||
uhyve_send(UHYVE_PORT_IBV_BIND_MW, (unsigned) virt_to_phys((size_t) &uhyve_args));
|
||||
|
||||
|
@ -1546,14 +1545,57 @@ typedef struct {
|
|||
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) {
|
||||
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_args.srq = srq;
|
||||
uhyve_args.recv_wr = (struct ibv_recv_wr *) guest_to_host((size_t) recv_wr);
|
||||
uhyve_args.bad_recv_wr = (struct ibv_recv_wr **) guest_to_host((size_t) bad_recv_wr);
|
||||
|
||||
struct ibv_recv_wr * curr_wr;
|
||||
int num_wrs;
|
||||
|
||||
// Number of work requests in linked list
|
||||
curr_wr = recv_wr->next;
|
||||
num_wrs = 1;
|
||||
while (curr_wr) {
|
||||
num_wrs++;
|
||||
curr_wr = curr_wr->next;
|
||||
}
|
||||
|
||||
// Backup arrays for original guest memory pointers
|
||||
struct ibv_recv_wr * wr__next[num_wrs];
|
||||
struct ibv_sge * wr__sg_list[num_wrs];
|
||||
|
||||
// Backup next ptrs and SGE array
|
||||
curr_wr = recv_wr;
|
||||
for (int i = 0; i < num_wrs; i++) {
|
||||
wr__next[i] = curr_wr->next;
|
||||
curr_wr->next = (struct ibv_recv_wr *) guest_to_host((size_t) curr_wr->next);
|
||||
|
||||
wr__sg_list[i] = curr_wr->sg_list;
|
||||
curr_wr->sg_list = (struct ibv_sge *) guest_to_host((size_t) curr_wr->sg_list);
|
||||
|
||||
curr_wr = curr_wr->next;
|
||||
}
|
||||
|
||||
uhyve_send(UHYVE_PORT_IBV_POST_SRQ_RECV, (unsigned) virt_to_phys((size_t) &uhyve_args));
|
||||
|
||||
if (*bad_recv_wr && *bad_recv_wr == uhyve_args.recv_wr) {
|
||||
*bad_recv_wr = recv_wr;
|
||||
}
|
||||
|
||||
// Recover next ptrs and SGE array
|
||||
curr_wr = recv_wr;
|
||||
for (int i = 0; i < num_wrs; i++) {
|
||||
if (*bad_recv_wr && *bad_recv_wr == curr_wr->next) {
|
||||
*bad_recv_wr = wr__next[i];
|
||||
}
|
||||
curr_wr->next = wr__next[i];
|
||||
curr_wr->sg_list = wr__sg_list[i];
|
||||
|
||||
curr_wr = curr_wr->next;
|
||||
}
|
||||
|
||||
return uhyve_args.ret;
|
||||
}
|
||||
|
||||
|
@ -1593,13 +1635,18 @@ typedef struct {
|
|||
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) {
|
||||
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 = (struct ibv_qp_init_attr_ex *) guest_to_host((size_t) qp_init_attr_ex);
|
||||
|
||||
uint8_t * qp_init_attr_ex__rx_hash_conf__rx_hash_key = qp_init_attr_ex->rx_hash_conf.rx_hash_key;
|
||||
qp_init_attr_ex->rx_hash_conf.rx_hash_key = (uint8_t *) guest_to_host((size_t) qp_init_attr_ex->rx_hash_conf.rx_hash_key);
|
||||
|
||||
uhyve_send(UHYVE_PORT_IBV_CREATE_QP_EX, (unsigned) virt_to_phys((size_t) &uhyve_args));
|
||||
|
||||
qp_init_attr_ex->rx_hash_conf.rx_hash_key = qp_init_attr_ex__rx_hash_conf__rx_hash_key;
|
||||
|
||||
return uhyve_args.ret;
|
||||
}
|
||||
|
||||
|
@ -1827,13 +1874,19 @@ typedef struct {
|
|||
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) {
|
||||
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_args.init_attr = (struct ibv_rwq_ind_table_init_attr *) guest_to_host((size_t) init_attr);
|
||||
|
||||
struct ibv_wq ** init_attr__ind_tbl = init_attr->ind_tbl;
|
||||
init_attr->ind_tbl = (struct ibv_wq **) guest_to_host((size_t) init_attr->ind_tbl);
|
||||
// TODO: entries of the list should be in ib mem pool, correct?
|
||||
|
||||
uhyve_send(UHYVE_PORT_IBV_CREATE_RWQ_IND_TABLE, (unsigned) virt_to_phys((size_t) &uhyve_args));
|
||||
|
||||
init_attr->ind_tbl = init_attr__ind_tbl;
|
||||
|
||||
return uhyve_args.ret;
|
||||
}
|
||||
|
||||
|
@ -1874,54 +1927,106 @@ typedef struct {
|
|||
|
||||
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 = (struct ibv_send_wr *) guest_to_host((size_t) wr);
|
||||
// TODO: Take care of ** parameter.
|
||||
uhyve_args.qp = qp;
|
||||
uhyve_args.wr = (struct ibv_send_wr *) guest_to_host((size_t) wr);
|
||||
uhyve_args.bad_wr = (struct ibv_send_wr **) guest_to_host((size_t) bad_wr);
|
||||
|
||||
bool is_rdma = wr->opcode == IBV_WR_RDMA_WRITE ||
|
||||
wr->opcode == IBV_WR_RDMA_WRITE_WITH_IMM ||
|
||||
wr->opcode == IBV_WR_RDMA_READ;
|
||||
bool is_atomic = wr->opcode == IBV_WR_ATOMIC_CMP_AND_SWP ||
|
||||
wr->opcode == IBV_WR_ATOMIC_FETCH_AND_ADD;
|
||||
bool is_bind_mw = wr->opcode == IBV_WR_BIND_MW;
|
||||
bool is_tso = wr->opcode == IBV_WR_TSO;
|
||||
struct ibv_send_wr * curr_wr;
|
||||
int num_wrs;
|
||||
int is_rdma, is_atomic, is_bind_mw, is_tso;
|
||||
|
||||
// union wr: rdma and atomic
|
||||
uint64_t wr__wr__rdma__remote_addr;
|
||||
uint64_t wr__wr__atomic__remote_addr;
|
||||
if (is_rdma) {
|
||||
wr__wr__rdma__remote_addr = wr->wr.rdma.remote_addr;
|
||||
wr->wr.rdma.remote_addr = (uint64_t) guest_to_host((size_t) wr->wr.rdma.remote_addr);
|
||||
} else if (is_atomic) {
|
||||
wr__wr__atomic__remote_addr = wr->wr.atomic.remote_addr;
|
||||
wr->wr.atomic.remote_addr = (uint64_t) guest_to_host((size_t) wr->wr.atomic.remote_addr);
|
||||
// Number of work requests in linked list
|
||||
curr_wr = wr->next;
|
||||
num_wrs = 1;
|
||||
while (curr_wr) {
|
||||
num_wrs++;
|
||||
curr_wr = curr_wr->next;
|
||||
}
|
||||
|
||||
// union: bind_mw and tso
|
||||
uint64_t wr__bind_mw__bind_info__addr;
|
||||
void * wr__tso__hdr;
|
||||
if (is_bind_mw) {
|
||||
wr__bind_mw__bind_info__addr = wr->bind_mw.bind_info.addr;
|
||||
wr->bind_mw.bind_info.addr = (uint64_t) guest_to_host((size_t) wr->bind_mw.bind_info.addr);
|
||||
} else if (is_tso) {
|
||||
wr__tso__hdr = wr->tso.hdr;
|
||||
wr->tso.hdr = (void *) guest_to_host((size_t) wr->tso.hdr);
|
||||
// Backup arrays for original guest memory pointers
|
||||
struct ibv_send_wr * wr__next[num_wrs];
|
||||
struct ibv_sge * wr__sg_list[num_wrs];
|
||||
uint64_t wr__wr__rdma__remote_addr[num_wrs];
|
||||
uint64_t wr__wr__atomic__remote_addr[num_wrs];
|
||||
uint64_t wr__bind_mw__bind_info__addr[num_wrs];
|
||||
void * wr__tso__hdr[num_wrs];
|
||||
|
||||
curr_wr = wr;
|
||||
for (int i = 0; i < num_wrs; i++) {
|
||||
is_rdma = curr_wr->opcode == IBV_WR_RDMA_WRITE ||
|
||||
curr_wr->opcode == IBV_WR_RDMA_WRITE_WITH_IMM ||
|
||||
curr_wr->opcode == IBV_WR_RDMA_READ;
|
||||
is_atomic = curr_wr->opcode == IBV_WR_ATOMIC_CMP_AND_SWP ||
|
||||
curr_wr->opcode == IBV_WR_ATOMIC_FETCH_AND_ADD;
|
||||
is_bind_mw = curr_wr->opcode == IBV_WR_BIND_MW;
|
||||
is_tso = curr_wr->opcode == IBV_WR_TSO;
|
||||
|
||||
// union wr: rdma and atomic
|
||||
if (is_rdma) {
|
||||
wr__wr__rdma__remote_addr[i] = curr_wr->wr.rdma.remote_addr;
|
||||
curr_wr->wr.rdma.remote_addr = (uint64_t) guest_to_host((size_t) curr_wr->wr.rdma.remote_addr);
|
||||
} else if (is_atomic) {
|
||||
wr__wr__atomic__remote_addr[i] = curr_wr->wr.atomic.remote_addr;
|
||||
curr_wr->wr.atomic.remote_addr = (uint64_t) guest_to_host((size_t) curr_wr->wr.atomic.remote_addr);
|
||||
}
|
||||
|
||||
// union: bind_mw and tso
|
||||
if (is_bind_mw) {
|
||||
wr__bind_mw__bind_info__addr[i] = curr_wr->bind_mw.bind_info.addr;
|
||||
curr_wr->bind_mw.bind_info.addr = (uint64_t) guest_to_host((size_t) curr_wr->bind_mw.bind_info.addr);
|
||||
} else if (is_tso) {
|
||||
wr__tso__hdr[i] = curr_wr->tso.hdr;
|
||||
curr_wr->tso.hdr = (void *) guest_to_host((size_t) curr_wr->tso.hdr);
|
||||
}
|
||||
|
||||
// Next pointer and SGE array
|
||||
wr__next[i] = curr_wr->next;
|
||||
curr_wr->next = (struct ibv_send_wr *) guest_to_host((size_t) curr_wr->next);
|
||||
wr__sg_list[i] = curr_wr->sg_list;
|
||||
curr_wr->sg_list = (struct ibv_sge *) guest_to_host((size_t) curr_wr->sg_list);
|
||||
|
||||
curr_wr = curr_wr->next;
|
||||
}
|
||||
|
||||
uhyve_send(UHYVE_PORT_IBV_POST_SEND, (unsigned) virt_to_phys((size_t) &uhyve_args));
|
||||
|
||||
// union: bind_mw and tso
|
||||
if (is_bind_mw) {
|
||||
wr->bind_mw.bind_info.addr = wr__bind_mw__bind_info__addr;
|
||||
} else if (is_tso) {
|
||||
wr->tso.hdr = wr__tso__hdr;
|
||||
if (*bad_wr && *bad_wr == uhyve_args.wr) {
|
||||
*bad_wr = wr;
|
||||
}
|
||||
|
||||
// union wr: rdma and atomic
|
||||
if (is_rdma) {
|
||||
wr->wr.rdma.remote_addr = wr__wr__rdma__remote_addr;
|
||||
} else if (is_atomic) {
|
||||
wr->wr.atomic.remote_addr = wr__wr__atomic__remote_addr;
|
||||
curr_wr = wr;
|
||||
for (int i = 0; i < num_wrs; i++) {
|
||||
is_rdma = curr_wr->opcode == IBV_WR_RDMA_WRITE ||
|
||||
curr_wr->opcode == IBV_WR_RDMA_WRITE_WITH_IMM ||
|
||||
curr_wr->opcode == IBV_WR_RDMA_READ;
|
||||
is_atomic = curr_wr->opcode == IBV_WR_ATOMIC_CMP_AND_SWP ||
|
||||
curr_wr->opcode == IBV_WR_ATOMIC_FETCH_AND_ADD;
|
||||
is_bind_mw = curr_wr->opcode == IBV_WR_BIND_MW;
|
||||
is_tso = curr_wr->opcode == IBV_WR_TSO;
|
||||
|
||||
// union wr: rdma and atomic
|
||||
if (is_rdma) {
|
||||
curr_wr->wr.rdma.remote_addr = wr__wr__rdma__remote_addr[i];
|
||||
} else if (is_atomic) {
|
||||
curr_wr->wr.atomic.remote_addr = wr__wr__atomic__remote_addr[i];
|
||||
}
|
||||
|
||||
// union: bind_mw and tso
|
||||
if (is_bind_mw) {
|
||||
curr_wr->bind_mw.bind_info.addr = wr__bind_mw__bind_info__addr[i];
|
||||
} else if (is_tso) {
|
||||
curr_wr->tso.hdr = wr__tso__hdr[i];
|
||||
}
|
||||
|
||||
// Bad request
|
||||
if (*bad_wr && *bad_wr == curr_wr->next) {
|
||||
*bad_wr = wr__next[i];
|
||||
}
|
||||
// Next pointer and SGE array
|
||||
curr_wr->next = wr__next[i];
|
||||
curr_wr->sg_list = wr__sg_list[i];
|
||||
|
||||
curr_wr = curr_wr->next;
|
||||
}
|
||||
|
||||
return uhyve_args.ret;
|
||||
|
@ -1943,12 +2048,53 @@ typedef struct {
|
|||
|
||||
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_args.qp = qp;
|
||||
uhyve_args.wr = (struct ibv_recv_wr *) guest_to_host((size_t) wr);
|
||||
uhyve_args.bad_wr = (struct ibv_recv_wr **) guest_to_host((size_t) bad_wr);
|
||||
|
||||
struct ibv_recv_wr * curr_wr;
|
||||
int num_wrs;
|
||||
|
||||
// Number of work requests in linked list
|
||||
curr_wr = wr->next;
|
||||
num_wrs = 1;
|
||||
while (curr_wr) {
|
||||
num_wrs++;
|
||||
curr_wr = curr_wr->next;
|
||||
}
|
||||
|
||||
// Backup arrays for original guest memory pointers
|
||||
struct ibv_recv_wr * wr__next[num_wrs];
|
||||
struct ibv_sge * wr__sg_list[num_wrs];
|
||||
|
||||
curr_wr = wr;
|
||||
for (int i = 0; i < num_wrs; i++) {
|
||||
wr__next[i] = curr_wr->next;
|
||||
curr_wr->next = (struct ibv_recv_wr *) guest_to_host((size_t) curr_wr->next);
|
||||
|
||||
wr__sg_list[i] = curr_wr->sg_list;
|
||||
curr_wr->sg_list = (struct ibv_sge *) guest_to_host((size_t) curr_wr->sg_list);
|
||||
|
||||
curr_wr = curr_wr->next;
|
||||
}
|
||||
|
||||
uhyve_send(UHYVE_PORT_IBV_POST_RECV, (unsigned) virt_to_phys((size_t) &uhyve_args));
|
||||
|
||||
if (*bad_wr && *bad_wr == uhyve_args.wr) {
|
||||
*bad_wr = wr;
|
||||
}
|
||||
|
||||
curr_wr = wr;
|
||||
for (int i = 0; i < num_wrs; i++) {
|
||||
if (*bad_wr && *bad_wr == curr_wr->next) {
|
||||
*bad_wr = wr__next[i];
|
||||
}
|
||||
curr_wr->next = wr__next[i];
|
||||
curr_wr->sg_list = wr__sg_list[i];
|
||||
|
||||
curr_wr = curr_wr->next;
|
||||
}
|
||||
|
||||
return uhyve_args.ret;
|
||||
}
|
||||
|
||||
|
@ -2108,15 +2254,12 @@ int ibv_detach_mcast(struct ibv_qp * qp, const union ibv_gid * gid, uint16_t lid
|
|||
*/
|
||||
|
||||
typedef struct {
|
||||
// Parameters:
|
||||
;
|
||||
// Return value:
|
||||
int ret;
|
||||
} __attribute__((packed)) uhyve_ibv_fork_init_t;
|
||||
|
||||
int ibv_fork_init( ) {
|
||||
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));
|
||||
|
||||
|
@ -2191,27 +2334,28 @@ const char * ibv_event_type_str(enum ibv_event_type event) {
|
|||
* ibv_resolve_eth_l2_from_gid
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
// Parameters:
|
||||
struct ibv_context * context;
|
||||
struct ibv_ah_attr * attr;
|
||||
uint8_t [6] eth_mac;
|
||||
uint16_t * vid;
|
||||
// Return value:
|
||||
int ret;
|
||||
} __attribute__((packed)) uhyve_ibv_resolve_eth_l2_from_gid_t;
|
||||
/* typedef struct { */
|
||||
/* // Parameters: */
|
||||
/* struct ibv_context * context; */
|
||||
/* struct ibv_ah_attr * attr; */
|
||||
/* uint8_t eth_mac[ETHERNET_LL_SIZE]; */
|
||||
/* 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 [6] eth_mac, uint16_t * vid) {
|
||||
uhyve_ibv_resolve_eth_l2_from_gid_t uhyve_args;
|
||||
uhyve_args.context = context;
|
||||
uhyve_args.attr = (struct ibv_ah_attr *) guest_to_host((size_t) attr);
|
||||
uhyve_args.eth_mac = eth_mac;
|
||||
uhyve_args.vid = vid;
|
||||
/* int ibv_resolve_eth_l2_from_gid(struct ibv_context * context, struct ibv_ah_attr * attr, */
|
||||
/* uint8_t eth_mac[ETHERNET_LL_SIZE], uint16_t * vid) { // !!! */
|
||||
/* uhyve_ibv_resolve_eth_l2_from_gid_t uhyve_args; */
|
||||
/* uhyve_args.context = context; */
|
||||
/* uhyve_args.attr = (struct ibv_ah_attr *) guest_to_host((size_t) attr); */
|
||||
/* memcpy(uhyve_args.eth_mac, eth_mac, ETHERNET_LL_SIZE * sizeof(uint8_t)); */
|
||||
/* uhyve_args.vid = vid; */
|
||||
|
||||
uhyve_send(UHYVE_PORT_IBV_RESOLVE_ETH_L2_FROM_GID, (unsigned) virt_to_phys((size_t) &uhyve_args));
|
||||
/* uhyve_send(UHYVE_PORT_IBV_RESOLVE_ETH_L2_FROM_GID, (unsigned) virt_to_phys((size_t) &uhyve_args)); */
|
||||
|
||||
return uhyve_args.ret;
|
||||
}
|
||||
/* return uhyve_args.ret; */
|
||||
/* } */
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -23,74 +23,72 @@
|
|||
#define UHYVE_PORT_IBV_WC_READ_CVLAN 0x625
|
||||
#define UHYVE_PORT_IBV_WC_READ_FLOW_TAG 0x626
|
||||
#define UHYVE_PORT_IBV_POST_WQ_RECV 0x627
|
||||
#define UHYVE_PORT_VERBS_GET_CTX 0x628
|
||||
#define UHYVE_PORT_IBV_GET_DEVICE_LIST 0x629
|
||||
#define UHYVE_PORT_IBV_FREE_DEVICE_LIST 0x62A
|
||||
#define UHYVE_PORT_IBV_GET_DEVICE_NAME 0x62B
|
||||
#define UHYVE_PORT_IBV_GET_DEVICE_GUID 0x62C
|
||||
#define UHYVE_PORT_IBV_OPEN_DEVICE 0x62D
|
||||
#define UHYVE_PORT_IBV_CLOSE_DEVICE 0x62E
|
||||
#define UHYVE_PORT_IBV_GET_ASYNC_EVENT 0x62F
|
||||
#define UHYVE_PORT_IBV_ACK_ASYNC_EVENT 0x630
|
||||
#define UHYVE_PORT_IBV_QUERY_DEVICE 0x631
|
||||
#define UHYVE_PORT_IBV_QUERY_PORT 0x632
|
||||
#define UHYVE_PORT____IBV_QUERY_PORT 0x633
|
||||
#define UHYVE_PORT_IBV_QUERY_GID 0x634
|
||||
#define UHYVE_PORT_IBV_QUERY_PKEY 0x635
|
||||
#define UHYVE_PORT_IBV_ALLOC_PD 0x636
|
||||
#define UHYVE_PORT_IBV_DEALLOC_PD 0x637
|
||||
#define UHYVE_PORT_IBV_CREATE_FLOW 0x638
|
||||
#define UHYVE_PORT_IBV_DESTROY_FLOW 0x639
|
||||
#define UHYVE_PORT_IBV_OPEN_XRCD 0x63A
|
||||
#define UHYVE_PORT_IBV_CLOSE_XRCD 0x63B
|
||||
#define UHYVE_PORT_IBV_REG_MR 0x63C
|
||||
#define UHYVE_PORT_IBV_REREG_MR 0x63D
|
||||
#define UHYVE_PORT_IBV_DEREG_MR 0x63E
|
||||
#define UHYVE_PORT_IBV_ALLOC_MW 0x63F
|
||||
#define UHYVE_PORT_IBV_DEALLOC_MW 0x640
|
||||
#define UHYVE_PORT_IBV_INC_RKEY 0x641
|
||||
#define UHYVE_PORT_IBV_BIND_MW 0x642
|
||||
#define UHYVE_PORT_IBV_CREATE_COMP_CHANNEL 0x643
|
||||
#define UHYVE_PORT_IBV_DESTROY_COMP_CHANNEL 0x644
|
||||
#define UHYVE_PORT_IBV_CREATE_CQ 0x645
|
||||
#define UHYVE_PORT_IBV_CREATE_CQ_EX 0x646
|
||||
#define UHYVE_PORT_IBV_RESIZE_CQ 0x647
|
||||
#define UHYVE_PORT_IBV_DESTROY_CQ 0x648
|
||||
#define UHYVE_PORT_IBV_GET_CQ_EVENT 0x649
|
||||
#define UHYVE_PORT_IBV_ACK_CQ_EVENTS 0x64A
|
||||
#define UHYVE_PORT_IBV_POLL_CQ 0x64B
|
||||
#define UHYVE_PORT_IBV_REQ_NOTIFY_CQ 0x64C
|
||||
#define UHYVE_PORT_IBV_CREATE_SRQ 0x64D
|
||||
#define UHYVE_PORT_IBV_CREATE_SRQ_EX 0x64E
|
||||
#define UHYVE_PORT_IBV_MODIFY_SRQ 0x64F
|
||||
#define UHYVE_PORT_IBV_QUERY_SRQ 0x650
|
||||
#define UHYVE_PORT_IBV_GET_SRQ_NUM 0x651
|
||||
#define UHYVE_PORT_IBV_DESTROY_SRQ 0x652
|
||||
#define UHYVE_PORT_IBV_POST_SRQ_RECV 0x653
|
||||
#define UHYVE_PORT_IBV_CREATE_QP 0x654
|
||||
#define UHYVE_PORT_IBV_CREATE_QP_EX 0x655
|
||||
#define UHYVE_PORT_IBV_QUERY_RT_VALUES_EX 0x656
|
||||
#define UHYVE_PORT_IBV_QUERY_DEVICE_EX 0x657
|
||||
#define UHYVE_PORT_IBV_OPEN_QP 0x658
|
||||
#define UHYVE_PORT_IBV_MODIFY_QP 0x659
|
||||
#define UHYVE_PORT_IBV_QUERY_QP 0x65A
|
||||
#define UHYVE_PORT_IBV_DESTROY_QP 0x65B
|
||||
#define UHYVE_PORT_IBV_CREATE_WQ 0x65C
|
||||
#define UHYVE_PORT_IBV_MODIFY_WQ 0x65D
|
||||
#define UHYVE_PORT_IBV_DESTROY_WQ 0x65E
|
||||
#define UHYVE_PORT_IBV_CREATE_RWQ_IND_TABLE 0x65F
|
||||
#define UHYVE_PORT_IBV_DESTROY_RWQ_IND_TABLE 0x660
|
||||
#define UHYVE_PORT_IBV_POST_SEND 0x661
|
||||
#define UHYVE_PORT_IBV_POST_RECV 0x662
|
||||
#define UHYVE_PORT_IBV_CREATE_AH 0x663
|
||||
#define UHYVE_PORT_IBV_INIT_AH_FROM_WC 0x664
|
||||
#define UHYVE_PORT_IBV_CREATE_AH_FROM_WC 0x665
|
||||
#define UHYVE_PORT_IBV_DESTROY_AH 0x666
|
||||
#define UHYVE_PORT_IBV_ATTACH_MCAST 0x667
|
||||
#define UHYVE_PORT_IBV_DETACH_MCAST 0x668
|
||||
#define UHYVE_PORT_IBV_FORK_INIT 0x669
|
||||
#define UHYVE_PORT_IBV_NODE_TYPE_STR 0x66A
|
||||
#define UHYVE_PORT_IBV_PORT_STATE_STR 0x66B
|
||||
#define UHYVE_PORT_IBV_EVENT_TYPE_STR 0x66C
|
||||
#define UHYVE_PORT_IBV_RESOLVE_ETH_L2_FROM_GID 0x66D
|
||||
#define UHYVE_PORT_IBV_IS_QPT_SUPPORTED 0x66E
|
||||
#define UHYVE_PORT_IBV_GET_DEVICE_LIST 0x628
|
||||
#define UHYVE_PORT_IBV_FREE_DEVICE_LIST 0x629
|
||||
#define UHYVE_PORT_IBV_GET_DEVICE_NAME 0x62A
|
||||
#define UHYVE_PORT_IBV_GET_DEVICE_GUID 0x62B
|
||||
#define UHYVE_PORT_IBV_OPEN_DEVICE 0x62C
|
||||
#define UHYVE_PORT_IBV_CLOSE_DEVICE 0x62D
|
||||
#define UHYVE_PORT_IBV_GET_ASYNC_EVENT 0x62E
|
||||
#define UHYVE_PORT_IBV_ACK_ASYNC_EVENT 0x62F
|
||||
#define UHYVE_PORT_IBV_QUERY_DEVICE 0x630
|
||||
#define UHYVE_PORT_IBV_QUERY_PORT 0x631
|
||||
#define UHYVE_PORT_IBV_QUERY_GID 0x632
|
||||
#define UHYVE_PORT_IBV_QUERY_PKEY 0x633
|
||||
#define UHYVE_PORT_IBV_ALLOC_PD 0x634
|
||||
#define UHYVE_PORT_IBV_DEALLOC_PD 0x635
|
||||
#define UHYVE_PORT_IBV_CREATE_FLOW 0x636
|
||||
#define UHYVE_PORT_IBV_DESTROY_FLOW 0x637
|
||||
#define UHYVE_PORT_IBV_OPEN_XRCD 0x638
|
||||
#define UHYVE_PORT_IBV_CLOSE_XRCD 0x639
|
||||
#define UHYVE_PORT_IBV_REG_MR 0x63A
|
||||
#define UHYVE_PORT_IBV_REREG_MR 0x63B
|
||||
#define UHYVE_PORT_IBV_DEREG_MR 0x63C
|
||||
#define UHYVE_PORT_IBV_ALLOC_MW 0x63D
|
||||
#define UHYVE_PORT_IBV_DEALLOC_MW 0x63E
|
||||
#define UHYVE_PORT_IBV_INC_RKEY 0x63F
|
||||
#define UHYVE_PORT_IBV_BIND_MW 0x640
|
||||
#define UHYVE_PORT_IBV_CREATE_COMP_CHANNEL 0x641
|
||||
#define UHYVE_PORT_IBV_DESTROY_COMP_CHANNEL 0x642
|
||||
#define UHYVE_PORT_IBV_CREATE_CQ 0x643
|
||||
#define UHYVE_PORT_IBV_CREATE_CQ_EX 0x644
|
||||
#define UHYVE_PORT_IBV_RESIZE_CQ 0x645
|
||||
#define UHYVE_PORT_IBV_DESTROY_CQ 0x646
|
||||
#define UHYVE_PORT_IBV_GET_CQ_EVENT 0x647
|
||||
#define UHYVE_PORT_IBV_ACK_CQ_EVENTS 0x648
|
||||
#define UHYVE_PORT_IBV_POLL_CQ 0x649
|
||||
#define UHYVE_PORT_IBV_REQ_NOTIFY_CQ 0x64A
|
||||
#define UHYVE_PORT_IBV_CREATE_SRQ 0x64B
|
||||
#define UHYVE_PORT_IBV_CREATE_SRQ_EX 0x64C
|
||||
#define UHYVE_PORT_IBV_MODIFY_SRQ 0x64D
|
||||
#define UHYVE_PORT_IBV_QUERY_SRQ 0x64E
|
||||
#define UHYVE_PORT_IBV_GET_SRQ_NUM 0x64F
|
||||
#define UHYVE_PORT_IBV_DESTROY_SRQ 0x650
|
||||
#define UHYVE_PORT_IBV_POST_SRQ_RECV 0x651
|
||||
#define UHYVE_PORT_IBV_CREATE_QP 0x652
|
||||
#define UHYVE_PORT_IBV_CREATE_QP_EX 0x653
|
||||
#define UHYVE_PORT_IBV_QUERY_RT_VALUES_EX 0x654
|
||||
#define UHYVE_PORT_IBV_QUERY_DEVICE_EX 0x655
|
||||
#define UHYVE_PORT_IBV_OPEN_QP 0x656
|
||||
#define UHYVE_PORT_IBV_MODIFY_QP 0x657
|
||||
#define UHYVE_PORT_IBV_QUERY_QP 0x658
|
||||
#define UHYVE_PORT_IBV_DESTROY_QP 0x659
|
||||
#define UHYVE_PORT_IBV_CREATE_WQ 0x65A
|
||||
#define UHYVE_PORT_IBV_MODIFY_WQ 0x65B
|
||||
#define UHYVE_PORT_IBV_DESTROY_WQ 0x65C
|
||||
#define UHYVE_PORT_IBV_CREATE_RWQ_IND_TABLE 0x65D
|
||||
#define UHYVE_PORT_IBV_DESTROY_RWQ_IND_TABLE 0x65E
|
||||
#define UHYVE_PORT_IBV_POST_SEND 0x65F
|
||||
#define UHYVE_PORT_IBV_POST_RECV 0x660
|
||||
#define UHYVE_PORT_IBV_CREATE_AH 0x661
|
||||
#define UHYVE_PORT_IBV_INIT_AH_FROM_WC 0x662
|
||||
#define UHYVE_PORT_IBV_CREATE_AH_FROM_WC 0x663
|
||||
#define UHYVE_PORT_IBV_DESTROY_AH 0x664
|
||||
#define UHYVE_PORT_IBV_ATTACH_MCAST 0x665
|
||||
#define UHYVE_PORT_IBV_DETACH_MCAST 0x666
|
||||
#define UHYVE_PORT_IBV_FORK_INIT 0x667
|
||||
#define UHYVE_PORT_IBV_NODE_TYPE_STR 0x668
|
||||
#define UHYVE_PORT_IBV_PORT_STATE_STR 0x669
|
||||
#define UHYVE_PORT_IBV_EVENT_TYPE_STR 0x66A
|
||||
#define UHYVE_PORT_IBV_RESOLVE_ETH_L2_FROM_GID 0x66B
|
||||
#define UHYVE_PORT_IBV_IS_QPT_SUPPORTED 0x66C
|
||||
|
|
|
@ -22,7 +22,6 @@ uint64_t ibv_wc_read_completion_ts(struct ibv_cq_ex * cq);
|
|||
uint16_t ibv_wc_read_cvlan(struct ibv_cq_ex * cq);
|
||||
uint32_t ibv_wc_read_flow_tag(struct ibv_cq_ex * cq);
|
||||
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);
|
||||
|
@ -33,7 +32,6 @@ int ibv_get_async_event(struct ibv_context * context, struct ibv_async_event * e
|
|||
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);
|
||||
|
@ -87,7 +85,7 @@ struct ibv_ah * ibv_create_ah_from_wc(struct ibv_pd * pd, struct ibv_wc * wc, st
|
|||
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( );
|
||||
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);
|
||||
|
|
|
@ -504,27 +504,6 @@ int ibv_post_wq_recv(struct ibv_wq * wq, struct ibv_recv_wr * recv_wr, struct ib
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
@ -735,31 +714,6 @@ int ibv_query_port(struct ibv_context * context, uint8_t port_num, struct ibv_po
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* ___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 = (struct ibv_port_attr *) guest_to_host((size_t) port_attr);
|
||||
|
||||
uhyve_send(UHYVE_PORT____IBV_QUERY_PORT, (unsigned) virt_to_phys((size_t) &uhyve_args));
|
||||
|
||||
return uhyve_args.ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ibv_query_gid
|
||||
*/
|
||||
|
@ -915,7 +869,7 @@ typedef struct {
|
|||
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_args.xrcd_init_attr = (struct ibv_xrcd_init_attr *) guest_to_host((size_t) xrcd_init_attr);
|
||||
|
||||
uhyve_send(UHYVE_PORT_IBV_OPEN_XRCD, (unsigned) virt_to_phys((size_t) &uhyve_args));
|
||||
|
||||
|
@ -1778,7 +1732,7 @@ typedef struct {
|
|||
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_args.init_attr = (struct ibv_rwq_ind_table_init_attr *) guest_to_host((size_t) init_attr);
|
||||
|
||||
uhyve_send(UHYVE_PORT_IBV_CREATE_RWQ_IND_TABLE, (unsigned) virt_to_phys((size_t) &uhyve_args));
|
||||
|
||||
|
@ -2012,15 +1966,12 @@ int ibv_detach_mcast(struct ibv_qp * qp, const union ibv_gid * gid, uint16_t lid
|
|||
*/
|
||||
|
||||
typedef struct {
|
||||
// Parameters:
|
||||
;
|
||||
// Return value:
|
||||
int ret;
|
||||
} __attribute__((packed)) uhyve_ibv_fork_init_t;
|
||||
|
||||
int ibv_fork_init( ) {
|
||||
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));
|
||||
|
||||
|
|
|
@ -24,77 +24,75 @@ typedef enum {
|
|||
UHYVE_PORT_IBV_WC_READ_CVLAN = 0x625,
|
||||
UHYVE_PORT_IBV_WC_READ_FLOW_TAG = 0x626,
|
||||
UHYVE_PORT_IBV_POST_WQ_RECV = 0x627,
|
||||
UHYVE_PORT_VERBS_GET_CTX = 0x628,
|
||||
UHYVE_PORT_IBV_GET_DEVICE_LIST = 0x629,
|
||||
UHYVE_PORT_IBV_FREE_DEVICE_LIST = 0x62A,
|
||||
UHYVE_PORT_IBV_GET_DEVICE_NAME = 0x62B,
|
||||
UHYVE_PORT_IBV_GET_DEVICE_GUID = 0x62C,
|
||||
UHYVE_PORT_IBV_OPEN_DEVICE = 0x62D,
|
||||
UHYVE_PORT_IBV_CLOSE_DEVICE = 0x62E,
|
||||
UHYVE_PORT_IBV_GET_ASYNC_EVENT = 0x62F,
|
||||
UHYVE_PORT_IBV_ACK_ASYNC_EVENT = 0x630,
|
||||
UHYVE_PORT_IBV_QUERY_DEVICE = 0x631,
|
||||
UHYVE_PORT_IBV_QUERY_PORT = 0x632,
|
||||
UHYVE_PORT____IBV_QUERY_PORT = 0x633,
|
||||
UHYVE_PORT_IBV_QUERY_GID = 0x634,
|
||||
UHYVE_PORT_IBV_QUERY_PKEY = 0x635,
|
||||
UHYVE_PORT_IBV_ALLOC_PD = 0x636,
|
||||
UHYVE_PORT_IBV_DEALLOC_PD = 0x637,
|
||||
UHYVE_PORT_IBV_CREATE_FLOW = 0x638,
|
||||
UHYVE_PORT_IBV_DESTROY_FLOW = 0x639,
|
||||
UHYVE_PORT_IBV_OPEN_XRCD = 0x63A,
|
||||
UHYVE_PORT_IBV_CLOSE_XRCD = 0x63B,
|
||||
UHYVE_PORT_IBV_REG_MR = 0x63C,
|
||||
UHYVE_PORT_IBV_REREG_MR = 0x63D,
|
||||
UHYVE_PORT_IBV_DEREG_MR = 0x63E,
|
||||
UHYVE_PORT_IBV_ALLOC_MW = 0x63F,
|
||||
UHYVE_PORT_IBV_DEALLOC_MW = 0x640,
|
||||
UHYVE_PORT_IBV_INC_RKEY = 0x641,
|
||||
UHYVE_PORT_IBV_BIND_MW = 0x642,
|
||||
UHYVE_PORT_IBV_CREATE_COMP_CHANNEL = 0x643,
|
||||
UHYVE_PORT_IBV_DESTROY_COMP_CHANNEL = 0x644,
|
||||
UHYVE_PORT_IBV_CREATE_CQ = 0x645,
|
||||
UHYVE_PORT_IBV_CREATE_CQ_EX = 0x646,
|
||||
UHYVE_PORT_IBV_RESIZE_CQ = 0x647,
|
||||
UHYVE_PORT_IBV_DESTROY_CQ = 0x648,
|
||||
UHYVE_PORT_IBV_GET_CQ_EVENT = 0x649,
|
||||
UHYVE_PORT_IBV_ACK_CQ_EVENTS = 0x64A,
|
||||
UHYVE_PORT_IBV_POLL_CQ = 0x64B,
|
||||
UHYVE_PORT_IBV_REQ_NOTIFY_CQ = 0x64C,
|
||||
UHYVE_PORT_IBV_CREATE_SRQ = 0x64D,
|
||||
UHYVE_PORT_IBV_CREATE_SRQ_EX = 0x64E,
|
||||
UHYVE_PORT_IBV_MODIFY_SRQ = 0x64F,
|
||||
UHYVE_PORT_IBV_QUERY_SRQ = 0x650,
|
||||
UHYVE_PORT_IBV_GET_SRQ_NUM = 0x651,
|
||||
UHYVE_PORT_IBV_DESTROY_SRQ = 0x652,
|
||||
UHYVE_PORT_IBV_POST_SRQ_RECV = 0x653,
|
||||
UHYVE_PORT_IBV_CREATE_QP = 0x654,
|
||||
UHYVE_PORT_IBV_CREATE_QP_EX = 0x655,
|
||||
UHYVE_PORT_IBV_QUERY_RT_VALUES_EX = 0x656,
|
||||
UHYVE_PORT_IBV_QUERY_DEVICE_EX = 0x657,
|
||||
UHYVE_PORT_IBV_OPEN_QP = 0x658,
|
||||
UHYVE_PORT_IBV_MODIFY_QP = 0x659,
|
||||
UHYVE_PORT_IBV_QUERY_QP = 0x65A,
|
||||
UHYVE_PORT_IBV_DESTROY_QP = 0x65B,
|
||||
UHYVE_PORT_IBV_CREATE_WQ = 0x65C,
|
||||
UHYVE_PORT_IBV_MODIFY_WQ = 0x65D,
|
||||
UHYVE_PORT_IBV_DESTROY_WQ = 0x65E,
|
||||
UHYVE_PORT_IBV_CREATE_RWQ_IND_TABLE = 0x65F,
|
||||
UHYVE_PORT_IBV_DESTROY_RWQ_IND_TABLE = 0x660,
|
||||
UHYVE_PORT_IBV_POST_SEND = 0x661,
|
||||
UHYVE_PORT_IBV_POST_RECV = 0x662,
|
||||
UHYVE_PORT_IBV_CREATE_AH = 0x663,
|
||||
UHYVE_PORT_IBV_INIT_AH_FROM_WC = 0x664,
|
||||
UHYVE_PORT_IBV_CREATE_AH_FROM_WC = 0x665,
|
||||
UHYVE_PORT_IBV_DESTROY_AH = 0x666,
|
||||
UHYVE_PORT_IBV_ATTACH_MCAST = 0x667,
|
||||
UHYVE_PORT_IBV_DETACH_MCAST = 0x668,
|
||||
UHYVE_PORT_IBV_FORK_INIT = 0x669,
|
||||
UHYVE_PORT_IBV_NODE_TYPE_STR = 0x66A,
|
||||
UHYVE_PORT_IBV_PORT_STATE_STR = 0x66B,
|
||||
UHYVE_PORT_IBV_EVENT_TYPE_STR = 0x66C,
|
||||
UHYVE_PORT_IBV_RESOLVE_ETH_L2_FROM_GID = 0x66D,
|
||||
UHYVE_PORT_IBV_IS_QPT_SUPPORTED = 0x66E,
|
||||
UHYVE_PORT_IBV_GET_DEVICE_LIST = 0x628,
|
||||
UHYVE_PORT_IBV_FREE_DEVICE_LIST = 0x629,
|
||||
UHYVE_PORT_IBV_GET_DEVICE_NAME = 0x62A,
|
||||
UHYVE_PORT_IBV_GET_DEVICE_GUID = 0x62B,
|
||||
UHYVE_PORT_IBV_OPEN_DEVICE = 0x62C,
|
||||
UHYVE_PORT_IBV_CLOSE_DEVICE = 0x62D,
|
||||
UHYVE_PORT_IBV_GET_ASYNC_EVENT = 0x62E,
|
||||
UHYVE_PORT_IBV_ACK_ASYNC_EVENT = 0x62F,
|
||||
UHYVE_PORT_IBV_QUERY_DEVICE = 0x630,
|
||||
UHYVE_PORT_IBV_QUERY_PORT = 0x631,
|
||||
UHYVE_PORT_IBV_QUERY_GID = 0x632,
|
||||
UHYVE_PORT_IBV_QUERY_PKEY = 0x633,
|
||||
UHYVE_PORT_IBV_ALLOC_PD = 0x634,
|
||||
UHYVE_PORT_IBV_DEALLOC_PD = 0x635,
|
||||
UHYVE_PORT_IBV_CREATE_FLOW = 0x636,
|
||||
UHYVE_PORT_IBV_DESTROY_FLOW = 0x637,
|
||||
UHYVE_PORT_IBV_OPEN_XRCD = 0x638,
|
||||
UHYVE_PORT_IBV_CLOSE_XRCD = 0x639,
|
||||
UHYVE_PORT_IBV_REG_MR = 0x63A,
|
||||
UHYVE_PORT_IBV_REREG_MR = 0x63B,
|
||||
UHYVE_PORT_IBV_DEREG_MR = 0x63C,
|
||||
UHYVE_PORT_IBV_ALLOC_MW = 0x63D,
|
||||
UHYVE_PORT_IBV_DEALLOC_MW = 0x63E,
|
||||
UHYVE_PORT_IBV_INC_RKEY = 0x63F,
|
||||
UHYVE_PORT_IBV_BIND_MW = 0x640,
|
||||
UHYVE_PORT_IBV_CREATE_COMP_CHANNEL = 0x641,
|
||||
UHYVE_PORT_IBV_DESTROY_COMP_CHANNEL = 0x642,
|
||||
UHYVE_PORT_IBV_CREATE_CQ = 0x643,
|
||||
UHYVE_PORT_IBV_CREATE_CQ_EX = 0x644,
|
||||
UHYVE_PORT_IBV_RESIZE_CQ = 0x645,
|
||||
UHYVE_PORT_IBV_DESTROY_CQ = 0x646,
|
||||
UHYVE_PORT_IBV_GET_CQ_EVENT = 0x647,
|
||||
UHYVE_PORT_IBV_ACK_CQ_EVENTS = 0x648,
|
||||
UHYVE_PORT_IBV_POLL_CQ = 0x649,
|
||||
UHYVE_PORT_IBV_REQ_NOTIFY_CQ = 0x64A,
|
||||
UHYVE_PORT_IBV_CREATE_SRQ = 0x64B,
|
||||
UHYVE_PORT_IBV_CREATE_SRQ_EX = 0x64C,
|
||||
UHYVE_PORT_IBV_MODIFY_SRQ = 0x64D,
|
||||
UHYVE_PORT_IBV_QUERY_SRQ = 0x64E,
|
||||
UHYVE_PORT_IBV_GET_SRQ_NUM = 0x64F,
|
||||
UHYVE_PORT_IBV_DESTROY_SRQ = 0x650,
|
||||
UHYVE_PORT_IBV_POST_SRQ_RECV = 0x651,
|
||||
UHYVE_PORT_IBV_CREATE_QP = 0x652,
|
||||
UHYVE_PORT_IBV_CREATE_QP_EX = 0x653,
|
||||
UHYVE_PORT_IBV_QUERY_RT_VALUES_EX = 0x654,
|
||||
UHYVE_PORT_IBV_QUERY_DEVICE_EX = 0x655,
|
||||
UHYVE_PORT_IBV_OPEN_QP = 0x656,
|
||||
UHYVE_PORT_IBV_MODIFY_QP = 0x657,
|
||||
UHYVE_PORT_IBV_QUERY_QP = 0x658,
|
||||
UHYVE_PORT_IBV_DESTROY_QP = 0x659,
|
||||
UHYVE_PORT_IBV_CREATE_WQ = 0x65A,
|
||||
UHYVE_PORT_IBV_MODIFY_WQ = 0x65B,
|
||||
UHYVE_PORT_IBV_DESTROY_WQ = 0x65C,
|
||||
UHYVE_PORT_IBV_CREATE_RWQ_IND_TABLE = 0x65D,
|
||||
UHYVE_PORT_IBV_DESTROY_RWQ_IND_TABLE = 0x65E,
|
||||
UHYVE_PORT_IBV_POST_SEND = 0x65F,
|
||||
UHYVE_PORT_IBV_POST_RECV = 0x660,
|
||||
UHYVE_PORT_IBV_CREATE_AH = 0x661,
|
||||
UHYVE_PORT_IBV_INIT_AH_FROM_WC = 0x662,
|
||||
UHYVE_PORT_IBV_CREATE_AH_FROM_WC = 0x663,
|
||||
UHYVE_PORT_IBV_DESTROY_AH = 0x664,
|
||||
UHYVE_PORT_IBV_ATTACH_MCAST = 0x665,
|
||||
UHYVE_PORT_IBV_DETACH_MCAST = 0x666,
|
||||
UHYVE_PORT_IBV_FORK_INIT = 0x667,
|
||||
UHYVE_PORT_IBV_NODE_TYPE_STR = 0x668,
|
||||
UHYVE_PORT_IBV_PORT_STATE_STR = 0x669,
|
||||
UHYVE_PORT_IBV_EVENT_TYPE_STR = 0x66A,
|
||||
UHYVE_PORT_IBV_RESOLVE_ETH_L2_FROM_GID = 0x66B,
|
||||
UHYVE_PORT_IBV_IS_QPT_SUPPORTED = 0x66C,
|
||||
} uhyve_ibv_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -266,13 +264,6 @@ typedef struct {
|
|||
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;
|
||||
|
@ -343,15 +334,6 @@ typedef struct {
|
|||
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;
|
||||
|
@ -791,8 +773,6 @@ typedef struct {
|
|||
} __attribute__((packed)) uhyve_ibv_detach_mcast_t;
|
||||
|
||||
typedef struct {
|
||||
// Parameters:
|
||||
;
|
||||
// Return value:
|
||||
int ret;
|
||||
} __attribute__((packed)) uhyve_ibv_fork_init_t;
|
||||
|
@ -862,7 +842,6 @@ void call_ibv_wc_read_completion_ts(struct kvm_run * run, uint8_t * guest_mem);
|
|||
void call_ibv_wc_read_cvlan(struct kvm_run * run, uint8_t * guest_mem);
|
||||
void call_ibv_wc_read_flow_tag(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);
|
||||
|
@ -873,7 +852,6 @@ 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);
|
||||
|
|
|
@ -358,21 +358,6 @@ void call_ibv_post_wq_recv(struct kvm_run * run, uint8_t * guest_mem) {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* verbs_get_ctx
|
||||
*/
|
||||
|
||||
void call_verbs_get_ctx(struct kvm_run * run, uint8_t * guest_mem) {
|
||||
printf("LOG: UHYVE - call_verbs_get_ctx\n");
|
||||
unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset));
|
||||
uhyve_verbs_get_ctx_t * args = (uhyve_verbs_get_ctx_t *) (guest_mem + data);
|
||||
|
||||
use_ib_mem_pool = true;
|
||||
args->ret = verbs_get_ctx(args->ctx);
|
||||
use_ib_mem_pool = false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ibv_get_device_list
|
||||
*/
|
||||
|
@ -523,21 +508,6 @@ void call_ibv_query_port(struct kvm_run * run, uint8_t * guest_mem) {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* ___ibv_query_port
|
||||
*/
|
||||
|
||||
void call____ibv_query_port(struct kvm_run * run, uint8_t * guest_mem) {
|
||||
printf("LOG: UHYVE - call____ibv_query_port\n");
|
||||
unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset));
|
||||
uhyve____ibv_query_port_t * args = (uhyve____ibv_query_port_t *) (guest_mem + data);
|
||||
|
||||
use_ib_mem_pool = true;
|
||||
args->ret = ___ibv_query_port(args->context, args->port_num, args->port_attr);
|
||||
use_ib_mem_pool = false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ibv_query_gid
|
||||
*/
|
||||
|
@ -1343,7 +1313,7 @@ void call_ibv_fork_init(struct kvm_run * run, uint8_t * guest_mem) {
|
|||
uhyve_ibv_fork_init_t * args = (uhyve_ibv_fork_init_t *) (guest_mem + data);
|
||||
|
||||
use_ib_mem_pool = true;
|
||||
args->ret = ibv_fork_init(args->);
|
||||
args->ret = ibv_fork_init();
|
||||
use_ib_mem_pool = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,9 +78,6 @@
|
|||
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;
|
||||
|
@ -111,9 +108,6 @@
|
|||
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;
|
||||
|
|
|
@ -22,7 +22,6 @@ uint64_t ibv_wc_read_completion_ts(struct ibv_cq_ex * cq)
|
|||
uint16_t ibv_wc_read_cvlan(struct ibv_cq_ex * cq)
|
||||
uint32_t ibv_wc_read_flow_tag(struct ibv_cq_ex * cq)
|
||||
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)
|
||||
|
@ -33,7 +32,6 @@ int ibv_get_async_event(struct ibv_context * context,struct ibv_async_event * ev
|
|||
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)
|
||||
|
|
|
@ -86,6 +86,8 @@ Required in: ./tool/uhyve-ibv.h
|
|||
} uhyve_ibv_t;
|
||||
"""
|
||||
|
||||
# TODO: Add ibv_resolve_eth_l2_from_gid function back in. Not linking right now.
|
||||
|
||||
from __future__ import print_function
|
||||
from parser import generate_struct_conversions
|
||||
|
||||
|
@ -144,6 +146,8 @@ params_in_guest_mem = ['struct ibv_device_attr',
|
|||
'struct ibv_mw_bind',
|
||||
'struct ibv_flow_spec',
|
||||
'struct ibv_values_ex',
|
||||
'struct ibv_rwq_ind_table_init_attr',
|
||||
'struct ibv_xrcd_init_attr',
|
||||
# containing ib pool pointers:
|
||||
'struct ibv_wq_init_attr',
|
||||
'struct ibv_qp_init_attr',
|
||||
|
@ -219,7 +223,10 @@ class FunctionPrototype:
|
|||
parens_split = string.split("(")
|
||||
ret_and_name = parens_split[0].split(" ")
|
||||
all_params = parens_split[-1].split(")")[0]
|
||||
param_strings = all_params.split(",")
|
||||
if all_params:
|
||||
param_strings = all_params.split(",")
|
||||
else:
|
||||
param_strings = []
|
||||
|
||||
self.parameters = [FunctionParameter(p) for p in param_strings]
|
||||
self.ret = Type(" ".join(ret_and_name[:-1]))
|
||||
|
@ -233,9 +240,10 @@ class FunctionPrototype:
|
|||
"""
|
||||
code = "typedef struct {\n"
|
||||
|
||||
code += "\t// Parameters:\n"
|
||||
for param in self.parameters or []:
|
||||
code += "\t{0};\n".format(param.get_full_expression())
|
||||
if self.get_num_parameters() > 0:
|
||||
code += "\t// Parameters:\n"
|
||||
for param in self.parameters:
|
||||
code += "\t{0};\n".format(param.get_full_expression())
|
||||
|
||||
if not self.ret.is_void():
|
||||
code += "\t// Return value:\n"
|
||||
|
@ -302,13 +310,10 @@ def generate_kernel_function(function_prototype):
|
|||
code = "{0} {1}({2}) {{\n".format(ret_type.type_string, fnc_name, comma_separated_params)
|
||||
code += "\t{0} uhyve_args;\n".format(function_prototype.get_args_struct_name())
|
||||
|
||||
# uhyve_args.attr = (struct ibv_poll_cq_attr *) guest_to_host((size_t) attr);
|
||||
|
||||
for p in params or []:
|
||||
for p in params:
|
||||
if p.is_pointer_pointer():
|
||||
code += "\t// TODO: Take care of ** parameter.\n"
|
||||
else:
|
||||
# print (p.get_struct_name())
|
||||
if 'struct ' + p.get_struct_name() in params_in_guest_mem and p.is_pointer():
|
||||
code += "\tuhyve_args.{0} = ({1}) guest_to_host((size_t) {0});\n".format(
|
||||
p.name, p.type.type_string)
|
||||
|
@ -364,9 +369,10 @@ def generate_uhyve_function(prototype):
|
|||
+ "{0}(".format(fnc_name))
|
||||
|
||||
if prototype.get_num_parameters() > 0:
|
||||
for param in prototype.parameters[:-1] or []:
|
||||
for param in prototype.parameters[:-1]:
|
||||
code += "args->{}, ".format(param.name)
|
||||
code += "args->{});\n".format(prototype.parameters[-1].name)
|
||||
code += "args->{}".format(prototype.parameters[-1].name)
|
||||
code += ");\n"
|
||||
code += "\tuse_ib_mem_pool = false;\n}\n\n\n"
|
||||
|
||||
return code
|
||||
|
|
|
@ -392,21 +392,6 @@ void call_ibv_post_wq_recv(struct kvm_run * run, uint8_t * guest_mem) {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* verbs_get_ctx
|
||||
*/
|
||||
|
||||
void call_verbs_get_ctx(struct kvm_run * run, uint8_t * guest_mem) {
|
||||
printf("LOG: UHYVE - call_verbs_get_ctx\n");
|
||||
unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset));
|
||||
uhyve_verbs_get_ctx_t * args = (uhyve_verbs_get_ctx_t *) (guest_mem + data);
|
||||
|
||||
use_ib_mem_pool = true;
|
||||
args->ret = verbs_get_ctx(args->ctx);
|
||||
use_ib_mem_pool = false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ibv_get_device_list
|
||||
*/
|
||||
|
@ -557,21 +542,6 @@ void call_ibv_query_port(struct kvm_run * run, uint8_t * guest_mem) {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* ___ibv_query_port
|
||||
*/
|
||||
|
||||
void call____ibv_query_port(struct kvm_run * run, uint8_t * guest_mem) {
|
||||
printf("LOG: UHYVE - call____ibv_query_port\n");
|
||||
unsigned data = *((unsigned*) ((size_t) run + run->io.data_offset));
|
||||
uhyve____ibv_query_port_t * args = (uhyve____ibv_query_port_t *) (guest_mem + data);
|
||||
|
||||
use_ib_mem_pool = true;
|
||||
args->ret = ___ibv_query_port(args->context, args->port_num, args->port_attr);
|
||||
use_ib_mem_pool = false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ibv_query_gid
|
||||
*/
|
||||
|
@ -1377,7 +1347,7 @@ void call_ibv_fork_init(struct kvm_run * run, uint8_t * guest_mem) {
|
|||
uhyve_ibv_fork_init_t * args = (uhyve_ibv_fork_init_t *) (guest_mem + data);
|
||||
|
||||
use_ib_mem_pool = true;
|
||||
args->ret = ibv_fork_init(args->);
|
||||
args->ret = ibv_fork_init();
|
||||
use_ib_mem_pool = false;
|
||||
}
|
||||
|
||||
|
@ -1431,15 +1401,15 @@ void call_ibv_event_type_str(struct kvm_run * run, uint8_t * guest_mem) {
|
|||
* ibv_resolve_eth_l2_from_gid
|
||||
*/
|
||||
|
||||
void call_ibv_resolve_eth_l2_from_gid(struct kvm_run * run, uint8_t * guest_mem) {
|
||||
printf("LOG: UHYVE - call_ibv_resolve_eth_l2_from_gid\n");
|
||||
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);
|
||||
/* void call_ibv_resolve_eth_l2_from_gid(struct kvm_run * run, uint8_t * guest_mem) { */
|
||||
/* printf("LOG: UHYVE - call_ibv_resolve_eth_l2_from_gid\n"); */
|
||||
/* 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); */
|
||||
|
||||
use_ib_mem_pool = true;
|
||||
args->ret = ibv_resolve_eth_l2_from_gid(args->context, args->attr, args->eth_mac, args->vid);
|
||||
use_ib_mem_pool = false;
|
||||
}
|
||||
/* use_ib_mem_pool = true; */
|
||||
/* args->ret = ibv_resolve_eth_l2_from_gid(args->context, args->attr, args->eth_mac, args->vid); */
|
||||
/* use_ib_mem_pool = false; */
|
||||
/* } */
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -51,7 +51,6 @@ typedef enum {
|
|||
UHYVE_PORT_IBV_WC_READ_CVLAN = 0x625,
|
||||
UHYVE_PORT_IBV_WC_READ_FLOW_TAG = 0x626,
|
||||
UHYVE_PORT_IBV_POST_WQ_RECV = 0x627,
|
||||
UHYVE_PORT_VERBS_GET_CTX = 0x628,
|
||||
UHYVE_PORT_IBV_GET_DEVICE_LIST = 0x629,
|
||||
UHYVE_PORT_IBV_FREE_DEVICE_LIST = 0x62A,
|
||||
UHYVE_PORT_IBV_GET_DEVICE_NAME = 0x62B,
|
||||
|
@ -62,7 +61,6 @@ typedef enum {
|
|||
UHYVE_PORT_IBV_ACK_ASYNC_EVENT = 0x630,
|
||||
UHYVE_PORT_IBV_QUERY_DEVICE = 0x631,
|
||||
UHYVE_PORT_IBV_QUERY_PORT = 0x632,
|
||||
UHYVE_PORT____IBV_QUERY_PORT = 0x633,
|
||||
UHYVE_PORT_IBV_QUERY_GID = 0x634,
|
||||
UHYVE_PORT_IBV_QUERY_PKEY = 0x635,
|
||||
UHYVE_PORT_IBV_ALLOC_PD = 0x636,
|
||||
|
@ -120,7 +118,7 @@ typedef enum {
|
|||
UHYVE_PORT_IBV_NODE_TYPE_STR = 0x66A,
|
||||
UHYVE_PORT_IBV_PORT_STATE_STR = 0x66B,
|
||||
UHYVE_PORT_IBV_EVENT_TYPE_STR = 0x66C,
|
||||
UHYVE_PORT_IBV_RESOLVE_ETH_L2_FROM_GID = 0x66D,
|
||||
// UHYVE_PORT_IBV_RESOLVE_ETH_L2_FROM_GID = 0x66D,
|
||||
UHYVE_PORT_IBV_IS_QPT_SUPPORTED = 0x66E,
|
||||
|
||||
UHYVE_PORT_KERNEL_IBV_LOG = 0x66F,
|
||||
|
@ -296,13 +294,6 @@ typedef struct {
|
|||
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;
|
||||
|
@ -373,15 +364,6 @@ typedef struct {
|
|||
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;
|
||||
|
@ -848,15 +830,15 @@ typedef struct {
|
|||
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 [6] eth_mac;
|
||||
uint16_t * vid;
|
||||
// Return value:
|
||||
int ret;
|
||||
} __attribute__((packed)) uhyve_ibv_resolve_eth_l2_from_gid_t;
|
||||
// typedef struct {
|
||||
// // Parameters:
|
||||
// struct ibv_context * context;
|
||||
// struct ibv_ah_attr * attr;
|
||||
// uint8_t eth_mac[ETHERNET_LL_SIZE];
|
||||
// uint16_t * vid;
|
||||
// // Return value:
|
||||
// int ret;
|
||||
// } __attribute__((packed)) uhyve_ibv_resolve_eth_l2_from_gid_t;
|
||||
|
||||
typedef struct {
|
||||
// Parameters:
|
||||
|
@ -892,7 +874,6 @@ void call_ibv_wc_read_completion_ts(struct kvm_run * run, uint8_t * guest_mem);
|
|||
void call_ibv_wc_read_cvlan(struct kvm_run * run, uint8_t * guest_mem);
|
||||
void call_ibv_wc_read_flow_tag(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);
|
||||
|
@ -903,7 +884,6 @@ 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);
|
||||
|
@ -961,7 +941,7 @@ 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_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);
|
||||
|
||||
#endif // UHYVE_IBV_H
|
||||
|
|
|
@ -1345,9 +1345,6 @@ static int vcpu_loop(void)
|
|||
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;
|
||||
|
@ -1378,9 +1375,6 @@ static int vcpu_loop(void)
|
|||
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;
|
||||
|
@ -1552,9 +1546,9 @@ static int vcpu_loop(void)
|
|||
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_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;
|
||||
|
|
|
@ -8,6 +8,22 @@ target_link_libraries(basic pthread)
|
|||
|
||||
add_executable(hg hg.c hist.c rdtsc.c run.c init.c opt.c report.c setup.c)
|
||||
|
||||
# add_executable(ib-pingpong-ud ib/pingpong.c ib/pingpong-ud.c)
|
||||
# add_executable(ib_write_bw ib/write_bw.c ib/get_clock.c ib/perftest_parameters.c
|
||||
# ib/perftest_resources.c ib/perftest_communication.c)
|
||||
add_executable(ib_write_bw ib/write_bw.c ib/get_clock.c
|
||||
ib/perftest_parameters_write_bw.c ib/perftest_resources_write_bw.c
|
||||
ib/perftest_communication_write_bw.c)
|
||||
add_executable(ib_write_lat ib/write_lat.c ib/get_clock.c
|
||||
ib/perftest_parameters_write_bw.c ib/perftest_resources_write_bw.c
|
||||
ib/perftest_communication_write_bw.c)
|
||||
add_executable(ib_read_bw ib/read_bw.c ib/get_clock.c
|
||||
ib/perftest_parameters_write_bw.c ib/perftest_resources_write_bw.c
|
||||
ib/perftest_communication_write_bw.c)
|
||||
add_executable(ib_read_lat ib/read_lat.c ib/get_clock.c
|
||||
ib/perftest_parameters_write_bw.c ib/perftest_resources_write_bw.c
|
||||
ib/perftest_communication_write_bw.c)
|
||||
|
||||
add_executable(netio netio.c)
|
||||
|
||||
add_executable(RCCE_pingpong RCCE_pingpong.c)
|
||||
|
|
|
@ -43,6 +43,97 @@
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// CONTAINING HOST PTRS:
|
||||
|
||||
struct ibv_wq_init_attr {
|
||||
void *wq_context; // host
|
||||
enum ibv_wq_type wq_type;
|
||||
uint32_t max_wr;
|
||||
uint32_t max_sge;
|
||||
struct ibv_pd *pd; // host
|
||||
struct ibv_cq *cq; // host
|
||||
uint32_t comp_mask; /* Use ibv_wq_init_attr_mask */
|
||||
uint32_t create_flags; /* use ibv_wq_flags */
|
||||
};
|
||||
|
||||
struct ibv_qp_init_attr {
|
||||
void *qp_context; // host
|
||||
struct ibv_cq *send_cq; // host
|
||||
struct ibv_cq *recv_cq; // host
|
||||
struct ibv_srq *srq; // host
|
||||
struct ibv_qp_cap cap;
|
||||
enum ibv_qp_type qp_type;
|
||||
int sq_sig_all;
|
||||
};
|
||||
|
||||
struct ibv_qp_init_attr_ex {
|
||||
void *qp_context; // host
|
||||
struct ibv_cq *send_cq; // host
|
||||
struct ibv_cq *recv_cq; // host
|
||||
struct ibv_srq *srq; // host
|
||||
struct ibv_qp_cap cap;
|
||||
enum ibv_qp_type qp_type;
|
||||
int sq_sig_all;
|
||||
|
||||
uint32_t comp_mask;
|
||||
struct ibv_pd *pd; // host
|
||||
struct ibv_xrcd *xrcd; // host
|
||||
uint32_t create_flags;
|
||||
uint16_t max_tso_header;
|
||||
struct ibv_rwq_ind_table *rwq_ind_tbl; // host
|
||||
struct ibv_rx_hash_conf rx_hash_conf;
|
||||
uint32_t source_qpn;
|
||||
};
|
||||
|
||||
struct ibv_srq_init_attr_ex {
|
||||
void *srq_context; // host
|
||||
struct ibv_srq_attr attr;
|
||||
|
||||
uint32_t comp_mask;
|
||||
enum ibv_srq_type srq_type;
|
||||
struct ibv_pd *pd; // host
|
||||
struct ibv_xrcd *xrcd; // host
|
||||
struct ibv_cq *cq; // host
|
||||
};
|
||||
|
||||
struct ibv_srq_init_attr {
|
||||
void *srq_context; // host
|
||||
struct ibv_srq_attr attr;
|
||||
};
|
||||
|
||||
struct ibv_qp_open_attr {
|
||||
uint32_t comp_mask;
|
||||
uint32_t qp_num;
|
||||
struct ibv_xrcd *xrcd; // host
|
||||
void *qp_context; // host
|
||||
enum ibv_qp_type qp_type;
|
||||
};
|
||||
|
||||
struct ibv_cq_init_attr_ex {
|
||||
/* Minimum number of entries required for CQ */
|
||||
uint32_t cqe;
|
||||
void *cq_context; // host
|
||||
struct ibv_comp_channel *channel; // host
|
||||
/* Completion vector used to signal completion events.
|
||||
* Must be < context->num_comp_vectors.
|
||||
*/
|
||||
uint32_t comp_vector;
|
||||
uint64_t wc_flags;
|
||||
uint32_t comp_mask;
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
struct ibv_async_event {
|
||||
union {
|
||||
struct ibv_cq *cq;
|
||||
struct ibv_qp *qp;
|
||||
struct ibv_srq *srq;
|
||||
struct ibv_wq *wq;
|
||||
int port_num;
|
||||
} element;
|
||||
enum ibv_event_type event_type;
|
||||
};
|
||||
|
||||
int i, random;
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue