[openib-general] [RFC] [PATCH] SA query: expose retries through API
Sean Hefty
sean.hefty at intel.com
Fri Apr 7 12:08:21 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 version applies on top of the module reference fix.
Index: include/rdma/ib_sa.h
===================================================================
--- include/rdma/ib_sa.h (revision 6322)
+++ include/rdma/ib_sa.h (working copy)
@@ -257,7 +257,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),
@@ -269,7 +269,7 @@ int __ib_sa_mcmember_rec_query(struct ib
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),
@@ -281,7 +281,7 @@ int __ib_sa_service_rec_query(struct ib_
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),
@@ -296,6 +296,7 @@ int __ib_sa_service_rec_query(struct ib_
* @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 a request
* @gfp_mask:GFP mask to use for internal allocations
* @callback:function called when query completes, times out or is
* canceled
@@ -317,7 +318,7 @@ static inline 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),
@@ -325,7 +326,7 @@ ib_sa_path_rec_get(struct ib_device *dev
struct ib_sa_query **sa_query)
{
return __ib_sa_path_rec_get(device, port_num, rec, comp_mask,
- timeout_ms, gfp_mask, callback,
+ timeout_ms, retries, gfp_mask, callback,
context, THIS_MODULE, sa_query);
}
@@ -336,6 +337,7 @@ ib_sa_path_rec_get(struct ib_device *dev
* @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 a request
* @gfp_mask:GFP mask to use for internal allocations
* @callback:function called when query completes, times out or is
* canceled
@@ -357,7 +359,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),
@@ -367,7 +369,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, THIS_MODULE, query);
}
@@ -378,6 +380,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 a request
* @gfp_mask:GFP mask to use for internal allocations
* @callback:function called when query completes, times out or is
* canceled
@@ -399,7 +402,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),
@@ -409,7 +412,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, THIS_MODULE, query);
}
@@ -421,6 +424,7 @@ ib_sa_mcmember_rec_delete(struct ib_devi
* @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 a request
* @gfp_mask:GFP mask to use for internal allocations
* @callback:function called when request completes, times out or is
* canceled
@@ -443,7 +447,7 @@ static inline 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),
@@ -451,7 +455,7 @@ ib_sa_service_rec_query(struct ib_device
struct ib_sa_query **sa_query)
{
return __ib_sa_service_rec_query(device, port_num, method, rec,
- comp_mask, timeout_ms, gfp_mask,
+ comp_mask, timeout_ms, retries, gfp_mask,
callback, context, THIS_MODULE,
sa_query);
}
Index: core/sa_query.c
===================================================================
--- core/sa_query.c (revision 6322)
+++ core/sa_query.c (working copy)
@@ -483,7 +483,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;
@@ -500,6 +500,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;
@@ -556,6 +557,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 a request
* @gfp_mask:GFP mask to use for internal allocations
* @callback:function called when query completes, times out or is
* canceled
@@ -576,7 +578,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),
@@ -627,7 +629,7 @@ int __ib_sa_path_rec_get(struct ib_devic
*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;
@@ -673,6 +675,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 a request
* @gfp_mask:GFP mask to use for internal allocations
* @callback:function called when request completes, times out or is
* canceled
@@ -694,7 +697,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),
@@ -751,7 +754,7 @@ int __ib_sa_service_rec_query(struct ib_
*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;
@@ -793,7 +796,7 @@ int __ib_sa_mcmember_rec_query(struct ib
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),
@@ -845,7 +848,7 @@ int __ib_sa_mcmember_rec_query(struct ib
*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: ulp/srp/ib_srp.c
===================================================================
--- ulp/srp/ib_srp.c (revision 6322)
+++ 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/ipoib/ipoib_main.c
===================================================================
--- ulp/ipoib/ipoib_main.c (revision 6322)
+++ ulp/ipoib/ipoib_main.c (working copy)
@@ -471,7 +471,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) {
Index: ulp/sdp/sdp_link.c
===================================================================
--- ulp/sdp/sdp_link.c (revision 6322)
+++ 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: core/cma.c
===================================================================
--- core/cma.c (revision 6322)
+++ 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 6322)
+++ 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,
More information about the general
mailing list