Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Aug 2013 19:12:29 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r254735 - in head/sys: contrib/rdma/krping modules/rdma
Message-ID:  <201308231912.r7NJCTR6032458@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Fri Aug 23 19:12:29 2013
New Revision: 254735
URL: http://svnweb.freebsd.org/changeset/base/254735

Log:
  Assorted fixes to krping.  Disconnect the rest of sys/contrib/rdma from
  the build while here.  sys/ofed has more recent RDMA code and should be
  used instead.  We should probably move krping out of sys/contrib/rdma
  and get rid of the rest of it.
  
  Obtained from:	Chelsio

Modified:
  head/sys/contrib/rdma/krping/krping.c
  head/sys/contrib/rdma/krping/krping.h
  head/sys/contrib/rdma/krping/krping_dev.c
  head/sys/modules/rdma/Makefile

Modified: head/sys/contrib/rdma/krping/krping.c
==============================================================================
--- head/sys/contrib/rdma/krping/krping.c	Fri Aug 23 18:54:27 2013	(r254734)
+++ head/sys/contrib/rdma/krping/krping.c	Fri Aug 23 19:12:29 2013	(r254735)
@@ -119,7 +119,7 @@ static void krping_wait(struct krping_cb
 	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(stru
 
 	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
 	}
 	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(stru
 	}
 
 	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);

Modified: head/sys/contrib/rdma/krping/krping.h
==============================================================================
--- head/sys/contrib/rdma/krping/krping.h	Fri Aug 23 18:54:27 2013	(r254734)
+++ head/sys/contrib/rdma/krping/krping.h	Fri Aug 23 19:12:29 2013	(r254735)
@@ -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

Modified: head/sys/contrib/rdma/krping/krping_dev.c
==============================================================================
--- head/sys/contrib/rdma/krping/krping_dev.c	Fri Aug 23 18:54:27 2013	(r254734)
+++ head/sys/contrib/rdma/krping/krping_dev.c	Fri Aug 23 19:12:29 2013	(r254735)
@@ -112,12 +112,11 @@ krping_read(struct cdev *dev, struct uio
 	mtx_unlock(&krping_mutex);
 
 	while (!TAILQ_EMPTY(&copy_cbs)) {
-		
 		cb = TAILQ_FIRST(&copy_cbs);
 		TAILQ_REMOVE(&copy_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,

Modified: head/sys/modules/rdma/Makefile
==============================================================================
--- head/sys/modules/rdma/Makefile	Fri Aug 23 18:54:27 2013	(r254734)
+++ head/sys/modules/rdma/Makefile	Fri Aug 23 19:12:29 2013	(r254735)
@@ -1,9 +1,9 @@
 # $FreeBSD$
 
-SUBDIR=  addr
-SUBDIR+= cma
-SUBDIR+= iwcm
-SUBDIR+= core
+#SUBDIR=  addr
+#SUBDIR+= cma
+#SUBDIR+= iwcm
+#SUBDIR+= core
 SUBDIR+= krping
 
 .include <bsd.subdir.mk>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308231912.r7NJCTR6032458>