[rds-commits] zab commits r116 - trunk/linux/net/rds

svn-commits@oss.oracle.com svn-commits at oss.oracle.com
Tue Jun 27 18:53:02 CDT 2006


Author: zab
Date: 2006-06-27 18:53:01 -0500 (Tue, 27 Jun 2006)
New Revision: 116

Modified:
   trunk/linux/net/rds/ib.h
   trunk/linux/net/rds/ib_cm.c
   trunk/linux/net/rds/ib_recv.c
   trunk/linux/net/rds/ib_send.c
Log:
Fix trivial IB connection buildup crashes.

We are using the QP inside the CM ID.  Lose our own QP that we weren't
initializing and shuffle headers around so the paths can get at the QP embedded
in the CM.

The conn is null for CM events in the listening path so don't deref it to get
at ib's connection state which is in fact never used in the function anyway.


Modified: trunk/linux/net/rds/ib.h
===================================================================
--- trunk/linux/net/rds/ib.h	2006-06-27 23:02:46 UTC (rev 115)
+++ trunk/linux/net/rds/ib.h	2006-06-27 23:53:01 UTC (rev 116)
@@ -2,6 +2,7 @@
 #define _RDS_IB_H 
 
 #include <rdma/ib_verbs.h>
+#include <rdma/rdma_cm.h>
 
 /*
  * XXX randomly chosen, but at least seems to be unused:
@@ -66,7 +67,6 @@
 	struct ib_pd		*i_pd;
 	struct ib_mr		*i_mr;
 	struct ib_cq		*i_cq;
-	struct ib_qp		*i_qp;
 
 	/* tx */
 	struct rds_ib_data_send	*i_ds;

Modified: trunk/linux/net/rds/ib_cm.c
===================================================================
--- trunk/linux/net/rds/ib_cm.c	2006-06-27 23:02:46 UTC (rev 115)
+++ trunk/linux/net/rds/ib_cm.c	2006-06-27 23:53:01 UTC (rev 116)
@@ -23,7 +23,6 @@
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/in.h>
-#include <rdma/rdma_cm.h>
 
 #include "rds.h"
 #include "ib.h"
@@ -237,11 +236,12 @@
 static int rds_ib_cm_event_handler(struct rdma_cm_id *cm_id,
 				   struct rdma_cm_event *event)
 {
+	/* this can be null in the listening path */
 	struct rds_connection *conn = cm_id->context;
-	struct rds_ib_connection *ic = conn->c_transport_data;
 	int ret = 0;
 
-	rdsdebug("id %p handling event %u\n", cm_id, event->event);
+	rdsdebug("conn %p id %p handling event %u\n", conn, cm_id,
+		 event->event);
 
 	switch (event->event) {
 		case RDMA_CM_EVENT_CONNECT_REQUEST:
@@ -250,7 +250,7 @@
 
 		case RDMA_CM_EVENT_ADDR_RESOLVED:
 			/* XXX do we need to clean up if this fails? */
-			ret = rdma_resolve_route(ic->i_cm_id,
+			ret = rdma_resolve_route(cm_id,
 						 RDS_IB_RESOLVE_TIMEOUT_MS);
 			break;
 

Modified: trunk/linux/net/rds/ib_recv.c
===================================================================
--- trunk/linux/net/rds/ib_recv.c	2006-06-27 23:02:46 UTC (rev 115)
+++ trunk/linux/net/rds/ib_recv.c	2006-06-27 23:53:01 UTC (rev 116)
@@ -175,7 +175,7 @@
 
 	/* XXX we could be posting lots of these at once */
 	atomic_inc(&ic->i_recv_posted);
-	ret = ib_post_recv(ic->i_qp, &recv->ir_wr, &failed);
+	ret = ib_post_recv(ic->i_cm_id->qp, &recv->ir_wr, &failed);
 	if (ret) {
 		rds_ib_recv_unmap(ic, recv);
 		rds_ib_recv_free(recv);

Modified: trunk/linux/net/rds/ib_send.c
===================================================================
--- trunk/linux/net/rds/ib_send.c	2006-06-27 23:02:46 UTC (rev 115)
+++ trunk/linux/net/rds/ib_send.c	2006-06-27 23:53:01 UTC (rev 116)
@@ -95,7 +95,7 @@
 	 * but maybe it'll be ok.  We can complex it up if their overhead
 	 * is too high.
 	 */ 
-	ret = ib_post_send(ic->i_qp, &ih->ih_wr, &failed_wr);
+	ret = ib_post_send(ic->i_cm_id->qp, &ih->ih_wr, &failed_wr);
 	if (ret == 0)
 		ret = sizeof(struct rds_header);
 	/* XXX disconnect and reconnect on error? */
@@ -236,7 +236,7 @@
 
 	/* we use wr to track how many suceeded */
 	wr = &ds->id_wr[first];
-	ret = ib_post_send(ic->i_qp, &ds->id_wr[first], &wr);
+	ret = ib_post_send(ic->i_cm_id->qp, &ds->id_wr[first], &wr);
 	rdsdebug("data post ic %p first wr %p nr %lu returned ret %d wr %p\n",
 		 ic,  &ds->id_wr[first], nr_work - first, ret, wr);
 	if (ret) {




More information about the rds-commits mailing list