From e58b7580317cc9d77395db50ceebc8a617663aa4 Mon Sep 17 00:00:00 2001 From: Galen Shipman Date: Wed, 22 Feb 2006 17:37:59 +0000 Subject: [PATCH] standardize behavior of btl_alloc, if the size is larger than the max send size, btl_alloc returns NULL. This commit was SVN r9114. --- ompi/mca/btl/gm/btl_gm.c | 12 +++++------- ompi/mca/btl/mvapi/btl_mvapi.c | 12 +++++------- ompi/mca/btl/openib/btl_openib.c | 12 +++++------- ompi/mca/btl/self/btl_self.c | 9 +++++---- ompi/mca/btl/tcp/btl_tcp.c | 9 +++++---- 5 files changed, 25 insertions(+), 29 deletions(-) diff --git a/ompi/mca/btl/gm/btl_gm.c b/ompi/mca/btl/gm/btl_gm.c index 7801a91560..d3d9d7ecbc 100644 --- a/ompi/mca/btl/gm/btl_gm.c +++ b/ompi/mca/btl/gm/btl_gm.c @@ -163,14 +163,12 @@ mca_btl_base_descriptor_t* mca_btl_gm_alloc( if(size <= btl->btl_eager_limit) { MCA_BTL_GM_FRAG_ALLOC_EAGER(gm_btl, frag, rc); - frag->segment.seg_len = - size <= btl->btl_eager_limit ? - size : btl->btl_eager_limit ; - } else { + frag->segment.seg_len = size; + } else if(size <= btl->btl_max_send_size) { MCA_BTL_GM_FRAG_ALLOC_MAX(gm_btl, frag, rc); - frag->segment.seg_len = - size <= btl->btl_max_send_size ? - size : btl->btl_max_send_size ; + frag->segment.seg_len = size; + } else { + return NULL; } frag->base.des_src = &frag->segment; diff --git a/ompi/mca/btl/mvapi/btl_mvapi.c b/ompi/mca/btl/mvapi/btl_mvapi.c index 423d788d3b..eeddf3a741 100644 --- a/ompi/mca/btl/mvapi/btl_mvapi.c +++ b/ompi/mca/btl/mvapi/btl_mvapi.c @@ -196,15 +196,13 @@ mca_btl_base_descriptor_t* mca_btl_mvapi_alloc( if(size <= mca_btl_mvapi_component.eager_limit){ MCA_BTL_IB_FRAG_ALLOC_EAGER(btl, frag, rc); if(NULL == frag) return NULL; - frag->segment.seg_len = - size <= mca_btl_mvapi_component.eager_limit ? - size: mca_btl_mvapi_component.eager_limit ; - } else { + frag->segment.seg_len = size; + } else if (size <= mca_btl_mvapi_component.max_send_size) { MCA_BTL_IB_FRAG_ALLOC_MAX(btl, frag, rc); if(NULL == frag) return NULL; - frag->segment.seg_len = - size <= mca_btl_mvapi_component.max_send_size ? - size: mca_btl_mvapi_component.max_send_size ; + frag->segment.seg_len = size; + } else { + return NULL; } frag->segment.seg_len = size <= mvapi_btl->super.btl_eager_limit ? size : mvapi_btl->super.btl_eager_limit; diff --git a/ompi/mca/btl/openib/btl_openib.c b/ompi/mca/btl/openib/btl_openib.c index dd207dc4cb..b59c695a31 100644 --- a/ompi/mca/btl/openib/btl_openib.c +++ b/ompi/mca/btl/openib/btl_openib.c @@ -192,14 +192,12 @@ mca_btl_base_descriptor_t* mca_btl_openib_alloc( if(size <= mca_btl_openib_component.eager_limit){ MCA_BTL_IB_FRAG_ALLOC_EAGER(btl, frag, rc); - frag->segment.seg_len = - size <= mca_btl_openib_component.eager_limit ? - size: mca_btl_openib_component.eager_limit ; - } else { + frag->segment.seg_len = size; + } else if(size <= mca_btl_openib_component.max_send_size) { MCA_BTL_IB_FRAG_ALLOC_MAX(btl, frag, rc); - frag->segment.seg_len = - size <= mca_btl_openib_component.max_send_size ? - size: mca_btl_openib_component.max_send_size ; + frag->segment.seg_len = size; + } else { + return NULL; } frag->segment.seg_len = size <= openib_btl->super.btl_eager_limit ? size : openib_btl->super.btl_eager_limit; diff --git a/ompi/mca/btl/self/btl_self.c b/ompi/mca/btl/self/btl_self.c index b53cc8c41d..7df13a3e73 100644 --- a/ompi/mca/btl/self/btl_self.c +++ b/ompi/mca/btl/self/btl_self.c @@ -153,12 +153,13 @@ extern mca_btl_base_descriptor_t* mca_btl_self_alloc( if(size <= mca_btl_self.btl_eager_limit) { MCA_BTL_SELF_FRAG_ALLOC_EAGER(frag,rc); frag->segment.seg_len = size; - } else { + } else if (size <= btl->btl_max_send_size) { MCA_BTL_SELF_FRAG_ALLOC_SEND(frag,rc); - frag->segment.seg_len = - size <= btl->btl_max_send_size ? - size : btl->btl_max_send_size; + frag->segment.seg_len = size; + } else { + return NULL; } + frag->base.des_flags = 0; return (mca_btl_base_descriptor_t*)frag; } diff --git a/ompi/mca/btl/tcp/btl_tcp.c b/ompi/mca/btl/tcp/btl_tcp.c index 2c43455994..f6609061ca 100644 --- a/ompi/mca/btl/tcp/btl_tcp.c +++ b/ompi/mca/btl/tcp/btl_tcp.c @@ -176,12 +176,13 @@ mca_btl_base_descriptor_t* mca_btl_tcp_alloc( if(size <= btl->btl_eager_limit) { MCA_BTL_TCP_FRAG_ALLOC_EAGER(frag, rc); frag->segments[0].seg_len = size; - } else { + } else if (size <= btl->btl_max_send_size) { MCA_BTL_TCP_FRAG_ALLOC_MAX(frag, rc); - frag->segments[0].seg_len = - size <= btl->btl_max_send_size ? - size : btl->btl_max_send_size ; + frag->segments[0].seg_len = size; + } else { + return NULL; } + frag->segments[0].seg_addr.pval = frag+1; frag->base.des_src = frag->segments;