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/
32 #ifndef __UAPI_LNET_IDL_H__
33 #define __UAPI_LNET_IDL_H__
35 #include <linux/types.h>
37 /************************************************************************
38 * Core LNet wire message format.
39 * These are sent in sender's byte order (i.e. receiver flips).
43 * Address of an end-point in an LNet network.
45 * A node can have multiple end-points and hence multiple addresses.
46 * An LNet network can be a simple network (e.g. tcp0) or a network of
47 * LNet networks connected by LNet routers. Therefore an end-point address
48 * has two parts: network ID, and address within a network.
50 * \see LNET_NIDNET, LNET_NIDADDR, and LNET_MKNID.
52 typedef __u64 lnet_nid_t;
55 * ID of a process in a node. Shortened as PID to distinguish from
56 * lnet_process_id, the global process ID.
58 typedef __u32 lnet_pid_t;
60 /* Packed version of struct lnet_process_id to transfer via network */
61 struct lnet_process_id_packed {
63 lnet_pid_t pid; /* node id / process id */
64 } __attribute__((packed));
66 /* The wire handle's interface cookie only matches one network interface in
67 * one epoch (i.e. new cookie when the interface restarts or the node
68 * reboots). The object cookie only matches one object on that interface
69 * during that object's lifetime (i.e. no cookie re-use).
71 struct lnet_handle_wire {
72 __u64 wh_interface_cookie;
73 __u64 wh_object_cookie;
74 } __attribute__((packed));
84 /* The variant fields of the portals message header are aligned on an 8
85 * byte boundary in the message header. Note that all types used in these
86 * wire structs MUST be fixed size and the smaller types are placed at the
90 struct lnet_handle_wire dst_wmd;
93 } __attribute__((packed));
96 struct lnet_handle_wire ack_wmd;
101 } __attribute__((packed));
104 struct lnet_handle_wire return_wmd;
109 } __attribute__((packed));
112 struct lnet_handle_wire dst_wmd;
113 } __attribute__((packed));
118 } __attribute__((packed));
125 __u32 type; /* enum lnet_msg_type */
126 __u32 payload_length; /* payload data to follow */
127 /*<------__u64 aligned------->*/
132 struct lnet_reply reply;
133 struct lnet_hello hello;
135 } __attribute__((packed));
137 /* A HELLO message contains a magic number and protocol version
138 * code in the header's dest_nid, the peer's NID in the src_nid, and
139 * LNET_MSG_HELLO in the type field. All other common fields are zero
140 * (including payload_size; i.e. no payload).
141 * This is for use by byte-stream LNDs (e.g. TCP/IP) to check the peer is
142 * running the same protocol and to find out its NID. These LNDs should
143 * exchange HELLO messages when a connection is first established. Individual
144 * LNDs can put whatever else they fancy in lnet_hdr::msg.
146 struct lnet_magicversion {
147 __u32 magic; /* LNET_PROTO_TCP_MAGIC */
148 __u16 version_major; /* increment on incompatible change */
149 __u16 version_minor; /* increment on compatible change */
150 } __attribute__((packed));
152 /* PROTO MAGIC for LNDs */
153 #define LNET_PROTO_IB_MAGIC 0x0be91b91
154 #define LNET_PROTO_GNI_MAGIC 0xb00fbabe /* ask Kim */
155 #define LNET_PROTO_TCP_MAGIC 0xeebc0ded
156 #define LNET_PROTO_ACCEPTOR_MAGIC 0xacce7100
157 #define LNET_PROTO_PING_MAGIC 0x70696E67 /* 'ping' */
159 /* Placeholder for a future "unified" protocol across all LNDs */
160 /* Current LNDs that receive a request with this magic will respond
161 * with a "stub" reply using their current protocol */
162 #define LNET_PROTO_MAGIC 0x45726963 /* ! */
164 #define LNET_PROTO_TCP_VERSION_MAJOR 1
165 #define LNET_PROTO_TCP_VERSION_MINOR 0
167 /* Acceptor connection request */
168 struct lnet_acceptor_connreq {
169 __u32 acr_magic; /* PTL_ACCEPTOR_PROTO_MAGIC */
170 __u32 acr_version; /* protocol version */
171 __u64 acr_nid; /* target NID */
172 } __attribute__((packed));
174 #define LNET_PROTO_ACCEPTOR_VERSION 1
176 struct lnet_counters_common {
177 __u32 lcc_msgs_alloc;
180 __u32 lcc_send_count;
181 __u32 lcc_recv_count;
182 __u32 lcc_route_count;
183 __u32 lcc_drop_count;
184 __u64 lcc_send_length;
185 __u64 lcc_recv_length;
186 __u64 lcc_route_length;
187 __u64 lcc_drop_length;
188 } __attribute__((packed));
191 #define LNET_NI_STATUS_UP 0x15aac0de
192 #define LNET_NI_STATUS_DOWN 0xdeadface
193 #define LNET_NI_STATUS_INVALID 0x00000000
195 struct lnet_ni_status {
199 } __attribute__((packed));
202 * NB: value of these features equal to LNET_PROTO_PING_VERSION_x
203 * of old LNet, so there shouldn't be any compatibility issue
205 #define LNET_PING_FEAT_INVAL (0) /* no feature */
206 #define LNET_PING_FEAT_BASE (1 << 0) /* just a ping */
207 #define LNET_PING_FEAT_NI_STATUS (1 << 1) /* return NI status */
208 #define LNET_PING_FEAT_RTE_DISABLED (1 << 2) /* Routing enabled */
209 #define LNET_PING_FEAT_MULTI_RAIL (1 << 3) /* Multi-Rail aware */
210 #define LNET_PING_FEAT_DISCOVERY (1 << 4) /* Supports Discovery */
213 * All ping feature bits fit to hit the wire.
214 * In lnet_assert_wire_constants() this is compared against its open-coded
215 * value, and in lnet_ping_target_update() it is used to verify that no
216 * unknown bits have been set.
217 * New feature bits can be added, just be aware that this does change the
218 * over-the-wire protocol.
220 #define LNET_PING_FEAT_BITS (LNET_PING_FEAT_BASE | \
221 LNET_PING_FEAT_NI_STATUS | \
222 LNET_PING_FEAT_RTE_DISABLED | \
223 LNET_PING_FEAT_MULTI_RAIL | \
224 LNET_PING_FEAT_DISCOVERY)
226 struct lnet_ping_info {
231 struct lnet_ni_status pi_ni[0];
232 } __attribute__((packed));
234 #define LNET_PING_INFO_SIZE(NNIDS) \
235 offsetof(struct lnet_ping_info, pi_ni[NNIDS])
236 #define LNET_PING_INFO_LONI(PINFO) ((PINFO)->pi_ni[0].ns_nid)
237 #define LNET_PING_INFO_SEQNO(PINFO) ((PINFO)->pi_ni[0].ns_status)