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 [sun.com URL with a
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_INVALID_HANDLE \
69 ((const lnet_handle_any_t){.cookie = -1})
70 #define LNET_EQ_NONE LNET_INVALID_HANDLE
72 static inline int LNetHandleIsEqual (lnet_handle_any_t h1, lnet_handle_any_t h2)
74 return (h1.cookie == h2.cookie);
79 lnet_pid_t pid; /* node id / process id */
99 lnet_handle_eq_t eq_handle;
102 /* Max Transfer Unit (minimum supported everywhere) */
103 #define LNET_MTU_BITS 20
104 #define LNET_MTU (1<<LNET_MTU_BITS)
106 /* limit on the number of entries in discontiguous MDs */
107 #define LNET_MAX_IOV 256
109 /* Max payload size */
110 #ifndef LNET_MAX_PAYLOAD
111 # error "LNET_MAX_PAYLOAD must be defined in config.h"
113 # if (LNET_MAX_PAYLOAD < LNET_MTU)
114 # error "LNET_MAX_PAYLOAD too small - error in configure --with-max-payload-mb"
115 # elif defined(__KERNEL__)
116 # if (LNET_MAX_PAYLOAD > (PAGE_SIZE * LNET_MAX_IOV))
117 /* PAGE_SIZE is a constant: check with cpp! */
118 # error "LNET_MAX_PAYLOAD too large - error in configure --with-max-payload-mb"
123 /* Options for the MD structure */
124 #define LNET_MD_OP_PUT (1 << 0)
125 #define LNET_MD_OP_GET (1 << 1)
126 #define LNET_MD_MANAGE_REMOTE (1 << 2)
127 /* unused (1 << 3) */
128 #define LNET_MD_TRUNCATE (1 << 4)
129 #define LNET_MD_ACK_DISABLE (1 << 5)
130 #define LNET_MD_IOVEC (1 << 6)
131 #define LNET_MD_MAX_SIZE (1 << 7)
132 #define LNET_MD_KIOV (1 << 8)
134 /* For compatibility with Cray Portals */
135 #define LNET_MD_PHYS 0
137 #define LNET_MD_THRESH_INF (-1)
139 /* NB lustre portals uses struct iovec internally! */
140 typedef struct iovec lnet_md_iovec_t;
143 cfs_page_t *kiov_page;
144 unsigned int kiov_len;
145 unsigned int kiov_offset;
157 #define LNET_SEQ_BASETYPE long
158 typedef unsigned LNET_SEQ_BASETYPE lnet_seq_t;
159 #define LNET_SEQ_GT(a,b) (((signed LNET_SEQ_BASETYPE)((a) - (b))) > 0)
162 * cygwin need the pragma line, not clear if it's needed in other places.
166 #pragma pack(push, 4)
169 lnet_process_id_t target;
170 lnet_process_id_t initiator;
172 lnet_event_kind_t type;
173 unsigned int pt_index;
175 unsigned int rlength;
176 unsigned int mlength;
177 lnet_handle_md_t md_handle;
187 volatile lnet_seq_t sequence;
198 typedef void (*lnet_eq_handler_t)(lnet_event_t *event);
199 #define LNET_EQ_HANDLER_NONE NULL