[openib-general] [RFC] [PATCH] SA query: expose retries through API
Sean Hefty
sean.hefty at intel.com
Thu Apr 6 10:59:43 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>
---
This will be used by the multicast code. I changed all of the APIs to
be consistent, but for the purposes of multicast, only ib_sa_mcmember_rec_set
and ib_sa_mcmember_rec_delete need to change.
Also, the MAD layer currently uses linear retries. This could be changed to
an exponential backoff algorithm instead. This would still allow for a default
retry algorithm that a consumer could use, but consumers that wanted to manage
their own timeout algorithm could do so by specifying a retry count of 0..
Index: include/rdma/ib_sa.h
===================================================================
--- include/rdma/ib_sa.h (revision 6230)
+++ include/rdma/ib_sa.h (working copy)
@@ -285,7 +285,7 @@ void ib_sa_cancel_query(int id, struct i
int ib_sa_path_rec_get(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),
@@ -296,7 +296,7 @@ int ib_sa_mcmember_rec_query(struct ib_d
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),
@@ -307,7 +307,7 @@ int ib_sa_service_rec_query(struct ib_de
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),
@@ -321,6 +321,7 @@ int ib_sa_service_rec_query(struct ib_de
* @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
@@ -342,7 +343,7 @@ static inline int
ib_sa_mcmember_rec_set(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),
@@ -352,7 +353,7 @@ ib_sa_mcmember_rec_set(struct ib_device
return ib_sa_mcmember_rec_query(device, port_num,
IB_MGMT_METHOD_SET,
rec, comp_mask,
- timeout_ms, gfp_mask, callback,
+ timeout_ms, retries, gfp_mask, callback,
context, query);
}
@@ -363,6 +364,7 @@ ib_sa_mcmember_rec_set(struct ib_device
* @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
@@ -384,7 +386,7 @@ static inline int
ib_sa_mcmember_rec_delete(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),
@@ -394,7 +396,7 @@ ib_sa_mcmember_rec_delete(struct ib_devi
return ib_sa_mcmember_rec_query(device, port_num,
IB_SA_METHOD_DELETE,
rec, comp_mask,
- timeout_ms, gfp_mask, callback,
+ timeout_ms, retries, gfp_mask, callback,
context, query);
}
Index: core/sa_query.c
===================================================================
--- core/sa_query.c (revision 6230)
+++ core/sa_query.c (working copy)
@@ -482,7 +482,7 @@ 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)
+static int send_mad(struct ib_sa_query *query, int timeout_ms, int retries)
{
unsigned long flags;
int ret, id;
@@ -499,6 +499,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;
@@ -555,6 +556,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
@@ -575,7 +577,7 @@ static void ib_sa_path_rec_release(struc
int ib_sa_path_rec_get(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),
@@ -624,7 +626,7 @@ int ib_sa_path_rec_get(struct ib_device
*sa_query = &query->sa_query;
- ret = send_mad(&query->sa_query, timeout_ms);
+ ret = send_mad(&query->sa_query, timeout_ms, retries);
if (ret < 0)
goto err2;
@@ -670,6 +672,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
@@ -691,7 +694,7 @@ static void ib_sa_service_rec_release(st
int ib_sa_service_rec_query(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),
@@ -746,7 +749,7 @@ int ib_sa_service_rec_query(struct ib_de
*sa_query = &query->sa_query;
- ret = send_mad(&query->sa_query, timeout_ms);
+ ret = send_mad(&query->sa_query, timeout_ms, retries);
if (ret < 0)
goto err2;
@@ -788,7 +791,7 @@ int ib_sa_mcmember_rec_query(struct ib_d
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),
@@ -838,7 +841,7 @@ int ib_sa_mcmember_rec_query(struct ib_d
*sa_query = &query->sa_query;
- ret = send_mad(&query->sa_query, timeout_ms);
+ ret = send_mad(&query->sa_query, timeout_ms, retries);
if (ret < 0)
goto err2;
Index: core/cma.c
===================================================================
--- core/cma.c (revision 6262)
+++ core/cma.c (working copy)
@@ -1064,7 +1064,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;
Index: core/at.c
===================================================================
--- core/at.c (revision 6230)
+++ core/at.c (working copy)
@@ -216,7 +216,7 @@ static void ib_dev_ats_op(struct ib_at_d
op,
rec,
mask,
- IB_AT_REQ_RETRY_MS,
+ IB_AT_REQ_RETRY_MS, 0,
GFP_KERNEL,
ats_op_complete,
ib_dev,
@@ -1118,7 +1118,7 @@ static int resolve_ats_ips(struct ats_ip
IB_MGMT_METHOD_GET,
rec,
IB_ATS_GET_PRIM_IP_MASK,
- req->pend.timeout_ms,
+ req->pend.timeout_ms, 0,
GFP_KERNEL,
ats_ips_req_complete,
req,
@@ -1163,7 +1163,7 @@ static int resolve_ats_route(struct rout
IB_MGMT_METHOD_GET,
rec,
IB_ATS_GET_GID_MASK,
- req->pend.timeout_ms,
+ req->pend.timeout_ms, 0,
GFP_KERNEL,
ats_route_req_complete,
req,
@@ -1226,7 +1226,7 @@ static int resolve_path(struct path_req
IB_SA_PATH_REC_SGID |
IB_SA_PATH_REC_PKEY |
IB_SA_PATH_REC_NUMB_PATH),
- req->pend.timeout_ms,
+ req->pend.timeout_ms, 0,
GFP_KERNEL,
path_req_complete,
req,
Index: ulp/srp/ib_srp.c
===================================================================
--- ulp/srp/ib_srp.c (revision 6230)
+++ ulp/srp/ib_srp.c (working copy)
@@ -257,7 +257,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);
Index: ulp/sdp/sdp_link.c
===================================================================
--- ulp/sdp/sdp_link.c (revision 6230)
+++ ulp/sdp/sdp_link.c (working copy)
@@ -323,7 +323,7 @@ static void sdp_link_path_rec_done(int s
IB_SA_PATH_REC_SGID |
IB_SA_PATH_REC_PKEY |
IB_SA_PATH_REC_NUMB_PATH),
- info->sa_time,
+ info->sa_time, 0,
GFP_KERNEL,
sdp_link_path_rec_done,
info,
@@ -359,7 +359,7 @@ static int sdp_link_path_rec_get(struct
IB_SA_PATH_REC_SGID |
IB_SA_PATH_REC_PKEY |
IB_SA_PATH_REC_NUMB_PATH),
- info->sa_time,
+ info->sa_time, 0,
GFP_KERNEL,
sdp_link_path_rec_done,
info,
Index: ulp/ipoib/ipoib_main.c
===================================================================
--- ulp/ipoib/ipoib_main.c (revision 6230)
+++ ulp/ipoib/ipoib_main.c (working copy)
@@ -468,7 +468,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) {
More information about the general
mailing list