Blame include/opensm/osm_pkey.h

Packit 13e616
/*
Packit 13e616
 * Copyright (c) 2010 Sun Microsystems, Inc. All rights reserved.
Packit 13e616
 * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
Packit 13e616
 * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
Packit 13e616
 * Copyright (c) 1996-2003 Intel Corporation. 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
#ifndef _OSM_PKEY_H_
Packit 13e616
#define _OSM_PKEY_H_
Packit 13e616
Packit 13e616
#include <iba/ib_types.h>
Packit 13e616
#include <complib/cl_dispatcher.h>
Packit 13e616
#include <complib/cl_map.h>
Packit 13e616
#include <opensm/osm_base.h>
Packit 13e616
#include <opensm/osm_log.h>
Packit 13e616
#include <opensm/osm_msgdef.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
/*
Packit 13e616
   Forward references.
Packit 13e616
*/
Packit 13e616
struct osm_physp;
Packit 13e616
struct osm_port;
Packit 13e616
struct osm_subn;
Packit 13e616
struct osm_node;
Packit 13e616
struct osm_physp;
Packit 13e616
Packit 13e616
/*
Packit 13e616
 * Abstract:
Packit 13e616
 * 	Declaration of pkey manipulation functions.
Packit 13e616
 */
Packit 13e616
Packit 13e616
/****s* OpenSM: osm_pkey_tbl_t
Packit 13e616
* NAME
Packit 13e616
*	osm_pkey_tbl_t
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	This object represents a pkey table. The need for a special object
Packit 13e616
*  is required to optimize search performance of a PKey in the IB standard
Packit 13e616
*  non sorted table.
Packit 13e616
*
Packit 13e616
*	The osm_pkey_tbl_t object should be treated as opaque and should
Packit 13e616
*	be manipulated only through the provided functions.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
typedef struct osm_pkeybl {
Packit 13e616
	cl_map_t accum_pkeys;
Packit 13e616
	cl_ptr_vector_t blocks;
Packit 13e616
	cl_ptr_vector_t new_blocks;
Packit 13e616
	cl_map_t keys;
Packit 13e616
	cl_qlist_t pending;
Packit 13e616
	uint16_t last_pkey_idx;
Packit 13e616
	uint16_t used_blocks;
Packit 13e616
	uint16_t max_blocks;
Packit 13e616
	uint16_t rcv_blocks_cnt;
Packit 13e616
	uint16_t indx0_pkey;
Packit 13e616
} osm_pkey_tbl_t;
Packit 13e616
/*
Packit 13e616
* FIELDS
Packit 13e616
*	accum_pkeys
Packit 13e616
*		Accumulated pkeys with pkey index. Used to
Packit 13e616
*		preserve pkey index.
Packit 13e616
*
Packit 13e616
*	blocks
Packit 13e616
*		The IBA defined blocks of pkey values, updated from the subnet
Packit 13e616
*
Packit 13e616
*	new_blocks
Packit 13e616
*		The blocks of pkey values, will be used for updates by SM
Packit 13e616
*
Packit 13e616
*	keys
Packit 13e616
*		A set holding all keys
Packit 13e616
*
Packit 13e616
*	pending
Packit 13e616
*		A list of osm_pending_pkey structs that is temporarily set by
Packit 13e616
*		the pkey mgr and used during pkey mgr algorithm only
Packit 13e616
*
Packit 13e616
*	used_blocks
Packit 13e616
*		Tracks the number of blocks having non-zero pkeys
Packit 13e616
*
Packit 13e616
*	max_blocks
Packit 13e616
*		The maximal number of blocks this partition table might hold
Packit 13e616
*		this value is based on node_info (for port 0 or CA) or
Packit 13e616
*		switch_info updated on receiving the node_info or switch_info
Packit 13e616
*		GetResp
Packit 13e616
*
Packit 13e616
*	rcv_blocks_cnt
Packit 13e616
*		Counter for the received GetPKeyTable mads.
Packit 13e616
*		For every GetPKeyTable mad we send, increase the counter,
Packit 13e616
*		and for every GetRespPKeyTable we decrease the counter.
Packit 13e616
*
Packit 13e616
*	indx0_pkey
Packit 13e616
*		stores the pkey to be inserted at block 0 index 0.
Packit 13e616
*		if this field is 0, the default pkey will be inserted.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
* 'blocks' vector should be used to store pkey values obtained from
Packit 13e616
* the port and SM pkey manager should not change it directly, for this
Packit 13e616
* purpose 'new_blocks' should be used.
Packit 13e616
*
Packit 13e616
* The only pkey values stored in 'blocks' vector will be mapped with
Packit 13e616
* 'keys' map
Packit 13e616
*
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****s* OpenSM: osm_pending_pkey_t
Packit 13e616
* NAME
Packit 13e616
*	osm_pending_pkey_t
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	This objects stores temporary information on pkeys, their target block,
Packit 13e616
*  and index during the pkey manager operation
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
typedef struct osm_pending_pkey {
Packit 13e616
	cl_list_item_t list_item;
Packit 13e616
	uint16_t pkey;
Packit 13e616
	uint16_t block;
Packit 13e616
	uint8_t index;
Packit 13e616
	boolean_t is_new;
Packit 13e616
} osm_pending_pkey_t;
Packit 13e616
/*
Packit 13e616
* FIELDS
Packit 13e616
*	pkey
Packit 13e616
*		The actual P_Key
Packit 13e616
*
Packit 13e616
*	block
Packit 13e616
*		The block index based on the previous table extracted from the
Packit 13e616
*		device
Packit 13e616
*
Packit 13e616
*	index
Packit 13e616
*		The index of the pkey within the block
Packit 13e616
*
Packit 13e616
*	is_new
Packit 13e616
*		TRUE for new P_Keys such that the block and index are invalid
Packit 13e616
*		in that case
Packit 13e616
*
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: osm_pkey_tbl_construct
Packit 13e616
* NAME
Packit 13e616
*  osm_pkey_tbl_construct
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*  Constructs the PKey table object
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
void osm_pkey_tbl_construct(IN osm_pkey_tbl_t * p_pkey_tbl);
Packit 13e616
/*
Packit 13e616
*  p_pkey_tbl
Packit 13e616
*     [in] Pointer to osm_pkey_tbl_t object.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: osm_pkey_tbl_init
Packit 13e616
* NAME
Packit 13e616
*  osm_pkey_tbl_init
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*  Inits the PKey table object
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
ib_api_status_t osm_pkey_tbl_init(IN osm_pkey_tbl_t * p_pkey_tbl);
Packit 13e616
/*
Packit 13e616
*  p_pkey_tbl
Packit 13e616
*     [in] Pointer to osm_pkey_tbl_t object.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: osm_pkey_tbl_destroy
Packit 13e616
* NAME
Packit 13e616
*  osm_pkey_tbl_destroy
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*  Destroys the PKey table object
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
void osm_pkey_tbl_destroy(IN osm_pkey_tbl_t * p_pkey_tbl);
Packit 13e616
/*
Packit 13e616
*  p_pkey_tbl
Packit 13e616
*     [in] Pointer to osm_pkey_tbl_t object.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: osm_pkey_tbl_get_num_blocks
Packit 13e616
* NAME
Packit 13e616
*  osm_pkey_tbl_get_num_blocks
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*  Obtain the number of blocks in IB PKey table
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
static inline uint16_t
Packit 13e616
osm_pkey_tbl_get_num_blocks(IN const osm_pkey_tbl_t * p_pkey_tbl)
Packit 13e616
{
Packit 13e616
	return ((uint16_t) (cl_ptr_vector_get_size(&p_pkey_tbl->blocks)));
Packit 13e616
}
Packit 13e616
Packit 13e616
/*
Packit 13e616
*  p_pkey_tbl
Packit 13e616
*     [in] Pointer to osm_pkey_tbl_t object.
Packit 13e616
*
Packit 13e616
* RETURN VALUES
Packit 13e616
*  The IB pkey table of that pkey table element
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: osm_pkey_tbl_block_get
Packit 13e616
* NAME
Packit 13e616
*  osm_pkey_tbl_block_get
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*  Obtain the pointer to the IB PKey table block stored in the object
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
static inline ib_pkey_table_t *osm_pkey_tbl_block_get(const osm_pkey_tbl_t *
Packit 13e616
						      p_pkey_tbl,
Packit 13e616
						      uint16_t block)
Packit 13e616
{
Packit 13e616
	return ((block < cl_ptr_vector_get_size(&p_pkey_tbl->blocks)) ?
Packit 13e616
		(ib_pkey_table_t *)cl_ptr_vector_get(
Packit 13e616
		&p_pkey_tbl->blocks, block) : NULL);
Packit 13e616
};
Packit 13e616
Packit 13e616
/*
Packit 13e616
*  p_pkey_tbl
Packit 13e616
*     [in] Pointer to osm_pkey_tbl_t object.
Packit 13e616
*
Packit 13e616
*  block
Packit 13e616
*     [in] The block number to get
Packit 13e616
*
Packit 13e616
* RETURN VALUES
Packit 13e616
*  The IB pkey table of that pkey table element
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: osm_pkey_tbl_new_block_get
Packit 13e616
* NAME
Packit 13e616
*  osm_pkey_tbl_new_block_get
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*  The same as above but for new block
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
static inline ib_pkey_table_t *osm_pkey_tbl_new_block_get(const osm_pkey_tbl_t *
Packit 13e616
							  p_pkey_tbl,
Packit 13e616
							  uint16_t block)
Packit 13e616
{
Packit 13e616
	return ((block < cl_ptr_vector_get_size(&p_pkey_tbl->new_blocks)) ?
Packit 13e616
		(ib_pkey_table_t *)cl_ptr_vector_get(
Packit 13e616
		&p_pkey_tbl->new_blocks, block) : NULL);
Packit 13e616
};
Packit 13e616
Packit 13e616
/****f* OpenSM: osm_pkey_find_last_accum_pkey_index
Packit 13e616
 * NAME
Packit 13e616
 *   osm_pkey_find_last_accum_pkey_index
Packit 13e616
 *
Packit 13e616
 * DESCRIPTION
Packit 13e616
 *   Finds the next last accumulated pkey
Packit 13e616
 *
Packit 13e616
 * SYNOPSIS
Packit 13e616
 */
