1219820Sjeff/* 2219820Sjeff * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3219820Sjeff * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4219820Sjeff * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5219820Sjeff * 6219820Sjeff * This software is available to you under a choice of one of two 7219820Sjeff * licenses. You may choose to be licensed under the terms of the GNU 8219820Sjeff * General Public License (GPL) Version 2, available from the file 9219820Sjeff * COPYING in the main directory of this source tree, or the 10219820Sjeff * OpenIB.org BSD license below: 11219820Sjeff * 12219820Sjeff * Redistribution and use in source and binary forms, with or 13219820Sjeff * without modification, are permitted provided that the following 14219820Sjeff * conditions are met: 15219820Sjeff * 16219820Sjeff * - Redistributions of source code must retain the above 17219820Sjeff * copyright notice, this list of conditions and the following 18219820Sjeff * disclaimer. 19219820Sjeff * 20219820Sjeff * - Redistributions in binary form must reproduce the above 21219820Sjeff * copyright notice, this list of conditions and the following 22219820Sjeff * disclaimer in the documentation and/or other materials 23219820Sjeff * provided with the distribution. 24219820Sjeff * 25219820Sjeff * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26219820Sjeff * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27219820Sjeff * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28219820Sjeff * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29219820Sjeff * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30219820Sjeff * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31219820Sjeff * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32219820Sjeff * SOFTWARE. 33219820Sjeff * 34219820Sjeff */ 35219820Sjeff 36219820Sjeff/* 37219820Sjeff * Abstract: 38219820Sjeff * Provides interface over VAPI for obtaining the local ports guids or from guid 39219820Sjeff * obtaining the HCA and port number. 40219820Sjeff */ 41219820Sjeff 42219820Sjeff#ifndef _OSM_VENDOR_HCA_GUID_H_ 43219820Sjeff#define _OSM_VENDOR_HCA_GUID_H_ 44219820Sjeff 45219820Sjeff#ifdef __cplusplus 46219820Sjeff# define BEGIN_C_DECLS extern "C" { 47219820Sjeff# define END_C_DECLS } 48219820Sjeff#else /* !__cplusplus */ 49219820Sjeff# define BEGIN_C_DECLS 50219820Sjeff# define END_C_DECLS 51219820Sjeff#endif /* __cplusplus */ 52219820Sjeff 53219820SjeffBEGIN_C_DECLS 54219820Sjeff/****s* OpenSM: Vendor AL/osm_ca_info_t 55219820Sjeff* NAME 56219820Sjeff* osm_ca_info_t 57219820Sjeff* 58219820Sjeff* DESCRIPTION 59219820Sjeff* Structure containing information about local Channle Adapters. 60219820Sjeff* 61219820Sjeff* SYNOPSIS 62219820Sjeff*/ 63219820Sjefftypedef struct _osm_ca_info { 64219820Sjeff ib_net64_t guid; 65219820Sjeff size_t attr_size; 66219820Sjeff ib_ca_attr_t *p_attr; 67219820Sjeff 68219820Sjeff} osm_ca_info_t; 69219820Sjeff 70219820Sjeff/* 71219820Sjeff* FIELDS 72219820Sjeff* guid 73219820Sjeff* Node GUID of the local CA. 74219820Sjeff* 75219820Sjeff* attr_size 76219820Sjeff* Size of the CA attributes for this CA. 77219820Sjeff* 78219820Sjeff* p_attr 79219820Sjeff* Pointer to dynamicly allocated CA Attribute structure. 80219820Sjeff* 81219820Sjeff* SEE ALSO 82219820Sjeff*********/ 83219820Sjeff 84219820Sjeff/****f* OpenSM: CA Info/osm_ca_info_get_port_guid 85219820Sjeff* NAME 86219820Sjeff* osm_ca_info_get_port_guid 87219820Sjeff* 88219820Sjeff* DESCRIPTION 89219820Sjeff* Returns the port GUID of the specified port owned by this CA. 90219820Sjeff* 91219820Sjeff* SYNOPSIS 92219820Sjeff*/ 93219820Sjeffstatic inline ib_net64_t 94219820Sjeffosm_ca_info_get_port_guid(IN const osm_ca_info_t * const p_ca_info, 95219820Sjeff IN const uint8_t index) 96219820Sjeff{ 97219820Sjeff return (p_ca_info->p_attr->p_port_attr[index].port_guid); 98219820Sjeff} 99219820Sjeff 100219820Sjeff/* 101219820Sjeff* PARAMETERS 102219820Sjeff* p_ca_info 103219820Sjeff* [in] Pointer to a CA Info object. 104219820Sjeff* 105219820Sjeff* index 106219820Sjeff* [in] Port "index" for which to retrieve the port GUID. 107219820Sjeff* The index is the offset into the ca's internal array 108219820Sjeff* of port attributes. 109219820Sjeff* 110219820Sjeff* RETURN VALUE 111219820Sjeff* Returns the port GUID of the specified port owned by this CA. 112219820Sjeff* 113219820Sjeff* NOTES 114219820Sjeff* 115219820Sjeff* SEE ALSO 116219820Sjeff*********/ 117219820Sjeff 118219820Sjeff/****f* OpenSM: SM Vendor/osm_vendor_get_guid_ca_and_port 119219820Sjeff * NAME 120219820Sjeff * osm_vendor_get_guid_ca_and_port 121219820Sjeff * 122219820Sjeff * DESCRIPTION 123219820Sjeff * Given the vendor obj and a guid 124219820Sjeff * return the ca id and port number that have that guid 125219820Sjeff * 126219820Sjeff * SYNOPSIS 127219820Sjeff */ 128219820Sjeffib_api_status_t 129219820Sjeffosm_vendor_get_guid_ca_and_port(IN osm_vendor_t * const p_vend, 130219820Sjeff IN ib_net64_t const guid, 131219820Sjeff OUT VAPI_hca_id_t * p_hca_id, 132219820Sjeff OUT uint32_t * p_port_num); 133219820Sjeff 134219820Sjeff/* 135219820Sjeff* PARAMETERS 136219820Sjeff* p_vend 137219820Sjeff* [in] Pointer to an osm_vendor_t object. 138219820Sjeff* 139219820Sjeff* guid 140219820Sjeff* [in] The guid to search for. 141219820Sjeff* 142219820Sjeff* p_hca_id 143219820Sjeff* [out] The HCA Id (VAPI_hca_id_t *) that the port is found on. 144219820Sjeff* 145219820Sjeff* p_port_num 146219820Sjeff* [out] Pointer to a port number arg to be filled with the port number with the given guid. 147219820Sjeff* 148219820Sjeff* RETURN VALUES 149219820Sjeff* IB_SUCCESS on SUCCESS 150219820Sjeff* IB_INVALID_GUID if the guid is notfound on any Local HCA Port 151219820Sjeff* 152219820Sjeff* NOTES 153219820Sjeff* 154219820Sjeff* SEE ALSO 155219820Sjeff*********/ 156219820Sjeff 157219820Sjeff/****f* OpenSM: SM Vendor/osm_vendor_get_all_port_attr 158219820Sjeff * NAME 159219820Sjeff * osm_vendor_get_all_port_attr 160219820Sjeff * 161219820Sjeff * DESCRIPTION 162219820Sjeff * Fill in the array of port_attr with all available ports on ALL the 163219820Sjeff * avilable CAs on this machine. 164219820Sjeff * ALSO - 165219820Sjeff * UPDATE THE VENDOR OBJECT LIST OF CA_INFO STRUCTS 166219820Sjeff * 167219820Sjeff * SYNOPSIS 168219820Sjeff */ 169219820Sjeffib_api_status_t osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend, 170219820Sjeff IN ib_port_attr_t * 171219820Sjeff const p_attr_array, 172219820Sjeff IN uint32_t * const p_num_ports); 173219820Sjeff 174219820Sjeff/* 175219820Sjeff* PARAMETERS 176219820Sjeff* p_vend 177219820Sjeff* [in] Pointer to an osm_vendor_t object. 178219820Sjeff* 179219820Sjeff* p_attr_array 180219820Sjeff* [out] Pre-allocated array of port attributes to be filled in 181219820Sjeff* 182219820Sjeff* p_num_ports 183219820Sjeff* [out] The size of the given array. Filled in by the actual numberof ports found. 184219820Sjeff* 185219820Sjeff* RETURN VALUES 186219820Sjeff* IB_SUCCESS if OK 187219820Sjeff* IB_INSUFFICIENT_MEMORY if not enough place for all ports was provided. 188219820Sjeff* 189219820Sjeff* NOTES 190219820Sjeff* 191219820Sjeff* SEE ALSO 192219820Sjeff*********/ 193219820Sjeff 194219820SjeffEND_C_DECLS 195219820Sjeff#endif /* _OSM_VENDOR_HCA_GUID_H_ */ 196