Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2004 Topspin Communications. All rights reserved. |
| 3 | * |
| 4 | * This software is available to you under a choice of one of two |
| 5 | * licenses. You may choose to be licensed under the terms of the GNU |
| 6 | * General Public License (GPL) Version 2, available from the file |
| 7 | * COPYING in the main directory of this source tree, or the |
| 8 | * OpenIB.org BSD license below: |
| 9 | * |
| 10 | * Redistribution and use in source and binary forms, with or |
| 11 | * without modification, are permitted provided that the following |
| 12 | * conditions are met: |
| 13 | * |
| 14 | * - Redistributions of source code must retain the above |
| 15 | * copyright notice, this list of conditions and the following |
| 16 | * disclaimer. |
| 17 | * |
| 18 | * - Redistributions in binary form must reproduce the above |
| 19 | * copyright notice, this list of conditions and the following |
| 20 | * disclaimer in the documentation and/or other materials |
| 21 | * provided with the distribution. |
| 22 | * |
| 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 24 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 25 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 26 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 27 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 28 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 29 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 30 | * SOFTWARE. |
| 31 | * |
| 32 | * $Id: ib_user_mad.h 1389 2004-12-27 22:56:47Z roland $ |
| 33 | */ |
| 34 | |
| 35 | #ifndef IB_USER_MAD_H |
| 36 | #define IB_USER_MAD_H |
| 37 | |
| 38 | #include <linux/types.h> |
| 39 | #include <linux/ioctl.h> |
| 40 | |
| 41 | /* |
| 42 | * Increment this value if any changes that break userspace ABI |
| 43 | * compatibility are made. |
| 44 | */ |
| 45 | #define IB_USER_MAD_ABI_VERSION 2 |
| 46 | |
| 47 | /* |
| 48 | * Make sure that all structs defined in this file remain laid out so |
| 49 | * that they pack the same way on 32-bit and 64-bit architectures (to |
| 50 | * avoid incompatibility between 32-bit userspace and 64-bit kernels). |
| 51 | */ |
| 52 | |
| 53 | /** |
| 54 | * ib_user_mad - MAD packet |
| 55 | * @data - Contents of MAD |
| 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 | * @qpn - Remote QP number received from/to be sent to |
| 62 | * @qkey - Remote Q_Key to be sent with (unset on receive) |
| 63 | * @lid - Remote lid received from/to be sent to |
| 64 | * @sl - Service level received with/to be sent with |
| 65 | * @path_bits - Local path bits received with/to be sent with |
| 66 | * @grh_present - If set, GRH was received/should be sent |
| 67 | * @gid_index - Local GID index to send with (unset on receive) |
| 68 | * @hop_limit - Hop limit in GRH |
| 69 | * @traffic_class - Traffic class in GRH |
| 70 | * @gid - Remote GID in GRH |
| 71 | * @flow_label - Flow label in GRH |
| 72 | * |
| 73 | * All multi-byte quantities are stored in network (big endian) byte order. |
| 74 | */ |
| 75 | struct ib_user_mad { |
| 76 | __u8 data[256]; |
| 77 | __u32 id; |
| 78 | __u32 status; |
| 79 | __u32 timeout_ms; |
| 80 | __u32 qpn; |
| 81 | __u32 qkey; |
| 82 | __u16 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 | __u32 flow_label; |
| 91 | }; |
| 92 | |
| 93 | /** |
| 94 | * ib_user_mad_reg_req - MAD registration request |
| 95 | * @id - Set by the kernel; used to identify agent in future requests. |
| 96 | * @qpn - Queue pair number; must be 0 or 1. |
| 97 | * @method_mask - The caller will receive unsolicited MADs for any method |
| 98 | * where @method_mask = 1. |
| 99 | * @mgmt_class - Indicates which management class of MADs should be receive |
| 100 | * by the caller. This field is only required if the user wishes to |
| 101 | * receive unsolicited MADs, otherwise it should be 0. |
| 102 | * @mgmt_class_version - Indicates which version of MADs for the given |
| 103 | * management class to receive. |
| 104 | * @oui: Indicates IEEE OUI when mgmt_class is a vendor class |
| 105 | * in the range from 0x30 to 0x4f. Otherwise not used. |
| 106 | */ |
| 107 | struct ib_user_mad_reg_req { |
| 108 | __u32 id; |
| 109 | __u32 method_mask[4]; |
| 110 | __u8 qpn; |
| 111 | __u8 mgmt_class; |
| 112 | __u8 mgmt_class_version; |
| 113 | __u8 oui[3]; |
| 114 | }; |
| 115 | |
| 116 | #define IB_IOCTL_MAGIC 0x1b |
| 117 | |
| 118 | #define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \ |
| 119 | struct ib_user_mad_reg_req) |
| 120 | |
| 121 | #define IB_USER_MAD_UNREGISTER_AGENT _IOW(IB_IOCTL_MAGIC, 2, __u32) |
| 122 | |
| 123 | #endif /* IB_USER_MAD_H */ |