x86: re-add reboot fixups
[wrt350n-kernel.git] / include / rdma / ib_user_mad.h
blob29d2c7205a90f17d76928dd1c01ae9940866005c
1 /*
2 * Copyright (c) 2004 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005 Voltaire, Inc. All rights reserved.
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the
9 * OpenIB.org BSD license below:
11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the following
13 * conditions are met:
15 * - Redistributions of source code must retain the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer.
19 * - Redistributions in binary form must reproduce the above
20 * copyright notice, this list of conditions and the following
21 * disclaimer in the documentation and/or other materials
22 * provided with the distribution.
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE.
33 * $Id: ib_user_mad.h 2814 2005-07-06 19:14:09Z halr $
36 #ifndef IB_USER_MAD_H
37 #define IB_USER_MAD_H
39 #include <linux/types.h>
40 #include <linux/ioctl.h>
43 * Increment this value if any changes that break userspace ABI
44 * compatibility are made.
46 #define IB_USER_MAD_ABI_VERSION 5
49 * Make sure that all structs defined in this file remain laid out so
50 * that they pack the same way on 32-bit and 64-bit architectures (to
51 * avoid incompatibility between 32-bit userspace and 64-bit kernels).
54 /**
55 * ib_user_mad_hdr_old - Old version of MAD packet header without pkey_index
56 * @id - ID of agent MAD received with/to be sent with
57 * @status - 0 on successful receive, ETIMEDOUT if no response
58 * received (transaction ID in data[] will be set to TID of original
59 * request) (ignored on send)
60 * @timeout_ms - Milliseconds to wait for response (unset on receive)
61 * @retries - Number of automatic retries to attempt
62 * @qpn - Remote QP number received from/to be sent to
63 * @qkey - Remote Q_Key to be sent with (unset on receive)
64 * @lid - Remote lid received from/to be sent to
65 * @sl - Service level received with/to be sent with
66 * @path_bits - Local path bits received with/to be sent with
67 * @grh_present - If set, GRH was received/should be sent
68 * @gid_index - Local GID index to send with (unset on receive)
69 * @hop_limit - Hop limit in GRH
70 * @traffic_class - Traffic class in GRH
71 * @gid - Remote GID in GRH
72 * @flow_label - Flow label in GRH
74 struct ib_user_mad_hdr_old {
75 __u32 id;
76 __u32 status;
77 __u32 timeout_ms;
78 __u32 retries;
79 __u32 length;
80 __be32 qpn;
81 __be32 qkey;
82 __be16 lid;
83 __u8 sl;
84 __u8 path_bits;
85 __u8 grh_present;
86 __u8 gid_index;
87 __u8 hop_limit;
88 __u8 traffic_class;
89 __u8 gid[16];
90 __be32 flow_label;
93 /**
94 * ib_user_mad_hdr - MAD packet header
95 * This layout allows specifying/receiving the P_Key index. To use
96 * this capability, an application must call the
97 * IB_USER_MAD_ENABLE_PKEY ioctl on the user MAD file handle before
98 * any other actions with the file handle.
99 * @id - ID of agent MAD received with/to be sent with
100 * @status - 0 on successful receive, ETIMEDOUT if no response
101 * received (transaction ID in data[] will be set to TID of original
102 * request) (ignored on send)
103 * @timeout_ms - Milliseconds to wait for response (unset on receive)
104 * @retries - Number of automatic retries to attempt
105 * @qpn - Remote QP number received from/to be sent to
106 * @qkey - Remote Q_Key to be sent with (unset on receive)
107 * @lid - Remote lid received from/to be sent to
108 * @sl - Service level received with/to be sent with
109 * @path_bits - Local path bits received with/to be sent with
110 * @grh_present - If set, GRH was received/should be sent
111 * @gid_index - Local GID index to send with (unset on receive)
112 * @hop_limit - Hop limit in GRH
113 * @traffic_class - Traffic class in GRH
114 * @gid - Remote GID in GRH
115 * @flow_label - Flow label in GRH
116 * @pkey_index - P_Key index
118 struct ib_user_mad_hdr {
119 __u32 id;
120 __u32 status;
121 __u32 timeout_ms;
122 __u32 retries;
123 __u32 length;
124 __be32 qpn;
125 __be32 qkey;
126 __be16 lid;
127 __u8 sl;
128 __u8 path_bits;
129 __u8 grh_present;
130 __u8 gid_index;
131 __u8 hop_limit;
132 __u8 traffic_class;
133 __u8 gid[16];
134 __be32 flow_label;
135 __u16 pkey_index;
136 __u8 reserved[6];
140 * ib_user_mad - MAD packet
141 * @hdr - MAD packet header
142 * @data - Contents of MAD
145 struct ib_user_mad {
146 struct ib_user_mad_hdr hdr;
147 __u64 data[0];
151 * Earlier versions of this interface definition declared the
152 * method_mask[] member as an array of __u32 but treated it as a
153 * bitmap made up of longs in the kernel. This ambiguity meant that
154 * 32-bit big-endian applications that can run on both 32-bit and
155 * 64-bit kernels had no consistent ABI to rely on, and 64-bit
156 * big-endian applications that treated method_mask as being made up
157 * of 32-bit words would have their bitmap misinterpreted.
159 * To clear up this confusion, we change the declaration of
160 * method_mask[] to use unsigned long and handle the conversion from
161 * 32-bit userspace to 64-bit kernel for big-endian systems in the
162 * compat_ioctl method. Unfortunately, to keep the structure layout
163 * the same, we need the method_mask[] array to be aligned only to 4
164 * bytes even when long is 64 bits, which forces us into this ugly
165 * typedef.
167 typedef unsigned long __attribute__((aligned(4))) packed_ulong;
168 #define IB_USER_MAD_LONGS_PER_METHOD_MASK (128 / (8 * sizeof (long)))
171 * ib_user_mad_reg_req - MAD registration request
172 * @id - Set by the kernel; used to identify agent in future requests.
173 * @qpn - Queue pair number; must be 0 or 1.
174 * @method_mask - The caller will receive unsolicited MADs for any method
175 * where @method_mask = 1.
176 * @mgmt_class - Indicates which management class of MADs should be receive
177 * by the caller. This field is only required if the user wishes to
178 * receive unsolicited MADs, otherwise it should be 0.
179 * @mgmt_class_version - Indicates which version of MADs for the given
180 * management class to receive.
181 * @oui: Indicates IEEE OUI when mgmt_class is a vendor class
182 * in the range from 0x30 to 0x4f. Otherwise not used.
183 * @rmpp_version: If set, indicates the RMPP version used.
186 struct ib_user_mad_reg_req {
187 __u32 id;
188 packed_ulong method_mask[IB_USER_MAD_LONGS_PER_METHOD_MASK];
189 __u8 qpn;
190 __u8 mgmt_class;
191 __u8 mgmt_class_version;
192 __u8 oui[3];
193 __u8 rmpp_version;
196 #define IB_IOCTL_MAGIC 0x1b
198 #define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \
199 struct ib_user_mad_reg_req)
201 #define IB_USER_MAD_UNREGISTER_AGENT _IOW(IB_IOCTL_MAGIC, 2, __u32)
203 #define IB_USER_MAD_ENABLE_PKEY _IO(IB_IOCTL_MAGIC, 3)
205 #endif /* IB_USER_MAD_H */