1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 only,
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License version 2 for more details (a copy is included
16 * in the LICENSE file that accompanied this code).
18 * You should have received a copy of the GNU General Public License
19 * version 2 along with this program; If not, see
20 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
29 * Copyright 2008 Sun Microsystems, Inc. All rights reserved
30 * Use is subject to license terms.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
37 #ifndef __LNET_TYPES_H__
38 #define __LNET_TYPES_H__
40 #include <libcfs/libcfs.h>
42 #define LNET_RESERVED_PORTAL 0 /* portals reserved for lnet's own use */
44 typedef __u64 lnet_nid_t;
45 typedef __u32 lnet_pid_t;
47 #define LNET_NID_ANY ((lnet_nid_t) -1)
48 #define LNET_PID_ANY ((lnet_pid_t) -1)
51 typedef __u32 lnet_uid_t;
52 #define LNET_UID_ANY ((lnet_uid_t) -1)
55 #define LNET_PID_RESERVED 0xf0000000 /* reserved bits in PID */
56 #define LNET_PID_USERFLAG 0x80000000 /* set in userspace peers */
58 #define LNET_TIME_FOREVER (-1)
64 typedef lnet_handle_any_t lnet_handle_eq_t;
65 typedef lnet_handle_any_t lnet_handle_md_t;
66 typedef lnet_handle_any_t lnet_handle_me_t;
68 #define LNET_WIRE_HANDLE_COOKIE_NONE (-1)
70 static inline void LNetInvalidateHandle(lnet_handle_any_t *h)
72 h->cookie = LNET_WIRE_HANDLE_COOKIE_NONE;
75 static inline int LNetHandleIsEqual (lnet_handle_any_t h1, lnet_handle_any_t h2)
77 return (h1.cookie == h2.cookie);
80 static inline int LNetHandleIsInvalid(lnet_handle_any_t h)
82 return (LNET_WIRE_HANDLE_COOKIE_NONE == h.cookie);
87 lnet_pid_t pid; /* node id / process id */
105 unsigned int options;
107 lnet_handle_eq_t eq_handle;
110 /* Max Transfer Unit (minimum supported everywhere) */
111 #define LNET_MTU_BITS 20
112 #define LNET_MTU (1<<LNET_MTU_BITS)
114 /* limit on the number of entries in discontiguous MDs */
115 #define LNET_MAX_IOV 256
117 /* Max payload size */
118 #ifndef LNET_MAX_PAYLOAD
119 # error "LNET_MAX_PAYLOAD must be defined in config.h"
121 # if (LNET_MAX_PAYLOAD < LNET_MTU)
122 # error "LNET_MAX_PAYLOAD too small - error in configure --with-max-payload-mb"
123 # elif defined(__KERNEL__)
124 # if (LNET_MAX_PAYLOAD > (PAGE_SIZE * LNET_MAX_IOV))
125 /* PAGE_SIZE is a constant: check with cpp! */
126 # error "LNET_MAX_PAYLOAD too large - error in configure --with-max-payload-mb"
131 /* Options for the MD structure */
132 #define LNET_MD_OP_PUT (1 << 0)
133 #define LNET_MD_OP_GET (1 << 1)
134 #define LNET_MD_MANAGE_REMOTE (1 << 2)
135 /* unused (1 << 3) */
136 #define LNET_MD_TRUNCATE (1 << 4)
137 #define LNET_MD_ACK_DISABLE (1 << 5)
138 #define LNET_MD_IOVEC (1 << 6)
139 #define LNET_MD_MAX_SIZE (1 << 7)
140 #define LNET_MD_KIOV (1 << 8)
142 /* For compatibility with Cray Portals */
143 #define LNET_MD_PHYS 0
145 #define LNET_MD_THRESH_INF (-1)
147 /* NB lustre portals uses struct iovec internally! */
148 typedef struct iovec lnet_md_iovec_t;
151 cfs_page_t *kiov_page;
152 unsigned int kiov_len;
153 unsigned int kiov_offset;
165 #define LNET_SEQ_BASETYPE long
166 typedef unsigned LNET_SEQ_BASETYPE lnet_seq_t;
167 #define LNET_SEQ_GT(a,b) (((signed LNET_SEQ_BASETYPE)((a) - (b))) > 0)
170 * cygwin need the pragma line, not clear if it's needed in other places.
174 #pragma pack(push, 4)
177 lnet_process_id_t target;
178 lnet_process_id_t initiator;
180 lnet_event_kind_t type;
181 unsigned int pt_index;
183 unsigned int rlength;
184 unsigned int mlength;
185 lnet_handle_md_t md_handle;
195 volatile lnet_seq_t sequence;
206 typedef void (*lnet_eq_handler_t)(lnet_event_t *event);
207 #define LNET_EQ_HANDLER_NONE NULL