1/*
2 * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
3 * Copyright (c) 2002-2012 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_mcm_port_t.
39 *	This object represents the membership of a port in a multicast group.
40 *	This object is part of the OpenSM family of objects.
41 */
42
43#ifndef _OSM_MCM_PORT_H_
44#define _OSM_MCM_PORT_H_
45
46#include <iba/ib_types.h>
47#include <complib/cl_qmap.h>
48#include <opensm/osm_base.h>
49#include <opensm/osm_port.h>
50
51#ifdef __cplusplus
52#  define BEGIN_C_DECLS extern "C" {
53#  define END_C_DECLS   }
54#else				/* !__cplusplus */
55#  define BEGIN_C_DECLS
56#  define END_C_DECLS
57#endif				/* __cplusplus */
58
59BEGIN_C_DECLS
60
61struct osm_mgrp;
62
63/****s* OpenSM: MCM Port Object/osm_mcm_port_t
64* NAME
65* 	osm_mcm_port_t
66*
67* DESCRIPTION
68* 	This object represents a particular port as a member of a
69*	multicast group.
70*
71*	This object should be treated as opaque and should
72*	be manipulated only through the provided functions.
73*
74* SYNOPSIS
75*/
76typedef struct osm_mcm_port {
77	cl_map_item_t map_item;
78	cl_list_item_t list_item;
79	osm_port_t *port;
80	struct osm_mgrp *mgrp;
81} osm_mcm_port_t;
82/*
83* FIELDS
84*	map_item
85*		Map Item for qmap linkage.  Must be first element!!
86*
87*	list_item
88*		Linkage structure for cl_qlist.
89*
90*	port
91*		Reference to the parent port
92*
93*	mgrp
94*		The pointer to multicast group where this port is member of
95*
96* SEE ALSO
97*	MCM Port Object
98*********/
99
100/****f* OpenSM: MCM Port Object/osm_mcm_port_new
101* NAME
102*	osm_mcm_port_new
103*
104* DESCRIPTION
105*	The osm_mcm_port_new function allocates and initializes a
106*	MCM Port Object for use.
107*
108* SYNOPSIS
109*/
110osm_mcm_port_t *osm_mcm_port_new(IN osm_port_t * port, IN struct osm_mgrp *mgrp);
111/*
112* PARAMETERS
113*	port
114*		[in] Pointer to the port object
115*
116*	mgrp
117*		[in] Pointer to multicast group where this port is joined
118*
119* RETURN VALUES
120*	Pointer to the allocated and initialized MCM Port object.
121*
122* NOTES
123*
124* SEE ALSO
125*	MCM Port Object, osm_mcm_port_delete,
126*********/
127
128/****f* OpenSM: MCM Port Object/osm_mcm_port_delete
129* NAME
130*	osm_mcm_port_delete
131*
132* DESCRIPTION
133*	The osm_mcm_port_delete function destroys and dellallocates an
134*	MCM Port Object, releasing all resources.
135*
136* SYNOPSIS
137*/
138void osm_mcm_port_delete(IN osm_mcm_port_t * p_mcm);
139/*
140* PARAMETERS
141*	p_mcm
142*		[in] Pointer to a MCM Port Object to delete.
143*
144* RETURN VALUE
145*	This function does not return a value.
146*
147* NOTES
148*
149* SEE ALSO
150*	MCM Port Object, osm_mcm_port_new
151*********/
152
153/****s* OpenSM: MCM Port Object/osm_mcm_alias_guid_t
154* NAME
155*	osm_mcm_alias_guid_t
156*
157* DESCRIPTION
158*	This object represents an alias guid for a mcm port.
159*
160*	The osm_mcm_alias_guid_t object should be treated as opaque and should
161*	be manipulated only through the provided functions.
162*
163* SYNOPSIS
164*/
165typedef struct osm_mcm_alias_guid {
166	cl_map_item_t map_item;
167	ib_net64_t alias_guid;
168	osm_mcm_port_t *p_base_mcm_port;
169	ib_gid_t port_gid;
170	uint8_t scope_state;
171	boolean_t proxy_join;
172} osm_mcm_alias_guid_t;
173/*
174* FIELDS
175*	map_item
176*		Linkage structure for cl_qmap.  MUST BE FIRST MEMBER!
177*
178*	alias_guid
179*		Alias GUID for port obtained from SM GUIDInfo attribute
180*
181*	p_base_mcm_port
182*		Pointer to osm_mcm_port_t for base port GUID
183*
184*	port_gid
185*		GID of the member port
186*
187*	scope_state
188*
189*	proxy_join
190*		If FALSE - Join was performed by the endport identified
191*		by PortGID. If TRUE - Join was performed on behalf of
192*		the endport identified by PortGID by another port within
193*		the same partition.
194*
195* SEE ALSO
196*	MCM Port, Physical Port, Physical Port Table
197*/
198
199/****f* OpenSM: MCM Port Object/osm_mcm_alias_guid_new
200* NAME
201*	osm_mcm_alias_guid_new
202*
203* DESCRIPTION
204*	This function allocates and initializes an mcm alias guid object.
205*
206* SYNOPSIS
207*/
208osm_mcm_alias_guid_t *osm_mcm_alias_guid_new(IN osm_mcm_port_t *p_base_mcm_port,
209					     IN ib_member_rec_t *mcmr,
210					     IN boolean_t proxy);
211/*
212* PARAMETERS
213*	p_base_mcm_port
214*		[in] Pointer to the mcm port for this base GUID
215*
216*	mcmr
217*		[in] Pointer to MCMember record of the join request
218*
219*	proxy
220*		[in] proxy_join state analyzed from the request
221*
222* RETURN VALUE
223*	Pointer to the initialized mcm alias guid object.
224*
225* NOTES
226*	Allows calling other mcm alias guid methods.
227*
228* SEE ALSO
229*       MCM Port Object
230*********/
231
232/****f* OpenSM: MCM Port Object/osm_mcm_alias_guid_delete
233* NAME
234*	osm_mcm_alias_guid_delete
235*
236* DESCRIPTION
237*	This function destroys and deallocates an mcm alias guid object.
238*
239* SYNOPSIS
240*/
241void osm_mcm_alias_guid_delete(IN OUT osm_mcm_alias_guid_t ** pp_mcm_alias_guid);
242/*
243* PARAMETERS
244*	pp_mcm_alias_guid
245*		[in][out] Pointer to a pointer to an mcm alias guid object to
246*		delete. On return, this pointer is NULL.
247*
248* RETURN VALUE
249*	This function does not return a value.
250*
251* NOTES
252*	Performs any necessary cleanup of the specified mcm alias guid object.
253*
254* SEE ALSO
255*	MCM Port Object
256*********/
257
258END_C_DECLS
259#endif				/* _OSM_MCM_PORT_H_ */
260