Blame include/opensm/osm_mcast_tbl.h

Packit 13e616
/*
Packit 13e616
 * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
Packit 13e616
 * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.
Packit 13e616
 * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
Packit 13e616
 * Copyright (c) 2009 HNR Consulting. All rights reserved.
Packit 13e616
 *
Packit 13e616
 * This software is available to you under a choice of one of two
Packit 13e616
 * licenses.  You may choose to be licensed under the terms of the GNU
Packit 13e616
 * General Public License (GPL) Version 2, available from the file
Packit 13e616
 * COPYING in the main directory of this source tree, or the
Packit 13e616
 * OpenIB.org BSD license below:
Packit 13e616
 *
Packit 13e616
 *     Redistribution and use in source and binary forms, with or
Packit 13e616
 *     without modification, are permitted provided that the following
Packit 13e616
 *     conditions are met:
Packit 13e616
 *
Packit 13e616
 *      - Redistributions of source code must retain the above
Packit 13e616
 *        copyright notice, this list of conditions and the following
Packit 13e616
 *        disclaimer.
Packit 13e616
 *
Packit 13e616
 *      - Redistributions in binary form must reproduce the above
Packit 13e616
 *        copyright notice, this list of conditions and the following
Packit 13e616
 *        disclaimer in the documentation and/or other materials
Packit 13e616
 *        provided with the distribution.
Packit 13e616
 *
Packit 13e616
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Packit 13e616
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Packit 13e616
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Packit 13e616
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
Packit 13e616
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
Packit 13e616
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
Packit 13e616
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
Packit 13e616
 * SOFTWARE.
Packit 13e616
 *
Packit 13e616
 */
Packit 13e616
Packit 13e616
/*
Packit 13e616
 * Abstract:
Packit 13e616
 * 	Declaration of osm_mcast_tbl_t.
Packit 13e616
 *	This object represents a multicast forwarding table.
Packit 13e616
 *	This object is part of the OpenSM family of objects.
Packit 13e616
 */
