[ofw] [PATCH] DAPL v2.0: common: query calls return incorrect IA handle to consumer
Davis, Arlin R
arlin.r.davis at intel.com
Wed Oct 26 14:06:18 PDT 2011
The IA handle from the consumer perspective is an IA vector and
not the provider IA address handle. Need to convert IA handle
to IA vector for consumer calls.
Modify dats_ia_get_handle call to convert both ways depending
on handle type provided so a dapl provider can convert to vector
on query calls. This fix is backward compatible with older libdat2
libraries. Function is already exported and syntax is unchanged.
Signed-off-by: Arlin Davis <arlin.r.davis at intel.com>
---
dapl/common/dapl_ep_query.c | 1 +
dapl/common/dapl_lmr_query.c | 1 +
dapl/common/dapl_psp_query.c | 2 +-
dapl/common/dapl_pz_query.c | 2 +-
dapl/common/dapl_rmr_query.c | 1 +
dapl/common/dapl_rsp_query.c | 2 +-
dapl/common/dapl_srq_query.c | 1 +
dapl/include/dapl.h | 4 ++++
dapl/udapl/dapl_cno_query.c | 2 +-
dapl/udapl/dapl_evd_query.c | 2 +-
dat/common/dat_api.c | 37 ++++++++++++++++++++++++-------------
11 files changed, 37 insertions(+), 18 deletions(-)
diff --git a/dapl/common/dapl_ep_query.c b/dapl/common/dapl_ep_query.c
index f5f548f..5241b96 100644
--- a/dapl/common/dapl_ep_query.c
+++ b/dapl/common/dapl_ep_query.c
@@ -107,6 +107,7 @@ dapl_ep_query(IN DAT_EP_HANDLE ep_handle,
(DAT_IA_ADDRESS_PTR) & ep_ptr->remote_ia_address;
}
*ep_param = ep_ptr->param;
+ dats_get_ia_handle(ep_ptr->param.ia_handle, &ep_param->ia_handle);
}
bail:
diff --git a/dapl/common/dapl_lmr_query.c b/dapl/common/dapl_lmr_query.c
index 4ac37ec..d8688c8 100644
--- a/dapl/common/dapl_lmr_query.c
+++ b/dapl/common/dapl_lmr_query.c
@@ -80,6 +80,7 @@ dapl_lmr_query(IN DAT_LMR_HANDLE lmr_handle,
lmr = (DAPL_LMR *) lmr_handle;
dapl_os_memcpy(lmr_param, &lmr->param, sizeof(DAT_LMR_PARAM));
+ dats_get_ia_handle(lmr->param.ia_handle, &lmr_param->ia_handle);
bail:
return dat_status;
diff --git a/dapl/common/dapl_psp_query.c b/dapl/common/dapl_psp_query.c
index d990ebd..bb01c9f 100644
--- a/dapl/common/dapl_psp_query.c
+++ b/dapl/common/dapl_psp_query.c
@@ -83,7 +83,7 @@ dapl_psp_query(IN DAT_PSP_HANDLE psp_handle,
/*
* Fill in the PSP params
*/
- psp_param->ia_handle = sp_ptr->header.owner_ia;
+ dats_get_ia_handle(sp_ptr->header.owner_ia, &psp_param->ia_handle);
psp_param->conn_qual = sp_ptr->conn_qual;
psp_param->evd_handle = sp_ptr->evd_handle;
psp_param->psp_flags = sp_ptr->psp_flags;
diff --git a/dapl/common/dapl_pz_query.c b/dapl/common/dapl_pz_query.c
index 5829af4..b95ca7d 100644
--- a/dapl/common/dapl_pz_query.c
+++ b/dapl/common/dapl_pz_query.c
@@ -79,7 +79,7 @@ dapl_pz_query(IN DAT_PZ_HANDLE pz_handle,
/* Since the DAT_PZ_ARGS values are easily accessible, */
/* don't bother checking the DAT_PZ_ARGS_MASK value */
- pz_param->ia_handle = (DAT_IA_HANDLE) pz->header.owner_ia;
+ dats_get_ia_handle(pz->header.owner_ia, &pz_param->ia_handle);
bail:
return dat_status;
diff --git a/dapl/common/dapl_rmr_query.c b/dapl/common/dapl_rmr_query.c
index d18aa84..18d9984 100644
--- a/dapl/common/dapl_rmr_query.c
+++ b/dapl/common/dapl_rmr_query.c
@@ -87,6 +87,7 @@ dapl_rmr_query(IN DAT_RMR_HANDLE rmr_handle,
}
dapl_os_memcpy(rmr_param, &rmr->param, sizeof(DAT_RMR_PARAM));
+ dats_get_ia_handle(rmr->param.ia_handle, &rmr_param->ia_handle);
bail:
return dat_status;
diff --git a/dapl/common/dapl_rsp_query.c b/dapl/common/dapl_rsp_query.c
index dfc8145..79b30d8 100644
--- a/dapl/common/dapl_rsp_query.c
+++ b/dapl/common/dapl_rsp_query.c
@@ -81,7 +81,7 @@ dapl_rsp_query(IN DAT_RSP_HANDLE rsp_handle,
/*
* Fill in the RSP params
*/
- rsp_param->ia_handle = sp_ptr->header.owner_ia;
+ dats_get_ia_handle(sp_ptr->header.owner_ia, &rsp_param->ia_handle);
rsp_param->conn_qual = sp_ptr->conn_qual;
rsp_param->evd_handle = sp_ptr->evd_handle;
rsp_param->ep_handle = sp_ptr->ep_handle;
diff --git a/dapl/common/dapl_srq_query.c b/dapl/common/dapl_srq_query.c
index af395d4..f9ad443 100644
--- a/dapl/common/dapl_srq_query.c
+++ b/dapl/common/dapl_srq_query.c
@@ -91,6 +91,7 @@ dapl_srq_query(IN DAT_SRQ_HANDLE srq_handle,
srq_ptr->param.outstanding_dto_count = DAT_VALUE_UNKNOWN;
*srq_param = srq_ptr->param;
+ dats_get_ia_handle(srq_ptr->header.owner_ia, &srq_param->ia_handle);
bail:
return dat_status;
diff --git a/dapl/include/dapl.h b/dapl/include/dapl.h
index 68d0ea4..2fd5032 100755
--- a/dapl/include/dapl.h
+++ b/dapl/include/dapl.h
@@ -739,6 +739,10 @@ extern DAT_RETURN DAT_API dapl_get_handle_type (
IN DAT_HANDLE,
OUT DAT_HANDLE_TYPE * );
+extern DAT_RETURN DAT_API dats_get_ia_handle (
+ IN DAT_HANDLE, /* dat_handle */
+ OUT DAT_IA_HANDLE * ); /* ia handle */
+
/* CNO functions */
#if !defined(__KERNEL__)
diff --git a/dapl/udapl/dapl_cno_query.c b/dapl/udapl/dapl_cno_query.c
index 5112e33..8dcae01 100644
--- a/dapl/udapl/dapl_cno_query.c
+++ b/dapl/udapl/dapl_cno_query.c
@@ -83,9 +83,9 @@ DAT_RETURN DAT_API dapl_cno_query(IN DAT_CNO_HANDLE cno_handle, /* cno_handle */
}
cno_ptr = (DAPL_CNO *) cno_handle;
- cno_param->ia_handle = cno_ptr->header.owner_ia;
cno_param->proxy_type = DAT_PROXY_TYPE_AGENT;
cno_param->proxy.agent = cno_ptr->cno_wait_agent;
+ dats_get_ia_handle(cno_ptr->header.owner_ia, &cno_param->ia_handle);
bail:
return dat_status;
diff --git a/dapl/udapl/dapl_evd_query.c b/dapl/udapl/dapl_evd_query.c
index 09abcad..caa88cd 100644
--- a/dapl/udapl/dapl_evd_query.c
+++ b/dapl/udapl/dapl_evd_query.c
@@ -101,7 +101,7 @@ dapl_evd_query(IN DAT_EVD_HANDLE evd_handle,
(evd_ptr->
evd_waitable ? DAT_EVD_STATE_WAITABLE :
DAT_EVD_STATE_UNWAITABLE);
- evd_param->ia_handle = evd_ptr->header.owner_ia;
+ dats_get_ia_handle(evd_ptr->header.owner_ia, &evd_param->ia_handle);
evd_param->evd_qlen = evd_ptr->qlen;
evd_param->cno_handle = (DAT_CNO_HANDLE) evd_ptr->cno_ptr;
evd_param->evd_flags = evd_ptr->evd_flags;
diff --git a/dat/common/dat_api.c b/dat/common/dat_api.c
index 781c9a6..4e6eadd 100755
--- a/dat/common/dat_api.c
+++ b/dat/common/dat_api.c
@@ -170,26 +170,37 @@ DAT_IA_HANDLE dats_set_ia_handle(IN DAT_IA_HANDLE ia_handle)
/***********************************************************************
* Function: dats_get_ia_handle(
*
- * Get a handle from a handle vector and return it in an OUT parameter
+ * Get handle from vector OR vector from handle, return in OUT parameter
+ *
***********************************************************************/
DAT_RETURN
dats_get_ia_handle(IN DAT_IA_HANDLE handle, OUT DAT_IA_HANDLE * ia_handle_p)
{
- DAT_RETURN dat_status;
+ DAT_RETURN dat_status = DAT_SUCCESS;
+ /* handle to vector */
if (DAT_IA_HANDLE_TO_UL(handle) >= g_hv.handle_max) {
- dat_status =
- DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
- goto bail;
- }
- *ia_handle_p = g_hv.handle_array[DAT_IA_HANDLE_TO_UL(handle)];
+ unsigned long i;
+
+ dat_os_lock(&g_hv.handle_lock);
+ for (i = 1; i < g_hv.handle_max; i++) {
+ if (g_hv.handle_array[i] == handle) {
+ dat_os_unlock(&g_hv.handle_lock);
+ *ia_handle_p = DAT_UL_TO_IA_HANDLE(i);
+ goto bail;
+ }
+ }
+ dat_os_unlock(&g_hv.handle_lock);
+ dat_status = DAT_ERROR(DAT_INVALID_HANDLE,
+ DAT_INVALID_HANDLE_IA);
+ /* vector to handle */
+ } else {
+ *ia_handle_p = g_hv.handle_array[DAT_IA_HANDLE_TO_UL(handle)];
- if (*ia_handle_p == NULL) {
- dat_status =
- DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
- goto bail;
+ if (*ia_handle_p == NULL)
+ dat_status = DAT_ERROR(DAT_INVALID_HANDLE,
+ DAT_INVALID_HANDLE_IA);
}
- dat_status = DAT_SUCCESS;
bail:
dat_os_dbg_print(DAT_OS_DBG_TYPE_PROVIDER_API,
--
1.7.3
More information about the ofw
mailing list