This source file includes following definitions.
- ompi_osc_rdma_request_deref
- ompi_osc_rdma_request_complete
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 #ifndef OMPI_OSC_RDMA_REQUEST_H
  14 #define OMPI_OSC_RDMA_REQUEST_H
  15 
  16 #include "osc_rdma.h"
  17 
  18 enum ompi_osc_rdma_request_type_t {
  19     OMPI_OSC_RDMA_TYPE_GET,
  20     OMPI_OSC_RDMA_TYPE_PUT,
  21     OMPI_OSC_RDMA_TYPE_RDMA,
  22     OMPI_OSC_RDMA_TYPE_ACC,
  23     OMPI_OSC_RDMA_TYPE_GET_ACC,
  24     OMPI_OSC_RDMA_TYPE_CSWAP,
  25 };
  26 typedef enum ompi_osc_rdma_request_type_t ompi_osc_rdma_request_type_t;
  27 
  28 struct ompi_osc_rdma_request_t;
  29 
  30 typedef void (*ompi_osc_rdma_request_cleanup_fn_t) (struct ompi_osc_rdma_request_t *);
  31 
  32 struct ompi_osc_rdma_request_t {
  33     ompi_request_t super;
  34 
  35     ompi_osc_rdma_peer_t *peer;
  36     ompi_osc_rdma_request_cleanup_fn_t cleanup;
  37 
  38     ompi_osc_rdma_request_type_t type;
  39     void *to_free;
  40     void *origin_addr;
  41 
  42     ompi_osc_rdma_module_t *module;
  43     opal_atomic_int32_t outstanding_requests;
  44     bool internal;
  45 
  46     ptrdiff_t offset;
  47     size_t    len;
  48     void     *ctx;
  49     void     *frag;
  50 
  51     uint64_t target_address;
  52 
  53     struct ompi_osc_rdma_request_t *parent_request;
  54     
  55     opal_convertor_t convertor;
  56 
  57     
  58     struct ompi_osc_rdma_sync_t *sync;
  59     void *buffer;
  60 };
  61 typedef struct ompi_osc_rdma_request_t ompi_osc_rdma_request_t;
  62 OBJ_CLASS_DECLARATION(ompi_osc_rdma_request_t);
  63 
  64 
  65 
  66 #define OMPI_OSC_RDMA_REQUEST_ALLOC(rmodule, rpeer, req)                \
  67     do {                                                                \
  68         (req) = OBJ_NEW(ompi_osc_rdma_request_t);                       \
  69         OMPI_REQUEST_INIT(&(req)->super, false);                        \
  70         (req)->super.req_mpi_object.win = (rmodule)->win;               \
  71         (req)->super.req_state = OMPI_REQUEST_ACTIVE;                   \
  72         (req)->module = rmodule;                                        \
  73         (req)->peer = (rpeer);                                          \
  74     } while (0)
  75 
  76 #define OMPI_OSC_RDMA_REQUEST_RETURN(req)                               \
  77     do {                                                                \
  78         OMPI_REQUEST_FINI(&(req)->super);                               \
  79         free ((req)->buffer);                                           \
  80         free (req);                                                     \
  81     } while (0)
  82 
  83 static inline void ompi_osc_rdma_request_complete (ompi_osc_rdma_request_t *request, int mpi_error);
  84 
  85 
  86 static inline void ompi_osc_rdma_request_deref (ompi_osc_rdma_request_t *request)
  87 {
  88     if (1 == OPAL_THREAD_FETCH_ADD32 (&request->outstanding_requests, -1)) {
  89         ompi_osc_rdma_request_complete (request, OMPI_SUCCESS);
  90     }
  91 }
  92 
  93 static inline void ompi_osc_rdma_request_complete (ompi_osc_rdma_request_t *request, int mpi_error)
  94 {
  95     ompi_osc_rdma_request_t *parent_request = request->parent_request;
  96 
  97     if (request->cleanup) {
  98         request->cleanup (request);
  99     }
 100 
 101     free (request->to_free);
 102 
 103     if (parent_request) {
 104         ompi_osc_rdma_request_deref (parent_request);
 105     }
 106 
 107     if (!request->internal) {
 108         request->super.req_status.MPI_ERROR = mpi_error;
 109 
 110         
 111         ompi_request_complete (&request->super, true);
 112     } else {
 113         OMPI_OSC_RDMA_REQUEST_RETURN (request);
 114     }
 115 }
 116 
 117 #endif