mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-09 00:00:03 +01:00
added rc pingpong, ud working without host_to_guest.
This commit is contained in:
parent
f929f91a6f
commit
c5657c2f95
8 changed files with 1375 additions and 311 deletions
|
@ -153,23 +153,23 @@ size_t phys_to_virt(size_t phy)
|
|||
/* LOG_INFO("Fourth for.\n"); */
|
||||
|
||||
if (pgt[l] & PG_PRESENT) { // Valid page table entry
|
||||
/* LOG_INFO("p"); */
|
||||
/* LOG_INFO("\tp\n"); */
|
||||
if ((pgt[l] & PFN_MASK) == pfn) { // Page frame found
|
||||
LOG_INFO("SAME PAGE.\n");
|
||||
LOG_INFO("\tSAME PAGE.\n");
|
||||
/* LOG_INFO("i: Hex: %zx, Dec: %zd\n", i, i); */
|
||||
/* LOG_INFO("j: Hex: %zx, Dec: %zd\n", j, j); */
|
||||
/* LOG_INFO("k: Hex: %zx, Dec: %zd\n", k, k); */
|
||||
/* LOG_INFO("l: Hex: %zx, Dec: %zd\n", l, l); */
|
||||
size_t vpn = ((((((i << PAGE_MAP_BITS) | j) << PAGE_MAP_BITS) | k) << PAGE_MAP_BITS) | l) << PAGE_BITS;
|
||||
/* LOG_INFO("vpn: Hex: %zx, Dec: %zd\n", vpn, vpn); */
|
||||
LOG_INFO("\tvpn: Hex: %zx, Dec: %zd\n", vpn, vpn);
|
||||
size_t sext = i & (1UL << (PAGE_MAP_BITS - 1));
|
||||
/* LOG_INFO("sext: Hex: %zx, Dec: %zd\n", sext, sext); */
|
||||
LOG_INFO("\tsext: Hex: %zx, Dec: %zd\n", sext, sext);
|
||||
if (sext) {
|
||||
/* LOG_INFO("sext true"); */
|
||||
LOG_INFO("\tsext true");
|
||||
vpn |= ~0UL << VIRT_BITS;
|
||||
/* LOG_INFO("vpn: Hex: %zx, Dec: %zd\n", vpn, vpn); */
|
||||
LOG_INFO("\tvpn: Hex: %zx, Dec: %zd\n", vpn, vpn);
|
||||
}
|
||||
/* LOG_INFO("return: Hex: %zx, Dec: %zd\n", vpn | off, vpn | off); */
|
||||
LOG_INFO("\treturn: Hex: %zx, Dec: %zd\n", vpn | off, vpn | off);
|
||||
return vpn | off;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,25 +45,25 @@ inline size_t host_to_guest(size_t address) {
|
|||
}
|
||||
|
||||
|
||||
struct ibv_device * guest_to_host_ibv_device(struct ibv_device * device);
|
||||
struct ibv_context * guest_to_host_ibv_context(struct ibv_context * context);
|
||||
struct ibv_context_ops * guest_to_host_ibv_context_ops(struct ibv_context_ops * context_ops);
|
||||
struct ibv_port_attr * guest_to_host_ibv_port_attr(struct ibv_port_attr * port_attr);
|
||||
// struct ibv_device * guest_to_host_ibv_device(struct ibv_device * device);
|
||||
// struct ibv_context * guest_to_host_ibv_context(struct ibv_context * context);
|
||||
// struct ibv_context_ops * guest_to_host_ibv_context_ops(struct ibv_context_ops * context_ops);
|
||||
// struct ibv_port_attr * guest_to_host_ibv_port_attr(struct ibv_port_attr * port_attr);
|
||||
struct ibv_recv_wr * guest_to_host_ibv_recv_wr(struct ibv_recv_wr * wr);
|
||||
struct ibv_send_wr * guest_to_host_ibv_send_wr(struct ibv_send_wr * wr);
|
||||
struct ibv_sge * guest_to_host_ibv_sge(struct ibv_sge * sg);
|
||||
struct ibv_abi_compat_v2 * guest_to_host_ibv_abi_compat_v2(struct ibv_abi_compat_v2 * abi_compat);
|
||||
pthread_mutex_t * guest_to_host_pthread_mutex_t(pthread_mutex_t * mutex);
|
||||
// struct ibv_abi_compat_v2 * guest_to_host_ibv_abi_compat_v2(struct ibv_abi_compat_v2 * abi_compat);
|
||||
// pthread_mutex_t * guest_to_host_pthread_mutex_t(pthread_mutex_t * mutex);
|
||||
|
||||
struct ibv_device * host_to_guest_ibv_device(struct ibv_device * device, addr_type type);
|
||||
struct ibv_context * host_to_guest_ibv_context(struct ibv_context * context, addr_type type);
|
||||
struct ibv_context_ops * host_to_guest_ibv_context_ops(struct ibv_context_ops * context_ops, addr_type type);
|
||||
struct ibv_port_attr * host_to_guest_ibv_port_attr(struct ibv_port_attr * port_attr, addr_type type);
|
||||
struct ibv_comp_channel * host_to_guest_ibv_comp_channel(struct ibv_comp_channel * channel, addr_type type);
|
||||
// struct ibv_device * host_to_guest_ibv_device(struct ibv_device * device, addr_type type);
|
||||
// struct ibv_context * host_to_guest_ibv_context(struct ibv_context * context, addr_type type);
|
||||
// struct ibv_context_ops * host_to_guest_ibv_context_ops(struct ibv_context_ops * context_ops, addr_type type);
|
||||
// struct ibv_port_attr * host_to_guest_ibv_port_attr(struct ibv_port_attr * port_attr, addr_type type);
|
||||
// struct ibv_comp_channel * host_to_guest_ibv_comp_channel(struct ibv_comp_channel * channel, addr_type type);
|
||||
struct ibv_recv_wr * host_to_guest_ibv_recv_wr(struct ibv_recv_wr * wr, addr_type type);
|
||||
struct ibv_send_wr * host_to_guest_ibv_send_wr(struct ibv_send_wr * wr, addr_type type);
|
||||
struct ibv_sge * host_to_guest_ibv_sge(struct ibv_sge * sg, addr_type type);
|
||||
struct ibv_abi_compat_v2 * host_to_guest_ibv_abi_compat_v2(struct ibv_abi_compat_v2 * abi_compat, addr_type type);
|
||||
pthread_mutex_t * host_to_guest_pthread_mutex_t(pthread_mutex_t * mutex, addr_type type);
|
||||
// struct ibv_abi_compat_v2 * host_to_guest_ibv_abi_compat_v2(struct ibv_abi_compat_v2 * abi_compat, addr_type type);
|
||||
// pthread_mutex_t * host_to_guest_pthread_mutex_t(pthread_mutex_t * mutex, addr_type type);
|
||||
|
||||
#endif // __IBV_GUEST_HOST_H__
|
||||
|
|
|
@ -1244,6 +1244,7 @@ typedef struct {
|
|||
|
||||
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 = (struct ibv_qp_attr *) guest_to_host((size_t) attr); // !
|
||||
uhyve_args.attr_mask = attr_mask;
|
||||
|
@ -1344,7 +1345,7 @@ typedef struct {
|
|||
} __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) {
|
||||
/* LOG_INFO("KERNEL: ibv_post_recv()\n"); */
|
||||
LOG_INFO("KERNEL: ibv_post_recv()\n");
|
||||
uhyve_ibv_post_recv_t uhyve_args;
|
||||
|
||||
uhyve_args.qp = qp;
|
||||
|
@ -1353,8 +1354,8 @@ int ibv_post_recv(struct ibv_qp * qp, struct ibv_recv_wr * wr, struct ibv_recv_w
|
|||
|
||||
uhyve_send(UHYVE_PORT_IBV_POST_RECV, (unsigned) virt_to_phys((size_t) &uhyve_args));
|
||||
|
||||
/* host_to_guest_ibv_recv_wr(wr, GUEST); */ // TODO: add this back in
|
||||
/* LOG_INFO("KERNEL: ibv_post_recv()\n"); */
|
||||
/* LOG_INFO("KERNEL: Before host_to_guest_ibv_recv_wr(wr, GUEST);\n"); */
|
||||
/* host_to_guest_ibv_recv_wr(wr, GUEST); // TODO: add this back in */
|
||||
|
||||
// TODO: Do we want to convert bad_wr's content back to guest memory?
|
||||
|
||||
|
|
|
@ -37,90 +37,6 @@
|
|||
#include <hermit/logging.h>
|
||||
|
||||
|
||||
/*
|
||||
* struct ibv_device
|
||||
*/
|
||||
|
||||
struct ibv_device * guest_to_host_ibv_device(struct ibv_device * device) {
|
||||
// _ops obsolete.
|
||||
return (struct ibv_device *) guest_to_host((size_t) device);
|
||||
}
|
||||
|
||||
struct ibv_device * host_to_guest_ibv_device(struct ibv_device * device, addr_type type) {
|
||||
struct ibv_device * vaddr = (type == GUEST) ? device
|
||||
: (struct ibv_device *) host_to_guest((size_t) device);
|
||||
|
||||
return vaddr;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* struct ibv_context
|
||||
*/
|
||||
|
||||
struct ibv_context * guest_to_host_ibv_context(struct ibv_context * context) {
|
||||
context->device = guest_to_host_ibv_device(context->device);
|
||||
context->abi_compat = guest_to_host_ibv_abi_compat_v2(context->abi_compat);
|
||||
|
||||
guest_to_host_ibv_context_ops(&context->ops);
|
||||
guest_to_host_pthread_mutex_t(&context->mutex); // TODO
|
||||
|
||||
return (struct ibv_context *) guest_to_host((size_t) context);
|
||||
}
|
||||
|
||||
struct ibv_context * host_to_guest_ibv_context(struct ibv_context * context, addr_type type) {
|
||||
struct ibv_context * vaddr = (type == GUEST) ? context
|
||||
: (struct ibv_context *) host_to_guest((size_t) context);
|
||||
|
||||
vaddr->device = host_to_guest_ibv_device(vaddr->device, HOST);
|
||||
vaddr->abi_compat = host_to_guest_ibv_abi_compat_v2(vaddr->abi_compat, HOST);
|
||||
|
||||
host_to_guest_ibv_context_ops(&vaddr->ops, GUEST);
|
||||
host_to_guest_pthread_mutex_t(&vaddr->mutex, GUEST);
|
||||
|
||||
return vaddr;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* struct ibv_port_attr
|
||||
*/
|
||||
|
||||
struct ibv_port_attr * guest_to_host_ibv_port_attr(struct ibv_port_attr * port_attr) {
|
||||
return (struct ibv_port_attr *) guest_to_host((size_t) port_attr);
|
||||
}
|
||||
|
||||
struct ibv_port_attr * host_to_guest_ibv_port_attr(struct ibv_port_attr * port_attr, addr_type type) {
|
||||
struct ibv_port_attr * vaddr = (type == GUEST) ? port_attr
|
||||
: (struct ibv_port_attr *) host_to_guest((size_t) port_attr);
|
||||
|
||||
return vaddr;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* struct ibv_sge
|
||||
*/
|
||||
|
||||
struct ibv_sge * guest_to_host_ibv_sge(struct ibv_sge * sg) {
|
||||
/* LOG_INFO("Entered guest_to_host_ibv_recv_wr()\n"); */
|
||||
/* LOG_INFO("\tsg->addr before conversion: %lu\n", sg->addr); */
|
||||
sg->addr = (uint64_t) guest_to_host((size_t) sg->addr);
|
||||
/* LOG_INFO("\tsg->addr after conversion: %lu\n", sg->addr); */
|
||||
|
||||
return (struct ibv_sge *) guest_to_host((size_t) sg);
|
||||
}
|
||||
|
||||
struct ibv_sge * host_to_guest_ibv_sge(struct ibv_sge * sg, addr_type type) {
|
||||
/* LOG_INFO("Entered host_to_guest_ibv_recv_wr()\n"); */
|
||||
struct ibv_sge * vaddr = (type == GUEST) ? sg
|
||||
: (struct ibv_sge *) host_to_guest((size_t) sg);
|
||||
|
||||
vaddr->addr = (uint64_t) host_to_guest((size_t) vaddr->addr);
|
||||
|
||||
return vaddr;
|
||||
}
|
||||
|
||||
// struct ibv_recv_wr {
|
||||
// uint64_t wr_id;
|
||||
// struct ibv_recv_wr *next;
|
||||
|
@ -135,43 +51,68 @@ struct ibv_sge * host_to_guest_ibv_sge(struct ibv_sge * sg, addr_type type) {
|
|||
// };
|
||||
|
||||
|
||||
/*
|
||||
* struct ibv_sge
|
||||
*/
|
||||
|
||||
struct ibv_sge * guest_to_host_ibv_sge(struct ibv_sge * sg) {
|
||||
LOG_INFO("\tEntered guest_to_host_ibv_sge()\n");
|
||||
/* LOG_INFO("\tsg->addr before conversion: %lu\n", sg->addr); */
|
||||
sg->addr = (uint64_t) guest_to_host((size_t) sg->addr);
|
||||
/* LOG_INFO("\tsg->addr after conversion: %lu\n", sg->addr); */
|
||||
|
||||
return (struct ibv_sge *) guest_to_host((size_t) sg);
|
||||
}
|
||||
|
||||
struct ibv_sge * host_to_guest_ibv_sge(struct ibv_sge * sg, addr_type type) {
|
||||
LOG_INFO("Entered host_to_guest_ibv_recv_wr()\n");
|
||||
struct ibv_sge * vaddr = (type == GUEST) ? sg
|
||||
: (struct ibv_sge *) host_to_guest((size_t) sg);
|
||||
|
||||
vaddr->addr = (uint64_t) host_to_guest((size_t) vaddr->addr);
|
||||
|
||||
return vaddr;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* struct ibv_recv_wr
|
||||
*/
|
||||
|
||||
struct ibv_recv_wr * guest_to_host_ibv_recv_wr(struct ibv_recv_wr * wr) {
|
||||
/* LOG_INFO("Entered guest_to_host_ibv_recv_wr()\n"); */
|
||||
LOG_INFO("Entered guest_to_host_ibv_recv_wr()\n");
|
||||
if (wr->next) {
|
||||
/* LOG_INFO("\twr->next is not NULL\n"); */
|
||||
LOG_INFO("\twr->next is not NULL\n");
|
||||
wr->next = guest_to_host_ibv_recv_wr(wr->next); // linked list
|
||||
}
|
||||
|
||||
for (int i = 0; i < wr->num_sge; i++) {
|
||||
guest_to_host_ibv_sge(wr->sg_list + i);
|
||||
}
|
||||
LOG_INFO("\twr->sg_list before conversion, guest: %lu\n", wr->sg_list);
|
||||
wr->sg_list = (struct ibv_sge *) guest_to_host((size_t) wr->sg_list);
|
||||
LOG_INFO("\twr->sg_list after conversion, host: %lu\n", wr->sg_list);
|
||||
|
||||
return (struct ibv_recv_wr *) guest_to_host((size_t) wr);
|
||||
}
|
||||
|
||||
struct ibv_recv_wr * host_to_guest_ibv_recv_wr(struct ibv_recv_wr * wr, addr_type type) {
|
||||
/* LOG_INFO("Entered host_to_guest_ibv_recv_wr()\n"); */
|
||||
LOG_INFO("Entered host_to_guest_ibv_recv_wr()\n");
|
||||
struct ibv_recv_wr * vaddr = (type == GUEST) ? wr
|
||||
: (struct ibv_recv_wr *) host_to_guest((size_t) wr);
|
||||
LOG_INFO("\tvaddr set.\n");
|
||||
|
||||
if (vaddr->next) {
|
||||
/* LOG_INFO("\twr->next is not NULL\n"); */
|
||||
LOG_INFO("\twr->next is not NULL\n");
|
||||
vaddr->next = host_to_guest_ibv_recv_wr(vaddr->next, HOST); // linked list
|
||||
}
|
||||
|
||||
vaddr->sg_list = (struct ibv_sge *) host_to_guest((size_t) vaddr->sg_list);
|
||||
LOG_INFO("\twr->sg_list before conversion, host: %lu\n", vaddr->sg_list);
|
||||
vaddr->sg_list = (struct ibv_sge *) host_to_guest((size_t) vaddr->sg_list); // TODO problem hier
|
||||
for (int i = 0; i < vaddr->num_sge; i++) {
|
||||
host_to_guest_ibv_sge(vaddr->sg_list + i, GUEST);
|
||||
}
|
||||
|
||||
// TODO: make this work with an actual list > 1 element.
|
||||
vaddr->sg_list = host_to_guest_ibv_sge(vaddr->sg_list, HOST);
|
||||
|
||||
return vaddr;
|
||||
}
|
||||
|
||||
|
@ -183,7 +124,7 @@ struct ibv_recv_wr * host_to_guest_ibv_recv_wr(struct ibv_recv_wr * wr, addr_typ
|
|||
struct ibv_send_wr * guest_to_host_ibv_send_wr(struct ibv_send_wr * wr) {
|
||||
/* LOG_INFO("Entered guest_to_host_ibv_send_wr()\n"); */
|
||||
if (wr->next) {
|
||||
/* LOG_INFO("\twr->next is not NULL\n"); */
|
||||
LOG_INFO("\twr->next is not NULL\n");
|
||||
wr->next = guest_to_host_ibv_send_wr(wr->next); // linked list
|
||||
}
|
||||
|
||||
|
@ -196,12 +137,12 @@ struct ibv_send_wr * guest_to_host_ibv_send_wr(struct ibv_send_wr * wr) {
|
|||
}
|
||||
|
||||
struct ibv_send_wr * host_to_guest_ibv_send_wr(struct ibv_send_wr * wr, addr_type type) {
|
||||
/* LOG_INFO("Entered host_to_guest_ibv_send_wr()\n"); */
|
||||
LOG_INFO("Entered host_to_guest_ibv_send_wr()\n");
|
||||
struct ibv_send_wr * vaddr = (type == GUEST) ? wr
|
||||
: (struct ibv_send_wr *) host_to_guest((size_t) wr);
|
||||
|
||||
if (wr->next) {
|
||||
/* LOG_INFO("\twr->next is not NULL\n"); */
|
||||
LOG_INFO("\twr->next is not NULL\n");
|
||||
vaddr->next = host_to_guest_ibv_send_wr(vaddr->next, HOST); // linked list
|
||||
}
|
||||
|
||||
|
@ -214,146 +155,208 @@ struct ibv_send_wr * host_to_guest_ibv_send_wr(struct ibv_send_wr * wr, addr_typ
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* struct ibv_device
|
||||
*/
|
||||
|
||||
/* struct ibv_device * guest_to_host_ibv_device(struct ibv_device * device) { */
|
||||
/* // _ops obsolete. */
|
||||
/* return (struct ibv_device *) guest_to_host((size_t) device); */
|
||||
/* } */
|
||||
|
||||
/* struct ibv_device * host_to_guest_ibv_device(struct ibv_device * device, addr_type type) { */
|
||||
/* struct ibv_device * vaddr = (type == GUEST) ? device */
|
||||
/* : (struct ibv_device *) host_to_guest((size_t) device); */
|
||||
|
||||
/* return vaddr; */
|
||||
/* } */
|
||||
|
||||
|
||||
/*
|
||||
* struct ibv_context
|
||||
*/
|
||||
|
||||
/* struct ibv_context * guest_to_host_ibv_context(struct ibv_context * context) { */
|
||||
/* context->device = guest_to_host_ibv_device(context->device); */
|
||||
/* context->abi_compat = guest_to_host_ibv_abi_compat_v2(context->abi_compat); */
|
||||
|
||||
/* guest_to_host_ibv_context_ops(&context->ops); */
|
||||
/* guest_to_host_pthread_mutex_t(&context->mutex); // TODO */
|
||||
|
||||
/* return (struct ibv_context *) guest_to_host((size_t) context); */
|
||||
/* } */
|
||||
|
||||
/* struct ibv_context * host_to_guest_ibv_context(struct ibv_context * context, addr_type type) { */
|
||||
/* struct ibv_context * vaddr = (type == GUEST) ? context */
|
||||
/* : (struct ibv_context *) host_to_guest((size_t) context); */
|
||||
|
||||
/* vaddr->device = host_to_guest_ibv_device(vaddr->device, HOST); */
|
||||
/* vaddr->abi_compat = host_to_guest_ibv_abi_compat_v2(vaddr->abi_compat, HOST); */
|
||||
|
||||
/* host_to_guest_ibv_context_ops(&vaddr->ops, GUEST); */
|
||||
/* host_to_guest_pthread_mutex_t(&vaddr->mutex, GUEST); */
|
||||
|
||||
/* return vaddr; */
|
||||
/* } */
|
||||
|
||||
|
||||
/*
|
||||
* struct ibv_port_attr
|
||||
*/
|
||||
|
||||
/* struct ibv_port_attr * guest_to_host_ibv_port_attr(struct ibv_port_attr * port_attr) { */
|
||||
/* return (struct ibv_port_attr *) guest_to_host((size_t) port_attr); */
|
||||
/* } */
|
||||
|
||||
/* struct ibv_port_attr * host_to_guest_ibv_port_attr(struct ibv_port_attr * port_attr, addr_type type) { */
|
||||
/* struct ibv_port_attr * vaddr = (type == GUEST) ? port_attr */
|
||||
/* : (struct ibv_port_attr *) host_to_guest((size_t) port_attr); */
|
||||
|
||||
/* return vaddr; */
|
||||
/* } */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* struct ibv_comp_channel
|
||||
*/
|
||||
|
||||
struct ibv_comp_channel * guest_to_host_ibv_comp_channel(struct ibv_comp_channel * channel) {
|
||||
channel->context = guest_to_host_ibv_context(channel->context);
|
||||
/* struct ibv_comp_channel * guest_to_host_ibv_comp_channel(struct ibv_comp_channel * channel) { */
|
||||
/* channel->context = guest_to_host_ibv_context(channel->context); */
|
||||
|
||||
return (struct ibv_comp_channel *) guest_to_host((size_t) channel);
|
||||
}
|
||||
/* return (struct ibv_comp_channel *) guest_to_host((size_t) channel); */
|
||||
/* } */
|
||||
|
||||
struct ibv_comp_channel * host_to_guest_ibv_comp_channel(struct ibv_comp_channel * channel, addr_type type) {
|
||||
struct ibv_comp_channel * vaddr = (type == GUEST) ? channel
|
||||
: (struct ibv_comp_channel *) host_to_guest((size_t) channel);
|
||||
/* struct ibv_comp_channel * host_to_guest_ibv_comp_channel(struct ibv_comp_channel * channel, addr_type type) { */
|
||||
/* struct ibv_comp_channel * vaddr = (type == GUEST) ? channel */
|
||||
/* : (struct ibv_comp_channel *) host_to_guest((size_t) channel); */
|
||||
|
||||
vaddr->context = host_to_guest_ibv_context(vaddr->context, HOST);
|
||||
/* vaddr->context = host_to_guest_ibv_context(vaddr->context, HOST); */
|
||||
|
||||
return vaddr;
|
||||
}
|
||||
/* return vaddr; */
|
||||
/* } */
|
||||
|
||||
|
||||
/*
|
||||
* struct ibv_abi_compat_v2
|
||||
*/
|
||||
|
||||
struct ibv_abi_compat_v2 * guest_to_host_ibv_abi_compat_v2(struct ibv_abi_compat_v2 * abi_compat) {
|
||||
guest_to_host_ibv_comp_channel(&abi_compat->channel);
|
||||
guest_to_host_pthread_mutex_t(&abi_compat->in_use);
|
||||
/* struct ibv_abi_compat_v2 * guest_to_host_ibv_abi_compat_v2(struct ibv_abi_compat_v2 * abi_compat) { */
|
||||
/* guest_to_host_ibv_comp_channel(&abi_compat->channel); */
|
||||
/* guest_to_host_pthread_mutex_t(&abi_compat->in_use); */
|
||||
|
||||
return (struct ibv_abi_compat_v2 *) guest_to_host((size_t) abi_compat);
|
||||
}
|
||||
/* return (struct ibv_abi_compat_v2 *) guest_to_host((size_t) abi_compat); */
|
||||
/* } */
|
||||
|
||||
struct ibv_abi_compat_v2 * host_to_guest_ibv_abi_compat_v2(struct ibv_abi_compat_v2 * abi_compat, addr_type type) {
|
||||
struct ibv_abi_compat_v2 * vaddr = (type == GUEST) ? abi_compat
|
||||
: (struct ibv_abi_compat_v2 *) host_to_guest((size_t) abi_compat);
|
||||
/* struct ibv_abi_compat_v2 * host_to_guest_ibv_abi_compat_v2(struct ibv_abi_compat_v2 * abi_compat, addr_type type) { */
|
||||
/* struct ibv_abi_compat_v2 * vaddr = (type == GUEST) ? abi_compat */
|
||||
/* : (struct ibv_abi_compat_v2 *) host_to_guest((size_t) abi_compat); */
|
||||
|
||||
host_to_guest_ibv_comp_channel(&abi_compat->channel, GUEST);
|
||||
host_to_guest_pthread_mutex_t(&abi_compat->in_use, GUEST);
|
||||
/* host_to_guest_ibv_comp_channel(&abi_compat->channel, GUEST); */
|
||||
/* host_to_guest_pthread_mutex_t(&abi_compat->in_use, GUEST); */
|
||||
|
||||
return vaddr;
|
||||
}
|
||||
/* return vaddr; */
|
||||
/* } */
|
||||
|
||||
|
||||
/*
|
||||
* pthread_mutex_t
|
||||
*/
|
||||
|
||||
pthread_mutex_t * guest_to_host_pthread_mutex_t(pthread_mutex_t * mutex) {
|
||||
/* mutex->__m_owner = guest_to_host__pthread_descr(mutex->__m_owner); */
|
||||
/* pthread_mutex_t * guest_to_host_pthread_mutex_t(pthread_mutex_t * mutex) { */
|
||||
/* [> mutex->__m_owner = guest_to_host__pthread_descr(mutex->__m_owner); <] */
|
||||
|
||||
return (pthread_mutex_t *) guest_to_host((size_t) mutex);
|
||||
}
|
||||
/* return (pthread_mutex_t *) guest_to_host((size_t) mutex); */
|
||||
/* } */
|
||||
|
||||
pthread_mutex_t * host_to_guest_pthread_mutex_t(pthread_mutex_t * mutex, addr_type type) {
|
||||
pthread_mutex_t * vaddr = (type == GUEST) ? mutex
|
||||
: (pthread_mutex_t *) host_to_guest((size_t) mutex);
|
||||
/* host_to_guest__pthread_descr(mutex->__m_owner); */
|
||||
/* pthread_mutex_t * host_to_guest_pthread_mutex_t(pthread_mutex_t * mutex, addr_type type) { */
|
||||
/* pthread_mutex_t * vaddr = (type == GUEST) ? mutex */
|
||||
/* : (pthread_mutex_t *) host_to_guest((size_t) mutex); */
|
||||
/* [> host_to_guest__pthread_descr(mutex->__m_owner); <] */
|
||||
|
||||
return vaddr;
|
||||
}
|
||||
/* return vaddr; */
|
||||
/* } */
|
||||
|
||||
|
||||
/*
|
||||
* struct ibv_context_ops
|
||||
*/
|
||||
|
||||
struct ibv_context_ops * guest_to_host_ibv_context_ops(struct ibv_context_ops * context_ops) {
|
||||
// TODO: Does this work?
|
||||
context_ops->query_device = (int (*)(struct ibv_context *, struct ibv_device_attr *)) guest_to_host((size_t) context_ops->query_device);
|
||||
context_ops->query_port = (int (*)(struct ibv_context *, uint8_t, struct ibv_port_attr *)) guest_to_host((size_t) context_ops->query_port);
|
||||
context_ops->alloc_pd = (struct ibv_pd * (*)(struct ibv_context *)) guest_to_host((size_t) context_ops->alloc_pd);
|
||||
context_ops->dealloc_pd = (int (*)(struct ibv_pd *)) guest_to_host((size_t) context_ops->dealloc_pd);
|
||||
context_ops->reg_mr = (struct ibv_mr * (*)(struct ibv_pd *, void *, size_t, int)) guest_to_host((size_t) context_ops->reg_mr);
|
||||
context_ops->rereg_mr = (int (*)(struct ibv_mr *, int, struct ibv_pd *, void *, size_t, int)) guest_to_host((size_t) context_ops->rereg_mr);
|
||||
context_ops->dereg_mr = (int (*)(struct ibv_mr *)) guest_to_host((size_t) context_ops->dereg_mr);
|
||||
context_ops->alloc_mw = (struct ibv_mw * (*)(struct ibv_pd *, enum ibv_mw_type)) guest_to_host((size_t) context_ops->alloc_mw);
|
||||
context_ops->bind_mw = (int (*)(struct ibv_qp *, struct ibv_mw *, struct ibv_mw_bind *)) guest_to_host((size_t) context_ops->bind_mw);
|
||||
context_ops->dealloc_mw = (int (*)(struct ibv_mw *)) guest_to_host((size_t) context_ops->dealloc_mw);
|
||||
context_ops->create_cq = (struct ibv_cq * (*)(struct ibv_context *, int, struct ibv_comp_channel *, int)) guest_to_host((size_t) context_ops->create_cq);
|
||||
context_ops->poll_cq = (int (*)(struct ibv_cq *, int, struct ibv_wc *)) guest_to_host((size_t) context_ops->poll_cq);
|
||||
context_ops->req_notify_cq = (int (*)(struct ibv_cq *, int)) guest_to_host((size_t) context_ops->req_notify_cq);
|
||||
context_ops->cq_event = (void (*)(struct ibv_cq *)) guest_to_host((size_t) context_ops->cq_event);
|
||||
context_ops->resize_cq = (int (*)(struct ibv_cq *, int)) guest_to_host((size_t) context_ops->resize_cq);
|
||||
context_ops->destroy_cq = (int (*)(struct ibv_cq *)) guest_to_host((size_t) context_ops->destroy_cq);
|
||||
context_ops->create_srq = (struct ibv_srq * (*)(struct ibv_pd *, struct ibv_srq_init_attr *)) guest_to_host((size_t) context_ops->create_srq);
|
||||
context_ops->modify_srq = (int (*)(struct ibv_srq *, struct ibv_srq_attr *, int)) guest_to_host((size_t) context_ops->modify_srq);
|
||||
context_ops->query_srq = (int (*)(struct ibv_srq *, struct ibv_srq_attr *)) guest_to_host((size_t) context_ops->query_srq);
|
||||
context_ops->destroy_srq = (int (*)(struct ibv_srq *)) guest_to_host((size_t) context_ops->destroy_srq);
|
||||
context_ops->post_srq_recv = (int (*)(struct ibv_srq *, struct ibv_recv_wr *, struct ibv_recv_wr **)) guest_to_host((size_t) context_ops->post_srq_recv);
|
||||
context_ops->create_qp = (struct ibv_qp * (*)(struct ibv_pd *, struct ibv_qp_init_attr *)) guest_to_host((size_t) context_ops->create_qp);
|
||||
context_ops->query_qp = (int (*)(struct ibv_qp *, struct ibv_qp_attr *, int, struct ibv_qp_init_attr *)) guest_to_host((size_t) context_ops->query_qp);
|
||||
context_ops->modify_qp = (int (*)(struct ibv_qp *, struct ibv_qp_attr *, int)) guest_to_host((size_t) context_ops->modify_qp);
|
||||
context_ops->destroy_qp = (int (*)(struct ibv_qp *)) guest_to_host((size_t) context_ops->destroy_qp);
|
||||
context_ops->post_send = (int (*)(struct ibv_qp *, struct ibv_send_wr *, struct ibv_send_wr **)) guest_to_host((size_t) context_ops->post_send);
|
||||
context_ops->post_recv = (int (*)(struct ibv_qp *, struct ibv_recv_wr *, struct ibv_recv_wr **)) guest_to_host((size_t) context_ops->post_recv);
|
||||
context_ops->create_ah = (struct ibv_ah * (*)(struct ibv_pd *, struct ibv_ah_attr *)) guest_to_host((size_t) context_ops->create_ah);
|
||||
context_ops->destroy_ah = (int (*)(struct ibv_ah *)) guest_to_host((size_t) context_ops->destroy_ah);
|
||||
context_ops->attach_mcast = (int (*)(struct ibv_qp *, const union ibv_gid *, uint16_t)) guest_to_host((size_t) context_ops->attach_mcast);
|
||||
context_ops->detach_mcast = (int (*)(struct ibv_qp *, const union ibv_gid *, uint16_t)) guest_to_host((size_t) context_ops->detach_mcast);
|
||||
context_ops->async_event = (void (*)(struct ibv_async_event *)) guest_to_host((size_t) context_ops->async_event);
|
||||
/* struct ibv_context_ops * guest_to_host_ibv_context_ops(struct ibv_context_ops * context_ops) { */
|
||||
/* // TODO: Does this work? */
|
||||
/* context_ops->query_device = (int (*)(struct ibv_context *, struct ibv_device_attr *)) guest_to_host((size_t) context_ops->query_device); */
|
||||
/* context_ops->query_port = (int (*)(struct ibv_context *, uint8_t, struct ibv_port_attr *)) guest_to_host((size_t) context_ops->query_port); */
|
||||
/* context_ops->alloc_pd = (struct ibv_pd * (*)(struct ibv_context *)) guest_to_host((size_t) context_ops->alloc_pd); */
|
||||
/* context_ops->dealloc_pd = (int (*)(struct ibv_pd *)) guest_to_host((size_t) context_ops->dealloc_pd); */
|
||||
/* context_ops->reg_mr = (struct ibv_mr * (*)(struct ibv_pd *, void *, size_t, int)) guest_to_host((size_t) context_ops->reg_mr); */
|
||||
/* context_ops->rereg_mr = (int (*)(struct ibv_mr *, int, struct ibv_pd *, void *, size_t, int)) guest_to_host((size_t) context_ops->rereg_mr); */
|
||||
/* context_ops->dereg_mr = (int (*)(struct ibv_mr *)) guest_to_host((size_t) context_ops->dereg_mr); */
|
||||
/* context_ops->alloc_mw = (struct ibv_mw * (*)(struct ibv_pd *, enum ibv_mw_type)) guest_to_host((size_t) context_ops->alloc_mw); */
|
||||
/* context_ops->bind_mw = (int (*)(struct ibv_qp *, struct ibv_mw *, struct ibv_mw_bind *)) guest_to_host((size_t) context_ops->bind_mw); */
|
||||
/* context_ops->dealloc_mw = (int (*)(struct ibv_mw *)) guest_to_host((size_t) context_ops->dealloc_mw); */
|
||||
/* context_ops->create_cq = (struct ibv_cq * (*)(struct ibv_context *, int, struct ibv_comp_channel *, int)) guest_to_host((size_t) context_ops->create_cq); */
|
||||
/* context_ops->poll_cq = (int (*)(struct ibv_cq *, int, struct ibv_wc *)) guest_to_host((size_t) context_ops->poll_cq); */
|
||||
/* context_ops->req_notify_cq = (int (*)(struct ibv_cq *, int)) guest_to_host((size_t) context_ops->req_notify_cq); */
|
||||
/* context_ops->cq_event = (void (*)(struct ibv_cq *)) guest_to_host((size_t) context_ops->cq_event); */
|
||||
/* context_ops->resize_cq = (int (*)(struct ibv_cq *, int)) guest_to_host((size_t) context_ops->resize_cq); */
|
||||
/* context_ops->destroy_cq = (int (*)(struct ibv_cq *)) guest_to_host((size_t) context_ops->destroy_cq); */
|
||||
/* context_ops->create_srq = (struct ibv_srq * (*)(struct ibv_pd *, struct ibv_srq_init_attr *)) guest_to_host((size_t) context_ops->create_srq); */
|
||||
/* context_ops->modify_srq = (int (*)(struct ibv_srq *, struct ibv_srq_attr *, int)) guest_to_host((size_t) context_ops->modify_srq); */
|
||||
/* context_ops->query_srq = (int (*)(struct ibv_srq *, struct ibv_srq_attr *)) guest_to_host((size_t) context_ops->query_srq); */
|
||||
/* context_ops->destroy_srq = (int (*)(struct ibv_srq *)) guest_to_host((size_t) context_ops->destroy_srq); */
|
||||
/* context_ops->post_srq_recv = (int (*)(struct ibv_srq *, struct ibv_recv_wr *, struct ibv_recv_wr **)) guest_to_host((size_t) context_ops->post_srq_recv); */
|
||||
/* context_ops->create_qp = (struct ibv_qp * (*)(struct ibv_pd *, struct ibv_qp_init_attr *)) guest_to_host((size_t) context_ops->create_qp); */
|
||||
/* context_ops->query_qp = (int (*)(struct ibv_qp *, struct ibv_qp_attr *, int, struct ibv_qp_init_attr *)) guest_to_host((size_t) context_ops->query_qp); */
|
||||
/* context_ops->modify_qp = (int (*)(struct ibv_qp *, struct ibv_qp_attr *, int)) guest_to_host((size_t) context_ops->modify_qp); */
|
||||
/* context_ops->destroy_qp = (int (*)(struct ibv_qp *)) guest_to_host((size_t) context_ops->destroy_qp); */
|
||||
/* context_ops->post_send = (int (*)(struct ibv_qp *, struct ibv_send_wr *, struct ibv_send_wr **)) guest_to_host((size_t) context_ops->post_send); */
|
||||
/* context_ops->post_recv = (int (*)(struct ibv_qp *, struct ibv_recv_wr *, struct ibv_recv_wr **)) guest_to_host((size_t) context_ops->post_recv); */
|
||||
/* context_ops->create_ah = (struct ibv_ah * (*)(struct ibv_pd *, struct ibv_ah_attr *)) guest_to_host((size_t) context_ops->create_ah); */
|
||||
/* context_ops->destroy_ah = (int (*)(struct ibv_ah *)) guest_to_host((size_t) context_ops->destroy_ah); */
|
||||
/* context_ops->attach_mcast = (int (*)(struct ibv_qp *, const union ibv_gid *, uint16_t)) guest_to_host((size_t) context_ops->attach_mcast); */
|
||||
/* context_ops->detach_mcast = (int (*)(struct ibv_qp *, const union ibv_gid *, uint16_t)) guest_to_host((size_t) context_ops->detach_mcast); */
|
||||
/* context_ops->async_event = (void (*)(struct ibv_async_event *)) guest_to_host((size_t) context_ops->async_event); */
|
||||
|
||||
return (struct ibv_context_ops *) guest_to_host((size_t) context_ops);
|
||||
}
|
||||
/* return (struct ibv_context_ops *) guest_to_host((size_t) context_ops); */
|
||||
/* } */
|
||||
|
||||
struct ibv_context_ops * host_to_guest_ibv_context_ops(
|
||||
struct ibv_context_ops * context_ops, addr_type type) {
|
||||
struct ibv_context_ops * vaddr = (type == GUEST) ? context_ops
|
||||
: (struct ibv_context_ops *) host_to_guest((size_t) context_ops);
|
||||
/* struct ibv_context_ops * host_to_guest_ibv_context_ops( */
|
||||
/* struct ibv_context_ops * context_ops, addr_type type) { */
|
||||
/* struct ibv_context_ops * vaddr = (type == GUEST) ? context_ops */
|
||||
/* : (struct ibv_context_ops *) host_to_guest((size_t) context_ops); */
|
||||
|
||||
vaddr->query_device = (int (*)(struct ibv_context *, struct ibv_device_attr *)) host_to_guest((size_t) vaddr->query_device);
|
||||
vaddr->query_port = (int (*)(struct ibv_context *, uint8_t, struct ibv_port_attr *)) host_to_guest((size_t) vaddr->query_port);
|
||||
vaddr->alloc_pd = (struct ibv_pd * (*)(struct ibv_context *)) host_to_guest((size_t) vaddr->alloc_pd);
|
||||
vaddr->dealloc_pd = (int (*)(struct ibv_pd *)) host_to_guest((size_t) vaddr->dealloc_pd);
|
||||
vaddr->reg_mr = (struct ibv_mr * (*)(struct ibv_pd *, void *, size_t, int)) host_to_guest((size_t) vaddr->reg_mr);
|
||||
vaddr->rereg_mr = (int (*)(struct ibv_mr *, int, struct ibv_pd *, void *, size_t, int)) host_to_guest((size_t) vaddr->rereg_mr);
|
||||
vaddr->dereg_mr = (int (*)(struct ibv_mr *)) host_to_guest((size_t) vaddr->dereg_mr);
|
||||
vaddr->alloc_mw = (struct ibv_mw * (*)(struct ibv_pd *, enum ibv_mw_type)) host_to_guest((size_t) vaddr->alloc_mw);
|
||||
vaddr->bind_mw = (int (*)(struct ibv_qp *, struct ibv_mw *, struct ibv_mw_bind *)) host_to_guest((size_t) vaddr->bind_mw);
|
||||
vaddr->dealloc_mw = (int (*)(struct ibv_mw *)) host_to_guest((size_t) vaddr->dealloc_mw);
|
||||
vaddr->create_cq = (struct ibv_cq * (*)(struct ibv_context *, int, struct ibv_comp_channel *, int)) host_to_guest((size_t) vaddr->create_cq);
|
||||
vaddr->poll_cq = (int (*)(struct ibv_cq *, int, struct ibv_wc *)) host_to_guest((size_t) vaddr->poll_cq);
|
||||
vaddr->req_notify_cq = (int (*)(struct ibv_cq *, int)) host_to_guest((size_t) vaddr->req_notify_cq);
|
||||
vaddr->cq_event = (void (*)(struct ibv_cq *)) host_to_guest((size_t) vaddr->cq_event);
|
||||
vaddr->resize_cq = (int (*)(struct ibv_cq *, int)) host_to_guest((size_t) vaddr->resize_cq);
|
||||
vaddr->destroy_cq = (int (*)(struct ibv_cq *)) host_to_guest((size_t) vaddr->destroy_cq);
|
||||
vaddr->create_srq = (struct ibv_srq * (*)(struct ibv_pd *, struct ibv_srq_init_attr *)) host_to_guest((size_t) vaddr->create_srq);
|
||||
vaddr->modify_srq = (int (*)(struct ibv_srq *, struct ibv_srq_attr *, int)) host_to_guest((size_t) vaddr->modify_srq);
|
||||
vaddr->query_srq = (int (*)(struct ibv_srq *, struct ibv_srq_attr *)) host_to_guest((size_t) vaddr->query_srq);
|
||||
vaddr->destroy_srq = (int (*)(struct ibv_srq *)) host_to_guest((size_t) vaddr->destroy_srq);
|
||||
vaddr->post_srq_recv = (int (*)(struct ibv_srq *, struct ibv_recv_wr *, struct ibv_recv_wr **)) host_to_guest((size_t) vaddr->post_srq_recv);
|
||||
vaddr->create_qp = (struct ibv_qp * (*)(struct ibv_pd *, struct ibv_qp_init_attr *)) host_to_guest((size_t) vaddr->create_qp);
|
||||
vaddr->query_qp = (int (*)(struct ibv_qp *, struct ibv_qp_attr *, int, struct ibv_qp_init_attr *)) host_to_guest((size_t) vaddr->query_qp);
|
||||
vaddr->modify_qp = (int (*)(struct ibv_qp *, struct ibv_qp_attr *, int)) host_to_guest((size_t) vaddr->modify_qp);
|
||||
vaddr->destroy_qp = (int (*)(struct ibv_qp *)) host_to_guest((size_t) vaddr->destroy_qp);
|
||||
vaddr->post_send = (int (*)(struct ibv_qp *, struct ibv_send_wr *, struct ibv_send_wr **)) host_to_guest((size_t) vaddr->post_send);
|
||||
vaddr->post_recv = (int (*)(struct ibv_qp *, struct ibv_recv_wr *, struct ibv_recv_wr **)) host_to_guest((size_t) vaddr->post_recv);
|
||||
vaddr->create_ah = (struct ibv_ah * (*)(struct ibv_pd *, struct ibv_ah_attr *)) host_to_guest((size_t) vaddr->create_ah);
|
||||
vaddr->destroy_ah = (int (*)(struct ibv_ah *)) host_to_guest((size_t) vaddr->destroy_ah);
|
||||
vaddr->attach_mcast = (int (*)(struct ibv_qp *, const union ibv_gid *, uint16_t)) host_to_guest((size_t) vaddr->attach_mcast);
|
||||
vaddr->detach_mcast = (int (*)(struct ibv_qp *, const union ibv_gid *, uint16_t)) host_to_guest((size_t) vaddr->detach_mcast);
|
||||
vaddr->async_event = (void (*)(struct ibv_async_event *)) host_to_guest((size_t) vaddr->async_event);
|
||||
/* vaddr->query_device = (int (*)(struct ibv_context *, struct ibv_device_attr *)) host_to_guest((size_t) vaddr->query_device); */
|
||||
/* vaddr->query_port = (int (*)(struct ibv_context *, uint8_t, struct ibv_port_attr *)) host_to_guest((size_t) vaddr->query_port); */
|
||||
/* vaddr->alloc_pd = (struct ibv_pd * (*)(struct ibv_context *)) host_to_guest((size_t) vaddr->alloc_pd); */
|
||||
/* vaddr->dealloc_pd = (int (*)(struct ibv_pd *)) host_to_guest((size_t) vaddr->dealloc_pd); */
|
||||
/* vaddr->reg_mr = (struct ibv_mr * (*)(struct ibv_pd *, void *, size_t, int)) host_to_guest((size_t) vaddr->reg_mr); */
|
||||
/* vaddr->rereg_mr = (int (*)(struct ibv_mr *, int, struct ibv_pd *, void *, size_t, int)) host_to_guest((size_t) vaddr->rereg_mr); */
|
||||
/* vaddr->dereg_mr = (int (*)(struct ibv_mr *)) host_to_guest((size_t) vaddr->dereg_mr); */
|
||||
/* vaddr->alloc_mw = (struct ibv_mw * (*)(struct ibv_pd *, enum ibv_mw_type)) host_to_guest((size_t) vaddr->alloc_mw); */
|
||||
/* vaddr->bind_mw = (int (*)(struct ibv_qp *, struct ibv_mw *, struct ibv_mw_bind *)) host_to_guest((size_t) vaddr->bind_mw); */
|
||||
/* vaddr->dealloc_mw = (int (*)(struct ibv_mw *)) host_to_guest((size_t) vaddr->dealloc_mw); */
|
||||
/* vaddr->create_cq = (struct ibv_cq * (*)(struct ibv_context *, int, struct ibv_comp_channel *, int)) host_to_guest((size_t) vaddr->create_cq); */
|
||||
/* vaddr->poll_cq = (int (*)(struct ibv_cq *, int, struct ibv_wc *)) host_to_guest((size_t) vaddr->poll_cq); */
|
||||
/* vaddr->req_notify_cq = (int (*)(struct ibv_cq *, int)) host_to_guest((size_t) vaddr->req_notify_cq); */
|
||||
/* vaddr->cq_event = (void (*)(struct ibv_cq *)) host_to_guest((size_t) vaddr->cq_event); */
|
||||
/* vaddr->resize_cq = (int (*)(struct ibv_cq *, int)) host_to_guest((size_t) vaddr->resize_cq); */
|
||||
/* vaddr->destroy_cq = (int (*)(struct ibv_cq *)) host_to_guest((size_t) vaddr->destroy_cq); */
|
||||
/* vaddr->create_srq = (struct ibv_srq * (*)(struct ibv_pd *, struct ibv_srq_init_attr *)) host_to_guest((size_t) vaddr->create_srq); */
|
||||
/* vaddr->modify_srq = (int (*)(struct ibv_srq *, struct ibv_srq_attr *, int)) host_to_guest((size_t) vaddr->modify_srq); */
|
||||
/* vaddr->query_srq = (int (*)(struct ibv_srq *, struct ibv_srq_attr *)) host_to_guest((size_t) vaddr->query_srq); */
|
||||
/* vaddr->destroy_srq = (int (*)(struct ibv_srq *)) host_to_guest((size_t) vaddr->destroy_srq); */
|
||||
/* vaddr->post_srq_recv = (int (*)(struct ibv_srq *, struct ibv_recv_wr *, struct ibv_recv_wr **)) host_to_guest((size_t) vaddr->post_srq_recv); */
|
||||
/* vaddr->create_qp = (struct ibv_qp * (*)(struct ibv_pd *, struct ibv_qp_init_attr *)) host_to_guest((size_t) vaddr->create_qp); */
|
||||
/* vaddr->query_qp = (int (*)(struct ibv_qp *, struct ibv_qp_attr *, int, struct ibv_qp_init_attr *)) host_to_guest((size_t) vaddr->query_qp); */
|
||||
/* vaddr->modify_qp = (int (*)(struct ibv_qp *, struct ibv_qp_attr *, int)) host_to_guest((size_t) vaddr->modify_qp); */
|
||||
/* vaddr->destroy_qp = (int (*)(struct ibv_qp *)) host_to_guest((size_t) vaddr->destroy_qp); */
|
||||
/* vaddr->post_send = (int (*)(struct ibv_qp *, struct ibv_send_wr *, struct ibv_send_wr **)) host_to_guest((size_t) vaddr->post_send); */
|
||||
/* vaddr->post_recv = (int (*)(struct ibv_qp *, struct ibv_recv_wr *, struct ibv_recv_wr **)) host_to_guest((size_t) vaddr->post_recv); */
|
||||
/* vaddr->create_ah = (struct ibv_ah * (*)(struct ibv_pd *, struct ibv_ah_attr *)) host_to_guest((size_t) vaddr->create_ah); */
|
||||
/* vaddr->destroy_ah = (int (*)(struct ibv_ah *)) host_to_guest((size_t) vaddr->destroy_ah); */
|
||||
/* vaddr->attach_mcast = (int (*)(struct ibv_qp *, const union ibv_gid *, uint16_t)) host_to_guest((size_t) vaddr->attach_mcast); */
|
||||
/* vaddr->detach_mcast = (int (*)(struct ibv_qp *, const union ibv_gid *, uint16_t)) host_to_guest((size_t) vaddr->detach_mcast); */
|
||||
/* vaddr->async_event = (void (*)(struct ibv_async_event *)) host_to_guest((size_t) vaddr->async_event); */
|
||||
|
||||
return vaddr;
|
||||
}
|
||||
/* return vaddr; */
|
||||
/* } */
|
||||
|
|
|
@ -1,70 +1,70 @@
|
|||
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)
|
||||
|
|
|
@ -11,7 +11,8 @@ 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 ib/pingpong.c 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)
|
||||
|
|
1057
usr/tests/ib/pingpong-rc.c
Normal file
1057
usr/tests/ib/pingpong-rc.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -504,28 +504,30 @@ 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)
|
||||
{
|
||||
/* printf("Entered pp_post_recv().\n"); */
|
||||
struct ibv_sge list = {
|
||||
.addr = (uintptr_t) ctx->buf,
|
||||
.length = ctx->size + 40,
|
||||
/* .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;
|
||||
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 + 40,
|
||||
/* .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;
|
||||
}
|
||||
|
||||
printf("Finished pp_post_recv().\n");
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -587,7 +589,7 @@ int main(int argc, char *argv[])
|
|||
unsigned int port = 18515;
|
||||
int ib_port = 1;
|
||||
unsigned int size = 2048;
|
||||
unsigned int rx_depth = 500;
|
||||
unsigned int rx_depth = 1;
|
||||
unsigned int iters = 1000;
|
||||
int use_event = 0;
|
||||
int routs;
|
||||
|
|
Loading…
Add table
Reference in a new issue