[openib-general] [PATCH] [ib_at]: Update async structure prior to returning requests to appropriate cache

Hal Rosenstock halr at voltaire.com
Mon May 30 10:37:26 PDT 2005


[ib_at]: Update async structure prior to returning requests to
appropriate cache. This change affacts req_free, free_route_req, and
free_path_req.

Also, some other minor changes to eliminate unneeded parameter passed to
path_req_output and changes to some DEBUG messages.

Signed-off-by: Hal Rosenstock <halr at voltaire.com>

Index: at.c
===================================================================
--- at.c	(revision 2507)
+++ at.c	(working copy)
@@ -155,7 +155,8 @@
 
 static void free_route_req(void *async);
 static void free_path_req(void *async);
-static void path_req_complete(int stat, struct ib_sa_path_rec *ret, void *ctx);
+static void path_req_complete(int status, struct ib_sa_path_rec *resp,
+			      void *context);
 static int resolve_path(struct path_req *req);
 
 static int resolve_ip(struct ib_at_src *src, u32 dst_ip, u32 src_ip,
@@ -274,7 +275,6 @@
 	}
 
 	memset(dgid, 0, sizeof *dgid);
-
 	return 0;
 }
 
@@ -319,11 +319,10 @@
 		break;
 	default:
 		WARN("bad async req type %d", pend->type);
+		pend->status = IB_AT_STATUS_INVALID;
+		pend->type = IBAT_REQ_NONE;
+		pend->sa_query = NULL;
 	}
-
-	pend->status = IB_AT_STATUS_INVALID;
-	pend->type = IBAT_REQ_NONE;
-	pend->sa_query = NULL;
 }
 
 static int req_start(struct async *q, struct async *pend,
@@ -464,6 +463,11 @@
 	struct route_req *req = container_of(async, struct route_req, pend);
 
 	DEBUG("free async %p req %p", async, req);
+
+	req->pend.status = IB_AT_STATUS_INVALID;
+	req->pend.type = IBAT_REQ_NONE;
+	req->pend.sa_query = NULL;
+
 	kmem_cache_free(route_req_cache, req);
 }
 
@@ -472,6 +476,11 @@
 	struct path_req *req = container_of(async, struct path_req, pend);
 
 	DEBUG("free async %p req %p", async, req);
+
+	req->pend.status = IB_AT_STATUS_INVALID;
+	req->pend.type = IBAT_REQ_NONE;
+	req->pend.sa_query = NULL;
+
 	kmem_cache_free(path_req_cache, req);
 }
 
@@ -537,15 +546,14 @@
 	return 1;		/* one entry is filled */
 }
 
-static int path_req_output(struct path_req *req, struct ib_sa_path_rec *resp,
-			   int npath, struct ib_sa_path_rec *out, int nelem)
+static int path_req_output(struct ib_sa_path_rec *resp, int npath,
+			   struct ib_sa_path_rec *out, int nelem)
 {
 	int n = min(npath, nelem);
 
-	DEBUG("parent %p output %d records", req, n);
+	DEBUG("fill ib_sa_path_rec %p output %d records", out, n);
 
 	memcpy(out, resp, n * sizeof (struct ib_sa_path_rec));
-
 	return n;
 }
 
@@ -579,7 +587,7 @@
 	unsigned long flags;
 	struct async *pend;
 
-	DEBUG("req %p", req);
+	DEBUG("req %p status %d", req, status);
 
 	if (req->pend.parent) {
 		WARN("for child req %p???", req);
@@ -598,12 +606,12 @@
 		return;
 	}
 
-	req->pend.nelem = path_req_output(req, resp, 1,
+	req->pend.nelem = path_req_output(resp, 1,
 					  req->pend.data, req->pend.nelem);
 
 	spin_lock_irqsave(&pending_reqs.lock, flags);
 	for (pend = req->pend.waiting; pend; pend = pend->waiting)	
-		pend->nelem = path_req_output(req, resp, 1,
+		pend->nelem = path_req_output(resp, 1,
 					      pend->data, pend->nelem);
 
 	req_end(&req->pend, req->pend.nelem, NULL);
@@ -876,7 +884,7 @@
 	if (in_cache) {
 		DEBUG("!in_cache free req %p", preq);
 		kmem_cache_free(path_req_cache, preq);
-		return path_req_output(preq, cached_arr, n, path_arr, npath);
+		return path_req_output(cached_arr, n, path_arr, npath);
 	}
 	*/
 
@@ -969,7 +977,6 @@
 EXPORT_SYMBOL(ib_at_status);
 
 
-
 /*
  * Internal init/cleanup functions:
  */






More information about the general mailing list