Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ib_user_mad.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2004 Topspin Communications. All rights reserved.
3  * Copyright (c) 2005 Voltaire, Inc. All rights reserved.
4  *
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:
10  *
11  * Redistribution and use in source and binary forms, with or
12  * without modification, are permitted provided that the following
13  * conditions are met:
14  *
15  * - Redistributions of source code must retain the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer.
18  *
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.
23  *
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.
32  */
33 
34 #ifndef IB_USER_MAD_H
35 #define IB_USER_MAD_H
36 
37 #include <linux/types.h>
38 #include <linux/ioctl.h>
39 
40 /*
41  * Increment this value if any changes that break userspace ABI
42  * compatibility are made.
43  */
44 #define IB_USER_MAD_ABI_VERSION 5
45 
46 /*
47  * Make sure that all structs defined in this file remain laid out so
48  * that they pack the same way on 32-bit and 64-bit architectures (to
49  * avoid incompatibility between 32-bit userspace and 64-bit kernels).
50  */
51 
87  __u8 gid[16];
89 };
90 
131  __u8 gid[16];
135 };
136 
143 struct ib_user_mad {
146 };
147 
148 /*
149  * Earlier versions of this interface definition declared the
150  * method_mask[] member as an array of __u32 but treated it as a
151  * bitmap made up of longs in the kernel. This ambiguity meant that
152  * 32-bit big-endian applications that can run on both 32-bit and
153  * 64-bit kernels had no consistent ABI to rely on, and 64-bit
154  * big-endian applications that treated method_mask as being made up
155  * of 32-bit words would have their bitmap misinterpreted.
156  *
157  * To clear up this confusion, we change the declaration of
158  * method_mask[] to use unsigned long and handle the conversion from
159  * 32-bit userspace to 64-bit kernel for big-endian systems in the
160  * compat_ioctl method. Unfortunately, to keep the structure layout
161  * the same, we need the method_mask[] array to be aligned only to 4
162  * bytes even when long is 64 bits, which forces us into this ugly
163  * typedef.
164  */
165 typedef unsigned long __attribute__((aligned(4))) packed_ulong;
166 #define IB_USER_MAD_LONGS_PER_METHOD_MASK (128 / (8 * sizeof (long)))
167 
190  __u8 oui[3];
192 };
193 
194 #define IB_IOCTL_MAGIC 0x1b
195 
196 #define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \
197  struct ib_user_mad_reg_req)
198 
199 #define IB_USER_MAD_UNREGISTER_AGENT _IOW(IB_IOCTL_MAGIC, 2, __u32)
200 
201 #define IB_USER_MAD_ENABLE_PKEY _IO(IB_IOCTL_MAGIC, 3)
202 
203 #endif /* IB_USER_MAD_H */