[openib-general] Re: [PATCH] [ib_at]: Update async structure prior to returning requests to appropriate cache
James Lentini
jlentini at netapp.com
Tue May 31 08:30:35 PDT 2005
Committed in revision 2513.
On Mon, 30 May 2005, Hal Rosenstock wrote:
halr> [ib_at]: Update async structure prior to returning requests to
halr> appropriate cache. This change affacts req_free, free_route_req, and
halr> free_path_req.
halr>
halr> Also, some other minor changes to eliminate unneeded parameter passed to
halr> path_req_output and changes to some DEBUG messages.
halr>
halr> Signed-off-by: Hal Rosenstock <halr at voltaire.com>
halr>
halr> Index: at.c
halr> ===================================================================
halr> --- at.c (revision 2507)
halr> +++ at.c (working copy)
halr> @@ -155,7 +155,8 @@
halr>
halr> static void free_route_req(void *async);
halr> static void free_path_req(void *async);
halr> -static void path_req_complete(int stat, struct ib_sa_path_rec *ret, void *ctx);
halr> +static void path_req_complete(int status, struct ib_sa_path_rec *resp,
halr> + void *context);
halr> static int resolve_path(struct path_req *req);
halr>
halr> static int resolve_ip(struct ib_at_src *src, u32 dst_ip, u32 src_ip,
halr> @@ -274,7 +275,6 @@
halr> }
halr>
halr> memset(dgid, 0, sizeof *dgid);
halr> -
halr> return 0;
halr> }
halr>
halr> @@ -319,11 +319,10 @@
halr> break;
halr> default:
halr> WARN("bad async req type %d", pend->type);
halr> + pend->status = IB_AT_STATUS_INVALID;
halr> + pend->type = IBAT_REQ_NONE;
halr> + pend->sa_query = NULL;
halr> }
halr> -
halr> - pend->status = IB_AT_STATUS_INVALID;
halr> - pend->type = IBAT_REQ_NONE;
halr> - pend->sa_query = NULL;
halr> }
halr>
halr> static int req_start(struct async *q, struct async *pend,
halr> @@ -464,6 +463,11 @@
halr> struct route_req *req = container_of(async, struct route_req, pend);
halr>
halr> DEBUG("free async %p req %p", async, req);
halr> +
halr> + req->pend.status = IB_AT_STATUS_INVALID;
halr> + req->pend.type = IBAT_REQ_NONE;
halr> + req->pend.sa_query = NULL;
halr> +
halr> kmem_cache_free(route_req_cache, req);
halr> }
halr>
halr> @@ -472,6 +476,11 @@
halr> struct path_req *req = container_of(async, struct path_req, pend);
halr>
halr> DEBUG("free async %p req %p", async, req);
halr> +
halr> + req->pend.status = IB_AT_STATUS_INVALID;
halr> + req->pend.type = IBAT_REQ_NONE;
halr> + req->pend.sa_query = NULL;
halr> +
halr> kmem_cache_free(path_req_cache, req);
halr> }
halr>
halr> @@ -537,15 +546,14 @@
halr> return 1; /* one entry is filled */
halr> }
halr>
halr> -static int path_req_output(struct path_req *req, struct ib_sa_path_rec *resp,
halr> - int npath, struct ib_sa_path_rec *out, int nelem)
halr> +static int path_req_output(struct ib_sa_path_rec *resp, int npath,
halr> + struct ib_sa_path_rec *out, int nelem)
halr> {
halr> int n = min(npath, nelem);
halr>
halr> - DEBUG("parent %p output %d records", req, n);
halr> + DEBUG("fill ib_sa_path_rec %p output %d records", out, n);
halr>
halr> memcpy(out, resp, n * sizeof (struct ib_sa_path_rec));
halr> -
halr> return n;
halr> }
halr>
halr> @@ -579,7 +587,7 @@
halr> unsigned long flags;
halr> struct async *pend;
halr>
halr> - DEBUG("req %p", req);
halr> + DEBUG("req %p status %d", req, status);
halr>
halr> if (req->pend.parent) {
halr> WARN("for child req %p???", req);
halr> @@ -598,12 +606,12 @@
halr> return;
halr> }
halr>
halr> - req->pend.nelem = path_req_output(req, resp, 1,
halr> + req->pend.nelem = path_req_output(resp, 1,
halr> req->pend.data, req->pend.nelem);
halr>
halr> spin_lock_irqsave(&pending_reqs.lock, flags);
halr> for (pend = req->pend.waiting; pend; pend = pend->waiting)
halr> - pend->nelem = path_req_output(req, resp, 1,
halr> + pend->nelem = path_req_output(resp, 1,
halr> pend->data, pend->nelem);
halr>
halr> req_end(&req->pend, req->pend.nelem, NULL);
halr> @@ -876,7 +884,7 @@
halr> if (in_cache) {
halr> DEBUG("!in_cache free req %p", preq);
halr> kmem_cache_free(path_req_cache, preq);
halr> - return path_req_output(preq, cached_arr, n, path_arr, npath);
halr> + return path_req_output(cached_arr, n, path_arr, npath);
halr> }
halr> */
halr>
halr> @@ -969,7 +977,6 @@
halr> EXPORT_SYMBOL(ib_at_status);
halr>
halr>
halr> -
halr> /*
halr> * Internal init/cleanup functions:
halr> */
halr>
halr>
halr>
More information about the general
mailing list