2 * Copyright (c) 2004, 2005 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_mcast_tbl_t.
39 * This object represents a multicast forwarding table.
40 * This object is part of the OpenSM family of objects.
43 #ifndef _OSM_MCAST_TBL_H_
44 #define _OSM_MCAST_TBL_H_
46 #include <iba/ib_types.h>
47 #include <complib/cl_qmap.h>
48 #include <opensm/osm_base.h>
51 # define BEGIN_C_DECLS extern "C" {
52 # define END_C_DECLS }
53 #else /* !__cplusplus */
54 # define BEGIN_C_DECLS
56 #endif /* __cplusplus */
59 /****s* OpenSM: Forwarding Table/osm_mcast_tbl_t
64 * Multicast Forwarding Table structure.
66 * Callers may directly access this object.
70 typedef struct osm_mcast_fwdbl {
74 int16_t max_block_in_use;
77 uint16_t(*p_mask_tbl)[][IB_MCAST_POSITION_MAX];
82 * The number of ports in the port mask. This value
83 * is the same as the number of ports on the switch
86 * Maximum bit mask position for this table. This value
87 * is computed from the number of ports on the switch.
90 * Maximum block number supported in the table. This value
91 * is approximately the number of MLID entries divided by the
92 * number of MLIDs per block
95 * Number of entries in the table (aka number of MLIDs supported).
98 * Maximum MLID value (host order).
101 * Pointer to a two dimensional array of port_masks for this switch.
102 * The first dimension is MLID, the second dimension is mask position.
103 * This pointer is null for switches that do not support multicast.
108 /****f* OpenSM: Forwarding Table/osm_mcast_tbl_init
113 * This function initializes a Multicast Forwarding Table object.
118 osm_mcast_tbl_init(IN osm_mcast_tbl_t * const p_tbl,
119 IN uint8_t const num_ports, IN uint16_t const capacity);
123 * [in] Number of ports in the switch owning this table.
126 * [in] The number of MLID entries (starting at 0xC000) supported
130 * IB_SUCCESS on success.
137 /****f* OpenSM: Forwarding Table/osm_mcast_tbl_delete
139 * osm_mcast_tbl_delete
142 * This destroys and deallocates a Multicast Forwarding Table object.
146 void osm_mcast_tbl_delete(IN osm_mcast_tbl_t ** const pp_tbl);
150 * [in] Pointer a Pointer to the Multicast Forwarding Table object.
153 * On success, returns a pointer to a new Multicast Forwarding Table object
154 * of the specified size.
162 /****f* OpenSM: Forwarding Table/osm_mcast_tbl_destroy
164 * osm_mcast_tbl_destroy
167 * This destroys and deallocates a Multicast Forwarding Table object.
171 void osm_mcast_tbl_destroy(IN osm_mcast_tbl_t * const p_tbl);
175 * [in] Pointer to the Multicast Forwarding Table object.
185 /****f* OpenSM: Forwarding Table/osm_mcast_tbl_set
190 * Adds the port to the multicast group.
195 osm_mcast_tbl_set(IN osm_mcast_tbl_t * const p_tbl,
196 IN const uint16_t mlid_ho, IN const uint8_t port_num);
200 * [in] Pointer to the Multicast Forwarding Table object.
203 * [in] MLID value (host order) for which to set the route.
206 * [in] Port to add to the multicast group.
216 /****f* OpenSM: Forwarding Table/osm_mcast_tbl_clear_mlid
218 * osm_mcast_tbl_clear_mlid
221 * Removes all multicast paths for the specified MLID.
226 osm_mcast_tbl_clear_mlid(IN osm_mcast_tbl_t * const p_tbl,
227 IN const uint16_t mlid_ho);
231 * [in] Pointer to the Multicast Forwarding Table object.
234 * [in] MLID value (host order) for which to clear.
244 /****f* OpenSM: Forwarding Table/osm_mcast_tbl_is_port
246 * osm_mcast_tbl_is_port
249 * Returns TRUE if the port is in the multicast group.
254 osm_mcast_tbl_is_port(IN const osm_mcast_tbl_t * const p_tbl,
255 IN const uint16_t mlid_ho, IN const uint8_t port_num);
259 * [in] Pointer to the Multicast Forwarding Table object.
262 * [in] MLID value (host order).
265 * [in] Port number on the switch
268 * Returns the port that routes the specified LID.
275 /****f* OpenSM: Forwarding Table/osm_mcast_tbl_is_any_port
277 * osm_mcast_tbl_is_any_port
280 * Returns TRUE if any port is in the multicast group.
285 osm_mcast_tbl_is_any_port(IN const osm_mcast_tbl_t * const p_tbl,
286 IN const uint16_t mlid_ho);
290 * [in] Pointer to the Multicast Forwarding Table object.
293 * [in] MLID value (host order).
296 * Returns TRUE if any port is in the multicast group.
303 /****f* OpenSM: Forwarding Table/osm_mcast_tbl_set_block
305 * osm_mcast_tbl_set_block
308 * Copies the specified block into the Multicast Forwarding Table.
313 osm_mcast_tbl_set_block(IN osm_mcast_tbl_t * const p_tbl,
314 IN const ib_net16_t * const p_block,
315 IN const int16_t block_num, IN const uint8_t position);
319 * [in] Pointer to the Multicast Forwarding Table object.
322 * [in] Pointer to the Forwarding Table block.
325 * [in] Block number of this block.
335 /****f* OpenSM: Forwarding Table/osm_mcast_get_tbl_block
337 * osm_mcast_get_tbl_block
340 * Retrieve a multicast forwarding table block.
345 osm_mcast_tbl_get_block(IN osm_mcast_tbl_t * const p_tbl,
346 IN const int16_t block_num,
347 IN const uint8_t position,
348 OUT ib_net16_t * const p_block);
352 * [in] Pointer to an osm_mcast_tbl_t object.
355 * [in] Pointer to the Forwarding Table block.
358 * [in] Block number of this block.
361 * [out] Pointer to the 32 entry array to store the
362 * forwarding table clock specified by block_id.
365 * Returns true if there are more blocks necessary to
366 * configure all the MLIDs reachable from this switch.
374 /****f* OpenSM: Forwarding Table/osm_mcast_tbl_get_max_block
376 * osm_mcast_tbl_get_max_block
379 * Returns the maximum block ID in this table.
383 static inline uint16_t
384 osm_mcast_tbl_get_max_block(IN osm_mcast_tbl_t * const p_tbl)
386 return (p_tbl->max_block);
392 * [in] Pointer to an osm_mcast_tbl_t object.
395 * Returns the maximum block ID in this table.
402 /****f* OpenSM: Forwarding Table/osm_mcast_tbl_get_max_block_in_use
404 * osm_mcast_tbl_get_max_block_in_use
407 * Returns the maximum block ID in use in this table.
408 * A value of -1 indicates no blocks are in use.
412 static inline int16_t
413 osm_mcast_tbl_get_max_block_in_use(IN osm_mcast_tbl_t * const p_tbl)
415 return (p_tbl->max_block_in_use);
421 * [in] Pointer to an osm_mcast_tbl_t object.
424 * Returns the maximum block ID in use in this table.
425 * A value of -1 indicates no blocks are in use.
432 /****f* OpenSM: Forwarding Table/osm_mcast_tbl_get_max_position
434 * osm_mcast_tbl_get_max_position
437 * Returns the maximum position in this table.
441 static inline uint8_t
442 osm_mcast_tbl_get_max_position(IN osm_mcast_tbl_t * const p_tbl)
444 return (p_tbl->max_position);
450 * [in] Pointer to an osm_mcast_tbl_t object.
453 * Returns the maximum position in this table.
461 #endif /* _OSM_MCAST_TBL_H_ */