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