Whamcloud - gitweb
lctl flush command to flush the cache of idmap, lsd, and gss svc context
[fs/lustre-release.git] / lnet / include / lnet / types.h
1 #ifndef _P30_TYPES_H_
2 #define _P30_TYPES_H_
3
4 #include "build_check.h"
5
6 #include <libcfs/libcfs.h>
7 #include <portals/errno.h>
8
9 /* This implementation uses the same type for API function return codes and
10  * the completion status in an event  */
11 #define PTL_NI_OK  PTL_OK
12 typedef ptl_err_t ptl_ni_fail_t;
13
14 typedef __u32 ptl_uid_t;
15 typedef __u32 ptl_jid_t;
16 typedef __u64 ptl_nid_t;
17 typedef __u32 ptl_netid_t;
18 typedef __u32 ptl_pid_t;
19 typedef __u32 ptl_pt_index_t;
20 typedef __u32 ptl_ac_index_t;
21 typedef __u64 ptl_match_bits_t;
22 typedef __u64 ptl_hdr_data_t;
23 typedef __u32 ptl_size_t;
24
25 #define PTL_TIME_FOREVER    (-1)
26
27 typedef struct {
28         unsigned long nal_idx;                  /* which network interface */
29         __u64         cookie;                   /* which thing on that interface */
30 } ptl_handle_any_t;
31
32 typedef ptl_handle_any_t ptl_handle_ni_t;
33 typedef ptl_handle_any_t ptl_handle_eq_t;
34 typedef ptl_handle_any_t ptl_handle_md_t;
35 typedef ptl_handle_any_t ptl_handle_me_t;
36
37 #define PTL_INVALID_HANDLE \
38     ((const ptl_handle_any_t){.nal_idx = -1, .cookie = -1})
39 #define PTL_EQ_NONE PTL_INVALID_HANDLE
40
41 static inline int PtlHandleIsEqual (ptl_handle_any_t h1, ptl_handle_any_t h2)
42 {
43         return (h1.nal_idx == h2.nal_idx && h1.cookie == h2.cookie);
44 }
45
46 #define PTL_UID_ANY      ((ptl_uid_t) -1)
47 #define PTL_JID_ANY      ((ptl_jid_t) -1)
48 #define PTL_NID_ANY      ((ptl_nid_t) -1)
49 #define PTL_PID_ANY      ((ptl_pid_t) -1)
50 #define PTL_NETID_ANY    ((ptl_netid_t) -1)
51
52 typedef struct {
53         ptl_nid_t nid;
54         ptl_pid_t pid;   /* node id / process id */
55 } ptl_process_id_t;
56
57 typedef enum {
58         PTL_RETAIN = 0,
59         PTL_UNLINK
60 } ptl_unlink_t;
61
62 typedef enum {
63         PTL_INS_BEFORE,
64         PTL_INS_AFTER
65 } ptl_ins_pos_t;
66
67 typedef struct {
68         void            *start;
69         ptl_size_t       length;
70         int              threshold;
71         int              max_size;
72         unsigned int     options;
73         void            *user_ptr;
74         ptl_handle_eq_t  eq_handle;
75 } ptl_md_t;
76
77 /* Options for the MD structure */
78 #define PTL_MD_OP_PUT               (1 << 0)
79 #define PTL_MD_OP_GET               (1 << 1)
80 #define PTL_MD_MANAGE_REMOTE        (1 << 2)
81 /* unused                           (1 << 3) */
82 #define PTL_MD_TRUNCATE             (1 << 4)
83 #define PTL_MD_ACK_DISABLE          (1 << 5)
84 #define PTL_MD_IOVEC                (1 << 6)
85 #define PTL_MD_MAX_SIZE             (1 << 7)
86 #define PTL_MD_KIOV                 (1 << 8)
87 #define PTL_MD_EVENT_START_DISABLE  (1 << 9)
88 #define PTL_MD_EVENT_END_DISABLE    (1 << 10)
89
90 /* For compatibility with Cray Portals */
91 #define PTL_MD_LUSTRE_COMPLETION_SEMANTICS  0
92 #define PTL_MD_PHYS                         0
93
94 #define PTL_MD_THRESH_INF       (-1)
95
96 /* NB lustre portals uses struct iovec internally! */
97 typedef struct iovec ptl_md_iovec_t;
98
99 typedef struct {
100         cfs_page_t      *kiov_page;
101         unsigned int     kiov_len;
102         unsigned int     kiov_offset;
103 } ptl_kiov_t;
104
105 typedef enum {
106         PTL_EVENT_GET_START,
107         PTL_EVENT_GET_END,
108
109         PTL_EVENT_PUT_START,
110         PTL_EVENT_PUT_END,
111
112         PTL_EVENT_REPLY_START,
113         PTL_EVENT_REPLY_END,
114
115         PTL_EVENT_ACK,
116
117         PTL_EVENT_SEND_START,
118         PTL_EVENT_SEND_END,
119
120         PTL_EVENT_UNLINK,
121 } ptl_event_kind_t;
122
123 #define PTL_SEQ_BASETYPE        long
124 typedef unsigned PTL_SEQ_BASETYPE ptl_seq_t;
125 #define PTL_SEQ_GT(a,b) (((signed PTL_SEQ_BASETYPE)((a) - (b))) > 0)
126
127 /* XXX
128  * cygwin need the pragma line, not clear if it's needed in other places.
129  * checking!!!
130  */
131 #ifdef __CYGWIN__
132 #pragma pack(push, 4)
133 #endif
134 typedef struct {
135         ptl_event_kind_t   type;
136         ptl_process_id_t   initiator;
137         ptl_uid_t          uid;
138         ptl_jid_t          jid;
139         ptl_pt_index_t     pt_index;
140         ptl_match_bits_t   match_bits;
141         ptl_size_t         rlength;
142         ptl_size_t         mlength;
143         ptl_size_t         offset;
144         ptl_handle_md_t    md_handle;
145         ptl_md_t           md;
146         ptl_hdr_data_t     hdr_data;
147         ptl_seq_t          link;
148         ptl_ni_fail_t      ni_fail_type;
149
150         int                unlinked;
151
152         volatile ptl_seq_t sequence;
153 } ptl_event_t;
154 #ifdef __CYGWIN__
155 #pragma pop
156 #endif
157
158 typedef enum {
159         PTL_ACK_REQ,
160         PTL_NOACK_REQ
161 } ptl_ack_req_t;
162
163 typedef void (*ptl_eq_handler_t)(ptl_event_t *event);
164 #define PTL_EQ_HANDLER_NONE NULL
165
166 typedef struct {
167         int max_mes;
168         int max_mds;
169         int max_eqs;
170         int max_ac_index;
171         int max_pt_index;
172         int max_md_iovecs;
173         int max_me_list;
174         int max_getput_md;
175 } ptl_ni_limits_t;
176
177 /*
178  * Status registers
179  */
180 typedef enum {
181         PTL_SR_DROP_COUNT,
182         PTL_SR_DROP_LENGTH,
183         PTL_SR_RECV_COUNT,
184         PTL_SR_RECV_LENGTH,
185         PTL_SR_SEND_COUNT,
186         PTL_SR_SEND_LENGTH,
187         PTL_SR_MSGS_MAX,
188 } ptl_sr_index_t;
189
190 typedef int ptl_sr_value_t;
191
192 typedef int ptl_interface_t;
193 #define PTL_IFACE_DEFAULT    (-1)
194
195 #endif