[openib-general] [RFC] [PATCH 1/7] ib_sa 2.6.20: expose MAD retry parameter through SA

Sean Hefty sean.hefty at intel.com
Tue Oct 10 15:53:24 PDT 2006


Currently, the SA query interface does not permit retrying requests
automatically.  Expose this capability to take advantage of underlying
MAD layer API, which provides it basically for free because of RMPP.

Without automatic retries pushed down into the SA query module, retries are
assigned new TIDs, and appear as separate requests.  This means that a
delayed response will be dropped, and the remote side will not detect that
the request is a duplicate, so will re-calculate the response.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 9ae4f3a..b9ba68d 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1334,7 +1334,7 @@ static int cma_query_ib_route(struct rdm
 				id_priv->id.port_num, &path_rec,
 				IB_SA_PATH_REC_DGID | IB_SA_PATH_REC_SGID |
 				IB_SA_PATH_REC_PKEY | IB_SA_PATH_REC_NUMB_PATH,
-				timeout_ms, GFP_KERNEL,
+				timeout_ms, 0, GFP_KERNEL,
 				cma_query_handler, work, &id_priv->query);
 
 	return (id_priv->query_id < 0) ? id_priv->query_id : 0;
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
index 1706d3c..82d4736 100644
--- a/drivers/infiniband/core/sa_query.c
+++ b/drivers/infiniband/core/sa_query.c
@@ -516,7 +516,8 @@ static void init_mad(struct ib_sa_mad *m
 	spin_unlock_irqrestore(&tid_lock, flags);
 }
 
