2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2005-07-01 01:28:35 +04:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
*/
|
|
|
|
#ifndef MCA_PTL_IB_H
|
|
|
|
#define MCA_PTL_IB_H
|
|
|
|
|
|
|
|
/* Standard system includes */
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
/* Open MPI includes */
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/class/ompi_free_list.h"
|
|
|
|
#include "ompi/class/ompi_bitmap.h"
|
2005-07-04 03:09:55 +04:00
|
|
|
#include "opal/event/event.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/mca/pml/pml.h"
|
|
|
|
#include "ompi/mca/btl/btl.h"
|
2005-07-04 03:31:27 +04:00
|
|
|
#include "opal/util/output.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/mca/mpool/mpool.h"
|
|
|
|
#include "ompi/mca/btl/base/btl_base_error.h"
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/mca/btl/btl.h"
|
|
|
|
#include "ompi/mca/btl/base/base.h"
|
2005-10-01 02:58:09 +04:00
|
|
|
#include "btl_openib_endpoint.h"
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define MCA_BTL_IB_LEAVE_PINNED 1
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Infiniband (IB) BTL component.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct mca_btl_openib_component_t {
|
|
|
|
mca_btl_base_component_1_0_0_t super; /**< base BTL component */
|
|
|
|
|
|
|
|
uint32_t ib_num_btls;
|
|
|
|
/**< number of hcas available to the IB component */
|
|
|
|
|
2005-07-12 17:38:54 +04:00
|
|
|
struct mca_btl_openib_module_t *openib_btls;
|
2005-07-01 01:28:35 +04:00
|
|
|
/**< array of available PTLs */
|
|
|
|
|
|
|
|
int ib_free_list_num;
|
|
|
|
/**< initial size of free lists */
|
|
|
|
|
|
|
|
int ib_free_list_max;
|
|
|
|
/**< maximum size of free lists */
|
|
|
|
|
|
|
|
int ib_free_list_inc;
|
|
|
|
/**< number of elements to alloc when growing free lists */
|
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_t ib_procs;
|
2005-07-01 01:28:35 +04:00
|
|
|
/**< list of ib proc structures */
|
|
|
|
|
2005-07-04 03:09:55 +04:00
|
|
|
opal_event_t ib_send_event;
|
2005-07-01 01:28:35 +04:00
|
|
|
/**< event structure for sends */
|
|
|
|
|
2005-07-04 03:09:55 +04:00
|
|
|
opal_event_t ib_recv_event;
|
2005-07-01 01:28:35 +04:00
|
|
|
/**< event structure for recvs */
|
|
|
|
|
2005-07-04 02:45:48 +04:00
|
|
|
opal_mutex_t ib_lock;
|
2005-07-01 01:28:35 +04:00
|
|
|
/**< lock for accessing module state */
|
|
|
|
|
|
|
|
char* ib_mpool_name;
|
|
|
|
/**< name of ib memory pool */
|
|
|
|
|
2005-11-10 23:15:02 +03:00
|
|
|
int32_t rd_num; /**< the number of receive descriptors to post to each queue pair */
|
|
|
|
int32_t rd_low; /**< low water mark to reach before posting additional receive descriptors */
|
|
|
|
int32_t rd_win; /**< ack credits when window size exceeded */
|
|
|
|
int32_t rd_rsv; /**< descriptors held in reserve for control messages */
|
|
|
|
|
2005-11-11 02:29:54 +03:00
|
|
|
int32_t srq_rd_max; /* maximum number of receive descriptors posted */
|
2005-11-10 23:15:02 +03:00
|
|
|
int32_t srq_rd_per_peer; /* number of receive descriptors to post per log2(peers) in SRQ mode */
|
2005-11-11 02:29:54 +03:00
|
|
|
int32_t srq_sd_max; /* maximum number of send descriptors posted */
|
2005-11-10 23:15:02 +03:00
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
size_t eager_limit;
|
|
|
|
size_t max_send_size;
|
|
|
|
uint32_t reg_mru_len;
|
2005-10-02 22:58:57 +04:00
|
|
|
uint32_t use_srq;
|
|
|
|
|
2005-07-15 19:13:19 +04:00
|
|
|
uint32_t ib_cq_size; /**< Max outstanding CQE on the CQ */
|
|
|
|
uint32_t ib_sg_list_size; /**< Max scatter/gather descriptor entries on the WQ*/
|
|
|
|
uint32_t ib_pkey_ix;
|
|
|
|
uint32_t ib_psn;
|
|
|
|
uint32_t ib_qp_ous_rd_atom;
|
|
|
|
uint32_t ib_mtu;
|
|
|
|
uint32_t ib_min_rnr_timer;
|
|
|
|
uint32_t ib_timeout;
|
|
|
|
uint32_t ib_retry_count;
|
|
|
|
uint32_t ib_rnr_retry;
|
|
|
|
uint32_t ib_max_rdma_dst_ops;
|
|
|
|
uint32_t ib_service_level;
|
|
|
|
uint32_t ib_static_rate;
|
|
|
|
uint32_t ib_src_path_bits;
|
2005-10-02 22:58:57 +04:00
|
|
|
|
2005-07-15 19:13:19 +04:00
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
}; typedef struct mca_btl_openib_component_t mca_btl_openib_component_t;
|
|
|
|
|
|
|
|
extern mca_btl_openib_component_t mca_btl_openib_component;
|
|
|
|
|
|
|
|
typedef mca_btl_base_recv_reg_t mca_btl_openib_recv_reg_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* IB PTL Interface
|
|
|
|
*/
|
|
|
|
struct mca_btl_openib_module_t {
|
|
|
|
mca_btl_base_module_t super; /**< base PTL interface */
|
|
|
|
bool btl_inited;
|
|
|
|
mca_btl_openib_recv_reg_t ib_reg[256];
|
2005-10-01 02:58:09 +04:00
|
|
|
mca_btl_openib_port_info_t port_info; /* contains only the subnet right now */
|
2005-07-12 17:38:54 +04:00
|
|
|
uint8_t port_num; /**< ID of the PORT */
|
|
|
|
struct ibv_device *ib_dev; /* the ib device */
|
|
|
|
struct ibv_context *ib_dev_context;
|
|
|
|
struct ibv_pd *ib_pd;
|
2005-11-10 23:15:02 +03:00
|
|
|
struct ibv_cq *ib_cq_hp;
|
|
|
|
struct ibv_cq *ib_cq_lp;
|
2005-07-12 17:38:54 +04:00
|
|
|
struct ibv_port_attr* ib_port_attr;
|
2005-11-10 23:15:02 +03:00
|
|
|
struct ibv_recv_wr* rd_desc_post;
|
2005-07-12 17:38:54 +04:00
|
|
|
|
2005-11-10 23:15:02 +03:00
|
|
|
ompi_free_list_t send_free_eager; /**< free list of eager buffer descriptors */
|
|
|
|
ompi_free_list_t send_free_max; /**< free list of max buffer descriptors */
|
|
|
|
ompi_free_list_t send_free_frag; /**< free list of frags only... used for pining memory */
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2005-11-10 23:15:02 +03:00
|
|
|
ompi_free_list_t recv_free_eager; /**< High priority free list of buffer descriptors */
|
|
|
|
ompi_free_list_t recv_free_max; /**< Low priority free list of buffer descriptors */
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2005-11-10 23:15:02 +03:00
|
|
|
opal_list_t reg_mru_list; /**< a most recently used list of mca_mpool_openib_registration_t
|
2005-07-01 01:28:35 +04:00
|
|
|
entries, this allows us to keep a working set of memory pinned */
|
2005-07-04 02:45:48 +04:00
|
|
|
opal_mutex_t ib_lock; /**< module level lock */
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
|
|
|
|
/**< an array to allow posting of rr in one swoop */
|
|
|
|
size_t ib_inline_max; /**< max size of inline send*/
|
2005-07-20 01:04:22 +04:00
|
|
|
bool poll_cq;
|
2005-07-15 19:13:19 +04:00
|
|
|
|
|
|
|
|
2005-10-02 22:58:57 +04:00
|
|
|
#ifdef OMPI_MCA_BTL_OPENIB_HAVE_SRQ
|
2005-11-10 23:15:02 +03:00
|
|
|
struct ibv_srq *srq_hp;
|
|
|
|
struct ibv_srq *srq_lp;
|
|
|
|
int32_t srd_posted_hp;
|
|
|
|
int32_t srd_posted_lp;
|
2005-10-02 22:58:57 +04:00
|
|
|
#endif
|
2005-11-10 23:15:02 +03:00
|
|
|
int32_t num_peers;
|
|
|
|
int32_t rd_num;
|
|
|
|
int32_t rd_low;
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2005-11-10 23:15:02 +03:00
|
|
|
int32_t sd_tokens_hp;
|
2005-10-21 06:21:45 +04:00
|
|
|
/**< number of high priority frags that can be outstanding (down counter) */
|
2005-11-10 23:15:02 +03:00
|
|
|
int32_t sd_tokens_lp;
|
2005-10-21 06:21:45 +04:00
|
|
|
/**< number of low priority frags that can be outstanding (down counter) */
|
|
|
|
|
|
|
|
opal_list_t pending_frags_hp;
|
|
|
|
/**< list of pending high priority frags */
|
|
|
|
|
|
|
|
opal_list_t pending_frags_lp;
|
|
|
|
/**< list of pending low priority frags */
|
|
|
|
|
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
}; typedef struct mca_btl_openib_module_t mca_btl_openib_module_t;
|
|
|
|
|
|
|
|
|
2005-07-12 17:38:54 +04:00
|
|
|
struct mca_btl_openib_frag_t;
|
2005-07-01 01:28:35 +04:00
|
|
|
extern mca_btl_openib_module_t mca_btl_openib_module;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register IB component parameters with the MCA framework
|
|
|
|
*/
|
|
|
|
extern int mca_btl_openib_component_open(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Any final cleanup before being unloaded.
|
|
|
|
*/
|
|
|
|
extern int mca_btl_openib_component_close(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* IB component initialization.
|
|
|
|
*
|
|
|
|
* @param num_btl_modules (OUT) Number of BTLs returned in BTL array.
|
|
|
|
* @param allow_multi_user_threads (OUT) Flag indicating wether BTL supports user threads (TRUE)
|
|
|
|
* @param have_hidden_threads (OUT) Flag indicating wether BTL uses threads (TRUE)
|
|
|
|
*
|
|
|
|
* (1) read interface list from kernel and compare against component parameters
|
|
|
|
* then create a BTL instance for selected interfaces
|
|
|
|
* (2) setup IB listen socket for incoming connection attempts
|
|
|
|
* (3) publish BTL addressing info
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
extern mca_btl_base_module_t** mca_btl_openib_component_init(
|
|
|
|
int *num_btl_modules,
|
|
|
|
bool allow_multi_user_threads,
|
|
|
|
bool have_hidden_threads
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* IB component progress.
|
|
|
|
*/
|
|
|
|
extern int mca_btl_openib_component_progress(
|
2005-07-12 17:38:54 +04:00
|
|
|
void
|
|
|
|
);
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register a callback function that is called on receipt
|
|
|
|
* of a fragment.
|
|
|
|
*
|
|
|
|
* @param btl (IN) BTL module
|
|
|
|
* @return Status indicating if cleanup was successful
|
|
|
|
*
|
|
|
|
* When the process list changes, the PML notifies the BTL of the
|
|
|
|
* change, to provide the opportunity to cleanup or release any
|
|
|
|
* resources associated with the peer.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_btl_openib_register(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
mca_btl_base_tag_t tag,
|
|
|
|
mca_btl_base_module_recv_cb_fn_t cbfunc,
|
|
|
|
void* cbdata
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cleanup any resources held by the BTL.
|
|
|
|
*
|
|
|
|
* @param btl BTL instance.
|
|
|
|
* @return OMPI_SUCCESS or error status on failure.
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern int mca_btl_openib_finalize(
|
|
|
|
struct mca_btl_base_module_t* btl
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PML->BTL notification of change in the process list.
|
|
|
|
*
|
|
|
|
* @param btl (IN)
|
|
|
|
* @param nprocs (IN) Number of processes
|
|
|
|
* @param procs (IN) Set of processes
|
|
|
|
* @param peers (OUT) Set of (optional) peer addressing info.
|
|
|
|
* @param peers (IN/OUT) Set of processes that are reachable via this BTL.
|
|
|
|
* @return OMPI_SUCCESS or error status on failure.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern int mca_btl_openib_add_procs(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
size_t nprocs,
|
|
|
|
struct ompi_proc_t **procs,
|
|
|
|
struct mca_btl_base_endpoint_t** peers,
|
|
|
|
ompi_bitmap_t* reachable
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PML->BTL notification of change in the process list.
|
|
|
|
*
|
|
|
|
* @param btl (IN) BTL instance
|
|
|
|
* @param nproc (IN) Number of processes.
|
|
|
|
* @param procs (IN) Set of processes.
|
|
|
|
* @param peers (IN) Set of peer data structures.
|
|
|
|
* @return Status indicating if cleanup was successful
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
extern int mca_btl_openib_del_procs(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
size_t nprocs,
|
|
|
|
struct ompi_proc_t **procs,
|
|
|
|
struct mca_btl_base_endpoint_t** peers
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PML->BTL Initiate a send of the specified size.
|
|
|
|
*
|
|
|
|
* @param btl (IN) BTL instance
|
|
|
|
* @param btl_base_peer (IN) BTL peer addressing
|
|
|
|
* @param send_request (IN/OUT) Send request (allocated by PML via mca_btl_base_request_alloc_fn_t)
|
|
|
|
* @param size (IN) Number of bytes PML is requesting BTL to deliver
|
|
|
|
* @param flags (IN) Flags that should be passed to the peer via the message header.
|
|
|
|
* @param request (OUT) OMPI_SUCCESS if the BTL was able to queue one or more fragments
|
|
|
|
*/
|
|
|
|
extern int mca_btl_openib_send(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* btl_peer,
|
|
|
|
struct mca_btl_base_descriptor_t* descriptor,
|
|
|
|
mca_btl_base_tag_t tag
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PML->BTL Initiate a put of the specified size.
|
|
|
|
*
|
|
|
|
* @param btl (IN) BTL instance
|
|
|
|
* @param btl_base_peer (IN) BTL peer addressing
|
|
|
|
* @param send_request (IN/OUT) Send request (allocated by PML via mca_btl_base_request_alloc_fn_t)
|
|
|
|
* @param size (IN) Number of bytes PML is requesting BTL to deliver
|
|
|
|
* @param flags (IN) Flags that should be passed to the peer via the message header.
|
|
|
|
* @param request (OUT) OMPI_SUCCESS if the BTL was able to queue one or more fragments
|
|
|
|
*/
|
|
|
|
extern int mca_btl_openib_put(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* btl_peer,
|
|
|
|
struct mca_btl_base_descriptor_t* decriptor
|
2005-08-18 21:08:27 +04:00
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PML->BTL Initiate a get of the specified size.
|
|
|
|
*
|
|
|
|
* @param btl (IN) BTL instance
|
|
|
|
* @param btl_base_peer (IN) BTL peer addressing
|
|
|
|
* @param send_request (IN/OUT) Send request (allocated by PML via mca_btl_base_request_alloc_fn_t)
|
|
|
|
* @param size (IN) Number of bytes PML is requesting BTL to deliver
|
|
|
|
* @param flags (IN) Flags that should be passed to the peer via the message header.
|
|
|
|
* @param request (OUT) OMPI_SUCCESS if the BTL was able to queue one or more fragments
|
|
|
|
*/
|
|
|
|
extern int mca_btl_openib_get(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* btl_peer,
|
|
|
|
struct mca_btl_base_descriptor_t* decriptor
|
|
|
|
);
|
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Allocate a descriptor.
|
|
|
|
*
|
|
|
|
* @param btl (IN) BTL module
|
|
|
|
* @param size (IN) Requested descriptor size.
|
|
|
|
*/
|
|
|
|
extern mca_btl_base_descriptor_t* mca_btl_openib_alloc(
|
2005-07-12 17:38:54 +04:00
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
size_t size);
|
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a segment allocated by this BTL.
|
|
|
|
*
|
|
|
|
* @param btl (IN) BTL module
|
|
|
|
* @param descriptor (IN) Allocated descriptor.
|
|
|
|
*/
|
|
|
|
extern int mca_btl_openib_free(
|
2005-07-12 17:38:54 +04:00
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
mca_btl_base_descriptor_t* des);
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pack data and return a descriptor that can be
|
|
|
|
* used for send/put.
|
|
|
|
*
|
|
|
|
* @param btl (IN) BTL module
|
|
|
|
* @param peer (IN) BTL peer addressing
|
|
|
|
*/
|
|
|
|
mca_btl_base_descriptor_t* mca_btl_openib_prepare_src(
|
2005-07-12 17:38:54 +04:00
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* peer,
|
|
|
|
mca_mpool_base_registration_t* registration,
|
|
|
|
struct ompi_convertor_t* convertor,
|
|
|
|
size_t reserve,
|
|
|
|
size_t* size
|
|
|
|
);
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Allocate a descriptor initialized for RDMA write.
|
|
|
|
*
|
|
|
|
* @param btl (IN) BTL module
|
|
|
|
* @param peer (IN) BTL peer addressing
|
|
|
|
*/
|
|
|
|
extern mca_btl_base_descriptor_t* mca_btl_openib_prepare_dst(
|
2005-07-12 17:38:54 +04:00
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_base_endpoint_t* peer,
|
|
|
|
mca_mpool_base_registration_t* registration,
|
|
|
|
struct ompi_convertor_t* convertor,
|
|
|
|
size_t reserve,
|
|
|
|
size_t* size);
|
2005-07-01 01:28:35 +04:00
|
|
|
/**
|
|
|
|
* Return a send fragment to the modules free list.
|
|
|
|
*
|
|
|
|
* @param btl (IN) BTL instance
|
|
|
|
* @param frag (IN) IB send fragment
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
extern void mca_btl_openib_send_frag_return(
|
2005-07-12 17:38:54 +04:00
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
struct mca_btl_openib_frag_t*
|
|
|
|
);
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
|
2005-07-12 17:38:54 +04:00
|
|
|
int mca_btl_openib_module_init(mca_btl_openib_module_t* openib_btl);
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
|
2005-10-02 22:58:57 +04:00
|
|
|
#ifdef OMPI_MCA_BTL_OPENIB_HAVE_SRQ
|
|
|
|
|
|
|
|
#define MCA_BTL_OPENIB_POST_SRR_HIGH(openib_btl, additional) \
|
|
|
|
{ \
|
2005-10-03 20:35:12 +04:00
|
|
|
do{ \
|
2005-10-02 22:58:57 +04:00
|
|
|
OPAL_THREAD_LOCK(&openib_btl->ib_lock); \
|
2005-11-10 23:15:02 +03:00
|
|
|
if(openib_btl->srd_posted_hp <= openib_btl->rd_low+additional && \
|
|
|
|
openib_btl->srd_posted_hp < openib_btl->rd_num){ \
|
|
|
|
MCA_BTL_OPENIB_POST_SRR_SUB(openib_btl->rd_num - \
|
|
|
|
openib_btl->srd_posted_hp, \
|
2005-10-02 22:58:57 +04:00
|
|
|
openib_btl, \
|
|
|
|
&openib_btl->recv_free_eager, \
|
2005-11-10 23:15:02 +03:00
|
|
|
&openib_btl->srd_posted_hp, \
|
|
|
|
openib_btl->srq_hp); \
|
2005-10-02 22:58:57 +04:00
|
|
|
} \
|
|
|
|
OPAL_THREAD_UNLOCK(&openib_btl->ib_lock); \
|
2005-10-03 20:35:12 +04:00
|
|
|
} while(0); \
|
2005-10-02 22:58:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#define MCA_BTL_OPENIB_POST_SRR_LOW(openib_btl, additional) \
|
|
|
|
{ \
|
2005-10-03 20:35:12 +04:00
|
|
|
do { \
|
2005-10-02 22:58:57 +04:00
|
|
|
OPAL_THREAD_LOCK(&openib_btl->ib_lock); \
|
2005-11-10 23:15:02 +03:00
|
|
|
if(openib_btl->srd_posted_lp <= openib_btl->rd_low+additional && \
|
|
|
|
openib_btl->srd_posted_lp < openib_btl->rd_num){ \
|
|
|
|
MCA_BTL_OPENIB_POST_SRR_SUB(openib_btl->rd_num - \
|
|
|
|
openib_btl->srd_posted_lp, \
|
2005-10-02 22:58:57 +04:00
|
|
|
openib_btl, \
|
|
|
|
&openib_btl->recv_free_max, \
|
2005-11-10 23:15:02 +03:00
|
|
|
&openib_btl->srd_posted_lp, \
|
|
|
|
openib_btl->srq_lp); \
|
2005-10-02 22:58:57 +04:00
|
|
|
} \
|
|
|
|
OPAL_THREAD_UNLOCK(&openib_btl->ib_lock); \
|
2005-10-03 20:35:12 +04:00
|
|
|
} while(0); \
|
2005-10-02 22:58:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define MCA_BTL_OPENIB_POST_SRR_SUB(cnt, \
|
|
|
|
openib_btl, \
|
|
|
|
frag_list, \
|
2005-11-10 23:15:02 +03:00
|
|
|
srd_posted, \
|
2005-10-02 22:58:57 +04:00
|
|
|
srq) \
|
|
|
|
{\
|
|
|
|
do { \
|
2005-11-10 23:15:02 +03:00
|
|
|
int32_t i; \
|
|
|
|
int32_t num_post = cnt; \
|
2005-10-02 22:58:57 +04:00
|
|
|
opal_list_item_t* item = NULL; \
|
|
|
|
mca_btl_openib_frag_t* frag = NULL; \
|
|
|
|
struct ibv_recv_wr *bad_wr; \
|
|
|
|
int32_t rc; \
|
2005-11-10 23:15:02 +03:00
|
|
|
for(i = 0; i < num_post; i++) { \
|
2005-10-02 22:58:57 +04:00
|
|
|
OMPI_FREE_LIST_WAIT(frag_list, item, rc); \
|
|
|
|
frag = (mca_btl_openib_frag_t*) item; \
|
|
|
|
frag->sg_entry.length = frag->size + \
|
|
|
|
((unsigned char*) frag->segment.seg_addr.pval- \
|
|
|
|
(unsigned char*) frag->hdr); \
|
2005-11-10 23:15:02 +03:00
|
|
|
if(ibv_post_srq_recv(srq, &frag->wr_desc.rd_desc, &bad_wr)) { \
|
2005-10-02 22:58:57 +04:00
|
|
|
BTL_ERROR(("error posting receive descriptors to shared receive queue: %s",\
|
|
|
|
strerror(errno))); \
|
|
|
|
return OMPI_ERROR; \
|
|
|
|
}\
|
|
|
|
}\
|
2005-11-10 23:15:02 +03:00
|
|
|
OPAL_THREAD_ADD32(srd_posted, num_post); \
|
2005-10-02 22:58:57 +04:00
|
|
|
} while(0);\
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|