Commit f868be22 authored by David Goodell's avatar David Goodell
Browse files

[svn-r9716] tt#1599: eliminate MPIDI_CH3_PktGeneric_t

Without this change we are vulnerable to a nasty bit of compiler
behavior.  MPIDI_CH3_PktGeneric_t sometimes included padding between the
"kind" and "pktptrs" fields.  Then whole-structure assignments using the
generic packet (e.g., ch3_istartmsg.c:96) of buffers that are actually
MPIDI_CH3_Pkt_t unions under the hood will can fail to copy key parts of
the MPIDI_CH3_Pkt_t.

This specifically manifested itself for #1599 by transmitting garbage
"source_win_handle" values in a LOCK_GRANTED packet, which in turn
caused segfaults.

Removing this second type and directly using the actual packet union
eliminates this source of bugs.  The minor downside is that the
mpidpkt.h header becomes more tightly integrated into the rest of the
device.

Reviewed by buntinas@.
parent 755276b7
......@@ -87,7 +87,6 @@ struct MPID_Request;
struct MPID_nem_copy_buf;
union MPIDI_CH3_Pkt;
struct MPID_nem_lmt_shm_wait_element;
struct MPIDI_CH3_PktGeneric;
typedef struct MPIDI_CH3I_VC
{
......@@ -108,7 +107,7 @@ typedef struct MPIDI_CH3I_VC
/* temp buffer to store partially received header */
MPIDI_msg_sz_t pending_pkt_len;
struct MPIDI_CH3_PktGeneric *pending_pkt;
union MPIDI_CH3_Pkt *pending_pkt;
/* can be used by netmods to put this vc on a send queue or list */
struct MPIDI_VC *next;
......
......@@ -117,7 +117,7 @@ struct MPID_nem_mx_internal_req
{
MPIU_OBJECT_HEADER; /* adds (unused) handle and ref_count fields */
MPID_Request_kind_t kind; /* used */
MPIDI_CH3_PktGeneric_t pending_pkt;
MPIDI_CH3_Pkt_t pending_pkt;
MPIDI_VC_t *vc;
void *tmpbuf;
MPIDI_msg_sz_t tmpbuf_sz;
......
......@@ -205,7 +205,7 @@ if(type == NEM_MX_DIRECT_TYPE)
mx_get_endpoint_addr_context(source,(void **)(&vc));
rreq->vc = vc;
if(length <= sizeof(MPIDI_CH3_PktGeneric_t)) {
if(length <= sizeof(MPIDI_CH3_Pkt_t)) {
iov.segment_ptr = (char*)&(rreq->pending_pkt);
}
else{
......@@ -268,7 +268,7 @@ int MPID_nem_mx_directRecv(MPIDI_VC_t *vc, MPID_Request *rreq)
int dt_contig;
MPI_Aint dt_true_lb;
MPID_Datatype *dt_ptr;
/*int threshold = (vc->eager_max_msg_sz - sizeof(MPIDI_CH3_PktGeneric_t));*/
/*int threshold = (vc->eager_max_msg_sz - sizeof(MPIDI_CH3_Pkt_t));*/
NEM_MX_DIRECT_MATCH(match_info,0,source,context);
if (tag == MPI_ANY_TAG)
......@@ -338,7 +338,7 @@ MPID_nem_mx_poll(int in_blocking_poll)
MPIU_Assert(status.code != MX_STATUS_TRUNCATED);
if(adi_req->vc == NULL)
mx_get_endpoint_addr_context(status.source,(void **)(&(adi_req->vc)));
if (status.msg_length <= sizeof(MPIDI_CH3_PktGeneric_t))
if (status.msg_length <= sizeof(MPIDI_CH3_Pkt_t))
{
MPID_nem_handle_pkt(adi_req->vc,(char *)&(adi_req->pending_pkt),(MPIDI_msg_sz_t)(status.msg_length));
}
......@@ -442,7 +442,7 @@ MPID_nem_mx_poll(int in_blocking_progress)
MPIU_Assert(status.code != MX_STATUS_TRUNCATED);
if(adi_req->vc == NULL)
mx_get_endpoint_addr_context(status.source,(void **)(&(adi_req->vc)));
if (status.msg_length <= sizeof(MPIDI_CH3_PktGeneric_t))
if (status.msg_length <= sizeof(MPIDI_CH3_Pkt_t))
{
MPID_nem_handle_pkt(adi_req->vc,(char *)&(adi_req->pending_pkt),(MPIDI_msg_sz_t)(status.msg_length));
}
......
......@@ -42,9 +42,9 @@ int MPID_nem_mx_iSendContig(MPIDI_VC_t *vc, MPID_Request *sreq, void *hdr, MPIDI
#endif
NEM_MX_ADI_MATCH(match_info);
MPIU_Memcpy(&(sreq->dev.pending_pkt),(char *)hdr,sizeof(MPIDI_CH3_PktGeneric_t));
MPIU_Memcpy(&(sreq->dev.pending_pkt),(char *)hdr,sizeof(MPIDI_CH3_Pkt_t));
mx_iov[0].segment_ptr = (char *)&(sreq->dev.pending_pkt);
mx_iov[0].segment_length = sizeof(MPIDI_CH3_PktGeneric_t);
mx_iov[0].segment_length = sizeof(MPIDI_CH3_Pkt_t);
num_seg = 1;
if(data_sz)
{
......@@ -101,9 +101,9 @@ int MPID_nem_mx_iStartContigMsg(MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_t hdr_sz
NEM_MX_ADI_MATCH(match_info);
/*fprintf(stdout,"[%i]=== Startcontigmsg sending (%lx) to %i... \n",MPID_nem_mem_region.rank,match_info,vc->lpid); */
MPIU_Memcpy(&(sreq->dev.pending_pkt),(char *)hdr,sizeof(MPIDI_CH3_PktGeneric_t));
MPIU_Memcpy(&(sreq->dev.pending_pkt),(char *)hdr,sizeof(MPIDI_CH3_Pkt_t));
mx_iov[0].segment_ptr = (char *)&(sreq->dev.pending_pkt);
mx_iov[0].segment_length = sizeof(MPIDI_CH3_PktGeneric_t);
mx_iov[0].segment_length = sizeof(MPIDI_CH3_Pkt_t);
num_seg = 1;
if (data_sz)
{
......@@ -155,9 +155,9 @@ int MPID_nem_mx_SendNoncontig(MPIDI_VC_t *vc, MPID_Request *sreq, void *header,
#endif
NEM_MX_ADI_MATCH(match_info);
MPIU_Memcpy(&(sreq->dev.pending_pkt),(char *)header,sizeof(MPIDI_CH3_PktGeneric_t));
MPIU_Memcpy(&(sreq->dev.pending_pkt),(char *)header,sizeof(MPIDI_CH3_Pkt_t));
mx_iov[0].segment_ptr = (char *)&(sreq->dev.pending_pkt);
mx_iov[0].segment_length = sizeof(MPIDI_CH3_PktGeneric_t);
mx_iov[0].segment_length = sizeof(MPIDI_CH3_Pkt_t);
num_seg = 1;
MPIU_Assert(sreq->dev.segment_first == 0);
......
......@@ -33,9 +33,9 @@ int MPID_Nem_nd_istart_contig_msg(MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_t hdr_
sreqp->ch.vc = vc;
sreqp->dev.iov_offset = 0;
sreqp->dev.pending_pkt = *(MPIDI_CH3_PktGeneric_t *)hdr;
sreqp->dev.pending_pkt = *(MPIDI_CH3_Pkt_t *)hdr;
sreqp->dev.iov[0].MPID_IOV_BUF = (char *)&sreqp->dev.pending_pkt;
sreqp->dev.iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_PktGeneric_t);
sreqp->dev.iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_Pkt_t);
if(data_sz > 0){
sreqp->dev.iov[1].MPID_IOV_BUF = (MPID_IOV_BUF_CAST )data;
......@@ -118,9 +118,9 @@ int MPID_Nem_nd_send_contig(MPIDI_VC_t *vc, MPID_Request *sreqp, void *hdr, MPID
*/
sreqp->ch.vc = vc;
sreqp->dev.iov_offset = 0;
sreqp->dev.pending_pkt = *(MPIDI_CH3_PktGeneric_t *)hdr;
sreqp->dev.pending_pkt = *(MPIDI_CH3_Pkt_t *)hdr;
sreqp->dev.iov[0].MPID_IOV_BUF = (char *)&sreqp->dev.pending_pkt;
sreqp->dev.iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_PktGeneric_t);
sreqp->dev.iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_Pkt_t);
if(data_sz > 0){
sreqp->dev.iov[1].MPID_IOV_BUF = (MPID_IOV_BUF_CAST )data;
......@@ -210,9 +210,9 @@ int MPID_Nem_nd_send_noncontig(MPIDI_VC_t *vc, MPID_Request *sreqp, void *header
mpi_errno = MPIDI_CH3U_Request_load_send_iov(sreqp, &(iov[1]), &iov_cnt);
MPIU_ERR_CHKANDJUMP(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|loadsendiov");
sreqp->dev.pending_pkt = *(MPIDI_CH3_PktGeneric_t *)header;
sreqp->dev.pending_pkt = *(MPIDI_CH3_Pkt_t *)header;
iov[0].MPID_IOV_BUF = (char *)&sreqp->dev.pending_pkt;
iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_PktGeneric_t);
iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_Pkt_t);
iov_cnt += 1;
......@@ -279,4 +279,4 @@ int MPID_Nem_nd_send_noncontig(MPIDI_VC_t *vc, MPID_Request *sreqp, void *header
fn_fail:
MPIU_DBG_MSG_D(CH3_CHANNEL, VERBOSE, "failed, mpi_errno = %d", mpi_errno);
goto fn_exit;
}
\ No newline at end of file
}
......@@ -104,7 +104,7 @@ struct MPID_nem_newmad_internal_req
{
MPIU_OBJECT_HEADER; /* adds (unused) handle and ref_count fields */
MPID_Request_kind_t kind; /* used */
MPIDI_CH3_PktGeneric_t pending_pkt;
MPIDI_CH3_Pkt_t pending_pkt;
MPIDI_VC_t *vc;
void *tmpbuf;
MPIDI_msg_sz_t tmpbuf_sz;
......
......@@ -62,7 +62,7 @@ MPID_nem_newmad_get_adi_msg(nm_sr_event_t event, const nm_sr_event_info_t*info)
rreq->kind = MPID_REQUEST_RECV;
rreq->vc = nm_gate_ref_get(from);
if(length <= sizeof(MPIDI_CH3_PktGeneric_t))
if(length <= sizeof(MPIDI_CH3_Pkt_t))
{
data = (char*)&(rreq->pending_pkt);
}
......@@ -232,7 +232,7 @@ MPID_nem_newmad_poll(int in_blocking_poll)
MPID_nem_newmad_internal_req_t *adi_req = &(ref->nem_newmad_req);
if (kind == MPID_REQUEST_RECV)
{
if (size <= sizeof(MPIDI_CH3_PktGeneric_t))
if (size <= sizeof(MPIDI_CH3_Pkt_t))
{
MPID_nem_handle_pkt(adi_req->vc,(char *)&(adi_req->pending_pkt),(MPIDI_msg_sz_t)(size));
}
......
......@@ -26,7 +26,7 @@ int MPID_nem_newmad_iSendContig(MPIDI_VC_t *vc, MPID_Request *sreq, void *hdr, M
MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_NEWMAD_ISENDCONTIG);
MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_NEWMAD_ISENDCONTIG);
MPIU_Assert(hdr_sz <= sizeof(MPIDI_CH3_PktGeneric_t));
MPIU_Assert(hdr_sz <= sizeof(MPIDI_CH3_Pkt_t));
MPIU_DBG_MSG(CH3_CHANNEL, VERBOSE, "newmad_iSendContig");
MPIDI_DBG_Print_packet((MPIDI_CH3_Pkt_t *)hdr);
......@@ -36,9 +36,9 @@ int MPID_nem_newmad_iSendContig(MPIDI_VC_t *vc, MPID_Request *sreq, void *hdr, M
fprintf(stdout,"iSendContig ========> Sending ADI msg for req %p (match is %lx) \n",sreq,match_info);
#endif
MPIU_Memcpy(&(sreq->dev.pending_pkt),(char *)hdr,sizeof(MPIDI_CH3_PktGeneric_t));
MPIU_Memcpy(&(sreq->dev.pending_pkt),(char *)hdr,sizeof(MPIDI_CH3_Pkt_t));
newmad_iov[0].iov_base = (char *)&(sreq->dev.pending_pkt);
newmad_iov[0].iov_len = sizeof(MPIDI_CH3_PktGeneric_t);
newmad_iov[0].iov_len = sizeof(MPIDI_CH3_Pkt_t);
if(data_sz)
{
newmad_iov[1].iov_base = data;
......@@ -74,7 +74,7 @@ int MPID_nem_newmad_iStartContigMsg(MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_t hd
MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_NEWMAD_ISTARTCONTIGMSG);
MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_NEWMAD_ISTARTCONTIGMSG);
MPIU_Assert(hdr_sz <= sizeof(MPIDI_CH3_PktGeneric_t));
MPIU_Assert(hdr_sz <= sizeof(MPIDI_CH3_Pkt_t));
MPIU_DBG_MSG(CH3_CHANNEL, VERBOSE, "newmad_iSendContig");
MPIDI_DBG_Print_packet((MPIDI_CH3_Pkt_t *)hdr);
......@@ -90,9 +90,9 @@ int MPID_nem_newmad_iStartContigMsg(MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_t hd
fprintf(stdout,"StartcontigMsg ========> Sending ADI msg for req %p (match is %lx) \n",sreq,match_info);
#endif
MPIU_Memcpy(&(sreq->dev.pending_pkt),(char *)hdr,sizeof(MPIDI_CH3_PktGeneric_t));
MPIU_Memcpy(&(sreq->dev.pending_pkt),(char *)hdr,sizeof(MPIDI_CH3_Pkt_t));
newmad_iov[0].iov_base = (char *)&(sreq->dev.pending_pkt);
newmad_iov[0].iov_len = sizeof(MPIDI_CH3_PktGeneric_t);
newmad_iov[0].iov_len = sizeof(MPIDI_CH3_Pkt_t);
if (data_sz)
{
newmad_iov[1].iov_base = (char *)data;
......@@ -138,14 +138,14 @@ int MPID_nem_newmad_SendNoncontig(MPIDI_VC_t *vc, MPID_Request *sreq, void *head
MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_NEWMAD_SENDNONCONTIGMSG);
MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_NEWMAD_SENDNONCONTIGMSG);
MPIU_Assert(hdr_sz <= sizeof(MPIDI_CH3_PktGeneric_t));
MPIU_Assert(hdr_sz <= sizeof(MPIDI_CH3_Pkt_t));
MPIU_DBG_MSG(CH3_CHANNEL, VERBOSE, "MPID_nem_newmad_iSendNoncontig");
NEM_NMAD_ADI_MATCH(match_info);
MPIU_Memcpy(&(sreq->dev.pending_pkt),(char *)header,sizeof(MPIDI_CH3_PktGeneric_t));
MPIU_Memcpy(&(sreq->dev.pending_pkt),(char *)header,sizeof(MPIDI_CH3_Pkt_t));
newmad_iov[0].iov_base = (char *)&(sreq->dev.pending_pkt);
newmad_iov[0].iov_len = sizeof(MPIDI_CH3_PktGeneric_t);
newmad_iov[0].iov_len = sizeof(MPIDI_CH3_Pkt_t);
MPIU_Assert(sreq->dev.segment_first == 0);
last = sreq->dev.segment_size;
......
......@@ -253,7 +253,7 @@ int MPID_nem_tcp_iStartContigMsg(MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_t hdr_s
MPID_IOV iov[2];
iov[0].MPID_IOV_BUF = hdr;
iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_PktGeneric_t);
iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_Pkt_t);
iov[1].MPID_IOV_BUF = data;
iov[1].MPID_IOV_LEN = data_sz;
......@@ -282,7 +282,7 @@ int MPID_nem_tcp_iStartContigMsg(MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_t hdr_s
}
MPIU_DBG_MSG_D(CH3_CHANNEL, VERBOSE, "write " MPIDI_MSG_SZ_FMT, offset);
if (offset == sizeof(MPIDI_CH3_PktGeneric_t) + data_sz)
if (offset == sizeof(MPIDI_CH3_Pkt_t) + data_sz)
{
/* sent whole message */
*sreq_ptr = NULL;
......@@ -312,11 +312,11 @@ int MPID_nem_tcp_iStartContigMsg(MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_t hdr_s
sreq->ch.vc = vc;
sreq->dev.iov_offset = 0;
if (offset < sizeof(MPIDI_CH3_PktGeneric_t))
if (offset < sizeof(MPIDI_CH3_Pkt_t))
{
sreq->dev.pending_pkt = *(MPIDI_CH3_PktGeneric_t *)hdr;
sreq->dev.pending_pkt = *(MPIDI_CH3_Pkt_t *)hdr;
sreq->dev.iov[0].MPID_IOV_BUF = (char *)&sreq->dev.pending_pkt + offset;
sreq->dev.iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_PktGeneric_t) - offset ;
sreq->dev.iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_Pkt_t) - offset ;
if (data_sz)
{
sreq->dev.iov[1].MPID_IOV_BUF = data;
......@@ -328,8 +328,8 @@ int MPID_nem_tcp_iStartContigMsg(MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_t hdr_s
}
else
{
sreq->dev.iov[0].MPID_IOV_BUF = (char *)data + (offset - sizeof(MPIDI_CH3_PktGeneric_t));
sreq->dev.iov[0].MPID_IOV_LEN = data_sz - (offset - sizeof(MPIDI_CH3_PktGeneric_t));
sreq->dev.iov[0].MPID_IOV_BUF = (char *)data + (offset - sizeof(MPIDI_CH3_Pkt_t));
sreq->dev.iov[0].MPID_IOV_LEN = data_sz - (offset - sizeof(MPIDI_CH3_Pkt_t));
sreq->dev.iov_count = 1;
}
......@@ -392,7 +392,7 @@ int MPID_nem_tcp_iStartContigMsg_paused(MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_
MPID_IOV iov[2];
iov[0].MPID_IOV_BUF = hdr;
iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_PktGeneric_t);
iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_Pkt_t);
iov[1].MPID_IOV_BUF = data;
iov[1].MPID_IOV_LEN = data_sz;
......@@ -422,7 +422,7 @@ int MPID_nem_tcp_iStartContigMsg_paused(MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_
}
MPIU_DBG_MSG_D(CH3_CHANNEL, VERBOSE, "write " MPIDI_MSG_SZ_FMT, offset);
if (offset == sizeof(MPIDI_CH3_PktGeneric_t) + data_sz)
if (offset == sizeof(MPIDI_CH3_Pkt_t) + data_sz)
{
/* sent whole message */
*sreq_ptr = NULL;
......@@ -451,11 +451,11 @@ int MPID_nem_tcp_iStartContigMsg_paused(MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_
sreq->ch.vc = vc;
sreq->dev.iov_offset = 0;
if (offset < sizeof(MPIDI_CH3_PktGeneric_t))
if (offset < sizeof(MPIDI_CH3_Pkt_t))
{
sreq->dev.pending_pkt = *(MPIDI_CH3_PktGeneric_t *)hdr;
sreq->dev.pending_pkt = *(MPIDI_CH3_Pkt_t *)hdr;
sreq->dev.iov[0].MPID_IOV_BUF = (char *)&sreq->dev.pending_pkt + offset;
sreq->dev.iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_PktGeneric_t) - offset ;
sreq->dev.iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_Pkt_t) - offset ;
if (data_sz)
{
sreq->dev.iov[1].MPID_IOV_BUF = data;
......@@ -467,8 +467,8 @@ int MPID_nem_tcp_iStartContigMsg_paused(MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_
}
else
{
sreq->dev.iov[0].MPID_IOV_BUF = (char *)data + (offset - sizeof(MPIDI_CH3_PktGeneric_t));
sreq->dev.iov[0].MPID_IOV_LEN = data_sz - (offset - sizeof(MPIDI_CH3_PktGeneric_t));
sreq->dev.iov[0].MPID_IOV_BUF = (char *)data + (offset - sizeof(MPIDI_CH3_Pkt_t));
sreq->dev.iov[0].MPID_IOV_LEN = data_sz - (offset - sizeof(MPIDI_CH3_Pkt_t));
sreq->dev.iov_count = 1;
}
......@@ -527,7 +527,7 @@ int MPID_nem_tcp_iSendContig(MPIDI_VC_t *vc, MPID_Request *sreq, void *hdr, MPID
MPID_IOV iov[2];
iov[0].MPID_IOV_BUF = hdr;
iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_PktGeneric_t);
iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_Pkt_t);
iov[1].MPID_IOV_BUF = data;
iov[1].MPID_IOV_LEN = data_sz;
......@@ -556,7 +556,7 @@ int MPID_nem_tcp_iSendContig(MPIDI_VC_t *vc, MPID_Request *sreq, void *hdr, MPID
}
MPIU_DBG_MSG_D(CH3_CHANNEL, VERBOSE, "write " MPIDI_MSG_SZ_FMT, offset);
if (offset == sizeof(MPIDI_CH3_PktGeneric_t) + data_sz)
if (offset == sizeof(MPIDI_CH3_Pkt_t) + data_sz)
{
/* sent whole message */
int (*reqFn)(MPIDI_VC_t *, MPID_Request *, int *);
......@@ -599,11 +599,11 @@ int MPID_nem_tcp_iSendContig(MPIDI_VC_t *vc, MPID_Request *sreq, void *hdr, MPID
/* save iov */
if (offset < sizeof(MPIDI_CH3_PktGeneric_t))
if (offset < sizeof(MPIDI_CH3_Pkt_t))
{
sreq->dev.pending_pkt = *(MPIDI_CH3_PktGeneric_t *)hdr;
sreq->dev.pending_pkt = *(MPIDI_CH3_Pkt_t *)hdr;
sreq->dev.iov[0].MPID_IOV_BUF = (char *)&sreq->dev.pending_pkt + offset;
sreq->dev.iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_PktGeneric_t) - offset;
sreq->dev.iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_Pkt_t) - offset;
if (data_sz)
{
sreq->dev.iov[1].MPID_IOV_BUF = data;
......@@ -615,8 +615,8 @@ int MPID_nem_tcp_iSendContig(MPIDI_VC_t *vc, MPID_Request *sreq, void *hdr, MPID
}
else
{
sreq->dev.iov[0].MPID_IOV_BUF = (char *)data + (offset - sizeof(MPIDI_CH3_PktGeneric_t));
sreq->dev.iov[0].MPID_IOV_LEN = data_sz - (offset - sizeof(MPIDI_CH3_PktGeneric_t));
sreq->dev.iov[0].MPID_IOV_BUF = (char *)data + (offset - sizeof(MPIDI_CH3_Pkt_t));
sreq->dev.iov[0].MPID_IOV_LEN = data_sz - (offset - sizeof(MPIDI_CH3_Pkt_t));
sreq->dev.iov_count = 1;
}
......@@ -672,10 +672,10 @@ int MPID_nem_tcp_SendNoncontig(MPIDI_VC_t *vc, MPID_Request *sreq, void *header,
MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_TCP_SENDNONCONTIG);
MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_TCP_SENDNONCONTIG);
MPIU_DBG_MSG(CH3_CHANNEL, VERBOSE, "tcp_SendNoncontig");
MPIU_Assert(hdr_sz <= sizeof(MPIDI_CH3_PktGeneric_t));
MPIU_Assert(hdr_sz <= sizeof(MPIDI_CH3_Pkt_t));
iov[0].MPID_IOV_BUF = header;
iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_PktGeneric_t);
iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_Pkt_t);
iov_n = MPID_IOV_LIMIT - 1;
......@@ -729,9 +729,9 @@ int MPID_nem_tcp_SendNoncontig(MPIDI_VC_t *vc, MPID_Request *sreq, void *header,
if (offset < iov[0].MPID_IOV_LEN)
{
/* header was not yet sent, save it in req */
sreq->dev.pending_pkt = *(MPIDI_CH3_PktGeneric_t *)header;
sreq->dev.pending_pkt = *(MPIDI_CH3_Pkt_t *)header;
iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST)&sreq->dev.pending_pkt;
iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_PktGeneric_t);
iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_Pkt_t);
}
/* check if whole iov was sent, and save any unsent portion of iov */
......
......@@ -274,7 +274,7 @@ int MPID_nem_newtcp_iStartContigMsg(MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_t hd
MPID_IOV iov[2];
iov[0].MPID_IOV_BUF = hdr;
iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_PktGeneric_t);
iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_Pkt_t);
iov[1].MPID_IOV_BUF = data;
iov[1].MPID_IOV_LEN = data_sz;
......@@ -288,7 +288,7 @@ int MPID_nem_newtcp_iStartContigMsg(MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_t hd
MPIU_DBG_MSG_D(CH3_CHANNEL, VERBOSE, "write %d", offset);
if (offset == sizeof(MPIDI_CH3_PktGeneric_t) + data_sz)
if (offset == sizeof(MPIDI_CH3_Pkt_t) + data_sz)
{
/* sent whole message */
*sreq_ptr = NULL;
......@@ -317,14 +317,14 @@ int MPID_nem_newtcp_iStartContigMsg(MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_t hd
sreq->ch.vc = vc;
sreq->dev.iov_offset = 0;
/* printf("&sreq->dev.pending_pkt = %p sizeof(MPIDI_CH3_PktGeneric_t) = %d\n", &sreq->dev.pending_pkt, sizeof(MPIDI_CH3_PktGeneric_t));//DARIUS */
/* printf("&sreq->dev.pending_pkt = %p sizeof(MPIDI_CH3_Pkt_t) = %d\n", &sreq->dev.pending_pkt, sizeof(MPIDI_CH3_Pkt_t));//DARIUS */
/* printf("offset = %d\n", offset);//DARIUS */
if (offset < sizeof(MPIDI_CH3_PktGeneric_t))
if (offset < sizeof(MPIDI_CH3_Pkt_t))
{
sreq->dev.pending_pkt = *(MPIDI_CH3_PktGeneric_t *)hdr;
sreq->dev.pending_pkt = *(MPIDI_CH3_Pkt_t *)hdr;
sreq->dev.iov[0].MPID_IOV_BUF = (char *)&sreq->dev.pending_pkt + offset;
sreq->dev.iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_PktGeneric_t) - offset ;
sreq->dev.iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_Pkt_t) - offset ;
if (data_sz)
{
sreq->dev.iov[1].MPID_IOV_BUF = data;
......@@ -336,8 +336,8 @@ int MPID_nem_newtcp_iStartContigMsg(MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_t hd
}
else
{
sreq->dev.iov[0].MPID_IOV_BUF = (char *)data + (offset - sizeof(MPIDI_CH3_PktGeneric_t));
sreq->dev.iov[0].MPID_IOV_LEN = data_sz - (offset - sizeof(MPIDI_CH3_PktGeneric_t));
sreq->dev.iov[0].MPID_IOV_BUF = (char *)data + (offset - sizeof(MPIDI_CH3_Pkt_t));
sreq->dev.iov[0].MPID_IOV_LEN = data_sz - (offset - sizeof(MPIDI_CH3_Pkt_t));
sreq->dev.iov_count = 1;
}
......@@ -392,7 +392,7 @@ int MPID_nem_newtcp_iSendContig(MPIDI_VC_t *vc, MPID_Request *sreq, void *hdr, M
int iov_cnt;
iov[0].MPID_IOV_BUF = hdr;
iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_PktGeneric_t);
iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_Pkt_t);
if(data_sz > 0){
iov[1].MPID_IOV_BUF = data;
iov[1].MPID_IOV_LEN = data_sz;
......@@ -402,7 +402,7 @@ int MPID_nem_newtcp_iSendContig(MPIDI_VC_t *vc, MPID_Request *sreq, void *hdr, M
iov_cnt = 1;
}
MPIU_DBG_MSG_FMT(CH3_CHANNEL, VERBOSE, (MPIU_DBG_FDEST, "writing hdr (sz = %d) and data (sz = %d)", sizeof(MPIDI_CH3_PktGeneric_t), data_sz));
MPIU_DBG_MSG_FMT(CH3_CHANNEL, VERBOSE, (MPIU_DBG_FDEST, "writing hdr (sz = %d) and data (sz = %d)", sizeof(MPIDI_CH3_Pkt_t), data_sz));
MPIU_OSW_RETRYON_INTR((offset < 0),
(mpi_errno = MPIU_SOCKW_Writev(VC_FIELD(vc, sc)->fd, iov, iov_cnt, &offset)));
......@@ -414,7 +414,7 @@ int MPID_nem_newtcp_iSendContig(MPIDI_VC_t *vc, MPID_Request *sreq, void *hdr, M
MPIU_DBG_MSG_D(CH3_CHANNEL, VERBOSE, "write %d", offset);
if (offset == sizeof(MPIDI_CH3_PktGeneric_t) + data_sz)
if (offset == sizeof(MPIDI_CH3_Pkt_t) + data_sz)
{
/* sent whole message */
int (*reqFn)(MPIDI_VC_t *, MPID_Request *, int *);
......@@ -454,11 +454,11 @@ int MPID_nem_newtcp_iSendContig(MPIDI_VC_t *vc, MPID_Request *sreq, void *hdr, M
}
/* save iov */
if (offset < sizeof(MPIDI_CH3_PktGeneric_t))
if (offset < sizeof(MPIDI_CH3_Pkt_t))
{
sreq->dev.pending_pkt = *(MPIDI_CH3_PktGeneric_t *)hdr;
sreq->dev.pending_pkt = *(MPIDI_CH3_Pkt_t *)hdr;
sreq->dev.iov[0].MPID_IOV_BUF = (char *)&sreq->dev.pending_pkt + offset;
sreq->dev.iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_PktGeneric_t) - offset;
sreq->dev.iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_Pkt_t) - offset;
if (data_sz)
{
sreq->dev.iov[1].MPID_IOV_BUF = data;
......@@ -470,8 +470,8 @@ int MPID_nem_newtcp_iSendContig(MPIDI_VC_t *vc, MPID_Request *sreq, void *hdr, M
}
else
{
sreq->dev.iov[0].MPID_IOV_BUF = (char *)data + (offset - sizeof(MPIDI_CH3_PktGeneric_t));
sreq->dev.iov[0].MPID_IOV_LEN = data_sz - (offset - sizeof(MPIDI_CH3_PktGeneric_t));
sreq->dev.iov[0].MPID_IOV_BUF = (char *)data + (offset - sizeof(MPIDI_CH3_Pkt_t));
sreq->dev.iov[0].MPID_IOV_LEN = data_sz - (offset - sizeof(MPIDI_CH3_Pkt_t));
sreq->dev.iov_count = 1;
}
......@@ -514,10 +514,10 @@ int MPID_nem_newtcp_SendNoncontig(MPIDI_VC_t *vc, MPID_Request *sreq, void *head
int complete;
MPIU_DBG_MSG(CH3_CHANNEL, VERBOSE, "newtcp_SendNoncontig");
MPIU_Assert(hdr_sz <= sizeof(MPIDI_CH3_PktGeneric_t));
MPIU_Assert(hdr_sz <= sizeof(MPIDI_CH3_Pkt_t));
iov[0].MPID_IOV_BUF = header;
iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_PktGeneric_t);
iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_Pkt_t);
iov_n = MPID_IOV_LIMIT - 1;
/* On the initial load of a send iov req, set the OnFinal action (null
......@@ -552,9 +552,9 @@ int MPID_nem_newtcp_SendNoncontig(MPIDI_VC_t *vc, MPID_Request *sreq, void *head
if (offset < iov[0].MPID_IOV_LEN)
{
/* header was not yet sent, save it in req */
sreq->dev.pending_pkt = *(MPIDI_CH3_PktGeneric_t *)header;
sreq->dev.pending_pkt = *(MPIDI_CH3_Pkt_t *)header;
iov[0].MPID_IOV_BUF = &sreq->dev.pending_pkt;
iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_PktGeneric_t);
iov[0].MPID_IOV_LEN = sizeof(MPIDI_CH3_Pkt_t);
}
/* check if whole iov was sent, and save any unsent portion of iov */
......
......@@ -68,7 +68,7 @@ MPID_nem_init(int pg_rank, MPIDI_PG_t *pg_p, int has_parent ATTRIBUTE((unused)))
packet. This is needed because we no longer include channel
packet types in the CH3 packet types to allow dynamic channel
loading. */
MPIU_Assert(sizeof(MPIDI_CH3_nem_pkt_t) <= sizeof(MPIDI_CH3_PktGeneric_t));
MPIU_Assert(sizeof(MPIDI_CH3_nem_pkt_t) <= sizeof(MPIDI_CH3_Pkt_t));
/* The MPID_nem_cell_rel_ptr_t defined in mpid_nem_datatypes.h
should only contain a OPA_ptr_t. This is to check that
......@@ -363,7 +363,7 @@ MPID_nem_vc_init (MPIDI_VC_t *vc)
vc_ch->ckpt_restart_vc = NULL;
#endif
vc_ch->pending_pkt_len = 0;
MPIU_CHKPMEM_MALLOC (vc_ch->pending_pkt, MPIDI_CH3_PktGeneric_t *, sizeof (MPIDI_CH3_PktGeneric_t), mpi_errno, "pending_pkt");
MPIU_CHKPMEM_MALLOC (vc_ch->pending_pkt, MPIDI_CH3_Pkt_t *, sizeof (MPIDI_CH3_Pkt_t), mpi_errno, "pending_pkt");
/* We do different things for vcs in the COMM_WORLD pg vs other pgs
COMM_WORLD vcs may use shared memory, and already have queues allocated
......
......@@ -95,7 +95,7 @@ int MPIDI_CH3_iSend (MPIDI_VC_t *vc, MPID_Request *sreq, void * hdr, MPIDI_msg_s
enqueue_it:
MPIDI_DBG_PRINTF((55, FCNAME, "enqueuing"));
sreq->dev.pending_pkt = *(MPIDI_CH3_PktGeneric_t *) hdr;
sreq->dev.pending_pkt = *(MPIDI_CH3_Pkt_t *) hdr;
sreq->dev.iov[0].MPID_IOV_BUF = (char *) &sreq->dev.pending_pkt;
sreq->dev.iov[0].MPID_IOV_LEN = hdr_sz;
sreq->dev.iov_count = 1;
......
......@@ -85,7 +85,7 @@ int MPIDI_CH3_iSendv (MPIDI_VC_t *vc, MPID_Request *sreq, MPID_IOV *iov, int n_i
{
/* header was not sent */
sreq->dev.pending_pkt =
*(MPIDI_CH3_PktGeneric_t *) iov[0].MPID_IOV_BUF;
*(MPIDI_CH3_Pkt_t *) iov[0].MPID_IOV_BUF;
sreq->dev.iov[0].MPID_IOV_BUF = (char *) &sreq->dev.pending_pkt;
sreq->dev.iov[0].MPID_IOV_LEN = iov[0].MPID_IOV_LEN;
}
......@@ -151,7 +151,7 @@ int MPIDI_CH3_iSendv (MPIDI_VC_t *vc, MPID_Request *sreq, MPID_IOV *iov, int n_i
MPIDI_DBG_PRINTF((55, FCNAME, "enqueuing"));
sreq->dev.pending_pkt = *(MPIDI_CH3_PktGeneric_t *) iov[0].MPID_IOV_BUF;
sreq->dev.pending_pkt = *(MPIDI_CH3_Pkt_t *) iov[0].MPID_IOV_BUF;
sreq->dev.iov[0].MPID_IOV_BUF = (char *) &sreq->dev.pending_pkt;
sreq->dev.iov[0].MPID_IOV_LEN = iov[0].MPID_IOV_LEN;
......
......@@ -93,7 +93,7 @@ int MPIDI_CH3_iStartMsg (MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_t hdr_sz, MPID_
MPIU_Object_set_ref (sreq, 2);
sreq->kind = MPID_REQUEST_SEND;
sreq->dev.pending_pkt = *(MPIDI_CH3_PktGeneric_t *) hdr;
sreq->dev.pending_pkt = *(MPIDI_CH3_Pkt_t *) hdr;
sreq->dev.iov[0].MPID_IOV_BUF = (char *) &sreq->dev.pending_pkt;
sreq->dev.iov[0].MPID_IOV_LEN = hdr_sz;
sreq->dev.iov_count = 1;
......
......@@ -132,7 +132,7 @@ int MPIDI_CH3_iStartMsgv (MPIDI_VC_t *vc, MPID_IOV *iov, int n_iov, MPID_Request
if ( iov == remaining_iov )
{
/* header was not sent, so iov[0] might point to something on the stack */
sreq->dev.pending_pkt = *(MPIDI_CH3_PktGeneric_t *) iov[0].MPID_IOV_BUF;
sreq->dev.pending_pkt = *(MPIDI_CH3_Pkt_t *) iov[0].MPID_IOV_BUF;
sreq->dev.iov[0].MPID_IOV_BUF = (char *) &sreq->dev.pending_pkt;
sreq->dev.iov[0].MPID_IOV_LEN = iov[0].MPID_IOV_LEN;
}
......@@ -152,7 +152,7 @@ int MPIDI_CH3_iStartMsgv (MPIDI_VC_t *vc, MPID_IOV *iov, int n_iov, MPID_Request
MPIU_Object_set_ref(sreq, 2);
sreq->kind = MPID_REQUEST_SEND;