-static int send_mad(struct ib_sa_query *query, int timeout_ms, gfp_t gfp_mask)
+static int send_mad(struct ib_sa_query *query, int timeout_ms, int retries,
+		    gfp_t gfp_mask)
 {
 	unsigned long flags;
 	int ret, id;
@@ -533,6 +534,7 @@ retry:
 		return ret;
 
 	query->mad_buf->timeout_ms  = timeout_ms;
+	query->mad_buf->retries = retries;
 	query->mad_buf->context[0] = query;
 	query->id = id;
 
@@ -590,6 +592,7 @@ static void ib_sa_path_rec_release(struc
  * @rec:Path Record to send in query
  * @comp_mask:component mask to send in query
  * @timeout_ms:time to wait for response
+ * @retries:number of times to retry request
  * @gfp_mask:GFP mask to use for internal allocations
  * @callback:function called when query completes, times out or is
  * canceled
@@ -611,7 +614,7 @@ int ib_sa_path_rec_get(struct ib_sa_clie
 		       struct ib_device *device, u8 port_num,
 		       struct ib_sa_path_rec *rec,
 		       ib_sa_comp_mask comp_mask,
-		       int timeout_ms, gfp_t gfp_mask,
+		       int timeout_ms, int retries, gfp_t gfp_mask,
 		       void (*callback)(int status,
 					struct ib_sa_path_rec *resp,
 					void *context),
@@ -662,7 +665,7 @@ int ib_sa_path_rec_get(struct ib_sa_clie
 
 	*sa_query = &query->sa_query;
 
-	ret = send_mad(&query->sa_query, timeout_ms, gfp_mask);
+	ret = send_mad(&query->sa_query, timeout_ms, retries, gfp_mask);
 	if (ret < 0)
 		goto err2;
 
@@ -710,6 +713,7 @@ static void ib_sa_service_rec_release(st
  * @rec:Service Record to send in request
  * @comp_mask:component mask to send in request
  * @timeout_ms:time to wait for response
+ * @retries:number of times to retry request
  * @gfp_mask:GFP mask to use for internal allocations
  * @callback:function called when request completes, times out or is
  * canceled
@@ -732,7 +736,7 @@ int ib_sa_service_rec_query(struct ib_sa
 			    struct ib_device *device, u8 port_num, u8 method,
 			    struct ib_sa_service_rec *rec,
 			    ib_sa_comp_mask comp_mask,
-			    int timeout_ms, gfp_t gfp_mask,
+			    int timeout_ms, int retries, gfp_t gfp_mask,
 			    void (*callback)(int status,
 					     struct ib_sa_service_rec *resp,
 					     void *context),
@@ -789,7 +793,7 @@ int ib_sa_service_rec_query(struct ib_sa
 
 	*sa_query = &query->sa_query;
 
-	ret = send_mad(&query->sa_query, timeout_ms, gfp_mask);
+	ret = send_mad(&query->sa_query, timeout_ms, retries, gfp_mask);
 	if (ret < 0)
 		goto err2;
 
@@ -833,7 +837,7 @@ int ib_sa_mcmember_rec_query(struct ib_s
 			     u8 method,
 			     struct ib_sa_mcmember_rec *rec,
 			     ib_sa_comp_mask comp_mask,
-			     int timeout_ms, gfp_t gfp_mask,
+			     int timeout_ms, int retries, gfp_t gfp_mask,
 			     void (*callback)(int status,
 					      struct ib_sa_mcmember_rec *resp,
 					      void *context),
@@ -885,7 +889,7 @@ int ib_sa_mcmember_rec_query(struct ib_s
 
 	*sa_query = &query->sa_query;
 
-	ret = send_mad(&query->sa_query, timeout_ms, gfp_mask);
+	ret = send_mad(&query->sa_query, timeout_ms, retries, gfp_mask);
 	if (ret < 0)
 		goto err2;
 
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 1eaf00e..dafeb3d 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -470,7 +470,7 @@ static int path_rec_start(struct net_dev
 				   IB_SA_PATH_REC_SGID		|
 				   IB_SA_PATH_REC_NUMB_PATH	|
 				   IB_SA_PATH_REC_PKEY,
-				   1000, GFP_ATOMIC,
+				   1000, 0, GFP_ATOMIC,
 				   path_rec_completion,
 				   path, &path->query);
 	if (path->query_id < 0) {
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 44b9e5b..bcf151c 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -277,7 +277,7 @@ static int srp_lookup_path(struct srp_ta
 						   IB_SA_PATH_REC_SGID		|
 						   IB_SA_PATH_REC_NUMB_PATH	|
 						   IB_SA_PATH_REC_PKEY,
-						   SRP_PATH_REC_TIMEOUT_MS,
+						   SRP_PATH_REC_TIMEOUT_MS, 0,
 						   GFP_KERNEL,
 						   srp_path_rec_completion,
 						   target, &target->path_query);
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h
index 97715b0..e94656a 100644
--- a/include/rdma/ib_sa.h
+++ b/include/rdma/ib_sa.h
@@ -278,7 +278,7 @@ int ib_sa_path_rec_get(struct ib_sa_clie
 		       struct ib_device *device, u8 port_num,
 		       struct ib_sa_path_rec *rec,
 		       ib_sa_comp_mask comp_mask,
-		       int timeout_ms, gfp_t gfp_mask,
+		       int timeout_ms, int retries, gfp_t gfp_mask,
 		       void (*callback)(int status,
 					struct ib_sa_path_rec *resp,
 					void *context),
@@ -290,7 +290,7 @@ int ib_sa_mcmember_rec_query(struct ib_s
 			     u8 method,
 			     struct ib_sa_mcmember_rec *rec,
 			     ib_sa_comp_mask comp_mask,
-			     int timeout_ms, gfp_t gfp_mask,
+			     int timeout_ms, int retries, gfp_t gfp_mask,
 			     void (*callback)(int status,
 					      struct ib_sa_mcmember_rec *resp,
 					      void *context),
@@ -302,7 +302,7 @@ int ib_sa_service_rec_query(struct ib_sa
 			 u8 method,
 			 struct ib_sa_service_rec *rec,
 			 ib_sa_comp_mask comp_mask,
-			 int timeout_ms, gfp_t gfp_mask,
+			 int timeout_ms, int retries, gfp_t gfp_mask,
 			 void (*callback)(int status,
 					  struct ib_sa_service_rec *resp,
 					  void *context),
@@ -317,6 +317,7 @@ int ib_sa_service_rec_query(struct ib_sa
  * @rec:MCMember Record to send in query
  * @comp_mask:component mask to send in query
  * @timeout_ms:time to wait for response
+ * @retries:number of times to retry request
  * @gfp_mask:GFP mask to use for internal allocations
  * @callback:function called when query completes, times out or is
  * canceled
@@ -339,7 +340,7 @@ ib_sa_mcmember_rec_set(struct ib_sa_clie
 		       struct ib_device *device, u8 port_num,
 		       struct ib_sa_mcmember_rec *rec,
 		       ib_sa_comp_mask comp_mask,
-		       int timeout_ms, gfp_t gfp_mask,
+		       int timeout_ms, int retries, gfp_t gfp_mask,
 		       void (*callback)(int status,
 					struct ib_sa_mcmember_rec *resp,
 					void *context),
@@ -349,7 +350,7 @@ ib_sa_mcmember_rec_set(struct ib_sa_clie
 	return ib_sa_mcmember_rec_query(client, device, port_num,
 					IB_MGMT_METHOD_SET,
 					rec, comp_mask,
-					timeout_ms, gfp_mask, callback,
+					timeout_ms, retries, gfp_mask, callback,
 					context, query);
 }
 
@@ -361,6 +362,7 @@ ib_sa_mcmember_rec_set(struct ib_sa_clie
  * @rec:MCMember Record to send in query
  * @comp_mask:component mask to send in query
  * @timeout_ms:time to wait for response
+ * @retries:number of times to retry request
  * @gfp_mask:GFP mask to use for internal allocations
  * @callback:function called when query completes, times out or is
  * canceled
@@ -383,7 +385,7 @@ ib_sa_mcmember_rec_delete(struct ib_sa_c
 			  struct ib_device *device, u8 port_num,
 			  struct ib_sa_mcmember_rec *rec,
 			  ib_sa_comp_mask comp_mask,
-			  int timeout_ms, gfp_t gfp_mask,
+			  int timeout_ms, int retries, gfp_t gfp_mask,
 			  void (*callback)(int status,
 					   struct ib_sa_mcmember_rec *resp,
 					   void *context),
@@ -393,7 +395,7 @@ ib_sa_mcmember_rec_delete(struct ib_sa_c
 	return ib_sa_mcmember_rec_query(client, device, port_num,
 					IB_SA_METHOD_DELETE,
 					rec, comp_mask,
-					timeout_ms, gfp_mask, callback,
+					timeout_ms, retries, gfp_mask, callback,
 					context, query);
 }
 





More information about the general mailing list