diff --git a/include/hermit/ibv.h b/include/hermit/ibv.h index 484819c94..77264859b 100644 --- a/include/hermit/ibv.h +++ b/include/hermit/ibv.h @@ -42,12 +42,11 @@ extern "C" { // TODO: File necessary? -//struct ibv_device** ibv_get_device_list(int *num_devices); - const char* ibv_get_device_name(struct ibv_device *device); struct ibv_context * ibv_open_device(struct ibv_device * device); int ibv_query_port(struct ibv_context * context, uint8_t port_num, struct ibv_port_attr * port_attr); struct ibv_comp_channel * ibv_create_comp_channel(struct ibv_context * context); +struct ibv_device** ibv_get_device_list(int * num_devices); diff --git a/kernel/ibv_guest_host.c b/kernel/ibv_guest_host.c index 1138983a3..d8228701c 100644 --- a/kernel/ibv_guest_host.c +++ b/kernel/ibv_guest_host.c @@ -263,12 +263,12 @@ void host_to_guest_ibv_comp_channel(struct ibv_comp_channel * channel) { 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); + /* guest_to_host_pthread_mutex_t(&abi_compat->in_use); */ return (struct ibv_abi_compat_v2 *) guest_to_host((size_t) abi_compat); } void host_to_guest_ibv_abi_compat_v2(struct ibv_abi_compat_v2 * abi_compat) { host_to_guest_ibv_comp_channel(&abi_compat->channel); - host_to_guest_pthread_mutex_t(&abi_compat->in_use); + /* host_to_guest_pthread_mutex_t(&abi_compat->in_use); */ } diff --git a/tools/uhyve-ibv.h b/tools/uhyve-ibv.h index 0a6836221..7265459f6 100644 --- a/tools/uhyve-ibv.h +++ b/tools/uhyve-ibv.h @@ -56,7 +56,7 @@ typedef struct { // Parameters: struct ibv_device * device; // Return value: - const char * ret; + const char * ret; // TODO Should this be const? } __attribute__((packed)) uhyve_ibv_get_device_name_t; typedef struct { @@ -80,6 +80,6 @@ void call_ibv_open_device(struct kvm_run * run); void call_ibv_get_device_name(struct kvm_run * run); void call_ibv_query_port(struct kvm_run * run); void call_ibv_create_comp_channel(struct kvm_run * run); -/*void call_ibv_get_device_list(struct kvm_run * run, uint8_t * guest_mem);*/ +void call_ibv_get_device_list(struct kvm_run * run); #endif // UHYVE_IBV_H diff --git a/tools/uhyve.c b/tools/uhyve.c index 7ea0bdcb5..cc083373a 100644 --- a/tools/uhyve.c +++ b/tools/uhyve.c @@ -983,6 +983,9 @@ static int vcpu_loop(void) case UHYVE_PORT_IBV_CREATE_COMP_CHANNEL: call_ibv_create_comp_channel(run); break; + case UHYVE_PORT_IBV_GET_DEVICE_LIST: + call_ibv_get_device_list(run); + break; default: err(1, "KVM: unhandled KVM_EXIT_IO at port 0x%x, direction %d\n", run->io.port, run->io.direction); diff --git a/usr/tests/ib/pingpong.c b/usr/tests/ib/pingpong.c index aab8e4c5d..fae8a78a3 100644 --- a/usr/tests/ib/pingpong.c +++ b/usr/tests/ib/pingpong.c @@ -55,27 +55,27 @@ int pp_get_port_info(struct ibv_context *context, int port, return ibv_query_port(context, port, attr); } -void wire_gid_to_gid(const char *wgid, union ibv_gid *gid) -{ - char tmp[9]; - __be32 v32; - int i; - uint32_t tmp_gid[4]; +/* void wire_gid_to_gid(const char *wgid, union ibv_gid *gid) */ +/* { */ + /* char tmp[9]; */ + /* __be32 v32; */ + /* int i; */ + /* uint32_t tmp_gid[4]; */ - for (tmp[8] = 0, i = 0; i < 4; ++i) { - memcpy(tmp, wgid + i * 8, 8); - sscanf(tmp, "%x", &v32); - tmp_gid[i] = be32toh(v32); - } - memcpy(gid, tmp_gid, sizeof(*gid)); -} + /* for (tmp[8] = 0, i = 0; i < 4; ++i) { */ + /* memcpy(tmp, wgid + i * 8, 8); */ + /* sscanf(tmp, "%x", &v32); */ + /* tmp_gid[i] = be32toh(v32); */ + /* } */ + /* memcpy(gid, tmp_gid, sizeof(*gid)); */ +/* } */ -void gid_to_wire_gid(const union ibv_gid *gid, char wgid[]) -{ - uint32_t tmp_gid[4]; - int i; +/* void gid_to_wire_gid(const union ibv_gid *gid, char wgid[]) */ +/* { */ + /* uint32_t tmp_gid[4]; */ + /* int i; */ - memcpy(tmp_gid, gid, sizeof(tmp_gid)); - for (i = 0; i < 4; ++i) - sprintf(&wgid[i * 8], "%08x", htobe32(tmp_gid[i])); -} + /* memcpy(tmp_gid, gid, sizeof(tmp_gid)); */ + /* for (i = 0; i < 4; ++i) */ + /* sprintf(&wgid[i * 8], "%08x", htobe32(tmp_gid[i])); */ +/* } */ diff --git a/usr/tests/ib/pingpong.h b/usr/tests/ib/pingpong.h index 1cdd81ff2..5749e8b07 100644 --- a/usr/tests/ib/pingpong.h +++ b/usr/tests/ib/pingpong.h @@ -35,5 +35,5 @@ enum ibv_mtu pp_mtu_to_enum(int mtu); int pp_get_port_info(struct ibv_context *context, int port, struct ibv_port_attr *attr); -void wire_gid_to_gid(const char *wgid, union ibv_gid *gid); -void gid_to_wire_gid(const union ibv_gid *gid, char wgid[]); +// void wire_gid_to_gid(const char *wgid, union ibv_gid *gid); +// void gid_to_wire_gid(const union ibv_gid *gid, char wgid[]); diff --git a/usr/tests/ib/pingpong_ud.c b/usr/tests/ib/pingpong_ud.c index f54e849a0..cac270faa 100644 --- a/usr/tests/ib/pingpong_ud.c +++ b/usr/tests/ib/pingpong_ud.c @@ -35,7 +35,7 @@ // #include // #include -// #include +/* #include */ // #include // #include // #include @@ -546,23 +546,23 @@ clean_ctx: /*return ibv_post_send(ctx->qp, &wr, &bad_wr);*/ /*}*/ -/*static void usage(const char *argv0)*/ -/*{*/ - /*printf("Usage:\n");*/ - /*printf(" %s start a server and wait for connection\n", argv0);*/ - /*printf(" %s connect to server at \n", argv0);*/ - /*printf("\n");*/ - /*printf("Options:\n");*/ - /*printf(" -p, --port= listen on/connect to port (default 18515)\n");*/ - /*printf(" -d, --ib-dev= use IB device (default first device found)\n");*/ - /*printf(" -i, --ib-port= use port of IB device (default 1)\n");*/ - /*printf(" -s, --size= size of message to exchange (default 2048)\n");*/ - /*printf(" -r, --rx-depth= number of receives to post at a time (default 500)\n");*/ - /*printf(" -n, --iters= number of exchanges (default 1000)\n");*/ - /*printf(" -l, --sl= send messages with service level (default 0)\n");*/ - /*printf(" -e, --events sleep on CQ events (default poll)\n");*/ - /*printf(" -g, --gid-idx= local port gid index\n");*/ -/*}*/ +static void usage(const char *argv0) +{ + printf("Usage:\n"); + printf(" %s start a server and wait for connection\n", argv0); + printf(" %s connect to server at \n", argv0); + printf("\n"); + printf("Options:\n"); + printf(" -p, --port= listen on/connect to port (default 18515)\n"); + printf(" -d, --ib-dev= use IB device (default first device found)\n"); + printf(" -i, --ib-port= use port of IB device (default 1)\n"); + printf(" -s, --size= size of message to exchange (default 2048)\n"); + printf(" -r, --rx-depth= number of receives to post at a time (default 500)\n"); + printf(" -n, --iters= number of exchanges (default 1000)\n"); + printf(" -l, --sl= send messages with service level (default 0)\n"); + printf(" -e, --events sleep on CQ events (default poll)\n"); + printf(" -g, --gid-idx= local port gid index\n"); +} int main(int argc, char *argv[]) { @@ -668,7 +668,7 @@ int main(int argc, char *argv[]) return 1; } - page_size = sysconf(_SC_PAGESIZE); + page_size = 4092; // TODO dev_list = ibv_get_device_list(NULL); if (!dev_list) {