[openib-general] RE: [PATCH 2/4] opensm: remove unused osm_pkey_mgr_t object

Eitan Zahavi eitan at mellanox.co.il
Tue May 2 01:41:24 PDT 2006


Hi Sasha,

I really do not like this patch. I think that although it does not break
the code TODAY, it will be reversed later. 
OpenSM uses the concept of "manager" for each of the algorithms used.
One could claim that all these managers are redundant and could be
replaced by an extension to the osm object. This is true but will result
with a non clear boundary between the managers.

Although there is no right or wrong on this kind of issues, I think that
the winning argument is that today OpenSM is written according to the
above simple rule.
Let's not break it. 

Eitan Zahavi
Design Technology Director
Mellanox Technologies LTD
Tel:+972-4-9097208
Fax:+972-4-9593245
P.O. Box 586 Yokneam 20692 ISRAEL


> -----Original Message-----
> From: Sasha Khapyorsky [mailto:sashak at voltaire.com]
> Sent: Sunday, April 23, 2006 5:26 PM
> To: Hal Rosenstock
> Cc: openib-general at openib.org; Eitan Zahavi; Ofer Gigi; Yael Kalka
> Subject: [PATCH 2/4] opensm: remove unused osm_pkey_mgr_t object
> 
> 
> The structure osm_pkey_mgr_t is not used for pkey management -
> clean it up.
> 
> Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
> ---
> 
>  osm/include/opensm/osm_pkey_mgr.h  |  183
++----------------------------------
>  osm/include/opensm/osm_sm.h        |    2
>  osm/include/opensm/osm_state_mgr.h |   11 --
>  osm/opensm/osm_pkey_mgr.c          |  182
++++++++++++++----------------------
>  osm/opensm/osm_sm.c                |   12 --
>  osm/opensm/osm_state_mgr.c         |    8 +-
>  6 files changed, 82 insertions(+), 316 deletions(-)
> 
> diff --git a/osm/include/opensm/osm_pkey_mgr.h
> b/osm/include/opensm/osm_pkey_mgr.h
> index fef3667..cb0075d 100644
> --- a/osm/include/opensm/osm_pkey_mgr.h
> +++ b/osm/include/opensm/osm_pkey_mgr.h
> @@ -1,4 +1,5 @@
>  /*
> + * Copyright (c) 2006 Voltaire, Inc. All rights reserved.
>   * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights
reserved.
>   *
>   * This software is available to you under a choice of one of two
> @@ -35,9 +36,8 @@
> 
>  /*
>   * Abstract:
> - * 	Declaration of osm_pkey_mgr_t.
> - *	This object represents the P_Key Manager object.
> - *	This object is part of the OpenSM family of objects.
> + * 	Prototype for osm_pkey_mgr_process() function
> + *	This is part of the OpenSM family of objects.
>   *
>   * Environment:
>   * 	Linux User Mode
> @@ -49,10 +49,8 @@
>  #ifndef _OSM_PKEY_MGR_H_
>  #define _OSM_PKEY_MGR_H_
> 
> -#include <complib/cl_passivelock.h>
> -#include <opensm/osm_subnet.h>
> -#include <opensm/osm_req.h>
> -#include <opensm/osm_log.h>
> +#include <opensm/osm_base.h>
> +#include <opensm/osm_opensm.h>
> 
>  #ifdef __cplusplus
>  #  define BEGIN_C_DECLS extern "C" {
> @@ -64,166 +62,6 @@ #endif /* __cplusplus */
> 
>  BEGIN_C_DECLS
> 
> -/****h* OpenSM/P_Key Manager
> -* NAME
> -*	P_Key Manager
> -*
> -* DESCRIPTION
> -*	The P_Key Manager object manage the p_key tables of all
> -*	objects in the subnet
> -*
> -* AUTHOR
> -*	Ofer Gigi, Mellanox
> -*
> -*********/
> -/****s* OpenSM: P_Key Manager/osm_pkey_mgr_t
> -* NAME
> -*	osm_pkey_mgr_t
> -*
> -* DESCRIPTION
> -*	p_Key Manager structure.
> -*
> -*
> -* SYNOPSIS
> -*/
> -
> -typedef struct _osm_pkey_mgr
> -{
> -    osm_subn_t					*p_subn;
> -	osm_log_t					*p_log;
> -	osm_req_t					*p_req;
> -	cl_plock_t					*p_lock;
> -
> -} osm_pkey_mgr_t;
> -
> -/*
> -* FIELDS
> -*	p_subn
> -*		Pointer to the Subnet object for this subnet.
> -*
> -*	p_log
> -*		Pointer to the log object.
> -*
> -*	p_req
> -*		Pointer to the Request object.
> -*
> -*	p_lock
> -*		Pointer to the serializing lock.
> -*
> -* SEE ALSO
> -*	P_Key Manager object
> -*********/
> -
> -/****** OpenSM: P_Key Manager/osm_pkey_mgr_construct
> -* NAME
> -*	osm_pkey_mgr_construct
> -*
> -* DESCRIPTION
> -*	This function constructs a P_Key Manager object.
> -*
> -* SYNOPSIS
> -*/
> -void
> -osm_pkey_mgr_construct(
> -	IN osm_pkey_mgr_t* const p_mgr );
> -/*
> -* PARAMETERS
> -*	p_mgr
> -*		[in] Pointer to a P_Key Manager object to construct.
> -*
> -* RETURN VALUE
> -*	This function does not return a value.
> -*
> -* NOTES
> -*	Allows calling osm_pkey_mgr_init, osm_pkey_mgr_destroy
> -*
> -*	Calling osm_pkey_mgr_construct is a prerequisite to calling any
other
> -*	method except osm_pkey_mgr_init.
> -*
> -* SEE ALSO
> -*	P_Key Manager object, osm_pkey_mgr_init,
> -*	osm_pkey_mgr_destroy
> -*********/
> -
> -/****f* OpenSM: P_Key Manager/osm_pkey_mgr_destroy
> -* NAME
> -*	osm_pkey_mgr_destroy
> -*
> -* DESCRIPTION
> -*	The osm_pkey_mgr_destroy function destroys the object, releasing
> -*	all resources.
> -*
> -* SYNOPSIS
> -*/
> -void
> -osm_pkey_mgr_destroy(
> -	IN osm_pkey_mgr_t* const p_mgr );
> -/*
> -* PARAMETERS
> -*	p_mgr
> -*		[in] Pointer to the object to destroy.
> -*
> -* RETURN VALUE
> -*	This function does not return a value.
> -*
> -* NOTES
> -*	Performs any necessary cleanup of the specified
> -*	P_Key Manager object.
> -*	Further operations should not be attempted on the destroyed
object.
> -*	This function should only be called after a call to
> -*	osm_pkey_mgr_construct or osm_pkey_mgr_init.
> -*
> -* SEE ALSO
> -*	P_Key Manager object, osm_pkey_mgr_construct,
> -*	osm_pkey_mgr_init
> -*********/
> -
> -/****f* OpenSM: P_Key Manager/osm_pkey_mgr_init
> -* NAME
> -*	osm_pkey_mgr_init
> -*
> -* DESCRIPTION
> -*	The osm_pkey_mgr_init function initializes a
> -*	P_Key Manager object for use.
> -*
> -* SYNOPSIS
> -*/
> -ib_api_status_t
> -osm_pkey_mgr_init(
> -	IN osm_pkey_mgr_t* const p_mgr,
> -	IN osm_subn_t* const p_subn,
> -	IN osm_log_t* const p_log,
> -	IN osm_req_t* const p_req,
> -	IN cl_plock_t* const p_lock );
> -/*
> -* PARAMETERS
> -*	p_mgr
> -*		[in] Pointer to an osm_pkey_mgr_t object to initialize.
> -*
> -*	p_subn
> -*		[in] Pointer to the Subnet object for this subnet.
> -*
> -*	p_log
> -*		[in] Pointer to the log object.
> -*
> -*	p_req
> -*		[in] Pointer to an osm_req_t object.
> -*
> -*	p_lock
> -*		[in] Pointer to the OpenSM serializing lock.
> -*
> -* RETURN VALUES
> -*	IB_SUCCESS if the P_Key Manager object was initialized
> -*	successfully.
> -*
> -* NOTES
> -*	Allows calling other P_Key Manager methods.
> -*
> -* SEE ALSO
> -*	P_Key Manager object, osm_pkey_mgr_construct,
> -*	osm_pkey_mgr_destroy
> -*********/
> -
>  /****f* OpenSM: P_Key Manager/osm_pkey_mgr_process
>  * NAME
>  *	osm_pkey_mgr_process
> @@ -235,23 +73,18 @@ osm_pkey_mgr_init(
>  */
>  osm_signal_t
>  osm_pkey_mgr_process(
> -	IN const osm_pkey_mgr_t* const p_mgr );
> +	IN osm_opensm_t *p_osm );
>  /*
>  * PARAMETERS
> -*	p_mgr
> -*		[in] Pointer to an osm_pkey_mgr_t object.
> +*	p_osm
> +*		[in] Pointer to an osm_opensm_t object.
>  *
>  * RETURN VALUES
>  *	None
>  *
>  * NOTES
> -*   Current Operations:
> -*   - Inserts IB_DEFAULT_PKEY to all node objects that don't have
> -*      IB_DEFAULT_PARTIAL_PKEY or IB_DEFAULT_PKEY as part
> -*     of their p_key table
>  *
>  * SEE ALSO
> -*	P_Key Manager
>  *********/
> 
>  END_C_DECLS
> diff --git a/osm/include/opensm/osm_sm.h b/osm/include/opensm/osm_sm.h
> index d9fbd8a..d6086d4 100644
> --- a/osm/include/opensm/osm_sm.h
> +++ b/osm/include/opensm/osm_sm.h
> @@ -74,7 +74,6 @@ #include <opensm/osm_lid_mgr.h>
>  #include <opensm/osm_ucast_mgr.h>
>  #include <opensm/osm_link_mgr.h>
>  #include <opensm/osm_drop_mgr.h>
> -#include <opensm/osm_pkey_mgr.h>
>  #include <opensm/osm_lin_fwd_rcv_ctrl.h>
>  #include <opensm/osm_mcast_fwd_rcv_ctrl.h>
>  #include <opensm/osm_sweep_fail_ctrl.h>
> @@ -162,7 +161,6 @@ typedef struct _osm_sm
>    osm_link_mgr_t           link_mgr;
>    osm_state_mgr_t          state_mgr;
>    osm_drop_mgr_t           drop_mgr;
> -  osm_pkey_mgr_t           pkey_mgr;
>    osm_lft_rcv_t            lft_rcv;
>    osm_lft_rcv_ctrl_t       lft_rcv_ctrl;
>    osm_mft_rcv_t            mft_rcv;
> diff --git a/osm/include/opensm/osm_state_mgr.h
> b/osm/include/opensm/osm_state_mgr.h
> index 92aa910..a9385d1 100644
> --- a/osm/include/opensm/osm_state_mgr.h
> +++ b/osm/include/opensm/osm_state_mgr.h
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
> + * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
>   * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights
reserved.
>   * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
>   *
> @@ -60,7 +60,6 @@ #include <opensm/osm_ucast_mgr.h>
>  #include <opensm/osm_mcast_mgr.h>
>  #include <opensm/osm_link_mgr.h>
>  #include <opensm/osm_drop_mgr.h>
> -#include <opensm/osm_pkey_mgr.h>
>  #include <opensm/osm_sm_mad_ctrl.h>
>  #include <opensm/osm_log.h>
> 
> @@ -113,7 +112,6 @@ typedef struct _osm_state_mgr
>    osm_mcast_mgr_t			*p_mcast_mgr;
>    osm_link_mgr_t				*p_link_mgr;
>    osm_drop_mgr_t				*p_drop_mgr;
> -  osm_pkey_mgr_t				*p_pkey_mgr;
>    osm_req_t					*p_req;
>    osm_stats_t					*p_stats;
>    struct _osm_sm_state_mgr  *p_sm_state_mgr;
> @@ -151,9 +149,6 @@ typedef struct _osm_state_mgr
>  *	p_drop_mgr
>  *		Pointer to the Drop Manager object.
>  *
> -*	p_pkey_mgr
> -*		Pointer to the P_Key Manager object.
> -*
>  *	p_req
>  *		Pointer to the Requester object sending SMPs.
>  *
> @@ -379,7 +374,6 @@ osm_state_mgr_init(
>  	IN osm_mcast_mgr_t*			const p_mcast_mgr,
>  	IN osm_link_mgr_t*			const p_link_mgr,
>  	IN osm_drop_mgr_t*			const p_drop_mgr,
> -	IN osm_pkey_mgr_t*			const p_pkey_mgr,
>  	IN osm_req_t*				const p_req,
>     IN osm_stats_t*               const p_stats,
>     IN struct _osm_sm_state_mgr*  const p_sm_state_mgr,
> @@ -411,9 +405,6 @@ osm_state_mgr_init(
>  *	p_drop_mgr
>  *		[in] Pointer to the Drop Manager object.
>  *
> -*	p_pkey_mgr
> -*		[in] Pointer to the P_Key Manager object.
> -*
>  *	p_req
>  *		[in] Pointer to the Request Controller object.
>  *
> diff --git a/osm/opensm/osm_pkey_mgr.c b/osm/opensm/osm_pkey_mgr.c
> index bdb3ae4..7b3da26 100644
> --- a/osm/opensm/osm_pkey_mgr.c
> +++ b/osm/opensm/osm_pkey_mgr.c
> @@ -37,9 +37,8 @@
> 
>  /*
>   * Abstract:
> - *    Implementation of osm_pkey_mgr_t.
> - * This object represents the P_Key Manager object.
> - * This object is part of the opensm family of objects.
> + * Implementation of the P_Key Manager (Partititon Manager).
> + * This is part of the OpenSM.
>   *
>   * Environment:
>   *    Linux User Mode
> @@ -58,62 +57,15 @@ #include <opensm/osm_node.h>
>  #include <opensm/osm_switch.h>
>  #include <opensm/osm_pkey_mgr.h>
>  #include <opensm/osm_partition.h>
> -
>
-/**********************************************************************
> -
**********************************************************************/
> -void
> -osm_pkey_mgr_construct(
> -   IN osm_pkey_mgr_t * const p_mgr )
> -{
> -   CL_ASSERT( p_mgr );
> -   cl_memclr( p_mgr, sizeof( *p_mgr ) );
> -}
> -
>
-/**********************************************************************
> -
**********************************************************************/
> -void
> -osm_pkey_mgr_destroy(
> -   IN osm_pkey_mgr_t * const p_mgr )
> -{
> -   CL_ASSERT( p_mgr );
> -
> -   OSM_LOG_ENTER( p_mgr->p_log, osm_pkey_mgr_destroy );
> -
> -   OSM_LOG_EXIT( p_mgr->p_log );
> -}
> -
>
-/**********************************************************************
> -
**********************************************************************/
> -ib_api_status_t
> -osm_pkey_mgr_init(
> -   IN osm_pkey_mgr_t * const p_mgr,
> -   IN osm_subn_t * const p_subn,
> -   IN osm_log_t * const p_log,
> -   IN osm_req_t * const p_req,
> -   IN cl_plock_t * const p_lock )
> -{
> -   ib_api_status_t status = IB_SUCCESS;
> -
> -   OSM_LOG_ENTER( p_log, osm_pkey_mgr_init );
> -
> -   osm_pkey_mgr_construct( p_mgr );
> -
> -   p_mgr->p_log = p_log;
> -   p_mgr->p_subn = p_subn;
> -   p_mgr->p_lock = p_lock;
> -   p_mgr->p_req = p_req;
> -
> -   OSM_LOG_EXIT( p_mgr->p_log );
> -   return ( status );
> -}
> +#include <opensm/osm_opensm.h>
> 
>
/**********************************************************************
>
**********************************************************************/
>  static ib_api_status_t
> -osm_pkey_mgr_update_pkey_entry(
> -   IN const osm_pkey_mgr_t * const p_mgr,
> -   IN const osm_physp_t * p_physp,
> -   IN const ib_pkey_table_t * block,
> +pkey_mgr_update_pkey_entry(
> +   IN const osm_req_t *p_req,
> +   IN const osm_physp_t *p_physp,
> +   IN const ib_pkey_table_t *block,
>     IN const uint16_t block_index )
>  {
>     osm_madw_context_t context;
> @@ -126,7 +78,7 @@ osm_pkey_mgr_update_pkey_entry(
>     attr_mod = block_index;
>     if ( osm_node_get_type( p_node ) == IB_NODE_TYPE_SWITCH )
>        attr_mod |= osm_physp_get_port_num( p_physp ) << 16;
> -   return osm_req_set( p_mgr->p_req, osm_physp_get_dr_path_ptr(
p_physp ),
> +   return osm_req_set( p_req, osm_physp_get_dr_path_ptr( p_physp ),
>                         ( uint8_t * ) block, sizeof( *block ),
>                         IB_MAD_ATTR_P_KEY_TABLE,
>                         cl_hton32( attr_mod ), CL_DISP_MSGID_NONE,
&context );
> @@ -135,9 +87,9 @@ osm_pkey_mgr_update_pkey_entry(
>
/**********************************************************************
>
**********************************************************************/
>  static ib_api_status_t
> -osm_pkey_mgr_enforce_partition(
> -   IN const osm_pkey_mgr_t * const p_mgr,
> -   IN const osm_physp_t * p_physp,
> +pkey_mgr_enforce_partition(
> +   IN const osm_req_t *p_req,
> +   IN const osm_physp_t *p_physp,
>     IN const boolean_t enforce)
>  {
>     osm_madw_context_t context;
> @@ -168,7 +120,7 @@ osm_pkey_mgr_enforce_partition(
>     context.pi_context.ignore_errors = FALSE;
>     context.pi_context.light_sweep = FALSE;
> 
> -   return osm_req_set( p_mgr->p_req, osm_physp_get_dr_path_ptr(
p_physp ),
> +   return osm_req_set( p_req, osm_physp_get_dr_path_ptr( p_physp ),
>                         payload, sizeof(payload),
>                         IB_MAD_ATTR_PORT_INFO,
>                         cl_hton32(osm_physp_get_port_num( p_physp )),
> @@ -184,10 +136,11 @@ osm_pkey_mgr_enforce_partition(
>   */
> 
>  static boolean_t
> -__osm_pkey_mgr_process_physical_port(
> -   IN const osm_pkey_mgr_t * const p_mgr,
> +pkey_mgr_process_physical_port(
> +   IN osm_log_t *p_log,
> +   IN const osm_req_t *p_req,
>     IN const ib_net16_t pkey,
> -   IN osm_physp_t * p_physp )
> +   IN osm_physp_t *p_physp )
>  {
>     boolean_t return_val = FALSE; /* TRUE if pkey was inserted or
updated */
>     ib_api_status_t status;
> @@ -200,7 +153,7 @@ __osm_pkey_mgr_process_physical_port(
>     uint32_t i;
>     boolean_t block_found = FALSE;
> 
> -   OSM_LOG_ENTER( p_mgr->p_log, __osm_pkey_mgr_process_physical_port
);
> +   OSM_LOG_ENTER( p_log, pkey_mgr_process_physical_port );
> 
>     p_pkey_tbl = osm_physp_get_pkey_tbl( p_physp );
>     num_of_blocks = osm_pkey_tbl_get_num_blocks( p_pkey_tbl );
> @@ -209,10 +162,10 @@ __osm_pkey_mgr_process_physical_port(
> 
>     if ( p_orig_pkey && *p_orig_pkey == pkey )
>     {
> -      if ( osm_log_is_active( p_mgr->p_log, OSM_LOG_VERBOSE ) )
> +      if ( osm_log_is_active( p_log, OSM_LOG_VERBOSE ) )
>        {
> -         osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
> -                  "__osm_pkey_mgr_process_physical_port:  "
> +         osm_log( p_log, OSM_LOG_VERBOSE,
> +                  "pkey_mgr_process_physical_port:  "
>                    "No need to insert pkey 0x%04x for node 0x%016"
PRIx64
>                    " port %u\n",
>                    cl_ntoh16( pkey ),
> @@ -258,8 +211,8 @@ __osm_pkey_mgr_process_physical_port(
> 
>     if ( block_found == FALSE )
>     {
> -      osm_log( p_mgr->p_log, OSM_LOG_ERROR,
> -               "__osm_pkey_mgr_process_physical_port: ERR 0501: "
> +      osm_log( p_log, OSM_LOG_ERROR,
> +               "pkey_mgr_process_physical_port: ERR 0501: "
>                 "No empty pkey entry was found to insert 0x%04x for
node "
>                 "0x%016" PRIx64 " port %u\n",
>                 cl_ntoh16( pkey ),
> @@ -269,13 +222,13 @@ __osm_pkey_mgr_process_physical_port(
>     }
> 
>     status =
> -      osm_pkey_mgr_update_pkey_entry( p_mgr, p_physp, block,
block_index );
> +      pkey_mgr_update_pkey_entry( p_req, p_physp, block, block_index
);
> 
>     if ( status != IB_SUCCESS )
>     {
> -      osm_log( p_mgr->p_log, OSM_LOG_ERROR,
> -               "__osm_pkey_mgr_process_physical_port:  "
> -               "osm_pkey_mgr_update_pkey_entry() failed to update "
> +      osm_log( p_log, OSM_LOG_ERROR,
> +               "pkey_mgr_process_physical_port:  "
> +               "pkey_mgr_update_pkey_entry() failed to update "
>                 "pkey table block %d for node 0x%016" PRIx64 " port
%u\n",
>                 block_index,
>                 cl_ntoh64( osm_node_get_node_guid( p_node ) ),
> @@ -285,10 +238,10 @@ __osm_pkey_mgr_process_physical_port(
> 
>     return_val = TRUE;           /* pkey was inserted/updated */
> 
> -   if ( osm_log_is_active( p_mgr->p_log, OSM_LOG_VERBOSE ) )
> +   if ( osm_log_is_active( p_log, OSM_LOG_VERBOSE ) )
>     {
> -      osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
> -               "__osm_pkey_mgr_process_physical_port:  "
> +      osm_log( p_log, OSM_LOG_VERBOSE,
> +               "pkey_mgr_process_physical_port:  "
>                 "pkey 0x%04x was inserted for node 0x%016" PRIx64
>                 " port %u\n",
>                 cl_ntoh16( pkey ),
> @@ -297,7 +250,7 @@ __osm_pkey_mgr_process_physical_port(
>     }
> 
>   _done:
> -   OSM_LOG_EXIT( p_mgr->p_log );
> +   OSM_LOG_EXIT( p_log );
>     return ( return_val );
>  }
> 
> @@ -305,9 +258,11 @@ __osm_pkey_mgr_process_physical_port(
>
/**********************************************************************
>
**********************************************************************/
>  static void
> -osm_pkey_mgr_update_peer_port(
> -   const osm_pkey_mgr_t * const p_mgr,
> -   const osm_port_t * const p_port,
> +pkey_mgr_update_peer_port(
> +   osm_log_t *p_log,
> +   const osm_req_t *p_req,
> +   const osm_subn_t *p_subn,
> +   const osm_port_t *p_port,
>     boolean_t enforce)
>  {
>     osm_physp_t *p, *peer;
> @@ -330,15 +285,15 @@ osm_pkey_mgr_update_peer_port(
>     if ( osm_node_get_type( p_node ) != IB_NODE_TYPE_SWITCH )
>        return;
> 
> -   p_sw = osm_get_switch_by_guid( p_mgr->p_subn,
osm_node_get_node_guid(
> p_node ));
> +   p_sw = osm_get_switch_by_guid( p_subn, osm_node_get_node_guid(
p_node ));
>     if (!p_sw || !(p_si = osm_switch_get_si_ptr( p_sw )) ||
>  	  !p_si->enforce_cap)
>        return;
> 
> -   if (osm_pkey_mgr_enforce_partition( p_mgr, peer, enforce ) !=
IB_SUCCESS) {
> -      osm_log( p_mgr->p_log, OSM_LOG_ERROR,
> -               "osm_pkey_mgr_update_peer_port: "
> -               "osm_pkey_mgr_enforce_partition() failed to update "
> +   if (pkey_mgr_enforce_partition( p_req, peer, enforce ) !=
IB_SUCCESS) {
> +      osm_log( p_log, OSM_LOG_ERROR,
> +               "pkey_mgr_update_peer_port: "
> +               "pkey_mgr_enforce_partition() failed to update "
>                 "node 0x%016" PRIx64 " port %u\n",
>                 cl_ntoh64( osm_node_get_node_guid( p_node ) ),
>                 osm_physp_get_port_num( peer ) );
> @@ -361,12 +316,12 @@ osm_pkey_mgr_update_peer_port(
>        {
>           cl_memcpy( peer_block, block, sizeof( *block ) );
>           status =
> -            osm_pkey_mgr_update_pkey_entry( p_mgr, peer, peer_block,
> +            pkey_mgr_update_pkey_entry( p_req, peer, peer_block,
>                                              block_index );
>           if ( status != IB_SUCCESS )
> -            osm_log( p_mgr->p_log, OSM_LOG_ERROR,
> -                     "osm_pkey_mgr_update_peer_port: "
> -                     "osm_pkey_mgr_update_pkey_entry() failed to
update "
> +            osm_log( p_log, OSM_LOG_ERROR,
> +                     "pkey_mgr_update_peer_port: "
> +                     "pkey_mgr_update_pkey_entry() failed to update "
>                       "pkey table block %d for node 0x%016" PRIx64
>                       " port %u\n",
>                       block_index,
> @@ -376,10 +331,10 @@ osm_pkey_mgr_update_peer_port(
>     }
> 
>     if ( num_of_blocks && status == IB_SUCCESS &&
> -        osm_log_is_active( p_mgr->p_log, OSM_LOG_VERBOSE ) )
> +        osm_log_is_active( p_log, OSM_LOG_VERBOSE ) )
>     {
> -      osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
> -               "osm_pkey_mgr_update_peer_port: "
> +      osm_log( p_log, OSM_LOG_VERBOSE,
> +               "pkey_mgr_update_peer_port: "
>                 "pkey table was updated for node 0x%016" PRIx64
>                 " port %u\n",
>                 cl_ntoh64( osm_node_get_node_guid( p_node ) ),
> @@ -390,9 +345,10 @@ osm_pkey_mgr_update_peer_port(
>
/**********************************************************************
>
**********************************************************************/
>  static boolean_t
> -osm_pkey_mgr_process_partition_table(
> -   const osm_pkey_mgr_t * const p_mgr,
> -   const osm_prtn_t * const p_prtn,
> +pkey_mgr_process_partition_table(
> +   osm_log_t *p_log,
> +   const osm_req_t *p_req,
> +   const osm_prtn_t *p_prtn,
>     const boolean_t full )
>  {
>     const cl_map_t *p_tbl = full ?
> @@ -412,12 +368,12 @@ osm_pkey_mgr_process_partition_table(
>        i_next = cl_map_next( i );
>        p_physp = cl_map_obj( i );
>        if ( p_physp && osm_physp_is_valid( p_physp ) &&
> -           __osm_pkey_mgr_process_physical_port( p_mgr, pkey, p_physp
) )
> +           pkey_mgr_process_physical_port( p_log, p_req, pkey,
p_physp ) )
>        {
>           result = TRUE;
> -         if ( osm_log_is_active( p_mgr->p_log, OSM_LOG_VERBOSE ) )
> -            osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
> -                     "osm_pkey_mgr_process_partition_table:  "
> +         if ( osm_log_is_active( p_log, OSM_LOG_VERBOSE ) )
> +            osm_log( p_log, OSM_LOG_VERBOSE,
> +                     "pkey_mgr_process_partition_table:  "
>                       "Adding 0x%04x to pkey table of node "
>                       "0x%016" PRIx64 " port %u\n",
>                       cl_ntoh16( pkey ),
> @@ -434,7 +390,7 @@ osm_pkey_mgr_process_partition_table(
>
**********************************************************************/
>  osm_signal_t
>  osm_pkey_mgr_process(
> -   IN const osm_pkey_mgr_t * const p_mgr )
> +   IN osm_opensm_t *p_osm )
>  {
>     cl_qmap_t *p_tbl;
>     cl_map_item_t *p_next;
> @@ -442,20 +398,20 @@ osm_pkey_mgr_process(
>     osm_port_t *p_port;
>     osm_signal_t signal = OSM_SIGNAL_DONE;
> 
> -   CL_ASSERT( p_mgr );
> +   CL_ASSERT( p_osm );
> 
> -   OSM_LOG_ENTER( p_mgr->p_log, osm_pkey_mgr_process );
> +   OSM_LOG_ENTER( &p_osm->log, osm_pkey_mgr_process );
> 
> -   CL_PLOCK_EXCL_ACQUIRE( p_mgr->p_lock );
> +   CL_PLOCK_EXCL_ACQUIRE( &p_osm->lock );
> 
> -   if ( osm_prtn_make_partitions( p_mgr->p_log, p_mgr->p_subn ) !=
IB_SUCCESS )
> +   if ( osm_prtn_make_partitions( &p_osm->log, &p_osm->subn ) !=
IB_SUCCESS )
>     {
> -      osm_log( p_mgr->p_log, OSM_LOG_ERROR, "osm_pkey_mgr_process: "
> +      osm_log( &p_osm->log, OSM_LOG_ERROR, "osm_pkey_mgr_process: "
>                 "osm_prtn_make_partitions() failed\n" );
>        goto _err;
>     }
> 
> -   p_tbl = &p_mgr->p_subn->prtn_pkey_tbl;
> +   p_tbl = &p_osm->subn.prtn_pkey_tbl;
> 
>     p_next = cl_qmap_head( p_tbl );
>     while ( p_next != cl_qmap_end( p_tbl ) )
> @@ -463,13 +419,13 @@ osm_pkey_mgr_process(
>        p_prtn = ( osm_prtn_t * ) p_next;
>        p_next = cl_qmap_next( p_next );
> 
> -      if ( osm_pkey_mgr_process_partition_table( p_mgr, p_prtn, FALSE
) )
> +      if ( pkey_mgr_process_partition_table( &p_osm->log,
&p_osm->sm.req, p_prtn,
> FALSE ) )
>           signal = OSM_SIGNAL_DONE_PENDING;
> -      if ( osm_pkey_mgr_process_partition_table( p_mgr, p_prtn, TRUE
) )
> +      if ( pkey_mgr_process_partition_table( &p_osm->log,
&p_osm->sm.req, p_prtn,
> TRUE ) )
>           signal = OSM_SIGNAL_DONE_PENDING;
>     }
> 
> -   p_tbl = &p_mgr->p_subn->port_guid_tbl;
> +   p_tbl = &p_osm->subn.port_guid_tbl;
> 
>     p_next = cl_qmap_head( p_tbl );
>     while ( p_next != cl_qmap_end( p_tbl ) )
> @@ -480,13 +436,13 @@ osm_pkey_mgr_process(
>        if ( osm_node_get_type( osm_port_get_parent_node( p_port ) ) !=
>             IB_NODE_TYPE_SWITCH )
>        {
> -         osm_pkey_mgr_update_peer_port( p_mgr, p_port,
> -              !p_mgr->p_subn->opt.no_partition_enforcement);
> +         pkey_mgr_update_peer_port( &p_osm->log, &p_osm->sm.req,
&p_osm->subn,
> +	       p_port, !p_osm->subn.opt.no_partition_enforcement );
>        }
>     }
> 
>   _err:
> -   CL_PLOCK_RELEASE( p_mgr->p_lock );
> -   OSM_LOG_EXIT( p_mgr->p_log );
> +   CL_PLOCK_RELEASE( &p_osm->lock );
> +   OSM_LOG_EXIT( &p_osm->log );
>     return ( signal );
>  }
> diff --git a/osm/opensm/osm_sm.c b/osm/opensm/osm_sm.c
> index 9c10651..99e5627 100644
> --- a/osm/opensm/osm_sm.c
> +++ b/osm/opensm/osm_sm.c
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
> + * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
>   * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights
reserved.
>   * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
>   *
> @@ -66,7 +66,6 @@ #include <opensm/osm_log.h>
>  #include <opensm/osm_node.h>
>  #include <opensm/osm_msgdef.h>
>  #include <opensm/osm_mcast_mgr.h>
> -#include <opensm/osm_pkey_mgr.h>
>  #include <opensm/osm_mcm_info.h>
>  #include <complib/cl_thread.h>
>  #include <signal.h>
> @@ -160,7 +159,6 @@ osm_sm_construct(
>     osm_state_mgr_construct( &p_sm->state_mgr );
>     osm_state_mgr_ctrl_construct( &p_sm->state_mgr_ctrl );
>     osm_drop_mgr_construct( &p_sm->drop_mgr );
> -   osm_pkey_mgr_construct( &p_sm->pkey_mgr );
>     osm_lft_rcv_construct( &p_sm->lft_rcv );
>     osm_lft_rcv_ctrl_construct( &p_sm->lft_rcv_ctrl );
>     osm_mft_rcv_construct( &p_sm->mft_rcv );
> @@ -250,7 +248,6 @@ osm_sm_destroy(
>     osm_ucast_mgr_destroy( &p_sm->ucast_mgr );
>     osm_link_mgr_destroy( &p_sm->link_mgr );
>     osm_drop_mgr_destroy( &p_sm->drop_mgr );
> -   osm_pkey_mgr_destroy( &p_sm->pkey_mgr );
>     osm_lft_rcv_destroy( &p_sm->lft_rcv );
>     osm_mft_rcv_destroy( &p_sm->mft_rcv );
>     osm_slvl_rcv_destroy( &p_sm->slvl_rcv );
> @@ -408,7 +405,6 @@ osm_sm_init(
>                                  &p_sm->mcast_mgr,
>                                  &p_sm->link_mgr,
>                                  &p_sm->drop_mgr,
> -                                &p_sm->pkey_mgr,
>                                  &p_sm->req,
>                                  p_stats,
>                                  &p_sm->sm_state_mgr,
> @@ -431,12 +427,6 @@ osm_sm_init(
>     if( status != IB_SUCCESS )
>        goto Exit;
> 
> -   status = osm_pkey_mgr_init( &p_sm->pkey_mgr,
> -                               p_sm->p_subn,
> -                               p_sm->p_log, &p_sm->req, p_sm->p_lock
);
> -   if( status != IB_SUCCESS )
> -      goto Exit;
> -
>     status = osm_lft_rcv_init( &p_sm->lft_rcv, p_subn, p_log, p_lock
);
>     if( status != IB_SUCCESS )
>        goto Exit;
> diff --git a/osm/opensm/osm_state_mgr.c b/osm/opensm/osm_state_mgr.c
> index 083185c..1aefc0b 100644
> --- a/osm/opensm/osm_state_mgr.c
> +++ b/osm/opensm/osm_state_mgr.c
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
> + * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
>   * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights
reserved.
>   * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
>   *
> @@ -64,6 +64,7 @@ #include <opensm/osm_helper.h>
>  #include <opensm/osm_msgdef.h>
>  #include <opensm/osm_node.h>
>  #include <opensm/osm_port.h>
> +#include <opensm/osm_pkey_mgr.h>
>  #include <vendor/osm_vendor_api.h>
>  #include <opensm/osm_sm_state_mgr.h>
>  #include <opensm/osm_opensm.h>
> @@ -108,7 +109,6 @@ osm_state_mgr_init(
>     IN osm_mcast_mgr_t * const p_mcast_mgr,
>     IN osm_link_mgr_t * const p_link_mgr,
>     IN osm_drop_mgr_t * const p_drop_mgr,
> -   IN osm_pkey_mgr_t * const p_pkey_mgr,
>     IN osm_req_t * const p_req,
>     IN osm_stats_t * const p_stats,
>     IN osm_sm_state_mgr_t * const p_sm_state_mgr,
> @@ -128,7 +128,6 @@ osm_state_mgr_init(
>     CL_ASSERT( p_mcast_mgr );
>     CL_ASSERT( p_link_mgr );
>     CL_ASSERT( p_drop_mgr );
> -   CL_ASSERT( p_pkey_mgr );
>     CL_ASSERT( p_req );
>     CL_ASSERT( p_stats );
>     CL_ASSERT( p_sm_state_mgr );
> @@ -145,7 +144,6 @@ osm_state_mgr_init(
>     p_mgr->p_mcast_mgr = p_mcast_mgr;
>     p_mgr->p_link_mgr = p_link_mgr;
>     p_mgr->p_drop_mgr = p_drop_mgr;
> -   p_mgr->p_pkey_mgr = p_pkey_mgr;
>     p_mgr->p_mad_ctrl = p_mad_ctrl;
>     p_mgr->p_req = p_req;
>     p_mgr->p_stats = p_stats;
> @@ -2235,7 +2233,7 @@ osm_state_mgr_process(
>
OSM_SM_SIGNAL_DISCOVERY_COMPLETED );
> 
>              /* the returned signal might be DONE or DONE_PENDING */
> -            signal = osm_pkey_mgr_process( p_mgr->p_pkey_mgr );
> +            signal = osm_pkey_mgr_process( p_mgr->p_subn->p_osm );
>              break;
> 
>           default:



More information about the general mailing list