1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2 /*
3 * Copyright (c) 2013 Mellanox Technologies, Inc.
4 * All rights reserved.
5 * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
6 * reserved.
7 * Copyright (c) 2015-2016 Research Organization for Information Science
8 * and Technology (RIST). All rights reserved.
9 * $COPYRIGHT$
10 *
11 * Additional copyrights may follow
12 *
13 * $HEADER$
14 */
15 /**
16 * @file
17 */
18 #ifndef MCA_SPML_BASE_REQUEST_H
19 #define MCA_SPML_BASE_REQUEST_H
20
21 #include "oshmem_config.h"
22 #include "oshmem/request/request.h" /* TODO: define */
23
24 #include "opal/datatype/opal_convertor.h"
25
26 #include "opal/class/opal_free_list.h"
27
28 BEGIN_C_DECLS
29
30 /**
31 * External list for the requests. They are declared as lists of
32 * the basic request type, which will allow all SPML to overload
33 * the list. Beware these free lists have to be initialized
34 * directly by the SPML who win the SPML election.
35 */
36 OSHMEM_DECLSPEC extern opal_free_list_t mca_spml_base_put_requests;
37 OSHMEM_DECLSPEC extern opal_free_list_t mca_spml_base_get_requests;
38 OSHMEM_DECLSPEC extern opal_free_list_t mca_spml_base_send_requests;
39 OSHMEM_DECLSPEC extern opal_free_list_t mca_spml_base_recv_requests;
40 OSHMEM_DECLSPEC extern opal_free_list_t mca_spml_base_atomic_requests;
41
42 /* TODO: Consider to add requests lists
43 * 1. List of Non blocking requests with NULL handle.
44 * 2. List of Non blocking request with Non-NULL handle.
45 * 3. List of non completed puts (for small msgs).
46 */
47
48 /**
49 * Types of one sided requests.
50 */
51 typedef enum {
52 MCA_SPML_REQUEST_NULL,
53 MCA_SPML_REQUEST_PUT, /* Put request */
54 MCA_SPML_REQUEST_GET, /* Get Request */
55 MCA_SPML_REQUEST_SEND, /* Send Request */
56 MCA_SPML_REQUEST_RECV, /* Receive Request */
57 MCA_SPML_REQUEST_ATOMIC_CAS, /* Atomic Compare-And-Swap request */
58 MCA_SPML_REQUEST_ATOMIC_FAAD /* Atomic Fatch-And-Add request */
59 } mca_spml_base_request_type_t;
60
61 /**
62 * Base type for SPML one sided requests
63 */
64 struct mca_spml_base_request_t {
65
66 oshmem_request_t req_oshmem; /**< base request */
67 volatile bool req_spml_complete; /**< flag indicating if the one sided layer is done with this request */
68 mca_spml_base_request_type_t req_type; /**< SHMEM request type */
69 volatile bool req_free_called; /**< flag indicating if the user has freed this request */
70 opal_convertor_t req_convertor; /**< always need the convertor */
71
72 void *req_addr; /**< pointer to application buffer */
73 size_t req_count; /**< count of user datatype elements *//* TODO: Need to remove since we are going to remove datatype*/
74 int32_t req_peer; /**< peer process - rank of process executing the parallel program */
75 ompi_proc_t* req_proc; /**< peer process */
76 uint64_t req_sequence; /**< sequence number for shmem one sided ordering */
77 };
78 typedef struct mca_spml_base_request_t mca_spml_base_request_t;
79
80 OSHMEM_DECLSPEC OBJ_CLASS_DECLARATION(mca_spml_base_request_t);
81
82 END_C_DECLS
83
84 #endif
85