1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * Copyright (c) 2006 - 2009 Mellanox Technology Inc. All rights reserved. 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * This software is available to you under a choice of one of two 5*4882a593Smuzhiyun * licenses. You may choose to be licensed under the terms of the GNU 6*4882a593Smuzhiyun * General Public License (GPL) Version 2, available from the file 7*4882a593Smuzhiyun * COPYING in the main directory of this source tree, or the 8*4882a593Smuzhiyun * OpenIB.org BSD license below: 9*4882a593Smuzhiyun * 10*4882a593Smuzhiyun * Redistribution and use in source and binary forms, with or 11*4882a593Smuzhiyun * without modification, are permitted provided that the following 12*4882a593Smuzhiyun * conditions are met: 13*4882a593Smuzhiyun * 14*4882a593Smuzhiyun * - Redistributions of source code must retain the above 15*4882a593Smuzhiyun * copyright notice, this list of conditions and the following 16*4882a593Smuzhiyun * disclaimer. 17*4882a593Smuzhiyun * 18*4882a593Smuzhiyun * - Redistributions in binary form must reproduce the above 19*4882a593Smuzhiyun * copyright notice, this list of conditions and the following 20*4882a593Smuzhiyun * disclaimer in the documentation and/or other materials 21*4882a593Smuzhiyun * provided with the distribution. 22*4882a593Smuzhiyun * 23*4882a593Smuzhiyun * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24*4882a593Smuzhiyun * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25*4882a593Smuzhiyun * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26*4882a593Smuzhiyun * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 27*4882a593Smuzhiyun * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28*4882a593Smuzhiyun * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29*4882a593Smuzhiyun * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30*4882a593Smuzhiyun * SOFTWARE. 31*4882a593Smuzhiyun * 32*4882a593Smuzhiyun */ 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun #ifndef IB_DM_MAD_H 35*4882a593Smuzhiyun #define IB_DM_MAD_H 36*4882a593Smuzhiyun 37*4882a593Smuzhiyun #include <linux/types.h> 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun #include <rdma/ib_mad.h> 40*4882a593Smuzhiyun 41*4882a593Smuzhiyun enum { 42*4882a593Smuzhiyun /* 43*4882a593Smuzhiyun * See also section 13.4.7 Status Field, table 115 MAD Common Status 44*4882a593Smuzhiyun * Field Bit Values and also section 16.3.1.1 Status Field in the 45*4882a593Smuzhiyun * InfiniBand Architecture Specification. 46*4882a593Smuzhiyun */ 47*4882a593Smuzhiyun DM_MAD_STATUS_UNSUP_METHOD = 0x0008, 48*4882a593Smuzhiyun DM_MAD_STATUS_UNSUP_METHOD_ATTR = 0x000c, 49*4882a593Smuzhiyun DM_MAD_STATUS_INVALID_FIELD = 0x001c, 50*4882a593Smuzhiyun DM_MAD_STATUS_NO_IOC = 0x0100, 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun /* 53*4882a593Smuzhiyun * See also the Device Management chapter, section 16.3.3 Attributes, 54*4882a593Smuzhiyun * table 279 Device Management Attributes in the InfiniBand 55*4882a593Smuzhiyun * Architecture Specification. 56*4882a593Smuzhiyun */ 57*4882a593Smuzhiyun DM_ATTR_CLASS_PORT_INFO = 0x01, 58*4882a593Smuzhiyun DM_ATTR_IOU_INFO = 0x10, 59*4882a593Smuzhiyun DM_ATTR_IOC_PROFILE = 0x11, 60*4882a593Smuzhiyun DM_ATTR_SVC_ENTRIES = 0x12 61*4882a593Smuzhiyun }; 62*4882a593Smuzhiyun 63*4882a593Smuzhiyun struct ib_dm_hdr { 64*4882a593Smuzhiyun u8 reserved[28]; 65*4882a593Smuzhiyun }; 66*4882a593Smuzhiyun 67*4882a593Smuzhiyun /* 68*4882a593Smuzhiyun * Structure of management datagram sent by the SRP target implementation. 69*4882a593Smuzhiyun * Contains a management datagram header, reliable multi-packet transaction 70*4882a593Smuzhiyun * protocol (RMPP) header and ib_dm_hdr. Notes: 71*4882a593Smuzhiyun * - The SRP target implementation does not use RMPP or ib_dm_hdr when sending 72*4882a593Smuzhiyun * management datagrams. 73*4882a593Smuzhiyun * - The header size must be exactly 64 bytes (IB_MGMT_DEVICE_HDR), since this 74*4882a593Smuzhiyun * is the header size that is passed to ib_create_send_mad() in ib_srpt.c. 75*4882a593Smuzhiyun * - The maximum supported size for a management datagram when not using RMPP 76*4882a593Smuzhiyun * is 256 bytes -- 64 bytes header and 192 (IB_MGMT_DEVICE_DATA) bytes data. 77*4882a593Smuzhiyun */ 78*4882a593Smuzhiyun struct ib_dm_mad { 79*4882a593Smuzhiyun struct ib_mad_hdr mad_hdr; 80*4882a593Smuzhiyun struct ib_rmpp_hdr rmpp_hdr; 81*4882a593Smuzhiyun struct ib_dm_hdr dm_hdr; 82*4882a593Smuzhiyun u8 data[IB_MGMT_DEVICE_DATA]; 83*4882a593Smuzhiyun }; 84*4882a593Smuzhiyun 85*4882a593Smuzhiyun /* 86*4882a593Smuzhiyun * IOUnitInfo as defined in section 16.3.3.3 IOUnitInfo of the InfiniBand 87*4882a593Smuzhiyun * Architecture Specification. 88*4882a593Smuzhiyun */ 89*4882a593Smuzhiyun struct ib_dm_iou_info { 90*4882a593Smuzhiyun __be16 change_id; 91*4882a593Smuzhiyun u8 max_controllers; 92*4882a593Smuzhiyun u8 op_rom; 93*4882a593Smuzhiyun u8 controller_list[128]; 94*4882a593Smuzhiyun }; 95*4882a593Smuzhiyun 96*4882a593Smuzhiyun /* 97*4882a593Smuzhiyun * IOControllerprofile as defined in section 16.3.3.4 IOControllerProfile of 98*4882a593Smuzhiyun * the InfiniBand Architecture Specification. 99*4882a593Smuzhiyun */ 100*4882a593Smuzhiyun struct ib_dm_ioc_profile { 101*4882a593Smuzhiyun __be64 guid; 102*4882a593Smuzhiyun __be32 vendor_id; 103*4882a593Smuzhiyun __be32 device_id; 104*4882a593Smuzhiyun __be16 device_version; 105*4882a593Smuzhiyun __be16 reserved1; 106*4882a593Smuzhiyun __be32 subsys_vendor_id; 107*4882a593Smuzhiyun __be32 subsys_device_id; 108*4882a593Smuzhiyun __be16 io_class; 109*4882a593Smuzhiyun __be16 io_subclass; 110*4882a593Smuzhiyun __be16 protocol; 111*4882a593Smuzhiyun __be16 protocol_version; 112*4882a593Smuzhiyun __be16 service_conn; 113*4882a593Smuzhiyun __be16 initiators_supported; 114*4882a593Smuzhiyun __be16 send_queue_depth; 115*4882a593Smuzhiyun u8 reserved2; 116*4882a593Smuzhiyun u8 rdma_read_depth; 117*4882a593Smuzhiyun __be32 send_size; 118*4882a593Smuzhiyun __be32 rdma_size; 119*4882a593Smuzhiyun u8 op_cap_mask; 120*4882a593Smuzhiyun u8 svc_cap_mask; 121*4882a593Smuzhiyun u8 num_svc_entries; 122*4882a593Smuzhiyun u8 reserved3[9]; 123*4882a593Smuzhiyun u8 id_string[64]; 124*4882a593Smuzhiyun }; 125*4882a593Smuzhiyun 126*4882a593Smuzhiyun struct ib_dm_svc_entry { 127*4882a593Smuzhiyun u8 name[40]; 128*4882a593Smuzhiyun __be64 id; 129*4882a593Smuzhiyun }; 130*4882a593Smuzhiyun 131*4882a593Smuzhiyun /* 132*4882a593Smuzhiyun * See also section 16.3.3.5 ServiceEntries in the InfiniBand Architecture 133*4882a593Smuzhiyun * Specification. See also section B.7, table B.8 in the T10 SRP r16a document. 134*4882a593Smuzhiyun */ 135*4882a593Smuzhiyun struct ib_dm_svc_entries { 136*4882a593Smuzhiyun struct ib_dm_svc_entry service_entries[4]; 137*4882a593Smuzhiyun }; 138*4882a593Smuzhiyun 139*4882a593Smuzhiyun #endif 140