Packit 13e616
Packit 13e616
#ifndef _OSM_MCAST_TBL_H_
Packit 13e616
#define _OSM_MCAST_TBL_H_
Packit 13e616
Packit 13e616
#include <iba/ib_types.h>
Packit 13e616
#include <complib/cl_qmap.h>
Packit 13e616
#include <opensm/osm_base.h>
Packit 13e616
Packit 13e616
#ifdef __cplusplus
Packit 13e616
#  define BEGIN_C_DECLS extern "C" {
Packit 13e616
#  define END_C_DECLS   }
Packit 13e616
#else				/* !__cplusplus */
Packit 13e616
#  define BEGIN_C_DECLS
Packit 13e616
#  define END_C_DECLS
Packit 13e616
#endif				/* __cplusplus */
Packit 13e616
Packit 13e616
BEGIN_C_DECLS
Packit 13e616
/****s* OpenSM: Forwarding Table/osm_mcast_tbl_t
Packit 13e616
* NAME
Packit 13e616
*	osm_mcast_tbl_t
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Multicast Forwarding Table structure.
Packit 13e616
*
Packit 13e616
*	Callers may directly access this object.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
typedef struct osm_mcast_fwdbl {
Packit 13e616
	uint8_t num_ports;
Packit 13e616
	uint8_t max_position;
Packit 13e616
	uint16_t max_block;
Packit 13e616
	int16_t max_block_in_use;
Packit 13e616
	uint16_t num_entries;
Packit 13e616
	uint16_t max_mlid_ho;
Packit 13e616
	uint16_t mft_depth;
Packit 13e616
	uint16_t(*p_mask_tbl)[][IB_MCAST_POSITION_MAX + 1];
Packit 13e616
} osm_mcast_tbl_t;
Packit 13e616
/*
Packit 13e616
* FIELDS
Packit 13e616
*	num_ports
Packit 13e616
*		The number of ports in the port mask.  This value
Packit 13e616
*		is the same as the number of ports on the switch
Packit 13e616
*
Packit 13e616
*	max_position
Packit 13e616
*		Maximum bit mask position for this table.  This value
Packit 13e616
*		is computed from the number of ports on the switch.
Packit 13e616
*
Packit 13e616
*	max_block
Packit 13e616
*		Maximum block number supported in the table.  This value
Packit 13e616
*		is approximately the number of MLID entries divided by the
Packit 13e616
*		number of MLIDs per block
Packit 13e616
*
Packit 13e616
*	num_entries
Packit 13e616
*		Number of entries in the table (aka number of MLIDs supported).
Packit 13e616
*
Packit 13e616
*	max_mlid_ho
Packit 13e616
*		Maximum MLID (host order) for the currently allocated multicast
Packit 13e616
*		port mask table.
Packit 13e616
*
Packit 13e616
*	mft_depth
Packit 13e616
*		Number of MLIDs in the currently allocated multicast port mask
Packit 13e616
*		table.
Packit 13e616
*
Packit 13e616
*	p_mask_tbl
Packit 13e616
*		Pointer to a two dimensional array of port_masks for this switch.
Packit 13e616
*		The first dimension is MLID offset, second dimension is mask position.
Packit 13e616
*		This pointer is null for switches that do not support multicast.
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: Forwarding Table/osm_mcast_tbl_init
Packit 13e616
* NAME
Packit 13e616
*	osm_mcast_tbl_init
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	This function initializes a Multicast Forwarding Table object.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
void osm_mcast_tbl_init(IN osm_mcast_tbl_t * p_tbl, IN uint8_t num_ports,
Packit 13e616
			IN uint16_t capacity);
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*	num_ports
Packit 13e616
*		[in] Number of ports in the switch owning this table.
Packit 13e616
*
Packit 13e616
*	capacity
Packit 13e616
*		[in] The number of MLID entries (starting at 0xC000) supported
Packit 13e616
*		by this switch.
Packit 13e616
*
Packit 13e616
* RETURN VALUE
Packit 13e616
*	None.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: Forwarding Table/osm_mcast_tbl_delete
Packit 13e616
* NAME
Packit 13e616
*	osm_mcast_tbl_delete
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	This destroys and deallocates a Multicast Forwarding Table object.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
void osm_mcast_tbl_delete(IN osm_mcast_tbl_t ** pp_tbl);
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*	pp_tbl
Packit 13e616
*		[in] Pointer a Pointer to the Multicast Forwarding Table object.
Packit 13e616
*
Packit 13e616
* RETURN VALUE
Packit 13e616
*	On success, returns a pointer to a new Multicast Forwarding Table object
Packit 13e616
*	of the specified size.
Packit 13e616
*	NULL otherwise.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: Forwarding Table/osm_mcast_tbl_realloc
Packit 13e616
* NAME
Packit 13e616
*	osm_mcast_tbl_realloc
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	This function reallocates the multicast port mask table if necessary.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
int osm_mcast_tbl_realloc(IN osm_mcast_tbl_t * p_tbl, IN unsigned mlid_offset);
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*
Packit 13e616
*	p_tbl
Packit 13e616
*		[in] Pointer to the Multicast Forwarding Table object.
Packit 13e616
*
Packit 13e616
*	mlid_offset
Packit 13e616
*		[in] Offset of MLID being accessed.
Packit 13e616
*
Packit 13e616
* RETURN VALUE
Packit 13e616
*	Returns 0 on success and non-zero value otherwise.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*/
Packit 13e616
Packit 13e616
/****f* OpenSM: Forwarding Table/osm_mcast_tbl_destroy
Packit 13e616
* NAME
Packit 13e616
*	osm_mcast_tbl_destroy
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	This destroys and deallocates a Multicast Forwarding Table object.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
void osm_mcast_tbl_destroy(IN osm_mcast_tbl_t * p_tbl);
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*	p_tbl
Packit 13e616
*		[in] Pointer to the Multicast Forwarding Table object.
Packit 13e616
*
Packit 13e616
* RETURN VALUE
Packit 13e616
*    None
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: Forwarding Table/osm_mcast_tbl_set
Packit 13e616
* NAME
Packit 13e616
*	osm_mcast_tbl_set
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Adds the port to the multicast group.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
void osm_mcast_tbl_set(IN osm_mcast_tbl_t * p_tbl, IN uint16_t mlid_ho,
Packit 13e616
		       IN uint8_t port_num);
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*	p_tbl
Packit 13e616
*		[in] Pointer to the Multicast Forwarding Table object.
Packit 13e616
*
Packit 13e616
*	mlid_ho
Packit 13e616
*		[in] MLID value (host order) for which to set the route.
Packit 13e616
*
Packit 13e616
*	port_num
Packit 13e616
*		[in] Port to add to the multicast group.
Packit 13e616
*
Packit 13e616
* RETURN VALUE
Packit 13e616
*	None.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: Forwarding Table/osm_mcast_tbl_clear_mlid
Packit 13e616
* NAME
Packit 13e616
*	osm_mcast_tbl_clear_mlid
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Removes all multicast paths for the specified MLID.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
void osm_mcast_tbl_clear_mlid(IN osm_mcast_tbl_t * p_tbl, IN uint16_t mlid_ho);
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*	p_tbl
Packit 13e616
*		[in] Pointer to the Multicast Forwarding Table object.
Packit 13e616
*
Packit 13e616
*	mlid_ho
Packit 13e616
*		[in] MLID value (host order) for which to clear.
Packit 13e616
*
Packit 13e616
* RETURN VALUE
Packit 13e616
*	None.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: Forwarding Table/osm_mcast_tbl_is_port
Packit 13e616
* NAME
Packit 13e616
*	osm_mcast_tbl_is_port
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Returns TRUE if the port is in the multicast group.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
boolean_t osm_mcast_tbl_is_port(IN const osm_mcast_tbl_t * p_tbl,
Packit 13e616
				IN uint16_t mlid_ho, IN uint8_t port_num);
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*	p_tbl
Packit 13e616
*		[in] Pointer to the Multicast Forwarding Table object.
Packit 13e616
*
Packit 13e616
*	mlid_ho
Packit 13e616
*		[in] MLID value (host order).
Packit 13e616
*
Packit 13e616
*	port_num
Packit 13e616
*		[in] Port number on the switch
Packit 13e616
*
Packit 13e616
* RETURN VALUE
Packit 13e616
*	Returns the port that routes the specified LID.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: Forwarding Table/osm_mcast_tbl_is_any_port
Packit 13e616
* NAME
Packit 13e616
*	osm_mcast_tbl_is_any_port
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Returns TRUE if any port is in the multicast group.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
boolean_t osm_mcast_tbl_is_any_port(IN const osm_mcast_tbl_t * p_tbl,
Packit 13e616
				    IN uint16_t mlid_ho);
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*	p_tbl
Packit 13e616
*		[in] Pointer to the Multicast Forwarding Table object.
Packit 13e616
*
Packit 13e616
*	mlid_ho
Packit 13e616
*		[in] MLID value (host order).
Packit 13e616
*
Packit 13e616
* RETURN VALUE
Packit 13e616
*	Returns TRUE if any port is in the multicast group.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: Forwarding Table/osm_mcast_tbl_set_block
Packit 13e616
* NAME
Packit 13e616
*	osm_mcast_tbl_set_block
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Copies the specified block into the Multicast Forwarding Table.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
ib_api_status_t osm_mcast_tbl_set_block(IN osm_mcast_tbl_t * p_tbl,
Packit 13e616
					IN const ib_net16_t * p_block,
Packit 13e616
					IN int16_t block_num,
Packit 13e616
					IN uint8_t position);
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*	p_tbl
Packit 13e616
*		[in] Pointer to the Multicast Forwarding Table object.
Packit 13e616
*
Packit 13e616
*	p_block
Packit 13e616
*		[in] Pointer to the Forwarding Table block.
Packit 13e616
*
Packit 13e616
*	block_num
Packit 13e616
*		[in] Block number of this block.
Packit 13e616
*
Packit 13e616
* RETURN VALUE
Packit 13e616
*	None.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: Forwarding Table/osm_mcast_get_tbl_block
Packit 13e616
* NAME
Packit 13e616
*	osm_mcast_get_tbl_block
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Retrieve a multicast forwarding table block.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
boolean_t osm_mcast_tbl_get_block(IN osm_mcast_tbl_t * p_tbl,
Packit 13e616
				  IN int16_t block_num, IN uint8_t position,
Packit 13e616
				  OUT ib_net16_t * p_block);
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*	p_tbl
Packit 13e616
*		[in] Pointer to an osm_mcast_tbl_t object.
Packit 13e616
*
Packit 13e616
*	p_block
Packit 13e616
*		[in] Pointer to the Forwarding Table block.
Packit 13e616
*
Packit 13e616
*	block_num
Packit 13e616
*		[in] Block number of this block.
Packit 13e616
*
Packit 13e616
*	p_block
Packit 13e616
*		[out] Pointer to the 32 entry array to store the
Packit 13e616
*		forwarding table clock specified by block_id.
Packit 13e616
*
Packit 13e616
* RETURN VALUES
Packit 13e616
*	Returns true if there are more blocks necessary to
Packit 13e616
*	configure all the MLIDs reachable from this switch.
Packit 13e616
*	FALSE otherwise.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: Forwarding Table/osm_mcast_tbl_get_max_block
Packit 13e616
* NAME
Packit 13e616
*	osm_mcast_tbl_get_max_block
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Returns the maximum block ID in this table.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
static inline uint16_t osm_mcast_tbl_get_max_block(IN osm_mcast_tbl_t * p_tbl)
Packit 13e616
{
Packit 13e616
	return p_tbl->max_block;
Packit 13e616
}
Packit 13e616
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*	p_tbl
Packit 13e616
*		[in] Pointer to an osm_mcast_tbl_t object.
Packit 13e616
*
Packit 13e616
* RETURN VALUES
Packit 13e616
*	Returns the maximum block ID in this table.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: Forwarding Table/osm_mcast_tbl_get_max_block_in_use
Packit 13e616
* NAME
Packit 13e616
*	osm_mcast_tbl_get_max_block_in_use
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Returns the maximum block ID in use in this table.
Packit 13e616
*	A value of -1 indicates no blocks are in use.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
static inline int16_t
Packit 13e616
osm_mcast_tbl_get_max_block_in_use(IN osm_mcast_tbl_t * p_tbl)
Packit 13e616
{
Packit 13e616
	return (p_tbl->max_block_in_use);
Packit 13e616
}
Packit 13e616
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*	p_tbl
Packit 13e616
*		[in] Pointer to an osm_mcast_tbl_t object.
Packit 13e616
*
Packit 13e616
* RETURN VALUES
Packit 13e616
*	Returns the maximum block ID in use in this table.
Packit 13e616
*	A value of -1 indicates no blocks are in use.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: Forwarding Table/osm_mcast_tbl_get_max_position
Packit 13e616
* NAME
Packit 13e616
*	osm_mcast_tbl_get_max_position
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Returns the maximum position in this table.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
static inline uint8_t
Packit 13e616
osm_mcast_tbl_get_max_position(IN osm_mcast_tbl_t * p_tbl)
Packit 13e616
{
Packit 13e616
	return (p_tbl->max_position);
Packit 13e616
}
Packit 13e616
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*	p_tbl
Packit 13e616
*		[in] Pointer to an osm_mcast_tbl_t object.
Packit 13e616
*
Packit 13e616
* RETURN VALUES
Packit 13e616
*	Returns the maximum position in this table.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*********/
Packit 13e616
Packit 13e616
END_C_DECLS
Packit 13e616
#endif				/* _OSM_MCAST_TBL_H_ */