This source file includes following definitions.
- mca_spml_ikrit_get_mkey
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 
  19 #ifndef MCA_SPML_UD_MXM_H
  20 #define MCA_SPML_UD_MXM_H
  21 
  22 #include "oshmem_config.h"
  23 #include "oshmem/request/request.h"
  24 #include "oshmem/mca/spml/spml.h"
  25 #include "oshmem/util/oshmem_util.h"
  26 #include "oshmem/mca/spml/base/spml_base_putreq.h"
  27 #include "oshmem/proc/proc.h"
  28 #include "oshmem/mca/spml/base/spml_base_request.h"
  29 #include "oshmem/mca/spml/base/spml_base_getreq.h"
  30 
  31 #include "ompi/mca/bml/base/base.h"
  32 #include "opal/class/opal_free_list.h"
  33 #include "opal/class/opal_list.h"
  34 
  35 #include "oshmem/mca/memheap/base/base.h"
  36 
  37 #include <mxm/api/mxm_api.h>
  38 
  39 #ifndef MXM_VERSION
  40 #define MXM_VERSION(major, minor) (((major)<<MXM_MAJOR_BIT)|((minor)<<MXM_MINOR_BIT))
  41 #endif
  42 
  43 #define MXM_SHMEM_MQ_ID 0x7119
  44 
  45 
  46 #define SPML_IKRIT_PUT_LOW_WATER    16
  47 
  48 #define SPML_IKRIT_PACKETS_PER_SYNC  64
  49 
  50 #define spml_ikrit_container_of(ptr, type, member) ( \
  51                 (type *)( ((char *)(ptr)) - offsetof(type,member) ))
  52 
  53 #define MXM_MAX_ADDR_LEN 512
  54 
  55 #define MXM_PTL_RDMA 0
  56 #define MXM_PTL_SHM  1
  57 #define MXM_PTL_LAST 2
  58 
  59 BEGIN_C_DECLS
  60 
  61 
  62 
  63 
  64 
  65 struct spml_ikrit_mkey {
  66     mkey_segment_t  super;
  67     mxm_mem_key_t   key;
  68 };
  69 typedef struct spml_ikrit_mkey spml_ikrit_mkey_t;
  70 
  71 struct mxm_peer {
  72     mxm_conn_h          mxm_conn;
  73     mxm_conn_h          mxm_hw_rdma_conn;
  74     uint8_t             ptl_id;
  75     uint8_t             need_fence;
  76     int32_t             n_active_puts;
  77     opal_list_item_t    link;
  78     spml_ikrit_mkey_t   mkeys[MCA_MEMHEAP_SEG_COUNT];
  79 };
  80 
  81 typedef struct mxm_peer mxm_peer_t;
  82 
  83 typedef mxm_mem_key_t *(*mca_spml_ikrit_get_mkey_slow_fn_t)(int pe, void *va, int ptl_id, void **rva);
  84 
  85 struct mca_spml_ikrit_ctx {
  86     int temp;
  87 };
  88 
  89 typedef struct mca_spml_ikrit_ctx mca_spml_ikrit_ctx_t;
  90 
  91 extern mca_spml_ikrit_ctx_t mca_spml_ikrit_ctx_default;
  92 
  93 struct mca_spml_ikrit_t {
  94     mca_spml_base_module_t super;
  95 
  96     mca_spml_ikrit_get_mkey_slow_fn_t get_mkey_slow;
  97 
  98     mxm_context_opts_t *mxm_ctx_opts;
  99     mxm_ep_opts_t *mxm_ep_opts;
 100     mxm_ep_opts_t *mxm_ep_hw_rdma_opts;
 101     mxm_h mxm_context;
 102     mxm_ep_h mxm_ep;
 103     mxm_ep_h mxm_hw_rdma_ep;
 104     mxm_mq_h mxm_mq;
 105     mxm_peer_t *mxm_peers;
 106 
 107     int32_t n_active_puts;
 108     int32_t n_active_gets;
 109     int32_t n_mxm_fences;
 110 
 111     int priority; 
 112     int free_list_num; 
 113     int free_list_max; 
 114     int free_list_inc; 
 115     int bulk_connect; 
 116     int bulk_disconnect; 
 117 
 118     bool enabled;
 119     opal_list_t active_peers;
 120     int n_relays; 
 121 
 122     char *mxm_tls;
 123     int   ud_only;  
 124 
 125 
 126     int hw_rdma_channel;  
 127 
 128     int np;
 129     int unsync_conn_max;
 130     size_t put_zcopy_threshold; 
 131 
 132 };
 133 
 134 typedef struct mca_spml_ikrit_t mca_spml_ikrit_t;
 135 
 136 
 137 typedef struct spml_ikrit_mxm_ep_conn_info_t {
 138     union {
 139         struct sockaddr_storage  ptl_addr[MXM_PTL_LAST];
 140         char ep_addr[MXM_MAX_ADDR_LEN];
 141     } addr;
 142 } spml_ikrit_mxm_ep_conn_info_t;
 143 
 144 extern mca_spml_ikrit_t mca_spml_ikrit;
 145 
 146 extern int mca_spml_ikrit_enable(bool enable);
 147 extern int mca_spml_ikrit_ctx_create(long options,
 148                                      shmem_ctx_t *ctx);
 149 extern void mca_spml_ikrit_ctx_destroy(shmem_ctx_t ctx);
 150 extern int mca_spml_ikrit_get(shmem_ctx_t ctx,
 151                               void* dst_addr,
 152                               size_t size,
 153                               void* src_addr,
 154                               int src);
 155 extern int mca_spml_ikrit_get_nb(shmem_ctx_t ctx,
 156                                  void* src_addr,
 157                                  size_t size,
 158                                  void* dst_addr,
 159                                  int src,
 160                                  void **handle);
 161 
 162 extern int mca_spml_ikrit_put(shmem_ctx_t ctx,
 163                               void* dst_addr,
 164                               size_t size,
 165                               void* src_addr,
 166                               int dst);
 167 extern int mca_spml_ikrit_put_nb(shmem_ctx_t ctx,
 168                                  void* dst_addr,
 169                                  size_t size,
 170                                  void* src_addr,
 171                                  int dst,
 172                                  void **handle);
 173 
 174 extern int mca_spml_ikrit_recv(void* buf, size_t size, int src);
 175 extern int mca_spml_ikrit_send(void* buf,
 176                                size_t size,
 177                                int dst,
 178                                mca_spml_base_put_mode_t mode);
 179 
 180 extern sshmem_mkey_t *mca_spml_ikrit_register(void* addr,
 181                                                 size_t size,
 182                                                 uint64_t shmid,
 183                                                 int *count);
 184 extern int mca_spml_ikrit_deregister(sshmem_mkey_t *mkeys);
 185 extern int mca_spml_ikrit_oob_get_mkeys(int pe,
 186                                         uint32_t segno,
 187                                         sshmem_mkey_t *mkeys);
 188 
 189 extern int mca_spml_ikrit_add_procs(ompi_proc_t** procs, size_t nprocs);
 190 extern int mca_spml_ikrit_del_procs(ompi_proc_t** procs, size_t nprocs);
 191 extern int mca_spml_ikrit_fence(shmem_ctx_t ctx);
 192 extern int spml_ikrit_progress(void);
 193 
 194 
 195 
 196 
 197 
 198 
 199 static inline mxm_mem_key_t *mca_spml_ikrit_get_mkey(int pe, void *va, int ptl_id, void **rva,
 200                                                      mca_spml_ikrit_t *module)
 201 {
 202     spml_ikrit_mkey_t *mkey;
 203 
 204     if (OPAL_UNLIKELY(MXM_PTL_RDMA != ptl_id)) {
 205         assert(module->get_mkey_slow);
 206         return module->get_mkey_slow(pe, va, ptl_id, rva);
 207     }
 208 
 209     mkey = module->mxm_peers[pe].mkeys;
 210     mkey = (spml_ikrit_mkey_t *)map_segment_find_va(&mkey->super.super, sizeof(*mkey), va);
 211     if (OPAL_UNLIKELY(NULL == mkey)) {
 212         assert(module->get_mkey_slow);
 213         return module->get_mkey_slow(pe, va, ptl_id, rva);
 214     }
 215     *rva = map_segment_va2rva(&mkey->super, va);
 216     return &mkey->key;
 217 }
 218 
 219 END_C_DECLS
 220 
 221 #endif
 222