1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 #ifndef __LNET_TYPES_H__
5 #define __LNET_TYPES_H__
7 #include <libcfs/libcfs.h>
9 #define LNET_RESERVED_PORTAL 0 /* portals reserved for lnet's own use */
11 typedef __u64 lnet_nid_t;
12 typedef __u32 lnet_pid_t;
14 #define LNET_NID_ANY ((lnet_nid_t) -1)
15 #define LNET_PID_ANY ((lnet_pid_t) -1)
18 typedef __u32 lnet_uid_t;
19 #define LNET_UID_ANY ((lnet_uid_t) -1)
22 #define LNET_PID_RESERVED 0xf0000000 /* reserved bits in PID */
23 #define LNET_PID_USERFLAG 0x80000000 /* set in userspace peers */
25 #define LNET_TIME_FOREVER (-1)
31 typedef lnet_handle_any_t lnet_handle_eq_t;
32 typedef lnet_handle_any_t lnet_handle_md_t;
33 typedef lnet_handle_any_t lnet_handle_me_t;
35 #define LNET_INVALID_HANDLE \
36 ((const lnet_handle_any_t){.cookie = -1})
37 #define LNET_EQ_NONE LNET_INVALID_HANDLE
39 static inline int LNetHandleIsEqual (lnet_handle_any_t h1, lnet_handle_any_t h2)
41 return (h1.cookie == h2.cookie);
46 lnet_pid_t pid; /* node id / process id */
66 lnet_handle_eq_t eq_handle;
69 /* Max Transfer Unit (minimum supported everywhere) */
70 #define LNET_MTU_BITS 20
71 #define LNET_MTU (1<<LNET_MTU_BITS)
73 /* limit on the number of entries in discontiguous MDs */
74 #define LNET_MAX_IOV 256
76 /* Max payload size */
77 #ifndef LNET_MAX_PAYLOAD
78 # error "LNET_MAX_PAYLOAD must be defined in config.h"
80 # if (LNET_MAX_PAYLOAD < LNET_MTU)
81 # error "LNET_MAX_PAYLOAD too small - error in configure --with-max-payload-mb"
82 # elif defined(__KERNEL__)
83 # if (LNET_MAX_PAYLOAD > (PAGE_SIZE * LNET_MAX_IOV))
84 /* PAGE_SIZE is a constant: check with cpp! */
85 # error "LNET_MAX_PAYLOAD too large - error in configure --with-max-payload-mb"
90 /* Options for the MD structure */
91 #define LNET_MD_OP_PUT (1 << 0)
92 #define LNET_MD_OP_GET (1 << 1)
93 #define LNET_MD_MANAGE_REMOTE (1 << 2)
95 #define LNET_MD_TRUNCATE (1 << 4)
96 #define LNET_MD_ACK_DISABLE (1 << 5)
97 #define LNET_MD_IOVEC (1 << 6)
98 #define LNET_MD_MAX_SIZE (1 << 7)
99 #define LNET_MD_KIOV (1 << 8)
101 /* For compatibility with Cray Portals */
102 #define LNET_MD_PHYS 0
104 #define LNET_MD_THRESH_INF (-1)
106 /* NB lustre portals uses struct iovec internally! */
107 typedef struct iovec lnet_md_iovec_t;
110 cfs_page_t *kiov_page;
111 unsigned int kiov_len;
112 unsigned int kiov_offset;
124 #define LNET_SEQ_BASETYPE long
125 typedef unsigned LNET_SEQ_BASETYPE lnet_seq_t;
126 #define LNET_SEQ_GT(a,b) (((signed LNET_SEQ_BASETYPE)((a) - (b))) > 0)
129 * cygwin need the pragma line, not clear if it's needed in other places.
133 #pragma pack(push, 4)
136 lnet_process_id_t target;
137 lnet_process_id_t initiator;
139 lnet_event_kind_t type;
140 unsigned int pt_index;
142 unsigned int rlength;
143 unsigned int mlength;
144 lnet_handle_md_t md_handle;
154 volatile lnet_seq_t sequence;
165 typedef void (*lnet_eq_handler_t)(lnet_event_t *event);
166 #define LNET_EQ_HANDLER_NONE NULL