1 /* 2 * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3 * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4 * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5 * 6 * This software is available to you under a choice of one of two 7 * licenses. You may choose to be licensed under the terms of the GNU 8 * General Public License (GPL) Version 2, available from the file 9 * COPYING in the main directory of this source tree, or the 10 * OpenIB.org BSD license below: 11 * 12 * Redistribution and use in source and binary forms, with or 13 * without modification, are permitted provided that the following 14 * conditions are met: 15 * 16 * - Redistributions of source code must retain the above 17 * copyright notice, this list of conditions and the following 18 * disclaimer. 19 * 20 * - Redistributions in binary form must reproduce the above 21 * copyright notice, this list of conditions and the following 22 * disclaimer in the documentation and/or other materials 23 * provided with the distribution. 24 * 25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 * SOFTWARE. 33 * 34 */ 35 36 /* 37 * Abstract: 38 * Provides interface over VAPI for obtaining the local ports guids or from guid 39 * obtaining the HCA and port number. 40 */ 41 42 #ifndef _OSM_VENDOR_HCA_GUID_H_ 43 #define _OSM_VENDOR_HCA_GUID_H_ 44 45 #ifdef __cplusplus 46 # define BEGIN_C_DECLS extern "C" { 47 # define END_C_DECLS } 48 #else /* !__cplusplus */ 49 # define BEGIN_C_DECLS 50 # define END_C_DECLS 51 #endif /* __cplusplus */ 52 53 BEGIN_C_DECLS 54 /****s* OpenSM: Vendor AL/osm_ca_info_t 55 * NAME 56 * osm_ca_info_t 57 * 58 * DESCRIPTION 59 * Structure containing information about local Channle Adapters. 60 * 61 * SYNOPSIS 62 */ 63 typedef struct _osm_ca_info { 64 ib_net64_t guid; 65 size_t attr_size; 66 ib_ca_attr_t *p_attr; 67 68 } osm_ca_info_t; 69 70 /* 71 * FIELDS 72 * guid 73 * Node GUID of the local CA. 74 * 75 * attr_size 76 * Size of the CA attributes for this CA. 77 * 78 * p_attr 79 * Pointer to dynamicly allocated CA Attribute structure. 80 * 81 * SEE ALSO 82 *********/ 83 84 /****f* OpenSM: CA Info/osm_ca_info_get_port_guid 85 * NAME 86 * osm_ca_info_get_port_guid 87 * 88 * DESCRIPTION 89 * Returns the port GUID of the specified port owned by this CA. 90 * 91 * SYNOPSIS 92 */ 93 static inline ib_net64_t 94 osm_ca_info_get_port_guid(IN const osm_ca_info_t * const p_ca_info, 95 IN const uint8_t index) 96 { 97 return (p_ca_info->p_attr->p_port_attr[index].port_guid); 98 } 99 100 /* 101 * PARAMETERS 102 * p_ca_info 103 * [in] Pointer to a CA Info object. 104 * 105 * index 106 * [in] Port "index" for which to retrieve the port GUID. 107 * The index is the offset into the ca's internal array 108 * of port attributes. 109 * 110 * RETURN VALUE 111 * Returns the port GUID of the specified port owned by this CA. 112 * 113 * NOTES 114 * 115 * SEE ALSO 116 *********/ 117 118 /****f* OpenSM: SM Vendor/osm_vendor_get_guid_ca_and_port 119 * NAME 120 * osm_vendor_get_guid_ca_and_port 121 * 122 * DESCRIPTION 123 * Given the vendor obj and a guid 124 * return the ca id and port number that have that guid 125 * 126 * SYNOPSIS 127 */ 128 ib_api_status_t 129 osm_vendor_get_guid_ca_and_port(IN osm_vendor_t * const p_vend, 130 IN ib_net64_t const guid, 131 OUT VAPI_hca_id_t * p_hca_id, 132 OUT uint32_t * p_port_num); 133 134 /* 135 * PARAMETERS 136 * p_vend 137 * [in] Pointer to an osm_vendor_t object. 138 * 139 * guid 140 * [in] The guid to search for. 141 * 142 * p_hca_id 143 * [out] The HCA Id (VAPI_hca_id_t *) that the port is found on. 144 * 145 * p_port_num 146 * [out] Pointer to a port number arg to be filled with the port number with the given guid. 147 * 148 * RETURN VALUES 149 * IB_SUCCESS on SUCCESS 150 * IB_INVALID_GUID if the guid is notfound on any Local HCA Port 151 * 152 * NOTES 153 * 154 * SEE ALSO 155 *********/ 156 157 /****f* OpenSM: SM Vendor/osm_vendor_get_all_port_attr 158 * NAME 159 * osm_vendor_get_all_port_attr 160 * 161 * DESCRIPTION 162 * Fill in the array of port_attr with all available ports on ALL the 163 * avilable CAs on this machine. 164 * ALSO - 165 * UPDATE THE VENDOR OBJECT LIST OF CA_INFO STRUCTS 166 * 167 * SYNOPSIS 168 */ 169 ib_api_status_t osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend, 170 IN ib_port_attr_t * 171 const p_attr_array, 172 IN uint32_t * const p_num_ports); 173 174 /* 175 * PARAMETERS 176 * p_vend 177 * [in] Pointer to an osm_vendor_t object. 178 * 179 * p_attr_array 180 * [out] Pre-allocated array of port attributes to be filled in 181 * 182 * p_num_ports 183 * [out] The size of the given array. Filled in by the actual numberof ports found. 184 * 185 * RETURN VALUES 186 * IB_SUCCESS if OK 187 * IB_INSUFFICIENT_MEMORY if not enough place for all ports was provided. 188 * 189 * NOTES 190 * 191 * SEE ALSO 192 *********/ 193 194 END_C_DECLS 195 #endif /* _OSM_VENDOR_HCA_GUID_H_ */ 196