Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2004 Topspin Communications. All rights reserved. |
Hal Rosenstock | 3f75dad | 2005-07-27 11:45:41 -0700 | [diff] [blame] | 3 | * Copyright (c) 2005 Voltaire, Inc. All rights reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | * |
Hal Rosenstock | 3f75dad | 2005-07-27 11:45:41 -0700 | [diff] [blame] | 33 | * $Id: ib_user_mad.h 2814 2005-07-06 19:14:09Z halr $ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | */ |
| 35 | |
| 36 | #ifndef IB_USER_MAD_H |
| 37 | #define IB_USER_MAD_H |
| 38 | |
| 39 | #include <linux/types.h> |
| 40 | #include <linux/ioctl.h> |
| 41 | |
| 42 | /* |
| 43 | * Increment this value if any changes that break userspace ABI |
| 44 | * compatibility are made. |
| 45 | */ |
Hal Rosenstock | 3f75dad | 2005-07-27 11:45:41 -0700 | [diff] [blame] | 46 | #define IB_USER_MAD_ABI_VERSION 5 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | |
| 48 | /* |
| 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). |
| 52 | */ |
| 53 | |
| 54 | /** |
Hal Rosenstock | 3f75dad | 2005-07-27 11:45:41 -0700 | [diff] [blame] | 55 | * ib_user_mad_hdr - MAD packet header |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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) |
Hal Rosenstock | 3f75dad | 2005-07-27 11:45:41 -0700 | [diff] [blame] | 61 | * @retries - Number of automatic retries to attempt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |
| 73 | * |
| 74 | * All multi-byte quantities are stored in network (big endian) byte order. |
| 75 | */ |
Hal Rosenstock | 3f75dad | 2005-07-27 11:45:41 -0700 | [diff] [blame] | 76 | struct ib_user_mad_hdr { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | __u32 id; |
| 78 | __u32 status; |
| 79 | __u32 timeout_ms; |
Hal Rosenstock | 3f75dad | 2005-07-27 11:45:41 -0700 | [diff] [blame] | 80 | __u32 retries; |
| 81 | __u32 length; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | __u32 qpn; |
| 83 | __u32 qkey; |
| 84 | __u16 lid; |
| 85 | __u8 sl; |
| 86 | __u8 path_bits; |
| 87 | __u8 grh_present; |
| 88 | __u8 gid_index; |
| 89 | __u8 hop_limit; |
| 90 | __u8 traffic_class; |
| 91 | __u8 gid[16]; |
| 92 | __u32 flow_label; |
| 93 | }; |
| 94 | |
| 95 | /** |
Hal Rosenstock | 3f75dad | 2005-07-27 11:45:41 -0700 | [diff] [blame] | 96 | * ib_user_mad - MAD packet |
| 97 | * @hdr - MAD packet header |
| 98 | * @data - Contents of MAD |
| 99 | * |
| 100 | */ |
| 101 | struct ib_user_mad { |
| 102 | struct ib_user_mad_hdr hdr; |
| 103 | __u8 data[0]; |
| 104 | }; |
| 105 | |
| 106 | /** |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | * ib_user_mad_reg_req - MAD registration request |
| 108 | * @id - Set by the kernel; used to identify agent in future requests. |
| 109 | * @qpn - Queue pair number; must be 0 or 1. |
| 110 | * @method_mask - The caller will receive unsolicited MADs for any method |
| 111 | * where @method_mask = 1. |
| 112 | * @mgmt_class - Indicates which management class of MADs should be receive |
| 113 | * by the caller. This field is only required if the user wishes to |
| 114 | * receive unsolicited MADs, otherwise it should be 0. |
| 115 | * @mgmt_class_version - Indicates which version of MADs for the given |
| 116 | * management class to receive. |
| 117 | * @oui: Indicates IEEE OUI when mgmt_class is a vendor class |
| 118 | * in the range from 0x30 to 0x4f. Otherwise not used. |
Hal Rosenstock | 3f75dad | 2005-07-27 11:45:41 -0700 | [diff] [blame] | 119 | * @rmpp_version: If set, indicates the RMPP version used. |
| 120 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | */ |
| 122 | struct ib_user_mad_reg_req { |
| 123 | __u32 id; |
| 124 | __u32 method_mask[4]; |
| 125 | __u8 qpn; |
| 126 | __u8 mgmt_class; |
| 127 | __u8 mgmt_class_version; |
| 128 | __u8 oui[3]; |
Hal Rosenstock | 3f75dad | 2005-07-27 11:45:41 -0700 | [diff] [blame] | 129 | __u8 rmpp_version; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | }; |
| 131 | |
| 132 | #define IB_IOCTL_MAGIC 0x1b |
| 133 | |
| 134 | #define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \ |
| 135 | struct ib_user_mad_reg_req) |
| 136 | |
| 137 | #define IB_USER_MAD_UNREGISTER_AGENT _IOW(IB_IOCTL_MAGIC, 2, __u32) |
| 138 | |
| 139 | #endif /* IB_USER_MAD_H */ |