2 * Copyright (c) 2004-2006 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.
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:
12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following
16 * - Redistributions of source code must retain the above
17 * copyright notice, this list of conditions and the following
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.
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
38 * Declaration of osm_prtn_t.
39 * This object represents an IBA Partition.
40 * This object is part of the OpenSM family of objects.
43 #ifndef _OSM_PARTITION_H_
44 #define _OSM_PARTITION_H_
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>
53 # define BEGIN_C_DECLS extern "C" {
54 # define END_C_DECLS }
55 #else /* !__cplusplus */
56 # define BEGIN_C_DECLS
58 #endif /* __cplusplus */
61 /****h* OpenSM/Partition
66 * The Partition object encapsulates the information needed by the
67 * OpenSM to manage Partitions. The OpenSM allocates one Partition
68 * object per Partition in the IBA subnet.
70 * The Partition is not thread safe, thus callers must provide
73 * This object should be treated as opaque and should be
74 * manipulated only through the provided functions.
80 /****s* OpenSM: Partition/osm_prtn_t
85 * Partition structure.
87 * The osm_prtn_t object should be treated as opaque and should
88 * be manipulated only through the provided functions.
92 typedef struct osm_prtn {
93 cl_map_item_t map_item;
97 cl_map_t full_guid_tbl;
98 cl_map_t part_guid_tbl;
104 * Linkage structure for cl_qmap. MUST BE FIRST MEMBER!
107 * The IBA defined P_KEY of this Partition.
110 * The network ordered LID of the well known Multicast Group
111 * that was created for this partition.
114 * The Service Level (SL) associated with this Partiton.
117 * Container of pointers to all Port objects in the Partition
118 * with full membership, indexed by port GUID.
121 * Container of pointers to all Port objects in the Partition
122 * with limited membership, indexed by port GUID.
125 * Name of the Partition as specified in partition
132 /****f* OpenSM: Partition/osm_prtn_delete
137 * This function destroys and deallocates a Partition object.
141 void osm_prtn_delete(IN OUT osm_prtn_t ** const pp_prtn);
145 * [in][out] Pointer to a pointer to a Partition object to
146 * delete. On return, this pointer is NULL.
149 * This function does not return a value.
152 * Performs any necessary cleanup of the specified Partition object.
155 * Partition, osm_prtn_new
158 /****f* OpenSM: Partition/osm_prtn_new
163 * This function allocates and initializes a Partition object.
167 osm_prtn_t *osm_prtn_new(IN const char *name, IN const uint16_t pkey);
171 * [in] Partition name string
174 * [in] Partition P_Key value
177 * Pointer to the initialize Partition object.
180 * Allows calling other partition methods.
186 /****f* OpenSM: Partition/osm_prtn_is_guid
191 * Indicates if a port is a member of the partition.
195 static inline boolean_t osm_prtn_is_guid(IN const osm_prtn_t * const p_prtn,
196 IN const ib_net64_t guid)
198 return (cl_map_get(&p_prtn->full_guid_tbl, guid) != NULL) ||
199 (cl_map_get(&p_prtn->part_guid_tbl, guid) != NULL);
205 * [in] Pointer to an osm_prtn_t object.
211 * TRUE if the specified port GUID is a member of the partition,
219 /****f* OpenSM: Partition/osm_prtn_make_partitions
221 * osm_prtn_make_partitions
224 * Makes all partitions in subnet.
228 ib_api_status_t osm_prtn_make_partitions(IN osm_log_t * const p_log,
229 IN osm_subn_t * const p_subn);
233 * [in] Pointer to a log object.
236 * [in] Pointer to subnet object.
239 * IB_SUCCESS value on success.
246 /****f* OpenSM: Partition/osm_prtn_find_by_name
248 * osm_prtn_find_by_name
251 * Fides partition by name.
255 osm_prtn_t *osm_prtn_find_by_name(IN osm_subn_t * p_subn, IN const char *name);
259 * [in] Pointer to a subnet object.
262 * [in] Required partition name.
265 * Pointer to the partition object on success.
273 #endif /* _OSM_PARTITION_H_ */