[openib-general] [PATCH] GSI: Use one send pool

Hal Rosenstock halr at voltaire.com
Mon Aug 16 13:55:09 PDT 2004


Use one send pool rather than 1/HCA in GSI

Index: gsi_main.c
===================================================================
--- gsi_main.c	(revision 648)
+++ gsi_main.c	(working copy)
@@ -145,6 +145,7 @@
 static struct list_head gsi_class_list;
 static struct list_head gsi_hca_list;
 static int gsi_pool_cnt = 0;
+static void *gsi_snd_dtgrm_pool = NULL;
 static struct timer_list gsi_sent_dtgrm_timer;
 static atomic_t gsi_sent_dtgrm_timer_running = ATOMIC_INIT(1);
 
@@ -649,7 +650,6 @@
 	gsi_hca_stop(hca);
 	gsi_thread_stop(hca);
 	gsi_dtgrm_pool_destroy(hca->rcv_dtgrm_pool);
-	gsi_dtgrm_pool_destroy(hca->snd_dtgrm_pool);
 	ib_destroy_qp(hca->qp);
 	ib_destroy_cq(hca->cq);
 	kfree(hca);
@@ -765,13 +765,7 @@
 		goto error6;
 	}
 
-	ret = gsi_dtgrm_pool_create_named(GSI_QP_SND_SIZE,
-					  "snd",
-					  &hca->snd_dtgrm_pool);
-	if (ret < 0) {
-		 printk(KERN_ERR "Could not create send datagram pool\n");
-		 goto error7;
-	}
+	hca->snd_dtgrm_pool = gsi_snd_dtgrm_pool;
 
 	spin_lock_init(&hca->rcv_list_lock);
 	spin_lock_init(&hca->snd_list_lock);
@@ -783,7 +777,7 @@
 	ret = gsi_hca_start(hca);
 	if (ret) {
 		printk(KERN_ERR "Could not start device\n");
-		goto error8;
+		goto error7;
 	}
 
 	GSI_HCA_LIST_LOCK();
@@ -792,11 +786,9 @@
 
 	return 0;
 
-error8:
+error7:
 	gsi_thread_stop(hca);
 
-	gsi_dtgrm_pool_destroy(hca->snd_dtgrm_pool);
-error7:
 	gsi_dtgrm_pool_destroy(hca->rcv_dtgrm_pool);
 error6:
 	ib_destroy_qp(hca->qp);
@@ -2870,6 +2862,18 @@
 		goto error2;
 	}
 
+	if (!gsi_snd_dtgrm_pool)
+	{
+		result = gsi_dtgrm_pool_create_named(GSI_QP_SND_SIZE,
+						  "snd",
+						  &gsi_snd_dtgrm_pool);
+		if (result < 0) {
+			printk(KERN_ERR "Could not create send datagram pool\n");
+		    	goto error3;
+		}
+
+	}
+
 	if (rmpp_init() != RMPP_SUCCESS) {
 		printk(KERN_ERR "Could init RMPP!\n");
 		result = -ENXIO;
@@ -2895,13 +2899,18 @@
 gsi_cleanup_module(void)
 {
 	printk(KERN_DEBUG "Bye GSI!\n");
+
+	ib_device_notifier_deregister(&gsi_notifier);
+
 #ifdef GSI_RMPP_SUPPORT
 	rmpp_cleanup();
 #endif
 
-	ib_device_notifier_deregister(&gsi_notifier);
-
 	gsi_sent_dtgrm_timer_stop();
+	if (gsi_snd_dtgrm_pool) {
+		gsi_dtgrm_pool_destroy(gsi_snd_dtgrm_pool);
+		gsi_snd_dtgrm_pool = NULL;
+	}
 	remove_proc_entry("openib/gsi/control", NULL);
 	module_version_exit(MODNAME);
 }





More information about the general mailing list