4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.gnu.org/licenses/gpl-2.0.html
23 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright (c) 2012, 2017, Intel Corporation.
29 * This file is part of Lustre, http://www.lustre.org/
30 * Lustre is a trademark of Sun Microsystems, Inc.
33 #ifndef __UAPI_LNET_IDL_H__
34 #define __UAPI_LNET_IDL_H__
36 #include <linux/types.h>
38 /************************************************************************
39 * Core LNet wire message format.
40 * These are sent in sender's byte order (i.e. receiver flips).
44 * Address of an end-point in an LNet network.
46 * A node can have multiple end-points and hence multiple addresses.
47 * An LNet network can be a simple network (e.g. tcp0) or a network of
48 * LNet networks connected by LNet routers. Therefore an end-point address
49 * has two parts: network ID, and address within a network.
51 * \see LNET_NIDNET, LNET_NIDADDR, and LNET_MKNID.
53 typedef __u64 lnet_nid_t;
56 * ID of a process in a node. Shortened as PID to distinguish from
57 * lnet_process_id, the global process ID.
59 typedef __u32 lnet_pid_t;
61 /* Packed version of struct lnet_process_id to transfer via network */
62 struct lnet_process_id_packed {
64 lnet_pid_t pid; /* node id / process id */
65 } __attribute__((packed));
67 /* The wire handle's interface cookie only matches one network interface in
68 * one epoch (i.e. new cookie when the interface restarts or the node
69 * reboots). The object cookie only matches one object on that interface
70 * during that object's lifetime (i.e. no cookie re-use).
72 struct lnet_handle_wire {
73 __u64 wh_interface_cookie;
74 __u64 wh_object_cookie;
75 } __attribute__((packed));
85 /* The variant fields of the portals message header are aligned on an 8
86 * byte boundary in the message header. Note that all types used in these
87 * wire structs MUST be fixed size and the smaller types are placed at the
91 struct lnet_handle_wire dst_wmd;
94 } __attribute__((packed));
97 struct lnet_handle_wire ack_wmd;
102 } __attribute__((packed));
105 struct lnet_handle_wire return_wmd;
110 } __attribute__((packed));
113 struct lnet_handle_wire dst_wmd;
114 } __attribute__((packed));
119 } __attribute__((packed));
126 __u32 type; /* enum lnet_msg_type */
127 __u32 payload_length; /* payload data to follow */
128 /*<------__u64 aligned------->*/
133 struct lnet_reply reply;
134 struct lnet_hello hello;
136 } __attribute__((packed));
138 /* A HELLO message contains a magic number and protocol version
139 * code in the header's dest_nid, the peer's NID in the src_nid, and
140 * LNET_MSG_HELLO in the type field. All other common fields are zero
141 * (including payload_size; i.e. no payload).
142 * This is for use by byte-stream LNDs (e.g. TCP/IP) to check the peer is
143 * running the same protocol and to find out its NID. These LNDs should
144 * exchange HELLO messages when a connection is first established. Individual
145 * LNDs can put whatever else they fancy in lnet_hdr::msg.
147 struct lnet_magicversion {
148 __u32 magic; /* LNET_PROTO_TCP_MAGIC */
149 __u16 version_major; /* increment on incompatible change */
150 __u16 version_minor; /* increment on compatible change */
151 } __attribute__((packed));
153 /* PROTO MAGIC for LNDs */
154 #define LNET_PROTO_IB_MAGIC 0x0be91b91
155 #define LNET_PROTO_GNI_MAGIC 0xb00fbabe /* ask Kim */
156 #define LNET_PROTO_TCP_MAGIC 0xeebc0ded
157 #define LNET_PROTO_ACCEPTOR_MAGIC 0xacce7100
158 #define LNET_PROTO_PING_MAGIC 0x70696E67 /* 'ping' */
160 /* Placeholder for a future "unified" protocol across all LNDs */
161 /* Current LNDs that receive a request with this magic will respond
162 * with a "stub" reply using their current protocol */
163 #define LNET_PROTO_MAGIC 0x45726963 /* ! */
165 #define LNET_PROTO_TCP_VERSION_MAJOR 1
166 #define LNET_PROTO_TCP_VERSION_MINOR 0
168 /* Acceptor connection request */
169 struct lnet_acceptor_connreq {
170 __u32 acr_magic; /* PTL_ACCEPTOR_PROTO_MAGIC */
171 __u32 acr_version; /* protocol version */
172 __u64 acr_nid; /* target NID */
173 } __attribute__((packed));
175 #define LNET_PROTO_ACCEPTOR_VERSION 1
177 struct lnet_counters_common {
178 __u32 lcc_msgs_alloc;
181 __u32 lcc_send_count;
182 __u32 lcc_recv_count;
183 __u32 lcc_route_count;
184 __u32 lcc_drop_count;
185 __u64 lcc_send_length;
186 __u64 lcc_recv_length;
187 __u64 lcc_route_length;
188 __u64 lcc_drop_length;
189 } __attribute__((packed));
192 #define LNET_NI_STATUS_UP 0x15aac0de
193 #define LNET_NI_STATUS_DOWN 0xdeadface
194 #define LNET_NI_STATUS_INVALID 0x00000000
196 struct lnet_ni_status {
200 } __attribute__((packed));
203 * NB: value of these features equal to LNET_PROTO_PING_VERSION_x
204 * of old LNet, so there shouldn't be any compatibility issue
206 #define LNET_PING_FEAT_INVAL (0) /* no feature */
207 #define LNET_PING_FEAT_BASE (1 << 0) /* just a ping */
208 #define LNET_PING_FEAT_NI_STATUS (1 << 1) /* return NI status */
209 #define LNET_PING_FEAT_RTE_DISABLED (1 << 2) /* Routing enabled */
210 #define LNET_PING_FEAT_MULTI_RAIL (1 << 3) /* Multi-Rail aware */
211 #define LNET_PING_FEAT_DISCOVERY (1 << 4) /* Supports Discovery */
214 * All ping feature bits fit to hit the wire.
215 * In lnet_assert_wire_constants() this is compared against its open-coded
216 * value, and in lnet_ping_target_update() it is used to verify that no
217 * unknown bits have been set.
218 * New feature bits can be added, just be aware that this does change the
219 * over-the-wire protocol.
221 #define LNET_PING_FEAT_BITS (LNET_PING_FEAT_BASE | \
222 LNET_PING_FEAT_NI_STATUS | \
223 LNET_PING_FEAT_RTE_DISABLED | \
224 LNET_PING_FEAT_MULTI_RAIL | \
225 LNET_PING_FEAT_DISCOVERY)
227 struct lnet_ping_info {
232 struct lnet_ni_status pi_ni[0];
233 } __attribute__((packed));
235 #define LNET_PING_INFO_SIZE(NNIDS) \
236 offsetof(struct lnet_ping_info, pi_ni[NNIDS])
237 #define LNET_PING_INFO_LONI(PINFO) ((PINFO)->pi_ni[0].ns_nid)
238 #define LNET_PING_INFO_SEQNO(PINFO) ((PINFO)->pi_ni[0].ns_status)