#include "dapl_proto.h"
+#define DT_LOCAL_COMPLETION_VECTOR_SIZE 32
+
/* -----------------------------------------------------------
* Post a recv buffer on each of this thread's EPs.
*/
{
unsigned int i, j;
unsigned char *completion_reaped;
+ unsigned char lcomp[DT_LOCAL_COMPLETION_VECTOR_SIZE];
+ bool rc = false;
- completion_reaped = DT_Mdep_Malloc(num_eps * sizeof(unsigned char));
-
- if (!completion_reaped) {
- return false;
+ if (num_eps <= DT_LOCAL_COMPLETION_VECTOR_SIZE) {
+ completion_reaped = lcomp;
+ bzero((void *)completion_reaped,
+ sizeof(unsigned char) * num_eps);
+ }
+ else {
+ completion_reaped = DT_Mdep_Malloc(num_eps * sizeof(unsigned char));
+ if (!completion_reaped) {
+ return false;
+ }
}
for (i = 0; i < num_eps; i++) {
"Test Error: dat_ep_post_send failed: %s\n",
DT_RetToString(ret));
DT_Test_Error();
- DT_Mdep_Free(completion_reaped);
- return false;
+ goto xit;
}
}
if (op->reap_send_on_recv && !op->server_initiated) {
/* we will reap the send on the recv (Client SR) */
- DT_Mdep_Free(completion_reaped);
- return true;
+ rc = true;
+ goto xit;
}
}
- bzero((void *)completion_reaped, sizeof(unsigned char) * num_eps);
-
/* reap the send completion */
for (i = 0; i < num_eps; i++) {
Transaction_Test_Op_t *op;
if (!DT_dto_event_reap
(phead, ep_context[i].reqt_evd_hdl, poll, &dto_stat)) {
- DT_Mdep_Free(completion_reaped);
- return false;
+ goto xit;
}
epnum = dto_stat.user_cookie.as_64 >> 32;
dto_stat.user_cookie.as_64,
dto_stat.transfered_length);
DT_Test_Error();
- DT_Mdep_Free(completion_reaped);
- return false;
+ goto xit;
}
op = &ep_context[epnum].op[op_indx];
ep_context[epnum].ep_handle,
op->num_segs * op->seg_size,
dto_cookie, "Send")) {
- DT_Mdep_Free(completion_reaped);
- return false;
+ goto xit;
}
if (completion_reaped[epnum]) {
"Test Error: Send: Secondary completion seen for endpoint 0x%p (%d)\n",
ep_context[epnum].ep_handle, epnum);
DT_Test_Error();
- DT_Mdep_Free(completion_reaped);
- return (false);
+ goto xit;
}
completion_reaped[epnum] = 1;
}
"Test Error: Send: No completion seen for endpoint 0x%p (#%d)\n",
ep_context[i].ep_handle, i);
DT_Test_Error();
- DT_Mdep_Free(completion_reaped);
- return (false);
+ goto xit;
}
}
- DT_Mdep_Free(completion_reaped);
- return true;
+ rc = true;
+
+xit:
+ if (completion_reaped != lcomp)
+ DT_Mdep_Free(completion_reaped);
+ return rc;
}
/* -----------------------------------------------------------
unsigned int i;
unsigned char *recv_completion_reaped;
unsigned char *send_completion_reaped;
-
- recv_completion_reaped = DT_Mdep_Malloc(num_eps);
- if (recv_completion_reaped == NULL) {
- return false;
+ unsigned char rcomp[DT_LOCAL_COMPLETION_VECTOR_SIZE];
+ unsigned char lcomp[DT_LOCAL_COMPLETION_VECTOR_SIZE];
+ bool rc = false;
+
+ if (num_eps <= DT_LOCAL_COMPLETION_VECTOR_SIZE ) {
+ recv_completion_reaped = rcomp;
+ send_completion_reaped = lcomp;
+ bzero((void *)recv_completion_reaped,
+ sizeof(unsigned char) * num_eps);
+ bzero((void *)send_completion_reaped,
+ sizeof(unsigned char) * num_eps);
}
+ else {
+ recv_completion_reaped = DT_Mdep_Malloc(num_eps);
+ if (recv_completion_reaped == NULL) {
+ return false;
+ }
- send_completion_reaped = DT_Mdep_Malloc(num_eps);
- if (send_completion_reaped == NULL) {
- DT_Mdep_Free(recv_completion_reaped);
- return false;
+ send_completion_reaped = DT_Mdep_Malloc(num_eps);
+ if (send_completion_reaped == NULL) {
+ DT_Mdep_Free(recv_completion_reaped);
+ return false;
+ }
}
/* Foreach EP, reap */
- bzero((void *)recv_completion_reaped, sizeof(unsigned char) * num_eps);
- bzero((void *)send_completion_reaped, sizeof(unsigned char) * num_eps);
for (i = 0; i < num_eps; i++) {
Transaction_Test_Op_t *op;
DAT_DTO_COMPLETION_EVENT_DATA dto_stat;
/* First reap the recv DTO event */
if (!DT_dto_event_reap
(phead, ep_context[i].recv_evd_hdl, poll, &dto_stat)) {
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return false;
+ goto xit;
}
epnum = dto_stat.user_cookie.as_64 >> 32;
dto_stat.user_cookie.as_64,
dto_stat.transfered_length);
DT_Test_Error();
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return false;
+ goto xit;
}
op = &ep_context[epnum].op[op_indx];
DT_Tdep_PT_Printf(phead,
"Test Error: recv DTO problem\n");
DT_Test_Error();
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return false;
+ goto xit;
}
if (recv_completion_reaped[epnum]) {
"Test Error: Receive: Secondary completion seen for endpoint 0x%p (%d)\n",
ep_context[epnum].ep_handle, epnum);
DT_Test_Error();
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return (false);
+ goto xit;
}
recv_completion_reaped[epnum] = 1;
"Internal Error: reap_send_on_recv"
" but current op == #%d\n",
op_indx);
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return false;
+ goto xit;
}
if (!DT_dto_event_reap
(phead, ep_context[i].reqt_evd_hdl, poll,
&dto_stat)) {
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return false;
+ goto xit;
}
epnum = dto_stat.user_cookie.as_64 >> 32;
dto_stat.user_cookie.as_64,
dto_stat.transfered_length);
DT_Test_Error();
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return false;
+ goto xit;
}
/*
DT_Tdep_PT_Printf(phead,
"Test Error: send DTO problem\n");
DT_Test_Error();
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return false;
+ goto xit;
}
if (send_completion_reaped[epnum]) {
ep_context[epnum].ep_handle,
epnum);
DT_Test_Error();
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return (false);
+ goto xit;
}
send_completion_reaped[epnum] = 1;
}
"Test Error: Receive: No completion seen for endpoint 0x%p (#%d)\n",
ep_context[i].ep_handle, i);
DT_Test_Error();
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return (false);
+ goto xit;
}
}
"Test Error: Send (ror): No completion seen for endpoint 0x%p (#%d)\n",
ep_context[i].ep_handle, i);
DT_Test_Error();
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return (false);
+ goto xit;
}
}
}
DT_Tdep_PT_Printf(phead,
"Test Error: recv re-post problem\n");
DT_Test_Error();
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return false;
+ goto xit;
}
}
-
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return true;
+ rc = true;
+xit:
+ if (send_completion_reaped != lcomp) {
+ DT_Mdep_Free(recv_completion_reaped);
+ DT_Mdep_Free(send_completion_reaped);
+ }
+ return rc;
}
/* -----------------------------------------------------------
unsigned int i, j;
DAT_RETURN ret;
unsigned char *completion_reaped;
+ unsigned char lcomp[DT_LOCAL_COMPLETION_VECTOR_SIZE];
+ bool rc = false;
- completion_reaped = DT_Mdep_Malloc(num_eps * sizeof(unsigned char));
-
- if (!completion_reaped) {
- return false;
+ if (num_eps <= DT_LOCAL_COMPLETION_VECTOR_SIZE) {
+ completion_reaped = lcomp;
+ bzero((void *)completion_reaped, sizeof(unsigned char) * num_eps);
+ }
+ else {
+ completion_reaped = DT_Mdep_Malloc(num_eps * sizeof(unsigned char));
+ if (!completion_reaped) {
+ return false;
+ }
}
/* Initiate the operation */
RDMA_WRITE ? "write" : "read"),
DT_RetToString(ret));
DT_Test_Error();
- DT_Mdep_Free(completion_reaped);
- return (false);
+ goto err;
} else {
DT_Tdep_PT_Debug(3, (phead,
"Done dat_ep_post_rdma_%s %s\n",
}
}
- bzero((void *)completion_reaped, sizeof(unsigned char) * num_eps);
/* Wait for it to happen */
for (i = 0; i < num_eps; i++) {
Transaction_Test_Op_t *op;
if (!DT_dto_event_reap
(phead, ep_context[i].reqt_evd_hdl, poll, &dto_stat)) {
- DT_Mdep_Free(completion_reaped);
- return (false);
+ goto err;
}
epnum = dto_stat.user_cookie.as_64 >> 32;
dto_stat.user_cookie.as_64,
dto_stat.transfered_length);
DT_Test_Error();
- DT_Mdep_Free(completion_reaped);
- return false;
+ goto err;
}
op = &ep_context[epnum].op[op_indx];
dto_cookie,
(opcode ==
RDMA_WRITE ? "RDMA/WR" : "RDMA/RD"))) {
- DT_Mdep_Free(completion_reaped);
- return (false);
+ goto err;
}
if (completion_reaped[epnum]) {
RDMA_WRITE ? "RDMA/WR" : "RDMA/RD",
ep_context[epnum].ep_handle, epnum);
DT_Test_Error();
- DT_Mdep_Free(completion_reaped);
- return (false);
+ goto err;
}
completion_reaped[epnum] = 1;
RDMA_WRITE ? "RDMA/WR" : "RDMA/RD",
ep_context[i].ep_handle, i);
DT_Test_Error();
- DT_Mdep_Free(completion_reaped);
- return (false);
+ goto err;
}
}
- DT_Mdep_Free(completion_reaped);
+ rc = true;
+
+err:
+ if (completion_reaped != lcomp)
+ DT_Mdep_Free(completion_reaped);
- return (true);
+ return rc;
}
/* -----------------------------------------------------------
#include "dapl_proto.h"
+#define DT_LOCAL_COMPLETION_VECTOR_SIZE 32
+
/* -----------------------------------------------------------
* Post a recv buffer on each of this thread's EPs.
*/
{
unsigned int i, j;
unsigned char *completion_reaped;
+ unsigned char lcomp[DT_LOCAL_COMPLETION_VECTOR_SIZE];
+ bool rc = false;
- completion_reaped = DT_Mdep_Malloc(num_eps * sizeof(unsigned char));
-
- if (!completion_reaped) {
- return false;
+ if (num_eps <= DT_LOCAL_COMPLETION_VECTOR_SIZE) {
+ completion_reaped = lcomp;
+ bzero((void *)completion_reaped,
+ sizeof(unsigned char) * num_eps);
+ }
+ else {
+ completion_reaped = DT_Mdep_Malloc(num_eps * sizeof(unsigned char));
+ if (!completion_reaped) {
+ return false;
+ }
}
for (i = 0; i < num_eps; i++) {
"Test Error: dat_ep_post_send failed: %s\n",
DT_RetToString(ret));
DT_Test_Error();
- DT_Mdep_Free(completion_reaped);
- return false;
+ goto xit;
}
}
if (op->reap_send_on_recv && !op->server_initiated) {
/* we will reap the send on the recv (Client SR) */
- DT_Mdep_Free(completion_reaped);
- return true;
+ rc = true;
+ goto xit;
}
}
- bzero((void *)completion_reaped, sizeof(unsigned char) * num_eps);
-
/* reap the send completion */
for (i = 0; i < num_eps; i++) {
Transaction_Test_Op_t *op;
if (!DT_dto_event_reap
(phead, ep_context[i].reqt_evd_hdl, poll, &dto_stat)) {
- DT_Mdep_Free(completion_reaped);
- return false;
+ goto xit;
}
epnum = dto_stat.user_cookie.as_64 >> 32;
dto_stat.user_cookie.as_64,
dto_stat.transfered_length);
DT_Test_Error();
- DT_Mdep_Free(completion_reaped);
- return false;
+ goto xit;
}
op = &ep_context[epnum].op[op_indx];
ep_context[epnum].ep_handle,
op->num_segs * op->seg_size,
dto_cookie, "Send")) {
- DT_Mdep_Free(completion_reaped);
- return false;
+ goto xit;
}
if (completion_reaped[epnum]) {
"Test Error: Send: Secondary completion seen for endpoint 0x%p (%d)\n",
ep_context[epnum].ep_handle, epnum);
DT_Test_Error();
- DT_Mdep_Free(completion_reaped);
- return (false);
+ goto xit;
}
completion_reaped[epnum] = 1;
}
"Test Error: Send: No completion seen for endpoint 0x%p (#%d)\n",
ep_context[i].ep_handle, i);
DT_Test_Error();
- DT_Mdep_Free(completion_reaped);
- return (false);
+ goto xit;
}
}
- DT_Mdep_Free(completion_reaped);
- return true;
+ rc = true;
+
+xit:
+ if (completion_reaped != lcomp)
+ DT_Mdep_Free(completion_reaped);
+ return rc;
}
/* -----------------------------------------------------------
unsigned int i;
unsigned char *recv_completion_reaped;
unsigned char *send_completion_reaped;
-
- recv_completion_reaped = DT_Mdep_Malloc(num_eps);
- if (recv_completion_reaped == NULL) {
- return false;
+ unsigned char rcomp[DT_LOCAL_COMPLETION_VECTOR_SIZE];
+ unsigned char lcomp[DT_LOCAL_COMPLETION_VECTOR_SIZE];
+ bool rc = false;
+
+ if (num_eps <= DT_LOCAL_COMPLETION_VECTOR_SIZE ) {
+ recv_completion_reaped = rcomp;
+ send_completion_reaped = lcomp;
+ bzero((void *)recv_completion_reaped,
+ sizeof(unsigned char) * num_eps);
+ bzero((void *)send_completion_reaped,
+ sizeof(unsigned char) * num_eps);
}
+ else {
+ recv_completion_reaped = DT_Mdep_Malloc(num_eps);
+ if (recv_completion_reaped == NULL) {
+ return false;
+ }
- send_completion_reaped = DT_Mdep_Malloc(num_eps);
- if (send_completion_reaped == NULL) {
- DT_Mdep_Free(recv_completion_reaped);
- return false;
+ send_completion_reaped = DT_Mdep_Malloc(num_eps);
+ if (send_completion_reaped == NULL) {
+ DT_Mdep_Free(recv_completion_reaped);
+ return false;
+ }
}
/* Foreach EP, reap */
- bzero((void *)recv_completion_reaped, sizeof(unsigned char) * num_eps);
- bzero((void *)send_completion_reaped, sizeof(unsigned char) * num_eps);
for (i = 0; i < num_eps; i++) {
Transaction_Test_Op_t *op;
DAT_DTO_COMPLETION_EVENT_DATA dto_stat;
/* First reap the recv DTO event */
if (!DT_dto_event_reap
(phead, ep_context[i].recv_evd_hdl, poll, &dto_stat)) {
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return false;
+ goto xit;
}
epnum = dto_stat.user_cookie.as_64 >> 32;
dto_stat.user_cookie.as_64,
dto_stat.transfered_length);
DT_Test_Error();
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return false;
+ goto xit;
}
op = &ep_context[epnum].op[op_indx];
DT_Tdep_PT_Printf(phead,
"Test Error: recv DTO problem\n");
DT_Test_Error();
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return false;
+ goto xit;
}
if (recv_completion_reaped[epnum]) {
"Test Error: Receive: Secondary completion seen for endpoint 0x%p (%d)\n",
ep_context[epnum].ep_handle, epnum);
DT_Test_Error();
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return (false);
+ goto xit;
}
recv_completion_reaped[epnum] = 1;
"Internal Error: reap_send_on_recv"
" but current op == #%d\n",
op_indx);
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return false;
+ goto xit;
}
if (!DT_dto_event_reap
(phead, ep_context[i].reqt_evd_hdl, poll,
&dto_stat)) {
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return false;
+ goto xit;
}
epnum = dto_stat.user_cookie.as_64 >> 32;
dto_stat.user_cookie.as_64,
dto_stat.transfered_length);
DT_Test_Error();
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return false;
+ goto xit;
}
/*
DT_Tdep_PT_Printf(phead,
"Test Error: send DTO problem\n");
DT_Test_Error();
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return false;
+ goto xit;
}
if (send_completion_reaped[epnum]) {
ep_context[epnum].ep_handle,
epnum);
DT_Test_Error();
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return (false);
+ goto xit;
}
send_completion_reaped[epnum] = 1;
}
"Test Error: Receive: No completion seen for endpoint 0x%p (#%d)\n",
ep_context[i].ep_handle, i);
DT_Test_Error();
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return (false);
+ goto xit;
}
}
"Test Error: Send (ror): No completion seen for endpoint 0x%p (#%d)\n",
ep_context[i].ep_handle, i);
DT_Test_Error();
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return (false);
+ goto xit;
}
}
}
DT_Tdep_PT_Printf(phead,
"Test Error: recv re-post problem\n");
DT_Test_Error();
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return false;
+ goto xit;
}
}
-
- DT_Mdep_Free(recv_completion_reaped);
- DT_Mdep_Free(send_completion_reaped);
- return true;
+ rc = true;
+xit:
+ if (send_completion_reaped != lcomp) {
+ DT_Mdep_Free(recv_completion_reaped);
+ DT_Mdep_Free(send_completion_reaped);
+ }
+ return rc;
}
/* -----------------------------------------------------------
unsigned int i, j;
DAT_RETURN ret;
unsigned char *completion_reaped;
+ unsigned char lcomp[DT_LOCAL_COMPLETION_VECTOR_SIZE];
+ bool rc = false;
- completion_reaped = DT_Mdep_Malloc(num_eps * sizeof(unsigned char));
-
- if (!completion_reaped) {
- return false;
+ if (num_eps <= DT_LOCAL_COMPLETION_VECTOR_SIZE) {
+ completion_reaped = lcomp;
+ bzero((void *)completion_reaped, sizeof(unsigned char) * num_eps);
+ }
+ else {
+ completion_reaped = DT_Mdep_Malloc(num_eps * sizeof(unsigned char));
+ if (!completion_reaped) {
+ return false;
+ }
}
/* Initiate the operation */
RDMA_WRITE ? "write" : "read"),
DT_RetToString(ret));
DT_Test_Error();
- DT_Mdep_Free(completion_reaped);
- return (false);
+ goto err;
} else {
DT_Tdep_PT_Debug(3, (phead,
"Done dat_ep_post_rdma_%s %s\n",
}
}
- bzero((void *)completion_reaped, sizeof(unsigned char) * num_eps);
/* Wait for it to happen */
for (i = 0; i < num_eps; i++) {
Transaction_Test_Op_t *op;
if (!DT_dto_event_reap
(phead, ep_context[i].reqt_evd_hdl, poll, &dto_stat)) {
- DT_Mdep_Free(completion_reaped);
- return (false);
+ goto err;
}
epnum = dto_stat.user_cookie.as_64 >> 32;
dto_stat.user_cookie.as_64,
dto_stat.transfered_length);
DT_Test_Error();
- DT_Mdep_Free(completion_reaped);
- return false;
+ goto err;
}
op = &ep_context[epnum].op[op_indx];
dto_cookie,
(opcode ==
RDMA_WRITE ? "RDMA/WR" : "RDMA/RD"))) {
- DT_Mdep_Free(completion_reaped);
- return (false);
+ goto err;
}
if (completion_reaped[epnum]) {
RDMA_WRITE ? "RDMA/WR" : "RDMA/RD",
ep_context[epnum].ep_handle, epnum);
DT_Test_Error();
- DT_Mdep_Free(completion_reaped);
- return (false);
+ goto err;
}
completion_reaped[epnum] = 1;
RDMA_WRITE ? "RDMA/WR" : "RDMA/RD",
ep_context[i].ep_handle, i);
DT_Test_Error();
- DT_Mdep_Free(completion_reaped);
- return (false);
+ goto err;
}
}
- DT_Mdep_Free(completion_reaped);
+ rc = true;
+
+err:
+ if (completion_reaped != lcomp)
+ DT_Mdep_Free(completion_reaped);
- return (true);
+ return rc;
}
/* -----------------------------------------------------------