Whamcloud - gitweb
d4038b6194c26ff62d75937364b3f49c9d74141d
[fs/lustre-release.git] / lnet / include / lnet / types.h
1 #ifndef _P30_TYPES_H_
2 #define _P30_TYPES_H_
3
4 #ifdef __linux__
5 #include <asm/types.h>
6 #include <asm/timex.h>
7 #else
8 #include <sys/types.h>
9 typedef u_int32_t __u32;
10 typedef u_int64_t __u64;
11 typedef unsigned long long cycles_t;
12 static inline cycles_t get_cycles(void) { return 0; }
13 #endif
14
15 typedef __u64 ptl_nid_t;
16 typedef __u32 ptl_pid_t;
17 typedef __u32 ptl_pt_index_t;
18 typedef __u32 ptl_ac_index_t;
19 typedef __u64 ptl_match_bits_t;
20 typedef __u64 ptl_hdr_data_t;
21 typedef __u32 ptl_size_t;
22
23 typedef struct {
24         unsigned long nal_idx;                  /* which network interface */
25         __u64         cookie;                   /* which thing on that interface */
26 } ptl_handle_any_t;
27
28 typedef ptl_handle_any_t ptl_handle_ni_t;
29 typedef ptl_handle_any_t ptl_handle_eq_t;
30 typedef ptl_handle_any_t ptl_handle_md_t;
31 typedef ptl_handle_any_t ptl_handle_me_t;
32
33 #define PTL_HANDLE_NONE \
34 ((const ptl_handle_any_t){.nal_idx = -1, .cookie = -1})
35 #define PTL_EQ_NONE PTL_HANDLE_NONE
36
37 static inline int PtlHandleEqual (ptl_handle_any_t h1, ptl_handle_any_t h2)
38 {
39         return (h1.nal_idx == h2.nal_idx && h1.cookie == h2.cookie);
40 }
41
42 #define PTL_NID_ANY      ((ptl_nid_t) -1)
43 #define PTL_PID_ANY      ((ptl_pid_t) -1)
44
45 typedef struct {
46         ptl_nid_t nid;
47         ptl_pid_t pid;   /* node id / process id */
48 } ptl_process_id_t;
49
50 typedef enum {
51         PTL_RETAIN = 0,
52         PTL_UNLINK
53 } ptl_unlink_t;
54
55 typedef enum {
56         PTL_INS_BEFORE,
57         PTL_INS_AFTER
58 } ptl_ins_pos_t;
59
60 typedef struct {
61         struct page     *kiov_page;
62         unsigned int     kiov_len;
63         unsigned int     kiov_offset;
64 } ptl_kiov_t;
65
66 typedef struct {
67         void            *start;
68         ptl_size_t       length;
69         int              threshold;
70         int              max_size;
71         unsigned int     options;
72         void            *user_ptr;
73         ptl_handle_eq_t  eventq;
74         unsigned int     niov;
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 #define PTL_MD_AUTO_UNLINK      (1 << 3)
82 #define PTL_MD_TRUNCATE         (1 << 4)
83 #define PTL_MD_ACK_DISABLE      (1 << 5)
84 #define PTL_MD_IOV              (1 << 6)
85 #define PTL_MD_MAX_SIZE         (1 << 7)
86 #define PTL_MD_KIOV             (1 << 8)
87
88 #define PTL_MD_THRESH_INF       (-1)
89
90 typedef enum {
91         PTL_EVENT_GET,
92         PTL_EVENT_PUT,
93         PTL_EVENT_REPLY,
94         PTL_EVENT_ACK,
95         PTL_EVENT_SENT
96 } ptl_event_kind_t;
97
98 #define PTL_SEQ_BASETYPE        long
99 typedef unsigned PTL_SEQ_BASETYPE ptl_seq_t;
100 #define PTL_SEQ_GT(a,b) (((signed PTL_SEQ_BASETYPE)((a) - (b))) > 0)
101
102 typedef struct {
103         ptl_event_kind_t type;
104         ptl_process_id_t initiator;
105         ptl_pt_index_t portal;
106         ptl_match_bits_t match_bits;
107         ptl_size_t rlength, mlength, offset;
108         ptl_handle_me_t unlinked_me;
109         ptl_md_t mem_desc;
110         ptl_hdr_data_t hdr_data;
111         cycles_t  arrival_time;
112         volatile ptl_seq_t sequence;
113 } ptl_event_t;
114
115
116 typedef enum {
117         PTL_ACK_REQ,
118         PTL_NOACK_REQ
119 } ptl_ack_req_t;
120
121
122 typedef struct {
123         volatile ptl_seq_t sequence;
124         ptl_size_t size;
125         ptl_event_t *base;
126         ptl_handle_any_t cb_eq_handle;
127 } ptl_eq_t;
128
129 typedef struct {
130         ptl_eq_t *eq;
131 } ptl_ni_t;
132
133
134 typedef struct {
135         int max_match_entries;    /* max number of match entries */
136         int max_mem_descriptors;  /* max number of memory descriptors */
137         int max_event_queues;     /* max number of event queues */
138         int max_atable_index;     /* maximum access control list table index */
139         int max_ptable_index;     /* maximum portals table index */
140 } ptl_ni_limits_t;
141
142 /*
143  * Status registers
144  */
145 typedef enum {
146         PTL_SR_DROP_COUNT,
147         PTL_SR_DROP_LENGTH,
148         PTL_SR_RECV_COUNT,
149         PTL_SR_RECV_LENGTH,
150         PTL_SR_SEND_COUNT,
151         PTL_SR_SEND_LENGTH,
152         PTL_SR_MSGS_MAX,
153 } ptl_sr_index_t;
154
155 typedef int ptl_sr_value_t;
156
157 #endif