1/* 2 * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. 3 * Copyright (c) 2002-2008 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 * Declaration of osm_prtn_t. 39 * This object represents an IBA Partition. 40 * This object is part of the OpenSM family of objects. 41 */ 42 43#ifndef _OSM_PARTITION_H_ 44#define _OSM_PARTITION_H_ 45 46#include <iba/ib_types.h> 47#include <complib/cl_qmap.h> 48#include <complib/cl_map.h> 49#include <opensm/osm_log.h> 50#include <opensm/osm_subnet.h> 51#include <opensm/osm_multicast.h> 52 53#ifdef __cplusplus 54# define BEGIN_C_DECLS extern "C" { 55# define END_C_DECLS } 56#else /* !__cplusplus */ 57# define BEGIN_C_DECLS 58# define END_C_DECLS 59#endif /* __cplusplus */ 60 61BEGIN_C_DECLS 62/****h* OpenSM/Partition 63* NAME 64* Partition 65* 66* DESCRIPTION 67* The Partition object encapsulates the information needed by the 68* OpenSM to manage Partitions. The OpenSM allocates one Partition 69* object per Partition in the IBA subnet. 70* 71* The Partition is not thread safe, thus callers must provide 72* serialization. 73* 74* This object should be treated as opaque and should be 75* manipulated only through the provided functions. 76* 77* AUTHOR 78* Steve King, Intel 79* 80*********/ 81/****s* OpenSM: Partition/osm_prtn_t 82* NAME 83* osm_prtn_t 84* 85* DESCRIPTION 86* Partition structure. 87* 88* The osm_prtn_t object should be treated as opaque and should 89* be manipulated only through the provided functions. 90* 91* SYNOPSIS 92*/ 93typedef struct osm_prtn { 94 cl_map_item_t map_item; 95 ib_net16_t pkey; 96 uint8_t sl; 97 cl_map_t full_guid_tbl; 98 cl_map_t part_guid_tbl; 99 char name[32]; 100 osm_mgrp_t **mgrps; 101 int nmgrps; 102} osm_prtn_t; 103/* 104* FIELDS 105* map_item 106* Linkage structure for cl_qmap. MUST BE FIRST MEMBER! 107* 108* pkey 109* The IBA defined P_KEY of this Partition. 110* 111* sl 112* The Service Level (SL) associated with this Partiton. 113* 114* full_guid_tbl 115* Container of pointers to all Port objects in the Partition 116* with full membership, indexed by port GUID. 117* 118* part_guid_tbl 119* Container of pointers to all Port objects in the Partition 120* with limited membership, indexed by port GUID. 121* 122* name 123* Name of the Partition as specified in partition 124* configuration. 125* 126* mgrps 127* List of well known Multicast Groups 128* that were created for this partition (when configured). 129* This includes the IPoIB broadcast group. 130* 131* nmgrps 132* Number of known Multicast Groups. 133* 134* SEE ALSO 135* Partition 136*********/ 137 138/****f* OpenSM: Partition/osm_prtn_delete 139* NAME 140* osm_prtn_delete 141* 142* DESCRIPTION 143* This function destroys and deallocates a Partition object. 144* 145* SYNOPSIS 146*/ 147void osm_prtn_delete(IN osm_subn_t * p_subn, IN OUT osm_prtn_t ** pp_prtn); 148/* 149* PARAMETERS 150* pp_prtn 151* [in][out] Pointer to a pointer to a Partition object to 152* delete. On return, this pointer is NULL. 153* 154* RETURN VALUE 155* This function does not return a value. 156* 157* NOTES 158* Performs any necessary cleanup of the specified Partition object. 159* 160* SEE ALSO 161* Partition, osm_prtn_new 162*********/ 163 164/****f* OpenSM: Partition/osm_prtn_new 165* NAME 166* osm_prtn_new 167* 168* DESCRIPTION 169* This function allocates and initializes a Partition object. 170* 171* SYNOPSIS 172*/ 173osm_prtn_t *osm_prtn_new(IN const char *name, IN uint16_t pkey); 174/* 175* PARAMETERS 176* name 177* [in] Partition name string 178* 179* pkey 180* [in] Partition P_Key value 181* 182* RETURN VALUE 183* Pointer to the initialize Partition object. 184* 185* NOTES 186* Allows calling other partition methods. 187* 188* SEE ALSO 189* Partition 190*********/ 191 192/****f* OpenSM: Partition/osm_prtn_is_guid 193* NAME 194* osm_prtn_is_guid 195* 196* DESCRIPTION 197* Indicates if a port is a member of the partition. 198* 199* SYNOPSIS 200*/ 201static inline boolean_t osm_prtn_is_guid(IN const osm_prtn_t * p_prtn, 202 IN ib_net64_t guid) 203{ 204 return (cl_map_get(&p_prtn->full_guid_tbl, guid) != NULL) || 205 (cl_map_get(&p_prtn->part_guid_tbl, guid) != NULL); 206} 207 208/* 209* PARAMETERS 210* p_prtn 211* [in] Pointer to an osm_prtn_t object. 212* 213* guid 214* [in] Port GUID. 215* 216* RETURN VALUES 217* TRUE if the specified port GUID is a member of the partition, 218* FALSE otherwise. 219* 220* NOTES 221* 222* SEE ALSO 223*********/ 224 225/****f* OpenSM: Partition/osm_prtn_make_partitions 226* NAME 227* osm_prtn_make_partitions 228* 229* DESCRIPTION 230* Makes all partitions in subnet. 231* 232* SYNOPSIS 233*/ 234ib_api_status_t osm_prtn_make_partitions(IN osm_log_t * p_log, 235 IN osm_subn_t * p_subn); 236/* 237* PARAMETERS 238* p_log 239* [in] Pointer to a log object. 240* 241* p_subn 242* [in] Pointer to subnet object. 243* 244* RETURN VALUES 245* IB_SUCCESS value on success. 246* 247* NOTES 248* 249* SEE ALSO 250*********/ 251 252/****f* OpenSM: Partition/osm_prtn_find_by_name 253* NAME 254* osm_prtn_find_by_name 255* 256* DESCRIPTION 257* Fides partition by name. 258* 259* SYNOPSIS 260*/ 261osm_prtn_t *osm_prtn_find_by_name(IN osm_subn_t * p_subn, IN const char *name); 262/* 263* PARAMETERS 264* p_subn 265* [in] Pointer to a subnet object. 266* 267* name 268* [in] Required partition name. 269* 270* RETURN VALUES 271* Pointer to the partition object on success. 272* 273* NOTES 274* 275* SEE ALSO 276*********/ 277 278END_C_DECLS 279#endif /* _OSM_PARTITION_H_ */ 280