[openib-general] Re: [PATCH] [AT] Initial changes to work with user AT

James Lentini jlentini at netapp.com
Wed Jun 22 08:59:33 PDT 2005


Committed in revision 2671

On Thu, 16 Jun 2005, Hal Rosenstock wrote:

halr> Initial changes to work with user AT.
halr> Also, some other changes based on code inspection.
halr> 
halr> Signed-off-by: Hal Rosenstock <halr at voltaire.com>
halr> 
halr> Index: at.c
halr> ===================================================================
halr> --- at.c	(revision 2610)
halr> +++ at.c	(working copy)
halr> @@ -118,7 +118,7 @@
halr>  	int sa_id;
halr>  };
halr>  
halr> -struct async pending_reqs;	/* dummy head for cyclic list */
halr> +static struct async pending_reqs;	/* dummy head for cyclic list */
halr>  
halr>  struct ib_at_src {
halr>  	u32 ip;
halr> @@ -286,7 +286,7 @@
halr>  
halr>  	spin_lock_irqsave(&pending_reqs.lock, flags);
halr>  	new_id = ++req_id;
halr> -	if (!new_id)
halr> +	if (!new_id)		/* 0 is not used as req_id (reserved value) */
halr>  		new_id = ++req_id;
halr>  	spin_unlock_irqrestore(&pending_reqs.lock, flags);
halr>  
halr> @@ -319,9 +319,13 @@
halr>  		break;
halr>  	default:
halr>  		WARN("bad async req type %d", pend->type);
halr> +		if (pend->sa_query) {
halr> +			ib_sa_cancel_query(pend->sa_id, pend->sa_query);
halr> +			pend->sa_query = NULL;
halr> +		}
halr>  		pend->status = IB_AT_STATUS_INVALID;
halr>  		pend->type = IBAT_REQ_NONE;
halr> -		pend->sa_query = NULL;
halr> +		break;
halr>  	}
halr>  }
halr>  
halr> @@ -377,16 +381,16 @@
halr>  
halr>  	DEBUG("pend %p nrec %d async %p", pend, nrec, q);
halr>  
halr> +	if (pend->sa_query) {
halr> +		ib_sa_cancel_query(pend->sa_id, pend->sa_query);
halr> +		pend->sa_query = NULL;
halr> +	}
halr> +
halr>  	if (pend->status != IB_AT_STATUS_PENDING)
halr>  		WARN("pend %p already completed? status %d", pend, pend->status);
halr>  
halr>  	pend->status = nrec < 0 ? IB_AT_STATUS_ERROR : IB_AT_STATUS_COMPLETED;
halr>  
halr> -	if (pend->sa_query) {
halr> -		ib_sa_cancel_query(pend->sa_id, pend->sa_query);
halr> -		pend->sa_query = NULL;
halr> -	}
halr> -
halr>  	if (q)
halr>  		spin_lock_irqsave(&q->lock, flags);
halr>  
halr> @@ -464,9 +468,12 @@
halr>  
halr>  	DEBUG("free async %p req %p", async, req);
halr>  
halr> +	if (req->pend.sa_query) {
halr> +		ib_sa_cancel_query(req->pend.sa_id, req->pend.sa_query);
halr> +		req->pend.sa_query = NULL;
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> @@ -477,9 +484,12 @@
halr>  
halr>  	DEBUG("free async %p req %p", async, req);
halr>  
halr> +	if (req->pend.sa_query) {
halr> +		ib_sa_cancel_query(req->pend.sa_id, req->pend.sa_query);
halr> +		req->pend.sa_query = NULL;
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> @@ -494,7 +504,7 @@
halr>  	DEBUG("lookup in q %p pending %p", q, new);
halr>  	spin_lock_irqsave(&q->lock, flags);
halr>  	for (a = q->next; a != q; a = a->next) {
halr> -		DEBUG("%d %d", a->type, type);
halr> +		DEBUG("req type %d %d", a->type, type);
halr>  		if (a->type == type && same_fn(a, new))
halr>  			break;
halr>  	}
halr> @@ -508,7 +518,7 @@
halr>  	unsigned long flags;
halr>  	struct async *a;
halr>  
halr> -	DEBUG("lookup in q %p id %llx", q, id);
halr> +	DEBUG("lookup in q %p id 0x%llx", q, id);
halr>  	spin_lock_irqsave(&q->lock, flags);
halr>  	for (a = q->next; a != q; a = a->next)
halr>  		if (a->id == id)
halr> @@ -551,8 +561,7 @@
halr>  {
halr>  	int n = min(npath, nelem);
halr>  
halr> -	DEBUG("fill ib_sa_path_rec %p output %d records", out, n);
halr> -
halr> +	DEBUG("output ib_sa_path_rec %p %d records", out, n);
halr>  	memcpy(out, resp, n * sizeof (struct ib_sa_path_rec));
halr>  	return n;
halr>  }
halr> @@ -589,15 +598,15 @@
halr>  
halr>  	DEBUG("req %p status %d", req, status);
halr>  
halr> +	req->pend.sa_query = NULL;
halr> +
halr>  	if (req->pend.parent) {
halr>  		WARN("for child req %p???", req);
halr>  		return;
halr>  	}
halr>  
halr> -	req->pend.sa_query = NULL;
halr> -
halr>  	if (status) {
halr> -		DEBUG("status %d - check if should retry", status);
halr> +		DEBUG("status %d - checking if should retry", status);
halr>  		if (status == -ETIMEDOUT &&
halr>  		    jiffies - req->pend.start < IB_AT_REQ_TIMEOUT)
halr>  			resolve_path(req);
halr> @@ -625,7 +634,7 @@
halr>  	struct path_req *preq;
halr>  	unsigned long flags;
halr>  
halr> -	DEBUG("start sweeping");
halr> +	DEBUG("start sweep");
halr>  
halr>  	spin_lock_irqsave(&pending_reqs.lock, flags);
halr>  	for (pend = pending_reqs.next; pend != &pending_reqs; pend = next) {
halr> @@ -638,7 +647,7 @@
halr>  
halr>  			DEBUG("examining route req %p pend %p", req, pend);
halr>  			if (jiffies > pend->start + IB_AT_REQ_TIMEOUT) {
halr> -				DEBUG("req delete <%d.%d.%d.%d> <%lu:%lu>",
halr> +				DEBUG("delete route <%d.%d.%d.%d> <%lu:%lu>",
halr>  				     (req->dst_ip & 0x000000ff),
halr>  				     (req->dst_ip & 0x0000ff00) >> 8,
halr>  				     (req->dst_ip & 0x00ff0000) >> 16,
halr> @@ -653,7 +662,7 @@
halr>  
halr>  			DEBUG("examining path req %p pend %p", preq, pend);
halr>  			if (jiffies > pend->start + IB_AT_REQ_TIMEOUT) {
halr> -				DEBUG("req delete path <%lu:%lu>",
halr> +				DEBUG("delete path <%lu:%lu>",
halr>  				      jiffies, pend->start);
halr>  
halr>  				req_end(pend, -ETIMEDOUT, NULL);
halr> @@ -661,6 +670,7 @@
halr>  			break;
halr>  		default:
halr>  			WARN("unknown async req type %d", pend->type);
halr> +			break;
halr>  		}
halr>  	}
halr>  
halr> @@ -722,7 +732,8 @@
halr>  					    &req->pend.sa_query);
halr>  
halr>  	if (req->pend.sa_id < 0) {
halr> -		WARN("ib_sa_path_rec_get %d", req->pend.sa_id);
halr> +		WARN("ib_sa_path_rec_get failed %d", req->pend.sa_id);
halr> +		req->pend.sa_query = NULL;
halr>  		return req->pend.sa_id;
halr>  	}
halr>  
halr> 
halr> 
halr> 



More information about the general mailing list