Packit 13e616
void osm_pkey_find_last_accum_pkey_index(IN osm_pkey_tbl_t * p_pkey_tbl);
Packit 13e616
Packit 13e616
Packit 13e616
/****f* OpenSM: osm_pkey_tbl_set_accum_pkeys
Packit 13e616
* NAME
Packit 13e616
*  osm_pkey_tbl_set_accum_pkeys
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*   Stores the given pkey and pkey index in the "accum_pkeys" array
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
cl_status_t
Packit 13e616
osm_pkey_tbl_set_accum_pkeys(IN osm_pkey_tbl_t * p_pkey_tbl,
Packit 13e616
			     IN uint16_t pkey, IN uint16_t pkey_idx);
Packit 13e616
/*
Packit 13e616
* p_pkey_tbl
Packit 13e616
*   [in] Pointer to the PKey table
Packit 13e616
*
Packit 13e616
* pkey
Packit 13e616
*   [in] PKey to store
Packit 13e616
*
Packit 13e616
* pkey_idx
Packit 13e616
*   [in] The overall index
Packit 13e616
*
Packit 13e616
* RETURN VALUES
Packit 13e616
*   CL_SUCCESS if OK
Packit 13e616
*   CL_INSUFFICIENT_MEMORY if failed
Packit 13e616
*
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: osm_pkey_tbl_set_new_entry
Packit 13e616
* NAME
Packit 13e616
*  osm_pkey_tbl_set_new_entry
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*   Stores the given pkey in the "new" blocks array and update
Packit 13e616
*   the "map" to show that on the "old" blocks
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
ib_api_status_t
Packit 13e616
osm_pkey_tbl_set_new_entry(IN osm_pkey_tbl_t * p_pkey_tbl,
Packit 13e616
			   IN uint16_t block_idx,
Packit 13e616
			   IN uint8_t pkey_idx, IN uint16_t pkey);
Packit 13e616
/*
Packit 13e616
* p_pkey_tbl
Packit 13e616
*   [in] Pointer to the PKey table
Packit 13e616
*
Packit 13e616
* block_idx
Packit 13e616
*   [in] The block index to use
Packit 13e616
*
Packit 13e616
* pkey_idx
Packit 13e616
*   [in] The index within the block
Packit 13e616
*
Packit 13e616
* pkey
Packit 13e616
*   [in] PKey to store
Packit 13e616
*
Packit 13e616
* RETURN VALUES
Packit 13e616
*   IB_SUCCESS if OK
Packit 13e616
*   IB_ERROR if failed
Packit 13e616
*
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: osm_pkey_find_next_free_entry
Packit 13e616
* NAME
Packit 13e616
*  osm_pkey_find_next_free_entry
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*  Find the next free entry in the PKey table starting at the given
Packit 13e616
*  index and block number. The user should increment pkey_idx before
Packit 13e616
*  next call
Packit 13e616
*  Inspect the "new" blocks array for empty space.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
boolean_t
Packit 13e616
osm_pkey_find_next_free_entry(IN osm_pkey_tbl_t * p_pkey_tbl,
Packit 13e616
			      OUT uint16_t * p_block_idx,
Packit 13e616
			      OUT uint8_t * p_pkey_idx);
Packit 13e616
/*
Packit 13e616
* p_pkey_tbl
Packit 13e616
*   [in] Pointer to the PKey table
Packit 13e616
*
Packit 13e616
* p_block_idx
Packit 13e616
*   [out] The block index to use
Packit 13e616
*
Packit 13e616
* p_pkey_idx
Packit 13e616
*   [out] The index within the block to use
Packit 13e616
*
Packit 13e616
* RETURN VALUES
Packit 13e616
*   TRUE if found
Packit 13e616
*   FALSE if did not find
Packit 13e616
*
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: osm_pkey_tbl_init_new_blocks
Packit 13e616
* NAME
Packit 13e616
*  osm_pkey_tbl_init_new_blocks
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*  Initializes new_blocks vector content (allocate and clear)
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
void osm_pkey_tbl_init_new_blocks(const osm_pkey_tbl_t * p_pkey_tbl);
Packit 13e616
/*
Packit 13e616
*  p_pkey_tbl
Packit 13e616
*     [in] Pointer to osm_pkey_tbl_t object.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: osm_pkey_tbl_get_block_and_idx
Packit 13e616
* NAME
Packit 13e616
*  osm_pkey_tbl_get_block_and_idx
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*  Set the block index and pkey index the given
Packit 13e616
*  pkey is found in. Return IB_NOT_FOUND if could
Packit 13e616
*  not find it, IB_SUCCESS if OK
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
ib_api_status_t
Packit 13e616
osm_pkey_tbl_get_block_and_idx(IN osm_pkey_tbl_t * p_pkey_tbl,
Packit 13e616
			       IN uint16_t * p_pkey,
Packit 13e616
			       OUT uint16_t * block_idx,
Packit 13e616
			       OUT uint8_t * pkey_index);
Packit 13e616
/*
Packit 13e616
*  p_pkey_tbl
Packit 13e616
*     [in] Pointer to osm_pkey_tbl_t object.
Packit 13e616
*
Packit 13e616
*  p_pkey
Packit 13e616
*     [in] Pointer to the P_Key entry searched
Packit 13e616
*
Packit 13e616
*  p_block_idx
Packit 13e616
*     [out] Pointer to the block index to be updated
Packit 13e616
*
Packit 13e616
*  p_pkey_idx
Packit 13e616
*     [out] Pointer to the pkey index (in the block) to be updated
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: osm_pkey_tbl_set
Packit 13e616
* NAME
Packit 13e616
*  osm_pkey_tbl_set
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*  Set the PKey table block provided in the PKey object.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
ib_api_status_t
Packit 13e616
osm_pkey_tbl_set(IN osm_pkey_tbl_t * p_pkey_tbl,
Packit 13e616
		 IN uint16_t block, IN ib_pkey_table_t * p_tbl,
Packit 13e616
		 IN boolean_t allow_both_pkeys);
Packit 13e616
/*
Packit 13e616
*  p_pkey_tbl
Packit 13e616
*     [in] Pointer to osm_pkey_tbl_t object
Packit 13e616
*
Packit 13e616
*  block
Packit 13e616
*     [in] The block number to set
Packit 13e616
*
Packit 13e616
*  p_tbl
Packit 13e616
*     [in] The IB PKey block to copy to the object
Packit 13e616
*
Packit 13e616
*  allow_both_pkeys
Packit 13e616
*     [in] Whether both full and limited membership on same partition
Packit 13e616
*          are allowed
Packit 13e616
*
Packit 13e616
* RETURN VALUES
Packit 13e616
*  IB_SUCCESS or IB_ERROR
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: osm_physp_share_this_pkey
Packit 13e616
* NAME
Packit 13e616
*  osm_physp_share_this_pkey
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*  Checks if the given physical ports share the specified pkey.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
boolean_t osm_physp_share_this_pkey(IN const struct osm_physp * p_physp1,
Packit 13e616
				    IN const struct osm_physp * p_physp2,
Packit 13e616
				    IN ib_net16_t pkey,
Packit 13e616
				    IN boolean_t allow_both_pkeys);
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*
Packit 13e616
*  p_physp1
Packit 13e616
*     [in] Pointer to an osm_physp_t object.
Packit 13e616
*
Packit 13e616
*  p_physp2
Packit 13e616
*     [in] Pointer to an osm_physp_t object.
Packit 13e616
*
Packit 13e616
*  pkey
Packit 13e616
*     [in] value of P_Key to check.
Packit 13e616
*
Packit 13e616
*  allow_both_pkeys
Packit 13e616
*     [in] whether both pkeys allowed policy is being used.
Packit 13e616
*
Packit 13e616
* RETURN VALUES
Packit 13e616
*  Returns TRUE if the two ports are matching.
Packit 13e616
*  FALSE otherwise.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: osm_physp_find_common_pkey
Packit 13e616
* NAME
Packit 13e616
*  osm_physp_find_common_pkey
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*  Returns first matching P_Key values for specified physical ports.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
ib_net16_t osm_physp_find_common_pkey(IN const struct osm_physp *p_physp1,
Packit 13e616
				      IN const struct osm_physp *p_physp2,
Packit 13e616
				      IN boolean_t allow_both_pkeys);
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*
Packit 13e616
*  p_physp1
Packit 13e616
*     [in] Pointer to an osm_physp_t object.
Packit 13e616
*
Packit 13e616
*  p_physp2
Packit 13e616
*     [in] Pointer to an osm_physp_t object.
Packit 13e616
*
Packit 13e616
*  allow_both_pkeys
Packit 13e616
*     [in] Whether both full and limited membership on same partition
Packit 13e616
*          are allowed
Packit 13e616
*
Packit 13e616
* RETURN VALUES
Packit 13e616
*  Returns value of first shared P_Key or INVALID P_Key (0x0) if not
Packit 13e616
*  found.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: osm_physp_share_pkey
Packit 13e616
* NAME
Packit 13e616
*  osm_physp_share_pkey
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*  Checks if the given physical ports share a pkey.
Packit 13e616
*  The meaning P_Key matching:
Packit 13e616
*  10.9.3 :
Packit 13e616
*   In the following, let M_P_Key(Message P_Key) be the P_Key in the incoming
Packit 13e616
*   packet and E_P_Key(Endnode P_Key) be the P_Key it is being compared against
Packit 13e616
*   in the packet's destination endnode.
Packit 13e616
*
Packit 13e616
*    If:
Packit 13e616
*    * neither M_P_Key nor E_P_Key are the invalid P_Key
Packit 13e616
*    * and the low-order 15 bits of the M_P_Key match the low order 15
Packit 13e616
*      bits of the E_P_Key
Packit 13e616
*    * and the high order bit(membership type) of both the M_P_Key and
Packit 13e616
*      E_P_Key are not both 0 (i.e., both are not Limited members of
Packit 13e616
*      the partition)
Packit 13e616
*
Packit 13e616
*    then the P_Keys are said to match.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
boolean_t osm_physp_share_pkey(IN osm_log_t * p_log,
Packit 13e616
			       IN const struct osm_physp * p_physp_1,
Packit 13e616
			       IN const struct osm_physp * p_physp_2,
Packit 13e616
			       IN boolean_t allow_both_pkeys);
Packit 13e616
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*  p_log
Packit 13e616
*     [in] Pointer to a log object.
Packit 13e616
*
Packit 13e616
*  p_physp_1
Packit 13e616
*     [in] Pointer to an osm_physp_t object.
Packit 13e616
*
Packit 13e616
*  p_physp_2
Packit 13e616
*     [in] Pointer to an osm_physp_t object.
Packit 13e616
*
Packit 13e616
*  allow_both_pkeys
Packit 13e616
*     [in] Whether both full and limited membership on same partition
Packit 13e616
*          are allowed
Packit 13e616
*
Packit 13e616
* RETURN VALUES
Packit 13e616
*  Returns TRUE if the 2 physical ports are matching.
Packit 13e616
*  FALSE otherwise.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: osm_port_share_pkey
Packit 13e616
* NAME
Packit 13e616
*  osm_port_share_pkey
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*  Checks if the given ports (on their default physical port) share a pkey.
Packit 13e616
*  The meaning P_Key matching:
Packit 13e616
*  10.9.3 :
Packit 13e616
*   In the following, let M_P_Key(Message P_Key) be the P_Key in the incoming
Packit 13e616
*   packet and E_P_Key(Endnode P_Key) be the P_Key it is being compared against
Packit 13e616
*   in the packet's destination endnode.
Packit 13e616
*
Packit 13e616
*    If:
Packit 13e616
*    * neither M_P_Key nor E_P_Key are the invalid P_Key
Packit 13e616
*    * and the low-order 15 bits of the M_P_Key match the low order 15
Packit 13e616
*      bits of the E_P_Key
Packit 13e616
*    * and the high order bit(membership type) of both the M_P_Key and
Packit 13e616
*      E_P_Key are not both 0 (i.e., both are not Limited members of
Packit 13e616
*      the partition)
Packit 13e616
*
Packit 13e616
*    then the P_Keys are said to match.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
boolean_t osm_port_share_pkey(IN osm_log_t * p_log,
Packit 13e616
			      IN const struct osm_port * p_port_1,
Packit 13e616
			      IN const struct osm_port * p_port_2,
Packit 13e616
			      IN boolean_t allow_both_pkeys);
Packit 13e616
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*  p_log
Packit 13e616
*     [in] Pointer to a log object.
Packit 13e616
*
Packit 13e616
*  p_port_1
Packit 13e616
*     [in] Pointer to an osm_port_t object.
Packit 13e616
*
Packit 13e616
*  p_port_2
Packit 13e616
*     [in] Pointer to an osm_port_t object.
Packit 13e616
*
Packit 13e616
* RETURN VALUES
Packit 13e616
*  Returns TRUE if the 2 ports are matching.
Packit 13e616
*  FALSE otherwise.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: osm_physp_has_pkey
Packit 13e616
* NAME
Packit 13e616
*  osm_physp_has_pkey
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Given a physp and a pkey, check if pkey exists in physp pkey table
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
boolean_t osm_physp_has_pkey(IN osm_log_t * p_log, IN ib_net16_t pkey,
Packit 13e616
			     IN const struct osm_physp *p_physp);
Packit 13e616
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*  p_log
Packit 13e616
*     [in] Pointer to a log object.
Packit 13e616
*
Packit 13e616
*  pkey
Packit 13e616
*     [in] pkey number to look for.
Packit 13e616
*
Packit 13e616
*  p_physp
Packit 13e616
*     [in] Pointer to osm_physp_t object.
Packit 13e616
*
Packit 13e616
* RETURN VALUES
Packit 13e616
*  Returns TRUE if the p_physp has the pkey given. False otherwise.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM: osm_pkey_tbl_set_indx0_pkey
Packit 13e616
* NAME
Packit 13e616
*  osm_pkey_tbl_set_indx0_pkey
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*  Sets given pkey at index0 in given pkey_tbl.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
void osm_pkey_tbl_set_indx0_pkey(IN osm_log_t * p_log, IN ib_net16_t pkey,
Packit 13e616
				 IN boolean_t full,
Packit 13e616
				 OUT osm_pkey_tbl_t * p_pkey_tbl);
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*  p_log
Packit 13e616
*     [in] Pointer to a log object.
Packit 13e616
*
Packit 13e616
*  pkey
Packit 13e616
*     [in] P_Key.
Packit 13e616
*
Packit 13e616
*  full
Packit 13e616
*     [in] Indication if this is a full/limited membership pkey.
Packit 13e616
*
Packit 13e616
*  p_pkey_tbl
Packit 13e616
*     [out] Pointer to osm_pkey_tbl_t object in which to set indx0 pkey.
Packit 13e616
*
Packit 13e616
* RETURN VALUES
Packit 13e616
*  None
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
*********/
Packit 13e616
END_C_DECLS
Packit 13e616
#endif				/* _OSM_PKEY_H_ */