1c39526b7SPramod Gunjikar /* 2c39526b7SPramod Gunjikar * This file contains definitions used in OFED defined user/kernel 3c39526b7SPramod Gunjikar * interfaces. These are imported from the OFED header ib_user_mad.h. Oracle 4c39526b7SPramod Gunjikar * elects to have and use the contents of ib_user_mad.h under and governed 5c39526b7SPramod Gunjikar * by the OpenIB.org BSD license (see below for full license text). However, 6c39526b7SPramod Gunjikar * the following notice accompanied the original version of this file: 7c39526b7SPramod Gunjikar */ 8c39526b7SPramod Gunjikar 9c39526b7SPramod Gunjikar /* 10c39526b7SPramod Gunjikar * Copyright (c) 2004 Topspin Communications. All rights reserved. 11c39526b7SPramod Gunjikar * Copyright (c) 2005 Voltaire, Inc. All rights reserved. 12c39526b7SPramod Gunjikar * 13c39526b7SPramod Gunjikar * This software is available to you under a choice of one of two 14c39526b7SPramod Gunjikar * licenses. You may choose to be licensed under the terms of the GNU 15c39526b7SPramod Gunjikar * General Public License (GPL) Version 2, available from the file 16c39526b7SPramod Gunjikar * COPYING in the main directory of this source tree, or the 17c39526b7SPramod Gunjikar * OpenIB.org BSD license below: 18c39526b7SPramod Gunjikar * 19c39526b7SPramod Gunjikar * Redistribution and use in source and binary forms, with or 20c39526b7SPramod Gunjikar * without modification, are permitted provided that the following 21c39526b7SPramod Gunjikar * conditions are met: 22c39526b7SPramod Gunjikar * 23c39526b7SPramod Gunjikar * - Redistributions of source code must retain the above 24c39526b7SPramod Gunjikar * copyright notice, this list of conditions and the following 25c39526b7SPramod Gunjikar * disclaimer. 26c39526b7SPramod Gunjikar * 27c39526b7SPramod Gunjikar * - Redistributions in binary form must reproduce the above 28c39526b7SPramod Gunjikar * copyright notice, this list of conditions and the following 29c39526b7SPramod Gunjikar * disclaimer in the documentation and/or other materials 30c39526b7SPramod Gunjikar * provided with the distribution. 31c39526b7SPramod Gunjikar * 32c39526b7SPramod Gunjikar * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 33c39526b7SPramod Gunjikar * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 34c39526b7SPramod Gunjikar * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 35c39526b7SPramod Gunjikar * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 36c39526b7SPramod Gunjikar * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 37c39526b7SPramod Gunjikar * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 38c39526b7SPramod Gunjikar * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 39c39526b7SPramod Gunjikar * SOFTWARE. 40c39526b7SPramod Gunjikar * 41c39526b7SPramod Gunjikar */ 42c39526b7SPramod Gunjikar 43c39526b7SPramod Gunjikar #ifndef _SYS_IB_CLIENTS_OF_RDMA_IB_USER_MAD_H 44c39526b7SPramod Gunjikar #define _SYS_IB_CLIENTS_OF_RDMA_IB_USER_MAD_H 45c39526b7SPramod Gunjikar 46c39526b7SPramod Gunjikar #ifdef __cplusplus 47c39526b7SPramod Gunjikar extern "C" { 48c39526b7SPramod Gunjikar #endif 49c39526b7SPramod Gunjikar 50c39526b7SPramod Gunjikar /* 51c39526b7SPramod Gunjikar * Increment this value if any changes that break userspace ABI 52c39526b7SPramod Gunjikar * compatibility are made. 53c39526b7SPramod Gunjikar */ 54c39526b7SPramod Gunjikar #define IB_USER_MAD_ABI_VERSION 5 55c39526b7SPramod Gunjikar 56c39526b7SPramod Gunjikar /* 57c39526b7SPramod Gunjikar * Make sure that all structs defined in this file remain laid out so 58c39526b7SPramod Gunjikar * that they pack the same way on 32-bit and 64-bit architectures (to 59c39526b7SPramod Gunjikar * avoid incompatibility between 32-bit userspace and 64-bit kernels). 60c39526b7SPramod Gunjikar */ 61c39526b7SPramod Gunjikar 62c39526b7SPramod Gunjikar /* 63c39526b7SPramod Gunjikar * ib_user_mad_hdr_old - Old version of MAD packet header without pkey_index 64c39526b7SPramod Gunjikar * @id - ID of agent MAD received with/to be sent with 65c39526b7SPramod Gunjikar * @status - 0 on successful receive, ETIMEDOUT if no response 66c39526b7SPramod Gunjikar * received (transaction ID in data[] will be set to TID of original 67c39526b7SPramod Gunjikar * request) (ignored on send) 68c39526b7SPramod Gunjikar * @timeout_ms - Milliseconds to wait for response (unset on receive) 69c39526b7SPramod Gunjikar * @retries - Number of automatic retries to attempt 70c39526b7SPramod Gunjikar * @qpn - Remote QP number received from/to be sent to 71c39526b7SPramod Gunjikar * @qkey - Remote Q_Key to be sent with (unset on receive) 72c39526b7SPramod Gunjikar * @lid - Remote lid received from/to be sent to 73c39526b7SPramod Gunjikar * @sl - Service level received with/to be sent with 74c39526b7SPramod Gunjikar * @path_bits - Local path bits received with/to be sent with 75c39526b7SPramod Gunjikar * @grh_present - If set, GRH was received/should be sent 76c39526b7SPramod Gunjikar * @gid_index - Local GID index to send with (unset on receive) 77c39526b7SPramod Gunjikar * @hop_limit - Hop limit in GRH 78c39526b7SPramod Gunjikar * @traffic_class - Traffic class in GRH 79c39526b7SPramod Gunjikar * @gid - Remote GID in GRH 80c39526b7SPramod Gunjikar * @flow_label - Flow label in GRH 81c39526b7SPramod Gunjikar * 82c39526b7SPramod Gunjikar */ 83c39526b7SPramod Gunjikar 84c39526b7SPramod Gunjikar /* 85c39526b7SPramod Gunjikar * ib_user_mad_hdr - MAD packet header 86c39526b7SPramod Gunjikar * This layout allows specifying/receiving the P_Key index. To use 87c39526b7SPramod Gunjikar * this capability, an application must call the 88c39526b7SPramod Gunjikar * IB_USER_MAD_ENABLE_PKEY ioctl on the user MAD file handle before 89c39526b7SPramod Gunjikar * any other actions with the file handle. 90c39526b7SPramod Gunjikar * @id - ID of agent MAD received with/to be sent with 91c39526b7SPramod Gunjikar * @status - 0 on successful receive, ETIMEDOUT if no response 92c39526b7SPramod Gunjikar * received (transaction ID in data[] will be set to TID of original 93c39526b7SPramod Gunjikar * request) (ignored on send) 94c39526b7SPramod Gunjikar * @timeout_ms - Milliseconds to wait for response (unset on receive) 95c39526b7SPramod Gunjikar * @retries - Number of automatic retries to attempt 96c39526b7SPramod Gunjikar * @qpn - Remote QP number received from/to be sent to 97c39526b7SPramod Gunjikar * @qkey - Remote Q_Key to be sent with (unset on receive) 98c39526b7SPramod Gunjikar * @lid - Remote lid received from/to be sent to 99c39526b7SPramod Gunjikar * @sl - Service level received with/to be sent with 100c39526b7SPramod Gunjikar * @path_bits - Local path bits received with/to be sent with 101c39526b7SPramod Gunjikar * @grh_present - If set, GRH was received/should be sent 102c39526b7SPramod Gunjikar * @gid_index - Local GID index to send with (unset on receive) 103c39526b7SPramod Gunjikar * @hop_limit - Hop limit in GRH 104c39526b7SPramod Gunjikar * @traffic_class - Traffic class in GRH 105c39526b7SPramod Gunjikar * @gid - Remote GID in GRH 106c39526b7SPramod Gunjikar * @flow_label - Flow label in GRH 107c39526b7SPramod Gunjikar * 108c39526b7SPramod Gunjikar */ 109c39526b7SPramod Gunjikar struct ib_user_mad_hdr { 110c39526b7SPramod Gunjikar uint32_t id; 111c39526b7SPramod Gunjikar uint32_t status; 112c39526b7SPramod Gunjikar uint32_t timeout_ms; 113c39526b7SPramod Gunjikar uint32_t retries; 114c39526b7SPramod Gunjikar uint32_t length; 115c39526b7SPramod Gunjikar uint32_t qpn; 116c39526b7SPramod Gunjikar uint32_t qkey; 117c39526b7SPramod Gunjikar uint16_t lid; 118c39526b7SPramod Gunjikar uint8_t sl; 119c39526b7SPramod Gunjikar uint8_t path_bits; 120c39526b7SPramod Gunjikar uint8_t grh_present; 121c39526b7SPramod Gunjikar uint8_t gid_index; 122c39526b7SPramod Gunjikar uint8_t hop_limit; 123c39526b7SPramod Gunjikar uint8_t traffic_class; 124c39526b7SPramod Gunjikar uint8_t gid[16]; 125c39526b7SPramod Gunjikar uint32_t flow_label; 126*448bf859SLida.Horn uint16_t pkey_index; 127*448bf859SLida.Horn uint8_t reserved[6]; 128c39526b7SPramod Gunjikar }; 129c39526b7SPramod Gunjikar 130c39526b7SPramod Gunjikar /* 131c39526b7SPramod Gunjikar * ib_user_mad - MAD packet 132c39526b7SPramod Gunjikar * @hdr - MAD packet header 133c39526b7SPramod Gunjikar * @data - Contents of MAD 134c39526b7SPramod Gunjikar * 135c39526b7SPramod Gunjikar */ 136c39526b7SPramod Gunjikar struct ib_user_mad { 137c39526b7SPramod Gunjikar struct ib_user_mad_hdr hdr; 138c39526b7SPramod Gunjikar uint64_t data[]; 139c39526b7SPramod Gunjikar }; 140c39526b7SPramod Gunjikar 141c39526b7SPramod Gunjikar /* 142c39526b7SPramod Gunjikar * ib_user_mad_reg_req - MAD registration request 143c39526b7SPramod Gunjikar * @id - Set by the kernel; used to identify agent in future requests. 144c39526b7SPramod Gunjikar * @qpn - Queue pair number; must be 0 or 1. 145c39526b7SPramod Gunjikar * @method_mask - The caller will receive unsolicited MADs for any method 146c39526b7SPramod Gunjikar * where @method_mask = 1. 147c39526b7SPramod Gunjikar * @mgmt_class - Indicates which management class of MADs should be receive 148c39526b7SPramod Gunjikar * by the caller. This field is only required if the user wishes to 149c39526b7SPramod Gunjikar * receive unsolicited MADs, otherwise it should be 0. 150c39526b7SPramod Gunjikar * @mgmt_class_version - Indicates which version of MADs for the given 151c39526b7SPramod Gunjikar * management class to receive. 152c39526b7SPramod Gunjikar * @oui: Indicates IEEE OUI when mgmt_class is a vendor class 153c39526b7SPramod Gunjikar * in the range from 0x30 to 0x4f. Otherwise not used. 154c39526b7SPramod Gunjikar * @rmpp_version: If set, indicates the RMPP version used. 155c39526b7SPramod Gunjikar * 156c39526b7SPramod Gunjikar */ 157c39526b7SPramod Gunjikar struct ib_user_mad_reg_req { 158c39526b7SPramod Gunjikar uint32_t id; 159c39526b7SPramod Gunjikar uint32_t method_mask[4]; 160c39526b7SPramod Gunjikar uint8_t qpn; 161c39526b7SPramod Gunjikar uint8_t mgmt_class; 162c39526b7SPramod Gunjikar uint8_t mgmt_class_version; 163c39526b7SPramod Gunjikar uint8_t oui[3]; 164c39526b7SPramod Gunjikar uint8_t rmpp_version; 165c39526b7SPramod Gunjikar }; 166c39526b7SPramod Gunjikar 167c39526b7SPramod Gunjikar #define IB_IOCTL_MAGIC 0x1b 168c39526b7SPramod Gunjikar 169c39526b7SPramod Gunjikar #define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \ 170c39526b7SPramod Gunjikar struct ib_user_mad_reg_req) 171c39526b7SPramod Gunjikar 172c39526b7SPramod Gunjikar #define IB_USER_MAD_UNREGISTER_AGENT _IOW(IB_IOCTL_MAGIC, 2, uint32_t) 173c39526b7SPramod Gunjikar 174*448bf859SLida.Horn #define IB_USER_MAD_ENABLE_PKEY _IO(IB_IOCTL_MAGIC, 3) 175*448bf859SLida.Horn 176c39526b7SPramod Gunjikar #ifdef __cplusplus 177c39526b7SPramod Gunjikar } 178c39526b7SPramod Gunjikar #endif 179c39526b7SPramod Gunjikar #endif /* _SYS_IB_CLIENTS_OF_RDMA_IB_USER_MAD_H */ 180