1 /**
2  * Copyright (C) Mellanox Technologies Ltd. 2019.  ALL RIGHTS RESERVED.
3  *
4  * See file LICENSE for terms.
5  */
6 
7 #ifndef _CRAY_GNI_PUB_H
8 #define _CRAY_GNI_PUB_H
9 
10 #include <stdint.h>
11 #include <stddef.h>
12 
13 #define GNI_RC_SUCCESS                           0
14 #define GNI_CDM_MODE_FORK_FULLCOPY               0
15 #define GNI_CDM_MODE_CACHED_AMO_ENABLED          0
16 #define GNI_CDM_MODE_ERR_NO_KILL                 0
17 #define GNI_CDM_MODE_FAST_DATAGRAM_POLL          0
18 #define GNI_DEVICE_GEMINI                        1
19 #define GNI_DEVICE_ARIES                         2
20 #define GNI_RC_NOT_DONE                          0
21 #define GNI_RC_TRANSACTION_ERROR                 1
22 #define GNI_RC_ERROR_NOMEM                       2
23 #define GNI_RC_ERROR_RESOURCE                    3
24 #define GNI_RC_ALIGNMENT_ERROR                   4
25 #define GNI_POST_RDMA_PUT                        0
26 #define GNI_POST_RDMA_GET                        0
27 #define GNI_POST_FMA_PUT                         0
28 #define GNI_POST_FMA_GET                         0
29 #define GNI_POST_FMA_AMO                         0
30 #define GNI_POST_AMO                             0
31 #define GNI_POST_TERMINATED                      0
32 #define GNI_POST_COMPLETED                       0
33 #define GNI_POST_PENDING                         0
34 #define GNI_POST_CQWRITE                         0
35 #define GNI_FMA_ATOMIC_ADD                       0
36 #define GNI_FMA_ATOMIC_FADD                      0
37 #define GNI_FMA_ATOMIC_CSWAP                     0
38 #define GNI_CDM_MODE_FMA_SHARED                  0
39 #define GNI_CQMODE_GLOBAL_EVENT                  0
40 #define GNI_DLVMODE_PERFORMANCE                  0
41 #define GNI_DLVMODE_NO_ADAPT                     0
42 #define GNI_DLVMODE_IN_ORDER                     0
43 #define GNI_FMA_ATOMIC2_FSWAP                    0
44 #define GNI_FMA_ATOMIC2_IADD_S                   0
45 #define GNI_FMA_ATOMIC2_FIADD_S                  0
46 #define GNI_FMA_ATOMIC2_FSWAP_S                  0
47 #define GNI_FMA_ATOMIC2_CSWAP_S                  0
48 #define GNI_FMA_ATOMIC2_FCSWAP_S                 0
49 #define GNI_FMA_ATOMIC2_AND_S                    0
50 #define GNI_FMA_ATOMIC2_OR_S                     0
51 #define GNI_FMA_ATOMIC2_XOR_S                    0
52 #define GNI_FMA_ATOMIC2_SWAP_S                   0
53 #define GNI_FMA_ATOMIC2_IMIN_S                   0
54 #define GNI_FMA_ATOMIC2_IMAX_S                   0
55 #define GNI_FMA_ATOMIC_AND                       0
56 #define GNI_FMA_ATOMIC_OR                        0
57 #define GNI_FMA_ATOMIC_XOR                       0
58 #define GNI_FMA_ATOMIC2_SWAP                     0
59 #define GNI_FMA_ATOMIC2_IMIN                     0
60 #define GNI_FMA_ATOMIC2_IMAX                     0
61 #define GNI_FMA_ATOMIC2_FPADD_S                  0
62 #define GNI_FMA_ATOMIC2_FPMIN_S                  0
63 #define GNI_FMA_ATOMIC2_FPMAX_S                  0
64 #define GNI_FMA_ATOMIC2_FPADD                    0
65 #define GNI_FMA_ATOMIC2_FPMIN                    0
66 #define GNI_FMA_ATOMIC2_FPMAX                    0
67 #define GNI_FMA_ATOMIC2_FAND_S                   0
68 #define GNI_FMA_ATOMIC2_FOR_S                    0
69 #define GNI_FMA_ATOMIC2_FXOR_S                   0
70 #define GNI_FMA_ATOMIC2_FIMIN_S                  0
71 #define GNI_FMA_ATOMIC2_FIMAX_S                  0
72 #define GNI_FMA_ATOMIC_FAND                      0
73 #define GNI_FMA_ATOMIC_FOR                       0
74 #define GNI_FMA_ATOMIC_FXOR                      0
75 #define GNI_FMA_ATOMIC2_FIMIN                    0
76 #define GNI_FMA_ATOMIC2_FIMAX                    0
77 #define GNI_FMA_ATOMIC2_FFPADD_S                 0
78 #define GNI_FMA_ATOMIC2_FFPMIN_S                 0
79 #define GNI_FMA_ATOMIC2_FFPMAX_S                 0
80 #define GNI_FMA_ATOMIC2_FFPADD                   0
81 #define GNI_FMA_ATOMIC2_FFPMIN                   0
82 #define GNI_FMA_ATOMIC2_FFPMAX                   0
83 #define GNI_RC_ILLEGAL_OP                        0
84 #define GNI_DATAGRAM_MAXSIZE                     128
85 #define GNI_RC_NO_MATCH                          1
86 #define GNI_MEM_READWRITE                        0
87 #define GNI_MEM_READ_ONLY                        0
88 #define GNI_MEM_RELAXED_PI_ORDERING              0
89 #define GNI_SMSG_TYPE_MBOX_AUTO_RETRANSMIT       0
90 #define GNI_SMSG_TYPE_INVALID                    0
91 #define GNI_SMSG_ANY_TAG                         0
92 #define GNI_RC_INVALID_PARAM                     0
93 
94 #define GNI_CQ_OVERRUN(...)                      0
95 #define GNI_GetCompleted(_cq, _data, _desc)      ({*(_desc)=0; 0;})
96 #define GNI_CdmGetNicAddress(...)                0
97 #define GNI_GetDeviceType(...)                   0
98 #define GNI_CdmCreate(d, t, c, m, cdm)           ({ (void)(m); 0; })
99 #define GNI_GetLocalDeviceIds(...)               0
100 #define GNI_GetNumLocalDevices(_count)           ({*(_count)=0; 0;})
101 #define GNI_CdmDestroy(...)                      0
102 #define GNI_CqGetEvent(_cq, _data)               ({ (void)(_cq); *(_data) = 0; 0; })
103 #define GNI_MemRegister(h, ...)                  ({ (void)h; 0; })
104 #define GNI_MemDeregister(h, ...)                ({ (void)h; 0; })
105 #define GNI_CqDestroy(...)                       ({0;})
106 #define GNI_CqErrorStr(...)                      0
107 #define GNI_CdmAttach(...)                       0
108 #define GNI_CqErrorRecoverable(...)              0
109 #define GNI_CqVectorMonitor(...)                 0
110 #define GNI_CqCreate(...)                        0
111 #define GNI_EpCreate(...)                        0
112 #define GNI_EpDestroy(...)                       ({0;})
113 #define GNI_EpBind(...)                          0
114 #define GNI_EpUnbind(...)                        0
115 #define GNI_PostRdma(...)                        0
116 #define GNI_PostFma(...)                         0
117 #define GNI_PostCqWrite(...)                     0
118 #define GNI_EpPostDataWId(e, sh, ml, rh, ...)    ({ (void)e; (void)sh; (void)ml; (void)rh; 0; })
119 #define GNI_PostDataProbeById(nh, id)            ({ *(id) = 0; 0; })
120 #define GNI_EpPostDataWaitById(e, i, x, s, a, j) ({ (void)e; *(s) = 0; *(a) = 0; *(j) = 0; 0; })
121 #define GNI_EpPostDataCancel(...)                0
122 #define GNI_CQ_GET_MSG_ID(...)                   0
123 #define GNI_SmsgGetNextWTag(_ep, _ptr, _tag)     ({ *(_ptr) = NULL; 0; })
124 #define GNI_SmsgRelease(...)                     0
125 #define GNI_SmsgInit(_ep, _local, _remote)       ({ (void)(_ep); (void)(_local); (void)(_remote); 0; })
126 #define GNI_EpSetEventData(_a, _b, _h)           ({ (void)(_h); 0; })
127 #define GNI_SmsgSendWTag(...)                    0
128 #define GNI_CQ_STATUS_OK(...)                    0
129 #define GNI_CQ_GET_INST_ID(...)                  0
130 #define GNI_SmsgBufferSizeNeeded(_a, _b)         ({ (void)*(_a); *(_b) = 0; 0; })
131 #define GNI_SmsgSetMaxRetrans(...)               0
132 #define GNI_EpPostDataCancelById(...)            0
133 #define GNI_PostdataProbeWaitById(n,j,i)         ({ *(i) = 0; 0; })
134 #define GNI_EpPostDataTestById(i, u, s, a, j)    ({ *(a) = 0; *(j) = 0; 0; })
135 
136 
137 typedef int   gni_nic_device_t;
138 typedef void* gni_nic_handle_t;
139 typedef void* gni_cq_handle_t;
140 typedef void* gni_cdm_handle_t;
141 typedef void* gni_ep_handle_t;
142 typedef int   gni_return_t;
143 typedef int   gni_cq_entry_t;
144 typedef int   gni_post_type_t;
145 typedef int   gni_fma_cmd_type_t;
146 typedef int   gni_amo_cmd_type_t;
147 typedef int   gni_post_state_t;
148 
149 extern const char* gni_err_str[];
150 
151 typedef struct {
152     uint64_t         qword1;
153     uint64_t         qword2;
154 } gni_mem_handle_t;
155 
156 typedef struct {
157     int                 type;
158     int                 cq_mode;
159     int                 dlvr_mode;
160     uint64_t            local_addr;
161     gni_mem_handle_t    local_mem_hndl;
162     uint64_t            remote_addr;
163     gni_mem_handle_t    remote_mem_hndl;
164     size_t              length;
165     gni_cq_handle_t     src_cq_hndl;
166     gni_amo_cmd_type_t  amo_cmd;
167     uint64_t            first_operand;
168     uint64_t            second_operand;
169     int                 rdma_mode;
170     int                 cqwrite_value;
171 } gni_post_descriptor_t;
172 
173 
174 typedef struct {
175     gni_mem_handle_t    mem_hndl;
176     void                *msg_buffer;
177     int                 msg_type;
178     size_t              buff_size;
179     size_t              mbox_offset;
180     int                 mbox_maxcredit;
181     size_t              msg_maxsize;
182 } gni_smsg_attr_t;
183 
184 #endif
185 
186