1/* 2 * Copyright (c) 2004-2007 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#ifndef _OSM_VENDOR_UMAD_H_ 37#define _OSM_VENDOR_UMAD_H_ 38 39#include <iba/ib_types.h> 40#include <complib/cl_qlist.h> 41#include <opensm/osm_base.h> 42#include <opensm/osm_log.h> 43 44#include <infiniband/common.h> 45#include <infiniband/umad.h> 46 47#ifdef __cplusplus 48# define BEGIN_C_DECLS extern "C" { 49# define END_C_DECLS } 50#else /* !__cplusplus */ 51# define BEGIN_C_DECLS 52# define END_C_DECLS 53#endif /* __cplusplus */ 54 55BEGIN_C_DECLS 56/****h* OpenSM/Vendor Access Layer (UMAD) 57* NAME 58* Vendor UMAD 59* 60* DESCRIPTION 61* This file is the vendor specific file for the UMAD Infiniband API. 62* 63* AUTHOR 64* 65* 66*********/ 67#define OSM_DEFAULT_RETRY_COUNT 3 68#define OSM_UMAD_MAX_CAS 32 69#define OSM_UMAD_MAX_PORTS_PER_CA 2 70/****s* OpenSM: Vendor UMAD/osm_ca_info_t 71* NAME 72* osm_ca_info_t 73* 74* DESCRIPTION 75* Structure containing information about local Channle Adapters. 76* 77* SYNOPSIS 78*/ 79typedef struct _osm_ca_info { 80 ib_net64_t guid; 81 size_t attr_size; 82 ib_ca_attr_t *p_attr; 83} osm_ca_info_t; 84/* 85* FIELDS 86* guid 87* Node GUID of the local CA. 88* 89* attr_size 90* Size of the CA attributes for this CA. 91* 92* p_attr 93* Pointer to dynamicly allocated CA Attribute structure. 94* 95* SEE ALSO 96*********/ 97 98/****f* OpenSM: CA Info/osm_ca_info_get_num_ports 99* NAME 100* osm_ca_info_get_num_ports 101* 102* DESCRIPTION 103* Returns the number of ports owned by this CA. 104* 105* SYNOPSIS 106*/ 107static inline uint8_t 108osm_ca_info_get_num_ports(IN const osm_ca_info_t * const p_ca_info) 109{ 110 return (p_ca_info->p_attr->num_ports); 111} 112 113/* 114* PARAMETERS 115* p_ca_info 116* [in] Pointer to a CA Info object. 117* 118* RETURN VUMADUE 119* Returns the number of ports owned by this CA. 120* 121* NOTES 122* 123* SEE ALSO 124*********/ 125 126/****s* OpenSM: Vendor UMAD/osm_bind_handle_t 127* NAME 128* osm_bind_handle_t 129* 130* DESCRIPTION 131* handle returned by the vendor transport bind call. 132* 133* SYNOPSIS 134*/ 135typedef void *osm_bind_handle_t; 136/***********/ 137 138typedef struct _umad_match { 139 ib_net64_t tid; 140 void *v; 141 uint32_t version; 142} umad_match_t; 143 144#define DEFAULT_OSM_UMAD_MAX_PENDING 1000 145 146typedef struct vendor_match_tbl { 147 uint32_t last_version; 148 int max; 149 umad_match_t *tbl; 150} vendor_match_tbl_t; 151 152typedef struct _osm_vendor { 153 osm_log_t *p_log; 154 uint32_t ca_count; 155 osm_ca_info_t *p_ca_info; 156 uint32_t timeout; 157 int max_retries; 158 osm_bind_handle_t agents[UMAD_CA_MAX_AGENTS]; 159 char ca_names[OSM_UMAD_MAX_CAS][UMAD_CA_NAME_LEN]; 160 vendor_match_tbl_t mtbl; 161 umad_port_t umad_port; 162 pthread_mutex_t cb_mutex; 163 pthread_mutex_t match_tbl_mutex; 164 int umad_port_id; 165 void *receiver; 166 int issmfd; 167 char issm_path[256]; 168} osm_vendor_t; 169 170#define OSM_BIND_INVALID_HANDLE 0 171 172typedef struct _osm_vend_wrap { 173 int agent; 174 int size; 175 int retries; 176 void *umad; 177 osm_bind_handle_t h_bind; 178} osm_vend_wrap_t; 179 180END_C_DECLS 181#endif /* _OSM_VENDOR_UMAD_H_ */ 182