From f22f76a6ffeb5ad4b523abddfbceea4c20e50ce8 Mon Sep 17 00:00:00 2001 From: Rolf vandeVaart Date: Wed, 19 Jan 2011 19:58:35 +0000 Subject: [PATCH] Add byte swapping macro for failover control message per jsquyres review. This commit was SVN r24266. --- ompi/mca/btl/openib/btl_openib_component.c | 2 +- ompi/mca/btl/openib/btl_openib_failover.c | 12 +++++++----- ompi/mca/btl/openib/btl_openib_failover.h | 3 ++- ompi/mca/btl/openib/btl_openib_frag.h | 16 ++++++++++++++++ 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/ompi/mca/btl/openib/btl_openib_component.c b/ompi/mca/btl/openib/btl_openib_component.c index 08215b49b0..d9b7d89acf 100644 --- a/ompi/mca/btl/openib/btl_openib_component.c +++ b/ompi/mca/btl/openib/btl_openib_component.c @@ -513,7 +513,7 @@ static void btl_openib_control(mca_btl_base_module_t* btl, #if OMPI_OPENIB_FAILOVER_ENABLED case MCA_BTL_OPENIB_CONTROL_EP_BROKEN: case MCA_BTL_OPENIB_CONTROL_EP_EAGER_RDMA_ERROR: - btl_openib_handle_failover_control_messages(ctl_hdr); + btl_openib_handle_failover_control_messages(ctl_hdr, ep); break; #endif default: diff --git a/ompi/mca/btl/openib/btl_openib_failover.c b/ompi/mca/btl/openib/btl_openib_failover.c index a103e7fd58..6dbee07d3d 100644 --- a/ompi/mca/btl/openib/btl_openib_failover.c +++ b/ompi/mca/btl/openib/btl_openib_failover.c @@ -280,13 +280,18 @@ void mca_btl_openib_handle_btl_error(mca_btl_openib_module_t* openib_btl) { * we are doing. * @param ctl_hdr Pointer control header that was received */ -void btl_openib_handle_failover_control_messages(mca_btl_openib_control_header_t *ctl_hdr) +void btl_openib_handle_failover_control_messages(mca_btl_openib_control_header_t *ctl_hdr, + mca_btl_openib_endpoint_t* ep) { mca_btl_openib_broken_connection_header_t *bc_hdr = (mca_btl_openib_broken_connection_header_t*)ctl_hdr; int i; int found = false; + if(ep->nbo) { + BTL_OPENIB_BROKEN_CONNECTION_HEADER_NTOH((*bc_hdr)); + } + opal_output_verbose(30, mca_btl_openib_component.verbose_failover, "IB: Control message received from %d: lid=%d,subnet=0x%" PRIx64 "", bc_hdr->vpid, bc_hdr->lid, bc_hdr->subnet_id); @@ -679,12 +684,9 @@ static void mca_btl_openib_endpoint_notify(mca_btl_base_endpoint_t* endpoint, ui bc_hdr->vpid = ORTE_PROC_MY_NAME->vpid; bc_hdr->index = index; -#if 0 - /* FIX ME: Need to add byte swapping macros */ if(newep->nbo) { - BTL_OPENIB_EAGER_RDMA_CONTROL_HEADER_HTON((*bc_hdr)); + BTL_OPENIB_BROKEN_CONNECTION_HEADER_HTON((*bc_hdr)); } -#endif rc = mca_btl_openib_endpoint_send(newep, frag); if (OMPI_SUCCESS == rc ||OMPI_ERR_RESOURCE_BUSY == rc) { return; diff --git a/ompi/mca/btl/openib/btl_openib_failover.h b/ompi/mca/btl/openib/btl_openib_failover.h index a8925fbc22..c151c32a0d 100644 --- a/ompi/mca/btl/openib/btl_openib_failover.h +++ b/ompi/mca/btl/openib/btl_openib_failover.h @@ -23,7 +23,8 @@ void mca_btl_openib_handle_endpoint_error(mca_btl_openib_module_t *openib_btl, ompi_proc_t* remote_proc, mca_btl_openib_endpoint_t* endpoint); void mca_btl_openib_handle_btl_error(mca_btl_openib_module_t* openib_btl); -void btl_openib_handle_failover_control_messages(mca_btl_openib_control_header_t *ctl_hdr); +void btl_openib_handle_failover_control_messages(mca_btl_openib_control_header_t *ctl_hdr, + mca_btl_openib_endpoint_t* ep); END_C_DECLS diff --git a/ompi/mca/btl/openib/btl_openib_frag.h b/ompi/mca/btl/openib/btl_openib_frag.h index 92330e2273..6dd6c8d469 100644 --- a/ompi/mca/btl/openib/btl_openib_frag.h +++ b/ompi/mca/btl/openib/btl_openib_frag.h @@ -178,6 +178,22 @@ struct mca_btl_openib_broken_connection_header_t { uint32_t index; /* for eager RDMA only */ }; typedef struct mca_btl_openib_broken_connection_header_t mca_btl_openib_broken_connection_header_t; + +#define BTL_OPENIB_BROKEN_CONNECTION_HEADER_HTON(h) \ + do { \ + (h).lid = htonl((h).lid); \ + (h).subnet_id = hton64((h).subnet_id); \ + (h).vpid = htonl((h).vpid); \ + (h).index = htonl((h).index); \ + } while (0) + +#define BTL_OPENIB_BROKEN_CONNECTION_HEADER_NTOH(h) \ + do { \ + (h).lid = ntohl((h).lid); \ + (h).subnet_id = ntoh64((h).subnet_id); \ + (h).vpid = ntohl((h).vpid); \ + (h).index = ntohl((h).index); \ + } while (0) #endif enum mca_btl_openib_frag_type_t { MCA_BTL_OPENIB_FRAG_RECV,