diff options
Diffstat (limited to 'sys/contrib')
-rw-r--r-- | sys/contrib/rdma/krping/krping.c | 19 | ||||
-rw-r--r-- | sys/contrib/rdma/krping/krping.h | 7 | ||||
-rw-r--r-- | sys/contrib/rdma/krping/krping_dev.c | 3 |
3 files changed, 22 insertions, 7 deletions
diff --git a/sys/contrib/rdma/krping/krping.c b/sys/contrib/rdma/krping/krping.c index 99d1924..c0acf0c 100644 --- a/sys/contrib/rdma/krping/krping.c +++ b/sys/contrib/rdma/krping/krping.c @@ -119,7 +119,7 @@ static void krping_wait(struct krping_cb *cb, int state) int rc; mtx_lock(&cb->lock); while (cb->state < state) { - rc = msleep(cb, &cb->lock, 0, "krping", 0); + rc = msleep(cb, &cb->lock, PCATCH, "krping", 0); if (rc && rc != ERESTART) { cb->state = ERROR; break; @@ -188,7 +188,12 @@ static int krping_cma_event_handler(struct rdma_cm_id *cma_id, case RDMA_CM_EVENT_DEVICE_REMOVAL: DEBUG_LOG(PFX "cma detected device removal!!!!\n"); - break; + cb->state = ERROR; + wakeup(cb); + mtx_unlock(&cb->lock); + krping_wait(cb, CLEANUP); + tsleep(cb, 0, "krping", 5000); + return 0; default: log(LOG_ERR, "oof bad type!\n"); @@ -603,6 +608,8 @@ static int krping_setup_qp(struct krping_cb *cb, struct rdma_cm_id *cm_id) } DEBUG_LOG(PFX "created pd %p\n", cb->pd); + strlcpy(cb->name, cb->pd->device->name, sizeof(cb->name)); + cb->cq = ib_create_cq(cm_id->device, krping_cq_event_handler, NULL, cb, cb->txdepth * 2, 0); if (IS_ERR(cb->cq)) { @@ -1164,7 +1171,7 @@ static void krping_wlat_test_server(struct krping_cb *cb) } wlat_test(cb); - + krping_wait(cb, ERROR); } static void krping_bw_test_server(struct krping_cb *cb) @@ -1776,6 +1783,12 @@ int krping_doit(char *cmd) else krping_run_client(cb); DEBUG_LOG(PFX "destroy cm_id %p\n", cb->cm_id); + + mtx_lock(&cb->lock); + cb->state = CLEANUP; + wakeup(cb); + mtx_unlock(&cb->lock); + rdma_destroy_id(cb->cm_id); out: mtx_lock(&krping_mutex); diff --git a/sys/contrib/rdma/krping/krping.h b/sys/contrib/rdma/krping/krping.h index d234825..5cced30 100644 --- a/sys/contrib/rdma/krping/krping.h +++ b/sys/contrib/rdma/krping/krping.h @@ -37,7 +37,8 @@ enum test_state { RDMA_READ_COMPLETE, RDMA_WRITE_ADV, RDMA_WRITE_COMPLETE, - ERROR + ERROR, + CLEANUP }; struct krping_rdma_info { @@ -100,13 +101,15 @@ struct krping_cb { /* listener on service side. */ struct rdma_cm_id *child_cm_id; /* connection on server side */ TAILQ_ENTRY(krping_cb) list; - + int rlat; /* run read latency test */ int wlat; /* run write latency test */ int bw; /* run write bw test */ int duplex; /* run write bw full duplex test */ int poll; /* poll vs block in rlat */ int txdepth; + + char name[16]; }; static __inline uint64_t diff --git a/sys/contrib/rdma/krping/krping_dev.c b/sys/contrib/rdma/krping/krping_dev.c index 92d954d..d6ab00a 100644 --- a/sys/contrib/rdma/krping/krping_dev.c +++ b/sys/contrib/rdma/krping/krping_dev.c @@ -112,12 +112,11 @@ krping_read(struct cdev *dev, struct uio *uio, int ioflag) mtx_unlock(&krping_mutex); while (!TAILQ_EMPTY(©_cbs)) { - cb = TAILQ_FIRST(©_cbs); TAILQ_REMOVE(©_cbs, cb, list); if (cb->pd) { uprintf("krping: %4d %10s %10u %10u %10u %10u %10u %10u %10u %10u\n", - num++, cb->pd->device->name, cb->stats.send_bytes, + num++, cb->name, cb->stats.send_bytes, cb->stats.send_msgs, cb->stats.recv_bytes, cb->stats.recv_msgs, cb->stats.write_bytes, cb->stats.write_msgs, |