[openib-general] [PATCH 7 of 7] branch 1.0, management/osm: updating from main trunk
Jack Morgenstein
jackm at mellanox.co.il
Thu Mar 30 06:51:37 PST 2006
osm: updating branch 1.0 from main trunk
Index: include/opensm/osm_subnet.h
===================================================================
--- include/opensm/osm_subnet.h
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ include/opensm/osm_subnet.h (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -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.
*
@@ -73,6 +73,8 @@ BEGIN_C_DECLS
#define OSM_SUBNET_VECTOR_CAPACITY 256
+struct _osm_opensm_t;
+
/****h* OpenSM/Subnet
* NAME
* Subnet
@@ -216,11 +218,13 @@ typedef struct _osm_subn_opt
uint8_t overrun_errors_threshold;
uint32_t sminfo_polling_timeout;
uint32_t polling_retry_number;
- uint32_t max_msg_fifo_timeout;
+ uint32_t max_msg_fifo_timeout;
boolean_t force_heavy_sweep;
uint8_t log_flags;
char * dump_files_dir;
char * log_file;
+ char * partition_config_file;
+ boolean_t no_partition_enforcement;
boolean_t accum_log_file;
boolean_t console;
cl_map_t port_prof_ignore_guids;
@@ -409,6 +413,7 @@ typedef struct _osm_subn_opt
*/
typedef struct _osm_subn
{
+ struct _osm_opensm_t *p_osm;
cl_qmap_t sw_guid_tbl;
cl_qmap_t node_guid_tbl;
cl_qmap_t port_guid_tbl;
@@ -654,6 +659,7 @@ osm_subn_destroy(
ib_api_status_t
osm_subn_init(
IN osm_subn_t* const p_subn,
+ IN struct _osm_opensm_t * const p_osm,
IN const osm_subn_opt_t* const p_opt );
/*
* PARAMETERS
@@ -688,7 +694,7 @@ struct _osm_port;
* osm_get_gid_by_mad_addr
*
* DESCRIPTION
-* Looks for the requestor gid in the mad address.
+* Looks for the requester gid in the mad address.
*
* Note: This code is not thread safe. Need to grab the lock before
* calling it.
@@ -724,7 +730,7 @@ osm_get_gid_by_mad_addr(
* osm_get_physp_by_mad_addr
*
* DESCRIPTION
-* Looks for the requestor physical port in the mad address.
+* Looks for the requester physical port in the mad address.
*
* Note: This code is not thread safe. Need to grab the lock before
* calling it.
@@ -748,7 +754,7 @@ osm_get_physp_by_mad_addr(
* [in] Pointer to mad address object.
*
* RETURN VALUES
-* Pointer to requestor physical port object if found. Null otherwise.
+* Pointer to requester physical port object if found. Null otherwise.
*
* NOTES
*
@@ -760,7 +766,7 @@ osm_get_physp_by_mad_addr(
* osm_get_port_by_mad_addr
*
* DESCRIPTION
-* Looks for the requestor port in the mad address.
+* Looks for the requester port in the mad address.
*
* Note: This code is not thread safe. Need to grab the lock before
* calling it.
@@ -784,7 +790,7 @@ osm_get_port_by_mad_addr(
* [in] Pointer to mad address object.
*
* RETURN VALUES
-* Pointer to requestor port object if found. Null otherwise.
+* Pointer to requester port object if found. Null otherwise.
*
* NOTES
*
@@ -892,7 +898,7 @@ osm_get_port_by_guid(
* osm_get_physp_by_mad_addr
*
* DESCRIPTION
-* Looks for the requestor physical port in the mad address.
+* Looks for the requester physical port in the mad address.
*
* Note: This code is not thread safe. Need to grab the lock before
* calling it.
@@ -916,7 +922,7 @@ osm_get_physp_by_mad_addr(
* [in] Pointer to mad address object.
*
* RETURN VALUES
-* Pointer to requestor physical port object if found. Null otherwise.
+* Pointer to requester physical port object if found. Null otherwise.
*
* NOTES
*
Index: include/opensm/osm_partition.h
===================================================================
--- include/opensm/osm_partition.h
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ include/opensm/osm_partition.h (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -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.
*
@@ -50,6 +50,12 @@
#ifndef _OSM_PARTITION_H_
#define _OSM_PARTITION_H_
+#include <iba/ib_types.h>
+#include <complib/cl_qmap.h>
+#include <complib/cl_map.h>
+#include <opensm/osm_log.h>
+#include <opensm/osm_subnet.h>
+
#ifdef __cplusplus
# define BEGIN_C_DECLS extern "C" {
# define END_C_DECLS }
@@ -94,12 +100,17 @@ BEGIN_C_DECLS
*/
typedef struct _osm_prtn
{
- uint16_t pkey;
- cl_map port_guid_tbl;
-
+ cl_map_item_t map_item;
+ uint16_t pkey;
+ cl_map_t full_guid_tbl;
+ cl_map_t part_guid_tbl;
+ char name[32];
} osm_prtn_t;
/*
* FIELDS
+* map_item
+* Linkage structure for cl_qmap. MUST BE FIRST MEMBER!
+*
* pkey
* The IBA defined P_KEY of this Partition.
*
@@ -111,118 +122,61 @@ typedef struct _osm_prtn
* Partition
*********/
-/****f* OpenSM: Partition/osm_prtn_construct
+/****f* OpenSM: Partition/osm_prtn_delete
* NAME
-* osm_prtn_construct
+* osm_prtn_delete
*
* DESCRIPTION
-* This function constructs a Partition.
+* This function destroys and deallocates a Partition object.
*
* SYNOPSIS
*/
-void osm_prtn_construct(
- IN osm_prtn_t* const p_prtn );
+void osm_prtn_delete(
+ IN OUT osm_prtn_t** const pp_prtn );
/*
* PARAMETERS
-* p_prtn
-* [in] Pointer to a Partition to construct.
+* pp_prtn
+* [in][out] Pointer to a pointer to a Partition oject to
+* delete. On return, this pointer is NULL.
*
* RETURN VALUE
* This function does not return a value.
*
* NOTES
-* Allows calling osm_prtn_init, osm_prtn_destroy, and osm_prtn_is_inited.
-*
-* Calling osm_prtn_construct is a prerequisite to calling any other
-* method except osm_prtn_init.
+* Performs any necessary cleanup of the specified Partition object.
*
* SEE ALSO
-* Partition, osm_prtn_init, osm_prtn_destroy, osm_prtn_is_inited
+* Partition, osm_prtn_new
*********/
-/****f* OpenSM: Partition/osm_prtn_destroy
+/****f* OpenSM: Partition/osm_prtn_new
* NAME
-* osm_prtn_destroy
+* osm_prtn_new
*
* DESCRIPTION
-* The osm_prtn_destroy function destroys a Partition, releasing
-* all resources.
+* This function allocates and initializes a Partition object.
*
* SYNOPSIS
*/
-void osm_prtn_destroy(
- IN osm_prtn_t* const p_prtn );
+osm_prtn_t* osm_prtn_new(
+ IN const char *name,
+ IN const uint16_t pkey );
/*
* PARAMETERS
-* p_prtn
-* [in] Pointer to a Partition to destroy.
-*
-* RETURN VALUE
-* This function does not return a value.
-*
-* NOTES
-* Performs any necessary cleanup of the specified Partition.
-* Further operations should not be attempted on the destroyed object.
-* This function should only be called after a call to osm_prtn_construct or
-* osm_prtn_init.
-*
-* SEE ALSO
-* Partition, osm_prtn_construct, osm_prtn_init
-*********/
-
-/****f* OpenSM: Partition/osm_prtn_init
-* NAME
-* osm_prtn_init
-*
-* DESCRIPTION
-* The osm_prtn_init function initializes a Partition for use.
-*
-* SYNOPSIS
-*/
-ib_api_status_t osm_prtn_init(
- IN osm_prtn_t* const p_prtn );
-/*
-* PARAMETERS
-* p_prtn
-* [in] Pointer to an osm_prtn_t object to initialize.
-*
-* RETURN VALUES
-* CL_SUCCESS if initialization was successful.
-*
-* NOTES
-* Allows calling other Partition methods.
+* name
+* [in] Partition name string
*
-* SEE ALSO
-* Partition, osm_prtn_construct, osm_prtn_destroy,
-* osm_prtn_is_inited
-*********/
-
-/****f* OpenSM: Partition/osm_prtn_is_inited
-* NAME
-* osm_prtn_is_inited
-*
-* DESCRIPTION
-* Indicates if the object has been initialized with osm_prtn_init.
-*
-* SYNOPSIS
-*/
-boolean_t osm_ptrn_is_inited(
- IN const osm_prtn_t* const p_prtn );
-/*
-* PARAMETERS
-* p_prtn
-* [in] Pointer to an osm_prtn_t object.
+* pkey
+* [in] Partition P_Key value
*
-* RETURN VALUES
-* TRUE if the object was initialized successfully,
-* FALSE otherwise.
+* RETURN VALUE
+* Pointer to the initialize Partition object.
*
* NOTES
-* The osm_prtn_construct or osm_prtn_init must be called before using
-* this function.
+* Allows calling other partition methods.
*
* SEE ALSO
-* Partition, osm_prtn_construct, osm_prtn_init
+* Partition
*********/
/****f* OpenSM: Partition/osm_prtn_is_guid
@@ -234,9 +188,14 @@ boolean_t osm_ptrn_is_inited(
*
* SYNOPSIS
*/
+static inline
boolean_t osm_prtn_is_guid(
IN const osm_prtn_t* const p_prtn,
- IN const uint64 guid );
+ IN const ib_net64_t guid )
+{
+ return (cl_map_get(&p_prtn->full_guid_tbl, guid) != NULL) ||
+ (cl_map_get(&p_prtn->part_guid_tbl, guid) != NULL);
+}
/*
* PARAMETERS
* p_prtn
@@ -254,24 +213,28 @@ boolean_t osm_prtn_is_guid(
* SEE ALSO
*********/
-/****f* OpenSM: Partition/osm_prtn_get_pkey
+/****f* OpenSM: Partition/osm_prtn_make_partitions
* NAME
-* osm_prtn_get_pkey
+* osm_prtn_make_partitions
*
* DESCRIPTION
-* Gets the IBA defined P_KEY value for this Partition.
+* Makes all partitions in subnet.
*
* SYNOPSIS
*/
-uint16_t osm_prtn_get_pkey(
- IN const osm_prtn_t* const p_prtn );
+ib_api_status_t osm_prtn_make_partitions(
+ IN osm_log_t * const p_log,
+ IN osm_subn_t * const p_subn);
/*
* PARAMETERS
-* p_prtn
-* [in] Pointer to an osm_prtn_t object.
+* p_log
+* [in] Pointer to a log object.
+*
+* p_subn
+* [in] Pointer to subnet object.
*
* RETURN VALUES
-* P_KEY value for this Partition.
+* IB_SUCCESS value on success.
*
* NOTES
*
Index: include/opensm/osm_sa.h
===================================================================
--- include/opensm/osm_sa.h (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ include/opensm/osm_sa.h (.../trunk/src/userspace/management/osm) (revision
6101)
@@ -442,89 +442,6 @@ osm_sa_bind(
* SEE ALSO
*********/
-/****f* OpenSM: SA/osm_sa_add_well_known_mc_record
-* NAME
-* osm_sa_add_well_known_mc_record
-*
-* DESCRIPTION
-* Adds the well known Multicast group to the SA database. This
-* should be called by SM before programming the switches and after
-* SA has been initialized
-*
-* SYNOPSIS
-*/
-
-void
-osm_sa_add_well_known_mc_record(
- osm_mcmr_recv_t* const p_ctrl,
- const ib_member_rec_t * const p_well_know_mc_rec);
-/*
-* PARAMETERS
-* p_ctrl
-* [in] Pointer to an osm_mcmr_recv_t object.
-*
-* p_well_know_mc_rec
-* [in] pointer to ib_member_rec_t structure.
-*
-*
-* RETURN VALUES
-* None
-*
-* NOTES
-* Called by SM after SA has been initialized and before programming the
switches
-*
-* SEE ALSO
-*********/
-
-
-/****f* OpenSM: SA/osm_sa_create_template_record_ipoib
-* NAME
-* osm_sa_create_template_record_ipoib
-*
-* DESCRIPTION
-* Creates the well known MC record and calls osm_sa_add_well_known_mc_record.
This
-* should be called by SM before programming the switches and after
-* SA has been initialized
-*
-* SYNOPSIS
-*/
-void
-osm_sa_create_template_record_ipoib(
- IN osm_sa_t* const p_sa,
- IN const osm_subn_opt_t* const p_opt );
-
-/*
-* PARAMETERS
-* p_sa
-* [in] Pointer to an osm_sa_t object.
-*
-* p_opt
-* [in] pointer to cmd line option structure.
-*
-*
-* RETURN VALUES
-* None
-*
-* NOTES
-* Called by SM after SA has been initialized and before programming the
switches
-*
-* SEE ALSO
-*********/
-
-/****g* OpenSM: SA/osm_ipoib_mgid
-* NAME
-* osm_ipoib_mgid
-*
-* DESCRIPTION
-* The MGID of the IPoIB Multicast Group
-*
-* SYNOPSIS
-*/
-extern ib_gid_t osm_ipoib_mgid;
-/*
-* SEE ALSO
-*********/
-
END_C_DECLS
#endif /* _OSM_SA_H_ */
Index: include/opensm/osm_base.h
===================================================================
--- include/opensm/osm_base.h (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ include/opensm/osm_base.h (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -222,6 +222,22 @@ BEGIN_C_DECLS
#endif
/***********/
+/****d* OpenSM: Base/OSM_DEFAULT_PARTITION_CONFIG_FILE
+* NAME
+* OSM_DEFAULT_PARTITION_CONFIG_FILE
+*
+* DESCRIPTION
+* Specifies the default partition config file name
+*
+* SYNOPSIS
+*/
+#ifdef __WIN__
+#define OSM_DEFAULT_PARTITION_CONFIG_FILE strcat(GetOsmPath(),
"osm-partitions.conf")
+#else
+#define OSM_DEFAULT_PARTITION_CONFIG_FILE "/etc/osm-partitions.conf"
+#endif
+/***********/
+
/****d* OpenSM: Base/OSM_DEFAULT_SWEEP_INTERVAL_SECS
* NAME
* OSM_DEFAULT_SWEEP_INTERVAL_SECS
Index: include/opensm/osm_pkey.h
===================================================================
--- include/opensm/osm_pkey.h (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ include/opensm/osm_pkey.h (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -244,6 +244,68 @@ int osm_pkey_tbl_set(
*
*********/
+/****f* OpenSM: osm_physp_share_this_pkey
+* NAME
+* osm_physp_share_this_pkey
+*
+* DESCRIPTION
+* Checks if the given physical ports share the specified pkey.
+*
+* SYNOPSIS
+*/
+boolean_t osm_physp_share_this_pkey(
+ IN const struct _osm_physp * const p_physp1,
+ IN const struct _osm_physp * const p_physp2,
+ IN const ib_net16_t pkey);
+/*
+* PARAMETERS
+*
+* p_physp1
+* [in] Pointer to an osm_physp_t object.
+*
+* p_physp2
+* [in] Pointer to an osm_physp_t object.
+*
+* pkey
+* [in] value of P_Key to check.
+*
+* RETURN VALUES
+* Returns TRUE if the two ports are matching.
+* FALSE otherwise.
+*
+* NOTES
+*
+*********/
+
+/****f* OpenSM: osm_physp_find_common_pkey
+* NAME
+* osm_physp_find_common_pkey
+*
+* DESCRIPTION
+* Returns first matching P_Key values for specified physical ports.
+*
+* SYNOPSIS
+*/
+ib_net16_t osm_physp_find_common_pkey(
+ IN const struct _osm_physp * const p_physp1,
+ IN const struct _osm_physp * const p_physp2 );
+/*
+* PARAMETERS
+*
+* p_physp1
+* [in] Pointer to an osm_physp_t object.
+*
+* p_physp2
+* [in] Pointer to an osm_physp_t object.
+*
+* RETURN VALUES
+* Returns value of first shared P_Key or INVALID P_Key (0x0) if not
+* found.
+*
+* NOTES
+*
+*********/
+
/****f* OpenSM: osm_physp_share_pkey
* NAME
* osm_physp_share_pkey
Index: include/opensm/osm_sa_mcmember_record.h
===================================================================
--- include/opensm/osm_sa_mcmember_record.h
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ include/opensm/osm_sa_mcmember_record.h
(.../trunk/src/userspace/management/osm) (revision 6101)
@@ -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.
*
@@ -320,6 +320,42 @@ osm_mcmr_rcv_create_new_mgrp(
*
*********/
+/****f* OpenSM: MC Member record
Receiver/osm_mcmr_rcv_find_or_create_new_mgrp
+* NAME
+* osm_mcmr_rcv_find_or_create_new_mgrp
+*
+* DESCRIPTION
+* Create new Multicast group
+*
+* SYNOPSIS
+*/
+
+ib_api_status_t
+osm_mcmr_rcv_find_or_create_new_mgrp(
+ IN osm_mcmr_recv_t* const p_mcmr,
+ IN uint64_t comp_mask,
+ IN ib_member_rec_t* const p_recvd_mcmember_rec,
+ OUT osm_mgrp_t **pp_mgrp);
+/*
+* PARAMETERS
+* p_mcmr
+* [in] Pointer to an osm_mcmr_recv_t object.
+* p_recvd_mcmember_rec
+* [in] Received Multicast member record
+*
+* pp_mgrp
+* [out] pointer the osm_mgrp_t object
+*
+* RETURN VALUES
+* IB_SUCCESS, IB_ERROR
+*
+* NOTES
+*
+*
+* SEE ALSO
+*
+*********/
+
#define JOIN_MC_COMP_MASK (IB_MCR_COMPMASK_MGID | \
IB_MCR_COMPMASK_PORT_GID | \
IB_MCR_COMPMASK_JOIN_STATE)
Index: include/complib/cl_thread_osd.h
===================================================================
--- include/complib/cl_thread_osd.h
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ include/complib/cl_thread_osd.h (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -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.
*
@@ -62,41 +62,6 @@ BEGIN_C_DECLS
#include <complib/cl_types.h>
#include <complib/cl_event.h>
-
-#ifdef __KERNEL__
-
-/* Linux Kernel Mode. */
-#include <linux/sched.h>
-#include <linux/interrupt.h>
-
-/* bit position 0 for thread wait flag */
-#define THREAD_WAKEUP (0)
-
-/* Milli Secs per tick, since there are HZ ticks per second */
-#define MISECS_PER_TICK (1000/HZ)
-
-/* Linux kernel mode thread object structure definition. */
-typedef struct _cl_thread_osd_t
-{
- char name[16];
- wait_queue_head_t wqueue;
- struct task_struct *task;
-
- cl_event_t kill_event;
- cl_state_t state;
-
-} cl_thread_osd_t;
-
-
-static inline boolean_t
-cl_is_blockable ( void )
-{
- return ( (in_interrupt()) ? FALSE : TRUE );
-}
-
-#else /* __KERNEL__ */
-
-/* Linux User Mode. */
#include <pthread.h>
/* Linux user mode thread object structure definition. */
@@ -113,8 +78,6 @@ cl_is_blockable ( void )
return TRUE;
}
-#endif /* __KERNEL__ */
-
END_C_DECLS
#endif /* _CL_THREAD_OSD_H_ */
Index: include/complib/cl_timer_osd.h
===================================================================
--- include/complib/cl_timer_osd.h
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ include/complib/cl_timer_osd.h (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -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.
*
@@ -63,25 +63,6 @@
BEGIN_C_DECLS
-#ifdef __KERNEL__
-
-/* Linux Kernel Mode. */
-#include <linux/timer.h>
-
-
-typedef struct _cl_timer_t
-{
- struct timer_list timer;
- cl_state_t state;
- cl_pfn_timer_callback_t pfn_callback;
- const void *context;
- boolean_t in_timer_cb;
-
-} cl_timer_t;
-
-#else /* __KERNEL__ */
-
-/* Linux User Mode. */
#include <complib/cl_qlist.h>
#include <pthread.h>
@@ -116,8 +97,6 @@ __cl_timer_prov_create( void );
void
__cl_timer_prov_destroy( void );
-#endif /* __KERNEL__ */
-
END_C_DECLS
#endif /* _CL_TIMER_OSD_H_ */
Index: include/complib/cl_event_osd.h
===================================================================
--- include/complib/cl_event_osd.h
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ include/complib/cl_event_osd.h (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -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,29 +64,6 @@
BEGIN_C_DECLS
-#ifdef __KERNEL__
-
-/* Linux Kernel Mode. */
-#include <linux/sched.h>
-
-
-/*
- * Linux kernel mode specific data structure for the event object.
- * Users should not access these variables directly.
- */
-typedef struct _cl_event_t
-{
- wait_queue_head_t wait_queue;
- boolean_t signaled;
- boolean_t manual_reset;
- cl_spinlock_t spinlock;
- cl_state_t state;
-
-} cl_event_t;
-
-#else /* __KERNEL__ */
-
-/* Linux User Mode. */
#include <pthread.h> /* usr/include */
@@ -104,8 +81,6 @@ typedef struct _cl_event_t
} cl_event_t;
-#endif /* __KERNEL__ */
-
END_C_DECLS
#endif /* _CL_EVENT_OSD_H_ */
Index: include/complib/cl_types_osd.h
===================================================================
--- include/complib/cl_types_osd.h
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ include/complib/cl_types_osd.h (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -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.
*
@@ -73,100 +73,6 @@ BEGIN_C_DECLS
#define cl_break
#endif
-#ifdef __KERNEL__
-#include <linux/config.h>
-
-/*
- * Linux Kernel Mode
- */
-
-#if defined (_DEBUG_) && defined (CONFIG_X86_REMOTE_DEBUG)
-#define CONFIG_GDB
-#endif
-
-#if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS)
-#define MODVERSIONS /* turn it on */
-#endif
-
-#ifdef MODVERSIONS
-#include <linux/modversions.h>
-#endif
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/string.h>
-#include <linux/init.h>
-
-#ifndef LINUX_VERSION_CODE
-#include <linux/version.h>
-#endif
-
-#if defined (_DEBUG_)
-
-#if defined (CONFIG_GDB)
-extern int gdb_initialized;
-
-#define CL_ASSERT( __exp__ ) \
-{ \
- if( !(__exp__) ) \
- { \
- if (!gdb_initialized) \
- { \
- panic( "Assertion failed: %s, file %s, line %d\n", \
- #__exp__, __FILE__, __LINE__ ); \
- } \
- else \
- { \
- printk( "Assertion failed: %s, file %s, line %d\n", \
- #__exp__, __FILE__, __LINE__ ); \
- printk ("Entering GDB...\n"); \
- cl_break(); \
- } \
- } \
-}
-#elif defined (CONFIG_KDB) /* not CONFIG_GDB */
-#include <linux/kdb.h>
-#undef cl_break
-#define cl_break() KDB_ENTER()
-
-#define CL_ASSERT( __exp__ ) \
-{ \
- if( !(__exp__) ) \
- { \
- printk( "Assertion failed: %s, file %s, line %d\n", \
- #__exp__, __FILE__, __LINE__ ); \
- printk ("Entering KDB...\n"); \
- cl_break(); \
- } \
-}
-#else /* not CONFIG_GDB and not CONFIG_KDB */
-#undef cl_break
-#define cl_break()
-
-#define CL_ASSERT( __exp__ ) \
-{ \
- if( !(__exp__) ) \
- { \
- panic( "Assertion failed: %s, file %s, line %d\n", \
- #__exp__, __FILE__, __LINE__ ); \
- } \
-}
-#endif /* CONFIG_GDB */
-
-#else /* not _DEBUG_ */
-#undef cl_break
-#define cl_break()
-#define CL_ASSERT( __exp__ )
-#endif /* _DEBUG_ */
-
-#define cl_panic panic
-
-#else /* __KERNEL__ */
-
-/*
- * Linux User Mode
- */
#include <inttypes.h>
#include <assert.h>
#include <string.h>
@@ -178,14 +84,12 @@ extern int gdb_initialized;
#define CL_ASSERT( __exp__ )
#endif /* _DEBUG_ */
-#endif /* __KERNEL__ */
-
/*
* Types not explicitly defined are native to the platform.
*/
typedef unsigned long uintn_t;
-typedef long intn_t;
-typedef int boolean_t;
+typedef long intn_t;
+typedef int boolean_t;
typedef volatile int32_t atomic32_t;
#ifndef NULL
Index: include/complib/cl_atomic.h
===================================================================
--- include/complib/cl_atomic.h
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ include/complib/cl_atomic.h (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -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.
*
@@ -216,90 +216,6 @@ cl_atomic_sub(
* Atomic Operations, cl_atomic_inc, cl_atomic_dec, cl_atomic_add,
* cl_atomic_xchg, cl_atomic_comp_xchg
*********/
-#ifdef __KERNEL__
-
-/****f* Component Library: Atomic Operations/cl_atomic_xchg
-* NAME
-* cl_atomic_xchg
-*
-* DESCRIPTION
-* The cl_atomic_xchg function atomically sets a value of a
-* 32-bit signed integer and returns the initial value.
-*
-* SYNOPSIS
-*/
-int32_t
-cl_atomic_xchg(
- IN atomic32_t* const p_value,
- IN const int32_t new_value );
-/*
-* PARAMETERS
-* p_value
-* [in] Pointer to a 32-bit integer to exchange with new_value.
-*
-* new_value
-* [in] Value to assign.
-*
-* RETURN VALUE
-* Returns the initial value pointed to by p_value.
-*
-* NOTES
-* The provided value is exchanged with new_value and its initial value
-* returned in one atomic operation.
-*
-* cl_atomic_xchg maintains data consistency without requiring additional
-* synchronization mechanisms in multi-threaded environments.
-*
-* SEE ALSO
-* Atomic Operations, cl_atomic_inc, cl_atomic_dec, cl_atomic_add,
-* cl_atomic_sub, cl_atomic_comp_xchg
-*********/
-
-
-/****f* Component Library: Atomic Operations/cl_atomic_comp_xchg
-* NAME
-* cl_atomic_comp_xchg
-*
-* DESCRIPTION
-* The cl_atomic_comp_xchg function atomically compares a 32-bit signed
-* integer to a desired value, sets that integer to the
-* specified value if equal, and returns the initial value.
-*
-* SYNOPSIS
-*/
-int32_t
-cl_atomic_comp_xchg(
- IN atomic32_t* const p_value,
- IN const int32_t compare,
- IN const int32_t new_value );
-/*
-* PARAMETERS
-* p_value
-* [in] Pointer to a 32-bit integer to exchange with new_value.
-*
-* compare
-* [in] Value to compare to the value pointed to by p_value.
-*
-* new_value
-* [in] Value to assign if the value pointed to by p_value is equal to
-* the value specified by the compare parameter.
-*
-* RETURN VALUE
-* Returns the initial value of the variable pointed to by p_value.
-*
-* NOTES
-* The value pointed to by p_value is compared to the value specified by the
-* compare parameter. If the two values are equal, the p_value variable is
-* set to new_value. The initial value pointed to by p_value is returned.
-*
-* cl_atomic_comp_xchg maintains data consistency without requiring additional
-* synchronization mechanisms in multi-threaded environments.
-*
-* SEE ALSO
-* Atomic Operations, cl_atomic_inc, cl_atomic_dec, cl_atomic_add,
-* cl_atomic_sub, cl_atomic_xchg
-*********/
-#endif /* __KERNEL__ */
END_C_DECLS
Index: include/complib/cl_spinlock_osd.h
===================================================================
--- include/complib/cl_spinlock_osd.h
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ include/complib/cl_spinlock_osd.h (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -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.
*
@@ -61,42 +61,6 @@
BEGIN_C_DECLS
#include <complib/cl_types.h>
-
-
-#ifdef __KERNEL__
-
-/* Linux Kernel Mode. */
-#include <linux/spinlock.h>
-#include <asm/system.h>
-#include <asm/atomic.h>
-
-typedef enum
-{
- SPIN_LVL_INVALID,
- SPIN_LVL_TASKLET,
- SPIN_LVL_INTERRUPT
-} cl_spin_level_t;
-
-/*
- * Spinlock object definition.
- */
-typedef struct _cl_spinlock_t
-{
- spinlock_t lock;
- unsigned long flags;
- cl_state_t state;
- cl_spin_level_t level;
-#ifdef _DEBUG_
- boolean_t locked;
- struct task_struct *owner;
- int cpuid;
-#endif
-
-} cl_spinlock_t;
-
-#else /* __KERNEL__ */
-
-/* Linux User Mode. */
#include <pthread.h> /* usr/include/ */
typedef struct _cl_spinlock_t
@@ -106,8 +70,6 @@ typedef struct _cl_spinlock_t
} cl_spinlock_t;
-#endif /* __KERNEL__ */
-
END_C_DECLS
#endif /* _CL_SPINLOCK_OSD_H_ */
Index: include/complib/cl_debug_osd.h
===================================================================
--- include/complib/cl_debug_osd.h
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ include/complib/cl_debug_osd.h (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -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.
*
@@ -80,111 +80,6 @@ BEGIN_C_DECLS
#define PRIdSIZE_T "d"
#endif
-#ifdef __KERNEL__
-
-#include <linux/sched.h>
-#include <linux/smp.h>
-#include <linux/interrupt.h>
-
-
-/* Linux Kernel Mode */
-#if __WORDSIZE == 64
-#define __PRI64_PREFIX "l"
-#else
-#define __PRI64_PREFIX "L"
-#endif
-
-
-#define PRId64 __PRI64_PREFIX"d"
-#define PRIo64 __PRI64_PREFIX"o"
-#define PRIu64 __PRI64_PREFIX"u"
-#define PRIx64 __PRI64_PREFIX"x"
-
-void cl_printk( char *message, ... ); /* see cl_debug.c */
-
-
-#ifndef PRINTK_LVL
-#define PRINTK_LVL KERN_INFO
-#endif
-
-#if defined (_DEBUG_)
-
-#if defined (CONFIG_GDB)
-#define cl_msg_out printk
-#define cl_dbg_out printk
-#else
-#define cl_msg_out cl_printk
-#define cl_dbg_out cl_printk
-#endif
-
-#else /* not _DEBUG_ */
-#define cl_msg_out cl_printk
-#define cl_dbg_out foo
-#endif /* _DEBUG_ */
-
-
-/*
- * The following macros are used internally by the CL_ENTER, CL_TRACE,
- * CL_TRACE_EXIT, and CL_EXIT macros.
- */
-
-#if defined (CONFIG_SMP)
-
-#define _CL_DBG_ENTER \
- ("~%d:%s%s%s() [\n", smp_processor_id(), __MODULE__, \
- __MOD_DELIMITER__, __func__)
-
-#define _CL_DBG_EXIT \
- ("~%d:%s%s%s() ]\n", smp_processor_id(), __MODULE__, \
- __MOD_DELIMITER__, __func__)
-
-#define _CL_DBG_INFO \
- ("~%d:%s%s%s(): ", smp_processor_id(), __MODULE__, \
- __MOD_DELIMITER__, __func__)
-
-#define _CL_DBG_ERROR \
- ("~%d:%s%s%s() !ERROR!: ", smp_processor_id(), __MODULE__, \
- __MOD_DELIMITER__, __func__)
-
-#else
-
-#define _CL_DBG_ENTER \
- ("%s%s%s() [\n", __MODULE__, __MOD_DELIMITER__, __func__)
-
-#define _CL_DBG_EXIT \
- ("%s%s%s() ]\n", __MODULE__, __MOD_DELIMITER__, __func__)
-
-#define _CL_DBG_INFO \
- ("%s%s%s(): ", __MODULE__, __MOD_DELIMITER__, __func__)
-
-#define _CL_DBG_ERROR \
- ("%s%s%s() !ERROR!: ", __MODULE__, __MOD_DELIMITER__, __func__)
-
-#endif
-
-#ifdef CONFIG_X86
-#define CL_CHK_STK \
-{ \
- uint32_t __CL_ESP__; \
- __asm__ __volatile__("movl %%esp,%0" : "=r" (__CL_ESP__)); \
- if (((uint32_t)current + sizeof(struct task_struct) + \
- (in_interrupt() ? 300: 1024)) > __CL_ESP__) \
- { \
- cl_msg_out("stack corruption detected!!!\n"); \
- cl_msg_out("::::::::esp(0x%x) top(0x%x)::::::::\n",__CL_ESP__,\
- ((uint32_t)current + sizeof(struct task_struct) + \
- (in_interrupt() ? 300: 1024))); \
- CL_ASSERT (0); \
- } \
-}
-#else
-#define CL_CHK_STK /* We do not do checks for 64 for now... */
-#endif
-
-
-#else /* __KERNEL__ */
-
-/* Linux User Mode */
#include <inttypes.h>
#include <stdio.h>
@@ -215,8 +110,6 @@ void cl_printk( char *message, ... ); /*
#define CL_CHK_STK
-#endif /* __KERNEL__ */
-
END_C_DECLS
#endif /* _CL_DEBUG_OSD_H_ */
Index: include/complib/cl_signal_osd.h
===================================================================
--- include/complib/cl_signal_osd.h
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ include/complib/cl_signal_osd.h (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
- *
- * This software is available to you under a choice of one of two
- * licenses. You may choose to be licensed under the terms of the GNU
- * General Public License (GPL) Version 2, available from the file
- * COPYING in the main directory of this source tree, or the
- * OpenIB.org BSD license below:
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the following
- * disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * $Id$
- */
-
-/*
- * Abstract:
- * Declaration of Signal Handler Registration
- *
- * Environment:
- * All
- *
- * $Revision: 1.3 $
- */
-
-#ifndef _CL_SIG_HDL_H_
-#define _CL_SIG_HDL_H_
-
-#include <signal.h>
-
-#ifdef __cplusplus
-# define BEGIN_C_DECLS extern "C" {
-# define END_C_DECLS }
-#else /* !__cplusplus */
-# define BEGIN_C_DECLS
-# define END_C_DECLS
-#endif /* __cplusplus */
-
-BEGIN_C_DECLS
-
-/****h* Component Library/Signal Handler
-* NAME
-* Signal Handler Registration
-*
-* DESCRIPTION
-* The Signal Handler Registration allows to register a callback on the case
of incoming signal
-*
-* SEE ALSO
-*********/
-
-typedef void (*cl_sig_hdl)(
- IN int sig);
-
-/* Prototypes */
-
-/****f* Component Library: Signal Handler/cl_reg_sig_hdl
-* NAME
-* cl_reg_sig_hdl
-*
-* DESCRIPTION
-* Register the handler for the given signal
-*
-* SYNOPSIS
-*/
-
-static inline void
-cl_reg_sig_hdl(int sig, cl_sig_hdl pfn_sig_hdl);
-
-/****f* Component Library: Signal Handler/cl_mask_sigint
-* NAME
-* cl_sig_mask_sigint
-*
-* DESCRIPTION
-* Mask the kill signal
-*
-* SYNOPSIS
-*/
-
-static inline void
-cl_sig_mask_sigint(void);
-
-/****f* Component Library: Signal Handler/cl_reg_sig_hdl
-* NAME
-* cl_reg_sig_hdl
-*
-* DESCRIPTION
-* Register the handler for the given signal
-*
-* SYNOPSIS
-*/
-static inline void
-cl_reg_sig_hdl(int sig, cl_sig_hdl pfn_sig_hdl) {
- #ifdef __WIN__
- signal(sig,pfn_sig_hdl);
- #else
- struct sigaction sigact;
- sigact.sa_handler = pfn_sig_hdl;
- sigemptyset(&sigact.sa_mask);
- sigaddset(&sigact.sa_mask, sig);
- sigact.sa_flags = 0;
- sigaction(sig, &sigact, NULL);
- #endif
-}
-/*
-*********/
-
-/****f* Component Library: Signal Handler/cl_mask_sigint
-* NAME
-* cl_sig_mask_sigint
-*
-* DESCRIPTION
-* Mask the kill signal
-*
-* SYNOPSIS
-*/
-static inline void
-cl_sig_mask_sigint(void)
-{
- #ifdef __WIN__
- /* we do not mask kill */
- #else
- #ifndef OSM_VENDOR_INTF_OPENIB
- sigset_t sigs;
-
- sigemptyset(&sigs);
- sigaddset(&sigs, SIGINT);
- pthread_sigmask(SIG_BLOCK, &sigs, NULL);
- #endif /* OSM_VENDOR_INTF_OPENIB */
- #endif /* __WIN__ */
-}
-/*
-*********/
-
-END_C_DECLS
-
-#endif /* _CL_SIG_HDL_H_ */
Index: include/complib/cl_waitobj.h
===================================================================
--- include/complib/cl_waitobj.h
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ include/complib/cl_waitobj.h (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -1,369 +0,0 @@
-/*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
- *
- * This software is available to you under a choice of one of two
- * licenses. You may choose to be licensed under the terms of the GNU
- * General Public License (GPL) Version 2, available from the file
- * COPYING in the main directory of this source tree, or the
- * OpenIB.org BSD license below:
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the following
- * disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * $Id$
- */
-
-
-
-/*
- * Abstract:
- * This header file defines the data structures and APIs for implementing
- * wait objects.
- *
- * Environment:
- * Linux Kernel Mode
- *
- * $Revision: 1.7 $
- */
-
-#ifndef _CL_WAITOBJ_H_
-#define _CL_WAITOBJ_H_
-
-#ifdef __cplusplus
-# define BEGIN_C_DECLS extern "C" {
-# define END_C_DECLS }
-#else /* !__cplusplus */
-# define BEGIN_C_DECLS
-# define END_C_DECLS
-#endif /* __cplusplus */
-
-BEGIN_C_DECLS
-
-/****h* Component Library/Wait Objects
-* NAME
-* Wait Object
-*
-* DESCRIPTION
-* The Wait Object provides the capability for a user mode process to
-* create and wait on a kernel event. An action on a wait object can
-* be done from both a user mode thread as well as a kernel thread.
-*
-******/
-
-#include <complib/cl_types.h>
-
-/****d* Component Library: Wait Objects/cl_wait_obj_handle_t
-* NAME
-* cl_wait_obj_handle_t
-*
-* DESCRIPTION
-* Defines the handle for an OS wait object.
-*
-* SYNOPSIS
-*/
-typedef void *cl_wait_obj_handle_t;
-/*
-*
-******/
-
-/****i* Component Library: Wait Objects/cl_wait_ioctl_params_t
-* NAME
-* cl_wait_ioctl_params
-*
-* DESCRIPTION
-* Defines parameters for the ioctl call to implement wait objects
-*
-* SYNOPSIS
-*/
-typedef struct cl_wait_ioctl_params
-{
- uint32_t wait_u_sec;
- cl_status_t wait_status;
-
-} cl_wait_ioctl_params_t;
-/*
-*
-******/
-
-/****i* Component Library: Wait Objects/cl_create_wait_obj_params_t
-* NAME
-* cl_create_wait_obj_params
-*
-* DESCRIPTION
-* Defines parameters for the ioctl call to create wait objects
-*
-* SYNOPSIS
-*/
-typedef struct cl_create_wait_obj_params
-{
- // Input
- boolean_t auto_reset;
- // Output
- cl_status_t status;
-
-} cl_create_wait_obj_params_t;
-/*
-*
-******/
-
-
-#if defined(__KERNEL__)
-/*
- * Kernel Mode Support for Wait Objects
- */
-
-/* Internal helper functions for wait object */
-
-cl_status_t
-__cl_create_wait_object(
- IN boolean_t auto_reset,
- OUT cl_wait_obj_handle_t *p_wait_obj_handle);
-
-cl_status_t
-__cl_wait_on_wait_object(
- IN cl_wait_obj_handle_t wait_obj_handle,
- IN uint32_t wait_u_sec );
-
-cl_status_t
-__cl_signal_wait_object(
- IN cl_wait_obj_handle_t wait_obj_handle);
-
-cl_status_t
-__cl_clear_wait_object(
- IN cl_wait_obj_handle_t wait_obj_handle);
-
-cl_status_t
-__cl_destroy_wait_object(
- IN cl_wait_obj_handle_t wait_obj_handle);
-
-
-/****i* Component Library: Wait Objects/cl_get_kernel_wait_object
-* NAME
-* cl_get_kernel_wait_object
-*
-* DESCRIPTION
-* cl_get_kernel_wait_object -- Validates the wait object handle and
-* returns the kernel wait object handle.
-*
-* SYNOPSIS
-*/
-cl_wait_obj_handle_t
-cl_get_kernel_wait_object(
- IN cl_wait_obj_handle_t user_mode_handle );
-/*
-* PARAMETERS
-* user_mode_handle
-* A handle to the wait object passed from user mode.
-*
-* RETURN VALUES
-* On successful validation, returns the kernel wait object handle.
-* Kernel threads use this handle to do any appropriate action
-* on this wait object.
-* On failure, returns NULL.
-*
-* NOTES
-* This API is used only in the kernel.
-*
-* SEE ALSO
-* cl_create_wait_object, cl_destroy_wait_object, cl_wait_on_wait_object,
-* cl_signal_wait_object, cl_clear_wait_object.
-*
-******/
-
-/******/
-
-#endif //__KERNEL__
-
-/*
- * Shared between user and kernel mode
- */
-
-/****f* Component Library: Wait Objects/cl_create_wait_object
-* NAME
-* cl_create_wait_object
-*
-* DESCRIPTION
-* cl_create_wait_object -- Creates a wait object.
-*
-* SYNOPSIS
-*/
-cl_status_t
-cl_create_wait_object(
- IN const boolean_t auto_reset,
- OUT cl_wait_obj_handle_t *p_wait_obj_handle );
-/*
-* PARAMETERS
-* auto_reset
-* Specifies whether the signaled state should be reset automatically
-* or manually. If set to TRUE, the state will be reset automatically.
-* p_wait_obj_handle
-* On successful creation, returns the wait object handle.
-*
-* RETURN VALUES
-* CL_SUCCESS
-* The wait object was created successfully.
-* CL_ERROR
-* The wait object creation failed.
-* NOTES
-* Used in both kernel mode as well as user mode.
-*
-* SEE ALSO
-* cl_destroy_wait_object, cl_wait_on_wait_object,
-* cl_signal_wait_object, cl_clear_wait_object.
-*
-******/
-
-/****f* Component Library: Wait Objects/cl_destroy_wait_object
-* NAME
-* cl_destroy_wait_object
-*
-* DESCRIPTION
-* cl_destroy_wait_object -- Destroys a wait object.
-*
-* SYNOPSIS
-*/
-cl_status_t
-cl_destroy_wait_object(
- IN cl_wait_obj_handle_t wait_obj_handle );
-/*
-* PARAMETERS
-* wait_obj_handle
-* A handle to the wait object that needs to be destroyed.
-*
-* RETURN VALUES
-* CL_SUCCESS
-* The wait object handle is destroyed.
-* NOTES
-* Used in both kernel mode as well as user mode.
-*
-* SEE ALSO
-* cl_create_wait_object, cl_wait_on_wait_object,
-* cl_signal_wait_object, cl_clear_wait_object.
-*
-*********/
-
-/****f* Component Library: Wait Objects/cl_wait_on_wait_object
-* NAME
-* cl_wait_on_wait_object
-* DESCRIPTION
-* cl_wait_on_wait_object -- Wait on this wait object until signalled
-* or timed out.
-*
-* SYNOPSIS
-*/
-cl_status_t
-cl_wait_on_wait_object(
- IN cl_wait_obj_handle_t wait_obj_handle,
- IN uint32_t wait_u_sec );
-/*
-* PARAMETERS
-* wait_obj_handle
-* A handle to the wait object that the thread needs to be wait on.
-* wait_u_sec
-* The number of micro seconds to wait before timing out.
-*
-* RETURN VALUES
-* CL_SUCCESS
-* The wait completed successfully and the event is signalled.
-* CL_ERROR
-* Some error happened during the wait.
-* CL_NOT_DONE
-* The wait got interrupted due to some signal.
-* CL_TIMEOUT
-* The wait timed out.
-*
-* NOTES
-* Used in both kernel mode as well as user mode.
-*
-* SEE ALSO
-* cl_create_wait_object, cl_destroy_wait_object,
-* cl_signal_wait_object, cl_clear_wait_object.
-*
-*********/
-
-/****f* Component Library: Wait Objects/cl_signal_wait_object
-* NAME
-* cl_signal_wait_object
-*
-* DESCRIPTION
-* cl_signal_wait_object -- Signal the wait object. The thread
-* that is waiting on this will be woken up.
-*
-* SYNOPSIS
-*/
-cl_status_t
-cl_signal_wait_object(
- IN cl_wait_obj_handle_t wait_obj_handle );
-/*
-* PARAMETERS
-* wait_obj_handle
-* A handle to the wait object that needs to be signaled.
-*
-* RETURN VALUES
-* CL_SUCCESS
-* The wait object is successfully signaled.
-*
-* NOTES
-* Used in both kernel mode as well as user mode.
-*
-* SEE ALSO
-* cl_create_wait_object, cl_destroy_wait_object,
-* cl_wait_on_wait_object, cl_clear_wait_object.
-*
-*********/
-
-/****f* Component Library: Wait Objects/cl_clear_wait_object
-* NAME
-* cl_clear_wait_object
-*
-* DESCRIPTION
-* cl_clear_wait_object -- Clear the signaled state of a wait object
-* and reset it.
-*
-* SYNOPSIS
-*/
-cl_status_t
-cl_clear_wait_object(
- IN cl_wait_obj_handle_t wait_obj_handle );
-/*
-* PARAMETERS
-* wait_obj_handle
-* A handle to the wait object whose state needs to be reset.
-*
-* RETURN VALUES
-* CL_SUCCESS
-* The wait object is reset successfully.
-*
-* NOTES
-* Used in both kernel mode as well as user mode.
-*
-* SEE ALSO
-* cl_create_wait_object, cl_destroy_wait_object,
-* cl_wait_on_wait_object, cl_signal_wait_object.
-*
-*********/
-
-END_C_DECLS
-
-#endif // _CL_WAITOBJ_H_
Index: include/complib/cl_device.h
===================================================================
--- include/complib/cl_device.h
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ include/complib/cl_device.h (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -1,712 +0,0 @@
-/*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
- *
- * This software is available to you under a choice of one of two
- * licenses. You may choose to be licensed under the terms of the GNU
- * General Public License (GPL) Version 2, available from the file
- * COPYING in the main directory of this source tree, or the
- * OpenIB.org BSD license below:
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the following
- * disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * $Id$
- */
-
-
-
-/*
- * Abstract:
- * This module defines the data structure and APIs for the kernel mode
- * component of the device framework.
- *
- * Environment:
- * Linux Kernel Mode
- *
- * $Revision: 1.5 $
- */
-
-
-#ifndef _CL_DEVICE_H_
-#define _CL_DEVICE_H_
-
-
-#include <complib/cl_types.h>
-#include <complib/cl_qlist.h>
-#include <complib/cl_qmap.h>
-#include <complib/cl_waitobj.h>
-#include <linux/ioctl.h>
-#ifdef __KERNEL__
-#include <linux/mm.h>
-#endif
-
-#ifdef __cplusplus
-# define BEGIN_C_DECLS extern "C" {
-# define END_C_DECLS }
-#else /* !__cplusplus */
-# define BEGIN_C_DECLS
-# define END_C_DECLS
-#endif /* __cplusplus */
-
-BEGIN_C_DECLS
-
-
-/****h* Component Library/Device Framework
-* NAME
-* Device Framework
-*
-* DESCRIPTION
-* The device framework provides functionality exchanging information between
-* kernel mode and user mode components.
-*
-* In kernel mode, the device framework provides functionality for creating
-* devices and providing various entry points that are called when an
-* application using the user-mode device framework accesses the device.
-*
-* In user mode, the device framework provides applications with a simplified
-* device usage model, allowing access to a device created using the kernel
-* mode device framework.
-*********/
-
-
-/*
- * Generic way to define a IOCTL_CMD
- */
-
-#define IOCTL_CMD(dev_id, command) _IO((dev_id), (command))
-
-
-/****d* Component Library: Device Framework/cl_dev_name_t
-* NAME
-* cl_dev_name_t
-*
-* DESCRIPTION
-* cl_dev_name defines the name of the system device being created.
-*
-* SYNOPSIS
-*/
-typedef char *cl_dev_name_t;
-/*
-* NOTES
-* In Linux this string turns is similar to "/dev/iba0".
-*********/
-
-
-/****s* Component Library: Device Framework/cl_ioctl_info_t
-* NAME
-* cl_ioctl_info_t
-*
-* PURPOSE
-* Defines the command and the input parameters for an ioctl passed
-* in from user mode.
-*
-* SYNOPSIS
-*/
-typedef struct _cl_ioctl_info
-{
- uintn_t command; /* IOCTL Command */
- void *p_buf; /* Pointer to the input buffer */
- uintn_t buf_size; /* Size of the input buffer */
- uintn_t num_bytes_ret; /* Bytes returned by the ioctl */
- cl_status_t io_status; /* Status of the IOCTL */
-
-} cl_ioctl_info_t;
-/**********/
-
-
-#ifdef __KERNEL__
-
-/* Linux Kernel Mode */
-
-/****d* Component Library: Device Framework/cl_dev_handle_t (Kernel Mode)
-* NAME
-* cl_dev_handle_t (Kernel Mode)
-*
-* DESCRIPTION
-* Handle to an device framework created device object.
-*
-* SYNOPSIS
-*/
-typedef void *cl_dev_handle_t;
-/*********/
-
-
-/****d* Component Library: Device Framework/cl_pfn_dev_open_t
-* NAME
-* cl_pfn_dev_open_t
-*
-* DESCRIPTION
-* Prototype of the driver exported "open" function. This function
-* is called when a user mode application opens the device
-*
-* SYNOPSIS
-*/
-typedef cl_status_t
-(*cl_pfn_dev_open_t)(
- IN void *p_device_context,
- OUT void **pp_open_context );
-
-/*
-* PARAMETERS
-* p_device_context
-* [in] device specific context passed into the open function. This
-* is defined when the device is first created.
-*
-* pp_open_context
-* [out] context specific to this open. This is set by the open call
-* and is passed into the read, write, mmap, ioctl and close calls.
-*
-* RETURN VALUE
-* This function returns a status of type cl_status_t
-* TBD
-*
-* NOTES
-*
-* SEE ALSO
-* Device Framework, cl_pfn_dev_close_t, cl_pfn_dev_ioctl_t, cl_pfn_dev_mmap_t
-*************/
-
-
-/****d* Component Library: Device Framework/cl_pfn_dev_close_t
-* NAME
-* cl_pfn_dev_close_t
-*
-* DESCRIPTION
-* Prototype of the driver exported "close" function. This function
-* is called when a user mode application closes the device.
-*
-* SYNOPSIS
-*/
-typedef cl_status_t
-(*cl_pfn_dev_close_t)(
- IN void *p_device_context,
- IN void *p_open_context );
-
-/*
-* PARAMETERS
-* p_device_context
-* [in] device specific context passed into the close function. This
-* is defined when the device is first created.
-*
-* p_open_context
-* [in] context specific to this open. This is set by the open call.
-*
-* RETURN VALUE
-* This function returns a status of type cl_status_t
-* TBD
-*
-* NOTES
-*
-* SEE ALSO
-* Device Framework, cl_pfn_dev_open_t, cl_pfn_dev_ioctl_t, cl_pfn_dev_mmap_t
-*************/
-
-
-/****d* Component Library: Device Framework/cl_pfn_dev_ioctl_t
-* NAME
-* cl_pfn_dev_ioctl_t
-*
-* DESCRIPTION
-* Prototype of the driver exported "ioctl" function. This function
-* is called when a user mode application issues and IO control to
-* the device.
-*
-* SYNOPSIS
-*/
-typedef void
-(*cl_pfn_dev_ioctl_t)(
- IN void *p_device_context,
- IN void *p_open_context,
- IN OUT cl_ioctl_info_t *p_ioctl_info );
-/*
-* PARAMETERS
-* p_device_context
-* [in] device specific context passed into the open function. This
-* is created when the device is first created.
-*
-* p_open_context
-* [in] context specific to this open. This is set by the open call.
-*
-* p_ioctl_info
-* [in/out] On input contains the input parameters such as the command,
-* the input buffer and it's size. On output, contains the output
-* buffer and the number of bytes returned.
-*
-* RETURN VALUE
-* This function does not return a value.
-*
-* NOTES
-* The IOCTL completion status is returned in the status field of the
-* p_ioctl_info structure.
-*
-* If set to CL_SUCCESS, the command completed successfully. The results
-* are returned in the same buffer (p_ioclt_info->p_in_buf) and num_ret_bytes
-* are copied by the device framework into the output buffer and returned
-* back to user mode.
-*
-* If set to CL_PENDING, the command did not complete (further processing
-* required by the kernel handler). If the user application does not specify
-* an OS wait object (see cl_ioctl_info_t), the device framework will suspend
-* the execution of the current thread (put it to sleep). If a wait object is
-* provided, the device framework will return immediately. The user mode
-* application must check the status of the command and get results using
-* get_ioctl_status
-*
-* Other failure status values will cause the device framework to perform
-* all necessary cleanup for the IOCTL before returning to the user.
-*
-* The mechanism to support pending ioclts is currently not supported.
-*
-* SEE ALSO
-* Device Framework, cl_pfn_dev_open_t, cl_pfn_dev_close_t, cl_pfn_dev_mmap_t
-************/
-
-/****d* Component Library: Device Framework/cl_pfn_dev_cancel_ioctl_t
-* NAME
-* cl_pfn_dev_cancel_ioctl_t
-*
-* DESCRIPTION
-* Prototype of the driver exported "ioctl" function. This function
-* is called when a blocked ioctl is interrupted due to a signal
-*
-* SYNOPSIS
-*/
-typedef void
-(*cl_pfn_dev_cancel_ioctl_t)(
- IN void *p_device_context,
- IN void *p_open_context,
- IN cl_ioctl_info_t *p_ioctl_info );
-/*
-* PARAMETERS
-* p_device_context
-* [in] device specific context passed into the open function. This
-* is created when the device is first created.
-*
-* p_open_context
-* [in] context specific to this open. This is set by the open call.
-*
-* p_ioctl_info
-* [in] contains the kernel ioctl buffer
-*
-* RETURN VALUE
-* This function does not return a value.
-*
-* NOTES
-*
-* SEE ALSO
-* Device Framework, cl_pfn_dev_open_t, cl_pfn_dev_close_t, cl_pfn_dev_mmap_t
-************/
-
-/****d* Component Library: Device Framework/cl_pfn_dev_mmap_t
-* NAME
-* cl_pfn_dev_mmap_t
-*
-* DESCRIPTION
-* Prototype of the driver exported "mmap" function. This function
-* is called when a user mode application calls mmap on this device.
-*
-* SYNOPSIS
-*/
-typedef cl_status_t
-(*cl_pfn_dev_mmap_t)(
- IN void *p_device_context,
- IN void *p_open_context,
- IN struct vm_area_struct *p_vma );
-/*
-* PARAMETERS
-* p_device_context
-* [in] device specific context passed into the open function. This
-* is created when the device is first created.
-*
-* pp_open_context
-* [out] context specific to this open. This is set by the open call.
-*
-* RETURN VALUE
-* CL_SUCCESS if the operation was successful.
-*
-* CL_ERROR if the operation failed.
-*
-* SEE ALSO
-* Device Framework, cl_pfn_dev_open_t, cl_pfn_dev_close_t, cl_pfn_dev_ioctl_t
-************/
-
-
-/****s* Component Library: Device Framework/cl_dev_info_t
-* NAME
-* cl_dev_info_t
-*
-* DESCRIPTION
-* Provides information about for creation of a system device.
-*
-* SYNOPSIS
-*/
-typedef struct _cl_dev_info
-{
- cl_dev_name_t name; /* name of the device to create */
- void *p_device_context; /* device context */
- cl_pfn_dev_open_t pfn_open; /* open function */
- cl_pfn_dev_close_t pfn_close; /* close function */
- cl_pfn_dev_ioctl_t pfn_ioctl; /* ioctl function */
- cl_pfn_dev_cancel_ioctl_t pfn_cancel_ioctl; /* cancel ioctl function */
- cl_pfn_dev_mmap_t pfn_mmap; /* mmap function */
- uint32_t max_use_count; /* maximum usage count */
-
-} cl_dev_info_t;
-/*
-* FIELDS
-* name
-* Name of the device to create.
-*
-* p_device_context
-* Device context.
-*
-* pfn_open
-* open function.
-*
-* pfn_close
-* close function.
-*
-* pfn_ioctl
-* ioctl function.
-*
-* pfn_mmap
-* mmap function.
-*
-* max_use_count
-* maximum usage count.
-*
-* NOTES
-* The consumer of the device framework defines the name of the device,
-* a device context and various handlers and registers with the device
-* framework.
-*
-* SEE ALSO
-* Device Framework, cl_pfn_dev_open_t, cl_pfn_dev_close_t,
-* cl_pfn_dev_ioctl_t, cl_pfn_dev_mmap_t
-**********/
-
-
-/****f* Component Library: Device Framework/cl_dev_create
-* NAME
-* cl_dev_create
-*
-* DESCRIPTION
-* This function creates a device accessible from a user mode application.
-* The device (a character device) can be accessed by opening it.
-*
-* SYNOPSIS
-*/
-cl_status_t
-cl_dev_create(
- IN cl_dev_info_t *p_dev_info,
- OUT cl_dev_handle_t *ph_dev );
-/*
-* PARAMETERS
-* p_dev_info
-* [in] Pointer to the structure containing information about
-* the system device that needs to be created.
-*
-* ph_dev
-* [out] Handle to the created system device.
-*
-* RETURN VALUE
-* CL_SUCCESS
-* The device is created successfully.
-*
-* CL_INVALID_PARAMETER
-* An input parameter was invalid.
-*
-* CL_ERROR
-* The function failed to create a device.
-*
-* SEE ALSO
-* Device Framework, cl_delete_device
-*********/
-
-/****d* Component Library: Device Framework/cl_delete_device
-* NAME
-* cl_delete_device
-*
-* DESCRIPTION
-* Delete a system device.
-*
-* SYNOPSIS
-*/
-void
-cl_dev_destroy(
- IN cl_dev_handle_t h_dev );
-/*
-* PARAMETERS
-* h_dev
-* [in] handle to the system device. This is returned by cl_dev_create.
-*
-* RETURN VALUE
-* This function does not return a value.
-*
-* SEE ALSO
-* Device Framework, cl_dev_create
-*********/
-
-
-/****d* Component Library: Device Framework/cl_complete_io
-* NAME
-* cl_complete_io
-*
-* DESCRIPTION
-* This function is used by the driver ioctl handler to indicate that a
-* pending ioctl command has completed. The device framework uses this
-* "notification" to wake up the blocked user mode thread and complete
-* the ioctl. The user mode thread is blocked when the driver ioctl handler
-* returns CL_PENDING (cannot complete the ioclt command immediately).
-*
-* SYNOPSIS
-*/
-cl_status_t
-cl_complete_io(
- IN cl_ioctl_info_t *p_ioctl_info );
-/*
-* PARAMETERS
-* p_ioctl_info
-* [in] Pointer to the kernel ioctl info structure that was passed in
-* by the device framework into the ioctl handler.
-*
-* RETURN VALUE
-* CL_SUCCESS
-* Completed pending ioctl operation from a previous ioctl command
-* successfully.
-*
-* CL_INVALID_PARAMETER
-* The p_ioctl_info parameter was not valid.
-*
-* NOTES
-* When the kernel ioctl handler returns CL_PENDING for a command, the
-* user mode application is blocked (if the OS wait object is NULL) or
-* returned with CL_PENDING (if a wait object is specified). If a wait
-* object is specified, the wait object is now signaled and the user mode
-* application needs to call get_ioctl_status() to get results of the
-* ioctl command (This isn't supported yet). If the OS wait object isn't
-* specified, and the user mode application was blocked by the driver
-* framework, it is unblocked now and returned.
-*
-* SEE ALSO
-* Device Framework, cl_dev_create, cl_delete_device.
-*********/
-
-
-/****f* Component Library: Device Framework/cl_dev_init
-* NAME
-* cl_dev_init
-*
-* DESCRIPTION
-* Initialize internal data structures for creating and managing system
-* devices and this framework.
-*
-* SYNOPSIS
-*/
-cl_status_t
-__cl_dev_frmwk_init(void);
-/*
-* RETURN VALUE
-* CL_SUCCESS
-* If the system device framework was initialized successfully.
-*
-* CL_INSUFFICIENT_RESOURCES
-* Failed to allocate/acquire some system resource.
-*
-* NOTES
-* This function is called by drivers needing to use the driver framework.
-* For instance, the driver might need to support IOCTL calls.
-*
-* SEE ALSO
-* Device Framework, cl_dev_destroy
-*********/
-
-/****f* Component Library: Device Framework/cl_dev_destroy
-* NAME
-* cl_dev_destroy
-*
-* DESCRIPTION
-* Cleanup all internal data structures, created in system_dev_init,
-* to support system devices and this framework
-*
-* SYNOPSIS
-*/
-void
-__cl_dev_frmwk_destroy(void);
-/*
-* RETURN VALUE
-* This function does not return a value.
-*
-* NOTES
-* This function is called by a driver that needed device framework support
-* and called system_dev_init. This function cleans up everything allocated
-* in system_dev_init.
-*
-* SEE ALSO
-* Device Framework, cl_dev_init
-*********/
-
-cl_status_t
-cl_get_open_context(
- IN int fd,
- OUT void** p_open_context,
- OUT cl_dev_info_t** p_dev_info );
-
-
-#else /* __KERNEL__ */
-
-/* Linux User Mode */
-
-
-/****d* Component Library: Device Framework/cl_dev_handle_t (User Mode)
-* NAME
-* cl_dev_handle_t (User Mode)
-*
-* DESCRIPTION
-* Handle to an device framework created device object.
-*
-* SYNOPSIS
-*/
-typedef intn_t cl_dev_handle_t;
-/*********/
-
-
-/****f* Component Library: Device Framework/cl_open_device
-* NAME
-* cl_open_device
-*
-* DESCRIPTION
-* Opens a system device. A user mode application needs to open a device
-* and use the returned device handle to use the device.
-*
-* The device must be closed when the application has finished using the
-* device.
-*
-* SYNOPSIS
-*/
-cl_status_t
-cl_open_device(
- IN cl_dev_name_t device_name,
- OUT cl_dev_handle_t *ph_dev );
-
-/*
-* PARAMETERS
-* device_name
-* [in] Name of the device to open. This is the same name that was used to
-* create the kernel mode device.
-*
-* ph_dev
-* [out] pointer to the location that holds the device handle. This handle
-* is used to reference this device in other calls like cl_close_device etc.
-*
-* RETURN VALUE
-* CL_SUCCESS
-* The open call succeeded.
-*
-* CL_INVALID_PARAMETER
-* The consumer passed in an invalid parameter.
-*
-* CL_ERROR
-* The device does not exist, open failed.
-*
-* NOTES
-* A kernel driver must use the kernel mode device framework to create this
-* device before it can be opened.
-*
-* SEE ALSO
-* Device Framework, cl_close_device, cl_iocl_device.
-********/
-
-
-/****f* Component Library: Device Framework/cl_close_device
-* NAME
-* cl_close_device
-*
-* DESCRIPTION
-* Closes an open system device.
-*
-* SYNOPSIS
-*/
-void
-cl_close_device(
- IN cl_dev_handle_t h_dev );
-
-/*
-* PARAMETERS
-* h_dev
-* [in] Handle to an open device returned by a previous call
-* to cl_open_device.
-*
-* RETURN VALUE
-* This function does not return a value.
-*
-* SEE ALSO
-* cl_open_device, cl_ioctl_device
-********/
-
-
-/****f* Component Library: Device Framework/cl_ioctl_device
-* NAME
-* cl_ioctl_device
-*
-* DESCRIPTION
-* Issue an io control (ioctl) operation to a device. The device must
-* be opened before this can be done.
-*
-* SYNOPSIS
-*/
-cl_status_t
-cl_ioctl_device(
- IN cl_dev_handle_t dev_handle,
- IN uint32_t command,
- IN void *p_buf,
- IN uintn_t buf_size,
- OUT uintn_t *p_num_bytes_ret );
-/*
-* PARAMETERS
-* dev_handle
-* [in] Handle to an open device. Returned by cl_open_device.
-* command
-* [in] The ioctl command for the kernel handler.
-* p_buf
-* [in] pointer to the input buffer to pass arguments to the kernel
-* handler. The same buffer will hold the results too.
-* buf_size
-* [in] size of the previous argument (p_buf).
-* p_num_bytes_ret
-* [in] actual number of bytes returned in the output buffer by the
-* kernel handler.
-*
-* RETURN VALUE
-* The ioctl status returned by the kernel handler.
-*
-* SEE ALSO
-* Device Framework, cl_open_device, cl_close_device.
-********/
-
-#endif // __KERNEL__
-
-END_C_DECLS
-
-#endif // _CL_DEVICE_H_
Index: include/complib/cl_syshelper.h
===================================================================
--- include/complib/cl_syshelper.h
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ include/complib/cl_syshelper.h (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -1,238 +0,0 @@
-/*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
- *
- * This software is available to you under a choice of one of two
- * licenses. You may choose to be licensed under the terms of the GNU
- * General Public License (GPL) Version 2, available from the file
- * COPYING in the main directory of this source tree, or the
- * OpenIB.org BSD license below:
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the following
- * disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * $Id$
- */
-
-
-
-/*
- * Abstract:
- * This header file defines data structures and APIs for the system helper
- * module of the component library.
- *
- * Environment:
- * Linux Kernel and User Mode.
- *
- * $Revision: 1.7 $
- */
-
-
-#ifndef _CL_SYSHELPER_H_
-#define _CL_SYSHELPER_H_
-
-/****h* Component Library/System Helper
-* NAME
-* System Helper
-*
-* DESCRIPTION
-* Provides ioctl support and handle validation for wait objects.
-*
-********/
-
-#ifdef __KERNEL__
-
-#include <linux/ioctl.h>
-#include <linux/mm.h>
-
-#endif //__KERNEL__
-
-#include <complib/cl_types.h>
-#include <complib/cl_list.h>
-#include <complib/cl_qlist.h>
-#include <complib/cl_event.h>
-#include <complib/cl_qmap.h>
-#include <complib/cl_passivelock.h>
-#include <complib/cl_spinlock.h>
-
-#ifdef __cplusplus
-# define BEGIN_C_DECLS extern "C" {
-# define END_C_DECLS }
-#else /* !__cplusplus */
-# define BEGIN_C_DECLS
-# define END_C_DECLS
-#endif /* __cplusplus */
-
-BEGIN_C_DECLS
-
-#define SYSHELP_DEVICE_NAME "/dev/cl_dev"
-#define SYSDEV_KEY '#'
-
-#ifdef __KERNEL__
-
-/****f* Component Library: System Helper/__cl_syshelper_init
-* NAME
-* __cl_syshelper_init
-*
-* DESCRIPTION
-* Initializes the system helper data structures and prepares it
-* for use.
-*
-* SYNOPSIS
-*/
-cl_status_t
-__cl_syshelper_init(void);
-
-/*
-* PARAMETERS
-* None.
-*
-* RETURN VALUES
-* CL_SUCCESS
-* The initialization completed successfully.
-* CL_ERROR
-* Could not create the device.
-*
-* NOTES
-*
-* SEE ALSO
-* __cl_syshelper_exit
-********/
-
-/****f* Component Library: System Helper/__cl_syshelper_exit
-* NAME
-* __cl_syshelper_exit
-*
-* DESCRIPTION
-* Releases the resources used by syshelper and destroys the device.
-*
-* SYNOPSIS
-*/
-void
-__cl_syshelper_exit(void);
-
-/*
-* PARAMETERS
-* None
-*
-* RETURN VALUES
-* None.
-*
-* NOTES
-*
-* SEE ALSO
-* __cl_syshelper_init
-*********/
-
-#else // __KERNEL__
-
-/*
- * User mode only
- */
-
-/****f* Component Library: System Helper/__cl_user_syshelper_init
-* NAME
-* __cl_user_syshelper_init
-*
-* DESCRIPTION
-* Initialize the system helper in user mode.
-*
-* SYNOPSIS
-*/
-cl_status_t
-__cl_user_syshelper_init(void);
-/*
-* PARAMETERS
-* None.
-*
-* RETURN VALUES
-* CL_SUCCESS
-* The initialization completed successfully.
-*
-* NOTES
-*
-* SEE ALSO
-*****/
-
-/****f* Component Library: System Helper/__cl_user_syshelper_exit
-* NAME
-* __cl_user_syshelper_exit
-*
-* DESCRIPTION
-* Cleanup the system helper in user mode.
-*
-* SYNOPSIS
-*/
-void
-__cl_user_syshelper_exit(void);
-/*
-* PARAMETERS
-* None.
-*
-* RETURN VALUES
-* None.
-*
-* NOTES
-*
-* SEE ALSO
-******/
-
-#endif // __KERNEL__
-
-/*
- * Shared between user and kernel mode.
- */
-
-/****d* Component Library: System Helper/cl_syshelper_ops_t
-* NAME
-* syshelper_ops_t
-*
-* DESCRIPTION
-*
-* SYNOPSIS
-*/
-typedef enum cl_syshelper_ops
-{
- create_wait_obj = 1,
- waiton_wait_obj,
- trigger_wait_obj,
- reset_wait_obj,
- syshelp_ioctl_max /* always at the end of the list */
-
-} cl_syshelper_ops_t;
-/**********/
-
-/*
- * Various Opration Allowable on the System Helper
- */
-#define CREATE_WAIT_OBJ \
- IOCTL_CMD(SYSDEV_KEY, create_wait_obj)
-#define WAITON_WAIT_OBJ \
- IOCTL_CMD(SYSDEV_KEY, waiton_wait_obj)
-#define TRIGGER_WAIT_OBJ \
- IOCTL_CMD(SYSDEV_KEY, trigger_wait_obj)
-#define RESET_WAIT_OBJ \
- IOCTL_CMD(SYSDEV_KEY, reset_wait_obj)
-END_C_DECLS
-
-#endif //_CL_SYSHELPER_H_
Index: include/Makefile.am
===================================================================
--- include/Makefile.am (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ include/Makefile.am (.../trunk/src/userspace/management/osm) (revision
6101)
@@ -124,7 +124,6 @@ EXTRA_DIST = \
$(srcdir)/complib/cl_packon.h \
$(srcdir)/complib/cl_memory_osd.h \
$(srcdir)/complib/cl_atomic_osd.h \
- $(srcdir)/complib/cl_signal_osd.h \
$(srcdir)/complib/cl_spinlock.h \
$(srcdir)/complib/cl_passivelock.h \
$(srcdir)/complib/cl_timer_osd.h \
@@ -136,8 +135,6 @@ EXTRA_DIST = \
$(srcdir)/complib/cl_qpool.h \
$(srcdir)/complib/cl_qlist.h \
$(srcdir)/complib/cl_reqmgr.h \
- $(srcdir)/complib/cl_waitobj.h \
- $(srcdir)/complib/cl_device.h \
$(srcdir)/complib/cl_vector.h \
$(srcdir)/complib/cl_byteswap_osd.h \
$(srcdir)/complib/cl_qlockpool.h \
@@ -150,7 +147,6 @@ EXTRA_DIST = \
$(srcdir)/complib/cl_list.h \
$(srcdir)/complib/cl_atomic.h \
$(srcdir)/complib/cl_map.h \
- $(srcdir)/complib/cl_syshelper.h \
$(srcdir)/complib/cl_timer.h \
$(srcdir)/complib/cl_event.h \
$(srcdir)/complib/cl_log.h \
Index: include/vendor/osm_vendor_mlx_svc.h
===================================================================
--- include/vendor/osm_vendor_mlx_svc.h
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ include/vendor/osm_vendor_mlx_svc.h
(.../trunk/src/userspace/management/osm) (revision 6101)
@@ -116,6 +116,10 @@ osmv_mad_is_rmpp(IN const ib_mad_t *p_ma
CL_ASSERT(NULL != p_mad);
rmpp_flags = ((ib_rmpp_mad_t*)p_mad)->rmpp_flags;
+ /* HACK - JUST SA and DevMgt for now - need to add BIS and DevAdm */
+ if ( (p_mad->mgmt_class != CL_NTOH16(IB_MCLASS_SUBN_ADM)) &&
+ (p_mad->mgmt_class != CL_NTOH16(IB_MCLASS_DEV_MGMT)) )
+ return(0);
return (0 != (rmpp_flags & IB_RMPP_FLAG_ACTIVE));
}
Index: include/vendor/osm_vendor_mlx_txn.h
===================================================================
--- include/vendor/osm_vendor_mlx_txn.h
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ include/vendor/osm_vendor_mlx_txn.h
(.../trunk/src/userspace/management/osm) (revision 6101)
@@ -287,7 +287,7 @@ osmv_txn_set_rmpp_state(IN osmv_txn_ctx_
* osmv_txn_get_madw
*
* DESCRIPTION
- * returns the requestor madw
+ * returns the requester madw
* SEE ALSO
*
*/
@@ -303,7 +303,7 @@ osmv_txn_get_madw(IN osmv_txn_ctx_t *p_t
* osmv_txn_set_madw
*
* DESCRIPTION
- * sets the requestor madw
+ * sets the requester madw
* SEE ALSO
*
*/
Index: libvendor/osm_vendor_mlx_dispatcher.c
===================================================================
--- libvendor/osm_vendor_mlx_dispatcher.c
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ libvendor/osm_vendor_mlx_dispatcher.c
(.../trunk/src/userspace/management/osm) (revision 6101)
@@ -327,7 +327,7 @@ __osmv_dispatch_rmpp_mad(IN osm_bind_han
}
/* IB Spec 13.6.2.2. This is a Sender Initiated Transfer.
- My peer is the requestor and RMPP Sender. I am the RMPP Receiver.
+ My peer is the requester and RMPP Sender. I am the RMPP Receiver.
*/
status = osmv_txn_init(h_bind, /*tid==key*/key, key, &p_txn);
if (IB_SUCCESS != status)
@@ -363,7 +363,7 @@ __osmv_dispatch_rmpp_mad(IN osm_bind_han
{
if (FALSE == osmv_txn_is_rmpp_init_by_peer(p_txn))
{
- /* This is a requestor, still waiting for the reply. Apply the
callback */
+ /* This is a requester, still waiting for the reply. Apply the
callback */
/* update the status of the p_madw */
p_madw = osmv_txn_get_madw(p_txn);
p_madw->status = status;
Index: libvendor/osm_vendor_mlx_txn.c
===================================================================
--- libvendor/osm_vendor_mlx_txn.c
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ libvendor/osm_vendor_mlx_txn.c (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -608,7 +608,7 @@ __osmv_txn_timeout_cb(IN uint64_t key,
osmv_txn_done((osm_bind_handle_t)p_bo, key,
TRUE /*in timeout callback*/);
- /* This is a requestor. Always apply the callback */
+ /* This is a requester. Always apply the callback */
invoke_err_cb = TRUE;
}
else
@@ -636,7 +636,7 @@ __osmv_txn_timeout_cb(IN uint64_t key,
osmv_txn_done((osm_bind_handle_t)p_bo, key,
TRUE /*in timeout callback*/);
- /* This is a requestor. Always apply the callback */
+ /* This is a requester. Always apply the callback */
invoke_err_cb = TRUE;
}
break;
@@ -682,7 +682,7 @@ __osmv_txn_timeout_cb(IN uint64_t key,
if (FALSE == osmv_txn_is_rmpp_init_by_peer(p_txn))
{
- /* This is a requestor, still waiting for the reply. Apply the
callback */
+ /* This is a requester, still waiting for the reply. Apply the
callback */
invoke_err_cb = TRUE;
}
Index: libvendor/osm_vendor_mlx_anafa.c
===================================================================
--- libvendor/osm_vendor_mlx_anafa.c
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ libvendor/osm_vendor_mlx_anafa.c (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -507,7 +507,7 @@ osm_vendor_send (IN osm_bind_handle_t h_
if (TRUE == resp_expected) {
/* Change the status on the p_madw */
p_madw->status = ret;
- /* Only the requestor expects the error callback */
+ /* Only the requester expects the error callback */
p_bo->send_err_cb (p_bo->cb_context, p_madw);
} else {
/* put back the mad - it is useless ... */
@@ -684,7 +684,7 @@ __osmv_get_send_txn (IN osm_bind_handle_
key = tid = cl_ntoh64 (p_mad->trans_id);
if (TRUE == resp_expected) {
- /* Create a unique identifier at the requestor side */
+ /* Create a unique identifier at the requester side */
key = osmv_txn_uniq_key (tid);
}
@@ -735,7 +735,7 @@ __osmv_get_send_txn (IN osm_bind_handle_
/* Save a reference to the MAD in the txn context
* We'll need to match it in two cases:
- * (1) When the response is returned, if I am the requestor
+ * (1) When the response is returned, if I am the requester
* (2) In RMPP retransmissions
*/
osmv_txn_set_madw (*pp_txn, p_madw);
Index: libvendor/osm_vendor_mlx.c
===================================================================
--- libvendor/osm_vendor_mlx.c (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ libvendor/osm_vendor_mlx.c (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -528,7 +528,7 @@ osm_vendor_send(
{
/* Change the status on the p_madw */
p_madw->status = ret;
- /* Only the requestor expects the error callback */
+ /* Only the requester expects the error callback */
p_bo->send_err_cb(p_bo->cb_context, p_madw);
}
else
@@ -734,7 +734,7 @@ __osmv_get_send_txn(IN osm_bind_handle_
key = tid = cl_ntoh64(p_mad->trans_id);
if (TRUE == resp_expected)
{
- /* Create a unique identifier at the requestor side */
+ /* Create a unique identifier at the requester side */
key = osmv_txn_uniq_key(tid);
}
@@ -798,7 +798,7 @@ __osmv_get_send_txn(IN osm_bind_handle_
/* Save a reference to the MAD in the txn context
* We'll need to match it in two cases:
- * (1) When the response is returned, if I am the requestor
+ * (1) When the response is returned, if I am the requester
* (2) In RMPP retransmissions
*/
osmv_txn_set_madw(*pp_txn, p_madw);
Index: AUTHORS
===================================================================
--- AUTHORS (.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ AUTHORS (.../trunk/src/userspace/management/osm) (revision 6101)
@@ -6,3 +6,4 @@ Eitan Zahavi, Mellanox Technologi
Yael Kalka, Mellanox Technologies, yael at mellanox.co.il
Shahar Frank, Voltaire
Hal Rosenstock, Voltaire, halr at voltaire.com
+Sasha Khapyorsky, Voltaire, sashak at voltaire.com
Index: complib/cl_complib.c
===================================================================
--- complib/cl_complib.c (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ complib/cl_complib.c (.../trunk/src/userspace/management/osm) (revision
6101)
@@ -40,11 +40,8 @@
#endif /* HAVE_CONFIG_H */
#include <complib/cl_types.h>
-#include <complib/cl_device.h>
#include <complib/cl_debug.h>
#include <complib/cl_spinlock.h>
-#include <complib/cl_syshelper.h>
-#include <complib/cl_waitobj.h>
#include <stdio.h>
#include <unistd.h>
@@ -65,7 +62,6 @@ __cl_timer_prov_destroy( void );
cl_spinlock_t cl_atomic_spinlock;
void
-__attribute (( constructor ))
complib_init(void)
{
cl_status_t status = CL_SUCCESS;
@@ -74,10 +70,6 @@ complib_init(void)
if (status != CL_SUCCESS)
goto _error;
- status = __cl_user_syshelper_init();
- if( status != CL_SUCCESS )
- goto _error;
-
status = __cl_timer_prov_create();
if( status != CL_SUCCESS)
goto _error;
@@ -90,18 +82,9 @@ complib_init(void)
}
void
-__attribute (( destructor ))
-complib_fini(void)
-{
- __cl_timer_prov_destroy();
- __cl_user_syshelper_exit();
-}
-
-void
complib_exit(void)
{
__cl_timer_prov_destroy();
- __cl_user_syshelper_exit();
cl_spinlock_destroy(&cl_atomic_spinlock);
}
Index: complib/Makefile.am
===================================================================
--- complib/Makefile.am (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ complib/Makefile.am (.../trunk/src/userspace/management/osm) (revision
6101)
@@ -18,14 +18,14 @@ else
libosmcomp_version_script =
endif
-libosmcomp_la_SOURCES = cl_async_proc.c cl_complib.c cl_device.c \
+libosmcomp_la_SOURCES = cl_async_proc.c cl_complib.c \
cl_dispatcher.c cl_event.c cl_event_wheel.c \
cl_list.c cl_log.c cl_map.c cl_memory.c \
cl_memory_osd.c cl_obj.c cl_perf.c cl_pool.c \
cl_ptr_vector.c cl_reqmgr.c \
cl_spinlock.c cl_statustext.c \
- cl_syshelper.c cl_thread.c cl_threadpool.c \
- cl_timer.c cl_vector.c cl_waitobj.c \
+ cl_thread.c cl_threadpool.c \
+ cl_timer.c cl_vector.c \
ib_statustext.c
libosmcomp_la_LDFLAGS = -version-info $(complib_api_version) \
-export-dynamic $(libosmcomp_version_script)
@@ -41,7 +41,6 @@ libosmcompinclude_HEADERS = $(srcdir)/..
$(srcdir)/../include/complib/cl_comppool.h \
$(srcdir)/../include/complib/cl_debug.h \
$(srcdir)/../include/complib/cl_debug_osd.h \
- $(srcdir)/../include/complib/cl_device.h \
$(srcdir)/../include/complib/cl_dispatcher.h \
$(srcdir)/../include/complib/cl_event.h \
$(srcdir)/../include/complib/cl_event_wheel.h \
@@ -69,7 +68,6 @@ libosmcompinclude_HEADERS = $(srcdir)/..
$(srcdir)/../include/complib/cl_reqmgr.h \
$(srcdir)/../include/complib/cl_spinlock.h \
$(srcdir)/../include/complib/cl_spinlock_osd.h \
- $(srcdir)/../include/complib/cl_syshelper.h \
$(srcdir)/../include/complib/cl_thread.h \
$(srcdir)/../include/complib/cl_thread_osd.h \
$(srcdir)/../include/complib/cl_threadpool.h \
@@ -82,8 +80,7 @@ libosmcompinclude_HEADERS = $(srcdir)/..
$(srcdir)/../include/complib/cl_timer_osd.h \
$(srcdir)/../include/complib/cl_types.h \
$(srcdir)/../include/complib/cl_types_osd.h \
- $(srcdir)/../include/complib/cl_vector.h \
- $(srcdir)/../include/complib/cl_waitobj.h
+ $(srcdir)/../include/complib/cl_vector.h
# headers are distributed as part of the include dir
EXTRA_DIST = $(srcdir)/libosmcomp.spec.in $(srcdir)/libosmcomp.map \
Index: complib/cl_device.c
===================================================================
--- complib/cl_device.c (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ complib/cl_device.c (.../trunk/src/userspace/management/osm) (revision
6101)
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
- *
- * This software is available to you under a choice of one of two
- * licenses. You may choose to be licensed under the terms of the GNU
- * General Public License (GPL) Version 2, available from the file
- * COPYING in the main directory of this source tree, or the
- * OpenIB.org BSD license below:
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the following
- * disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * $Id$
- */
-
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif /* HAVE_CONFIG_H */
-
-/*
- * Standard user mode includes
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <errno.h>
-#include <string.h>
-
-#include <complib/cl_types.h>
-#include <complib/cl_debug.h>
-#include <complib/cl_device.h>
-
-
-cl_status_t
-cl_open_device(
- IN cl_dev_name_t device_name,
- IN cl_dev_handle_t *p_dev_handle )
-{
- /* sanity check */
- if ( p_dev_handle == NULL)
- {
- return CL_INVALID_PARAMETER;
- }
-
- cl_dbg_out ("cl_open_device: opening device %s\n",
- device_name);
-
- *p_dev_handle = open(device_name, O_RDWR);
-
- if (*p_dev_handle < 0)
- {
- *p_dev_handle = 0;
- cl_msg_out("cl_open_dev: error opening %s (%s)\n",
- device_name, strerror(errno));
- return CL_ERROR;
- }
- else
- {
- return CL_SUCCESS;
- }
-}
-
-void
-cl_close_device(
- IN cl_dev_handle_t dev_handle )
-{
- int status = 0;
-
- status = close (dev_handle);
- if (status)
- {
- cl_msg_out("cl_close_device: error closing device (%s)\n",
- strerror(errno));
- }
- return;
-}
-
-cl_status_t
-cl_ioctl_device(
- IN cl_dev_handle_t dev_handle,
- IN uint32_t command,
- IN void *p_buf,
- IN uintn_t buf_size,
- OUT uintn_t *p_num_bytes_ret )
-{
- cl_ioctl_info_t ioctl_args;
- int retval = 0;
-
- /*
- * Fill up ioctl_args and issue a real ioctl
- */
- ioctl_args.command = command;
- ioctl_args.p_buf = p_buf;
- ioctl_args.buf_size = buf_size;
- ioctl_args.num_bytes_ret = 0; /* for now */
- ioctl_args.io_status = CL_SUCCESS; /* lets start here */
-
- retval = ioctl(dev_handle, command, &ioctl_args);
-
- if (retval != 0)
- {
- cl_msg_out("cl_ioctl_device: error (%s) issuing command (0x%x)\n",
- strerror(errno), command);
- return CL_ERROR;
- }
-
- /*
- * Set the Number of bytes returned from the Kernel.
- * The driver sets the number of bytes returned in
- * ioctl_args.num_bytes_ret
- */
- if (p_num_bytes_ret != NULL)
- {
- *p_num_bytes_ret = ioctl_args.num_bytes_ret;
- }
-
- /*
- * Return the status received from the Kernel
- */
-
- return (ioctl_args.io_status);
-}
Index: complib/cl_waitobj.c
===================================================================
--- complib/cl_waitobj.c (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ complib/cl_waitobj.c (.../trunk/src/userspace/management/osm) (revision
6101)
@@ -1,215 +0,0 @@
-/*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
- *
- * This software is available to you under a choice of one of two
- * licenses. You may choose to be licensed under the terms of the GNU
- * General Public License (GPL) Version 2, available from the file
- * COPYING in the main directory of this source tree, or the
- * OpenIB.org BSD license below:
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the following
- * disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * $Id$
- */
-
-/*
- * Abstract:
- * This module defines
- *
- * Environment:
- * Linux User Mode
- *
- * $Revision: 1.5 $
- */
-
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif /* HAVE_CONFIG_H */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-
-#include <complib/cl_types.h>
-#include <complib/cl_device.h>
-#include <complib/cl_debug.h>
-#include <complib/cl_syshelper.h>
-#include <complib/cl_waitobj.h>
-#include <complib/cl_memory.h>
-
-
-cl_status_t
-cl_create_wait_object(
- IN const boolean_t auto_reset,
- OUT cl_wait_obj_handle_t *p_wait_obj_handle )
-{
- cl_status_t status = CL_SUCCESS;
- uintn_t command;
- cl_create_wait_obj_params_t ioctl_buf;
- uintn_t num_bytes_returned;
- cl_dev_handle_t device_handle;
-
- /*
- * First open sysdev to get a new FD
- */
- status = cl_open_device( SYSHELP_DEVICE_NAME, &device_handle );
- if ( status != CL_SUCCESS )
- {
- cl_msg_out( "Failed to open device %s, status (%s)\n",
- SYSHELP_DEVICE_NAME, CL_STATUS_MSG(status) );
- return status;
- }
-
- command = CREATE_WAIT_OBJ;
- ioctl_buf.auto_reset = auto_reset;
-
- status = cl_ioctl_device(device_handle,
- command,
- &ioctl_buf, /* result */
- sizeof (cl_create_wait_obj_params_t),
- &num_bytes_returned);
-
- status = (CL_SUCCESS != status) ? status : ioctl_buf.status;
-
- if ( status != CL_SUCCESS)
- {
- cl_msg_out("create_wait_object: failed to create waitobject (%s)\n",
- CL_STATUS_MSG(status) );
- return status;
- }
-
- *p_wait_obj_handle = (cl_wait_obj_handle_t)device_handle;
-
- return status;
-}
-
-cl_status_t
-cl_wait_on_wait_object(
- IN cl_wait_obj_handle_t wait_obj_handle,
- IN uint32_t wait_u_sec )
-{
- cl_status_t status = CL_SUCCESS;
- cl_wait_ioctl_params_t ioctl_params;
- uintn_t command;
- cl_dev_handle_t device_handle = (cl_dev_handle_t)wait_obj_handle;
-
- /* fill out the ioctl parameters */
- ioctl_params.wait_u_sec = wait_u_sec;
- ioctl_params.wait_status = CL_SUCCESS;
-
- command = WAITON_WAIT_OBJ;
-
- status = cl_ioctl_device(device_handle,
- command,
- &ioctl_params,
- sizeof(cl_wait_ioctl_params_t),
- NULL );
-
- if ( status != CL_SUCCESS)
- {
- cl_msg_out("wait_on_wait_object: cl_ioctl_device failed (%s)\n",
- CL_STATUS_MSG(status) );
- return status;
- }
-
- /*
- * if the ioctl returned successfully, return the status
- * of the wait
- */
-
- return (ioctl_params.wait_status);
-}
-
-cl_status_t
-cl_signal_wait_object(
- IN cl_wait_obj_handle_t wait_obj_handle )
-{
- uintn_t command;
- cl_status_t status = CL_SUCCESS;
- void *p_in_buf;
- cl_dev_handle_t device_handle = (cl_dev_handle_t)wait_obj_handle;
-
- p_in_buf = wait_obj_handle;
-
- command = TRIGGER_WAIT_OBJ;
-
- status = cl_ioctl_device(device_handle,
- command,
- &p_in_buf,
- sizeof(p_in_buf),
- NULL);
-
- if ( status != CL_SUCCESS)
- {
- cl_msg_out("trigger_wait_object: cl_ioctl_device failed (%s)\n",
- CL_STATUS_MSG(status) );
- return status;
- }
-
- return status;
-}
-
-cl_status_t
-cl_destroy_wait_object(
- IN cl_wait_obj_handle_t wait_obj_handle )
-{
- cl_status_t status = CL_SUCCESS;
- cl_dev_handle_t device_handle = (cl_dev_handle_t)wait_obj_handle;
-
- cl_close_device( device_handle );
-
- return status;
-}
-
-cl_status_t
-cl_clear_wait_object(
- IN cl_wait_obj_handle_t wait_obj_handle )
-{
- uintn_t command;
- cl_status_t status = CL_SUCCESS;
- void *p_in_buf;
- cl_dev_handle_t device_handle = (cl_dev_handle_t)wait_obj_handle;
-
- p_in_buf = wait_obj_handle;
-
- command = RESET_WAIT_OBJ;
-
- status = cl_ioctl_device(device_handle,
- command,
- &p_in_buf,
- sizeof(p_in_buf),
- NULL);
-
- if ( status != CL_SUCCESS)
- {
- cl_msg_out("clear_wait_object: cl_ioctl_device failed (%s)\n",
- CL_STATUS_MSG(status) );
- return status;
- }
-
- return status;
-}
Index: complib/cl_syshelper.c
===================================================================
--- complib/cl_syshelper.c (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ complib/cl_syshelper.c (.../trunk/src/userspace/management/osm) (revision
6101)
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
- *
- * This software is available to you under a choice of one of two
- * licenses. You may choose to be licensed under the terms of the GNU
- * General Public License (GPL) Version 2, available from the file
- * COPYING in the main directory of this source tree, or the
- * OpenIB.org BSD license below:
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the following
- * disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * $Id$
- */
-
-
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif /* HAVE_CONFIG_H */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-
-#include <complib/cl_types.h>
-#include <complib/cl_device.h>
-#include <complib/cl_debug.h>
-#include <complib/cl_syshelper.h>
-#include <complib/cl_waitobj.h>
-
-/*
- * Open the system helper device and prepare it for use
- */
-cl_status_t
-__cl_user_syshelper_init(void)
-{
- cl_status_t status = CL_SUCCESS;
-
- /* Nothing to do. Just a place holder */
- return status;
-}
-
-void
-__cl_user_syshelper_exit(void)
-{
- /* Nothing to do. Just a place holder */
-
- return;
-}
Index: osmtest/osmt_mtl_regular_qp.c
===================================================================
--- osmtest/osmt_mtl_regular_qp.c
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ osmtest/osmt_mtl_regular_qp.c (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -402,7 +402,6 @@ int osmt_mtl_mad_post_recv_bufs(osmt_mtl
}
-#ifndef __KERNEL__
VAPI_ret_t osmt_mtl_mad_poll4cqe(VAPI_hca_hndl_t hca,VAPI_cq_hndl_t cq,
VAPI_wc_desc_t *wc_desc_p,
u_int32_t max_poll, u_int32_t poll_sleep,
@@ -444,21 +443,5 @@ VAPI_ret_t osmt_mtl_mad_poll4cqe(VAPI_hc
return VAPI_OK;
}
-#endif
-
-
-
-#ifdef __KERNEL__
-int init_module(void)
-{
- MTL_TRACE1("mad module loaded.\n");
- return(0);
-}
-
-void cleanup_module(void)
-{
- MTL_TRACE1("mad module unloaded.\n");
-}
-#endif
#endif /* OSM_VENDOR_INTF_MTL */
Index: osmtest/include/osmt_mtl_regular_qp.h
===================================================================
--- osmtest/include/osmt_mtl_regular_qp.h
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ osmtest/include/osmt_mtl_regular_qp.h
(.../trunk/src/userspace/management/osm) (revision 6101)
@@ -174,7 +174,6 @@ int osmt_mtl_mad_post_recv_bufs(
/* Poll given CQ for completion max_poll times (POLL_SLEEP [usec] delays).
result in wc_desc_p. */
-#ifndef __KERNEL__
VAPI_ret_t osmt_mtl_mad_poll4cqe(
VAPI_hca_hndl_t hca, /*handle for HCA*/
VAPI_cq_hndl_t cq, /*handle for Completion Queue - Rcv/Send */
@@ -183,7 +182,6 @@ VAPI_ret_t osmt_mtl_mad_poll4cqe(
u_int32_t poll_sleep, /*timeout for each polling */
VAPI_ud_av_hndl_t *avh_p /* address vectopr handle to cleanup */
);
-#endif
#endif
Index: opensm/osm_sm_state_mgr.c
===================================================================
--- opensm/osm_sm_state_mgr.c (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ opensm/osm_sm_state_mgr.c (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -199,7 +199,7 @@ __osm_sm_state_mgr_send_local_port_info_
{
osm_log( p_sm_mgr->p_log, OSM_LOG_ERROR,
"__osm_sm_state_mgr_send_local_port_info_req: ERR 3202: "
- "Failure requesting PortInfo (%s)\n",
+ "Failure requesting PortInfo (%s)\n",
ib_get_err_str( status ) );
}
@@ -380,7 +380,7 @@ __osm_sm_state_mgr_polling_callback(
{
osm_log( p_sm_mgr->p_log, OSM_LOG_ERROR,
"__osm_sm_state_mgr_polling_callback : ERR 3211: "
- "Failed to re-start timer\n" );
+ "Failed to restart timer\n" );
}
Exit:
Index: opensm/osm_port.c
===================================================================
--- opensm/osm_port.c (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ opensm/osm_port.c (.../trunk/src/userspace/management/osm) (revision 6101)
@@ -413,7 +413,7 @@ osm_physp_calc_link_mtu(
"MTU mismatch between ports."
"\n\t\t\t\tPort 0x%016" PRIx64 ", port# 0x%X"
" and port 0x%016" PRIx64 ", port# 0x%X."
- "\n\t\t\t\tUsing lower MTU of %u.\n",
+ "\n\t\t\t\tUsing lower MTU of %u\n",
cl_ntoh64( osm_physp_get_port_guid( p_physp ) ),
osm_physp_get_port_num( p_physp ),
cl_ntoh64( osm_physp_get_port_guid( p_remote_physp ) ),
@@ -427,7 +427,7 @@ osm_physp_calc_link_mtu(
{
osm_log( p_log, OSM_LOG_DEBUG,
"osm_physp_calc_link_mtu: ERR 4101: "
- "Invalid MTU = 0. Forcing correction to 256.\n" );
+ "Invalid MTU = 0. Forcing correction to 256\n" );
mtu = 1;
}
@@ -486,7 +486,7 @@ osm_physp_calc_link_op_vls(
"OP_VLS mismatch between ports."
"\n\t\t\t\tPort 0x%016" PRIx64 ", port# 0x%X"
" and port 0x%016" PRIx64 ", port# 0x%X."
- "\n\t\t\t\tUsing lower OP_VLS of %u.\n",
+ "\n\t\t\t\tUsing lower OP_VLS of %u\n",
cl_ntoh64( osm_physp_get_port_guid( p_physp ) ),
osm_physp_get_port_num( p_physp ),
cl_ntoh64( osm_physp_get_port_guid( p_remote_physp ) ),
@@ -504,7 +504,7 @@ osm_physp_calc_link_op_vls(
{
osm_log( p_log, OSM_LOG_DEBUG,
"osm_physp_calc_link_op_vls: ERR 4102: "
- "Invalid OP_VLS = 0. Forcing correction to 256.\n" );
+ "Invalid OP_VLS = 0. Forcing correction to 256\n" );
op_vls = 1;
}
@@ -554,7 +554,7 @@ __osm_physp_get_dr_physp_set(
{
osm_log( p_log, OSM_LOG_ERROR,
"__osm_physp_get_dr_nodes_set: ERR 4103: "
- "Fail to find the SM own port by guid.\n");
+ "Failed to find the SM own port by guid\n");
status = CL_ERROR;
goto Exit;
}
@@ -718,7 +718,7 @@ osm_physp_replace_dr_path_with_alternate
{
osm_log( p_log, OSM_LOG_ERROR,
"osm_physp_replace_dr_path_with_alternate_dr_path: ERR 4105: "
- "No SM port object.\n" );
+ "No SM port object\n" );
goto Exit;
}
Index: opensm/osm_sa_guidinfo_record.c
===================================================================
--- opensm/osm_sa_guidinfo_record.c
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ opensm/osm_sa_guidinfo_record.c (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -244,8 +244,8 @@ __osm_sa_gir_create_gir(
if( !osm_physp_is_valid( p_physp ) )
continue;
- /* Check to see if the found p_physp and the requestor physp
- share a pkey. If not - continue */
+ /* Check to see if the found p_physp and the requester physp
+ share a pkey. If not, continue */
if (!osm_physp_share_pkey( p_rcv->p_log, p_physp, p_req_physp ) )
continue;
@@ -444,7 +444,7 @@ osm_gir_rcv_process(
CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_GUIDINFO_RECORD );
- /* update the requestor physical port. */
+ /* update the requester physical port. */
p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
p_rcv->p_subn,
osm_madw_get_mad_addr_ptr(p_madw) );
@@ -452,7 +452,7 @@ osm_gir_rcv_process(
{
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
"osm_gir_rcv_process: ERR 5104: "
- "Cannot find requestor physical port\n" );
+ "Cannot find requester physical port\n" );
goto Exit;
}
Index: opensm/osm_state_mgr.c
===================================================================
--- opensm/osm_state_mgr.c (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ opensm/osm_state_mgr.c (.../trunk/src/userspace/management/osm) (revision
6101)
@@ -1646,7 +1646,7 @@ __osm_state_mgr_send_handover(
p_smi->pri_state = ( uint8_t ) ( p_mgr->p_subn->sm_state |
p_mgr->p_subn->opt.sm_priority << 4 );
/*
- * Return 0 for the SM key unless we authenticate the requestor
+ * Return 0 for the SM key unless we authenticate the requester
* as the master SM.
*/
if( ib_sminfo_get_state( &p_sm->smi ) == IB_SMINFO_STATE_MASTER )
@@ -1658,7 +1658,7 @@ __osm_state_mgr_send_handover(
}
else
{
- /* The requestor is not authenticated as master - set sm_key to zero */
+ /* The requester is not authenticated as master - set sm_key to zero */
osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
"__osm_state_mgr_send_handover: "
"Responding to SM not master with zero sm_key\n" );
@@ -2220,7 +2220,7 @@ osm_state_mgr_process(
}
}
- /* Need to continue with lid assigning */
+ /* Need to continue with lid assignment */
osm_drop_mgr_process( p_mgr->p_drop_mgr );
p_mgr->state = OSM_SM_STATE_SET_PKEY;
Index: opensm/osm_sa_vlarb_record.c
===================================================================
--- opensm/osm_sa_vlarb_record.c
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ opensm/osm_sa_vlarb_record.c (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -269,8 +269,8 @@ __osm_sa_vl_arb_by_comp_mask(
if (port_num < osm_port_get_num_physp( p_port ))
{
p_physp = osm_port_get_phys_ptr( p_port, port_num );
- /* check that the p_physp is valid, and that the requestor
- and the p_phsyp share a pkey. */
+ /* check that the p_physp is valid, and that the requester
+ and the p_physp share a pkey. */
if( p_physp && osm_physp_is_valid( p_physp ) &&
osm_physp_share_pkey(p_rcv->p_log, p_req_physp, p_physp) )
__osm_sa_vl_arb_check_physp( p_rcv, p_physp, p_ctxt );
@@ -296,7 +296,7 @@ __osm_sa_vl_arb_by_comp_mask(
if( !osm_physp_is_valid( p_physp ) )
continue;
- /* if the requestor and the p_physp don't share a pkey -
+ /* if the requester and the p_physp don't share a pkey -
continue */
if (!osm_physp_share_pkey(p_rcv->p_log, p_req_physp, p_physp))
continue;
@@ -352,7 +352,7 @@ osm_vlarb_rec_rcv_process(
OSM_LOG_ENTER( p_rcv->p_log, osm_vlarb_rec_rcv_process );
- /* update the requestor physical port. */
+ /* update the requester physical port. */
p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
p_rcv->p_subn,
osm_madw_get_mad_addr_ptr(p_madw) );
@@ -360,7 +360,7 @@ osm_vlarb_rec_rcv_process(
{
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
"osm_vlarb_rec_rcv_process: ERR 2A04: "
- "Cannot find requestor physical port\n" );
+ "Cannot find requester physical port\n" );
goto Exit;
}
Index: opensm/osm_subnet.c
===================================================================
--- opensm/osm_subnet.c (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ opensm/osm_subnet.c (.../trunk/src/userspace/management/osm) (revision
6101)
@@ -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.
*
@@ -53,11 +53,13 @@
#include <complib/cl_debug.h>
#include <opensm/osm_subnet.h>
+#include <opensm/osm_opensm.h>
#include <opensm/osm_log.h>
#include <opensm/osm_madw.h>
#include <opensm/osm_port.h>
#include <opensm/osm_switch.h>
#include <opensm/osm_remote_sm.h>
+#include <opensm/osm_partition.h>
#include <opensm/osm_node.h>
#include <opensm/osm_multicast.h>
#include <opensm/osm_inform.h>
@@ -97,6 +99,7 @@ osm_subn_destroy(
osm_port_t *p_port, *p_next_port;
osm_switch_t *p_sw, *p_next_sw;
osm_remote_sm_t *p_rsm, *p_next_rsm;
+ osm_prtn_t *p_prtn, *p_next_prtn;
osm_mgrp_t *p_mgrp, *p_next_mgrp;
osm_infr_t *p_infr, *p_next_infr;
@@ -135,6 +138,14 @@ osm_subn_destroy(
cl_free( p_rsm );
}
+ p_next_prtn = (osm_prtn_t*)cl_qmap_head( &p_subn->prtn_pkey_tbl );
+ while( p_next_prtn != (osm_prtn_t*)cl_qmap_end( &p_subn->prtn_pkey_tbl ) )
+ {
+ p_prtn = p_next_prtn;
+ p_next_prtn = (osm_prtn_t*)cl_qmap_next( &p_prtn->map_item );
+ osm_prtn_delete( &p_prtn );
+ }
+
p_next_mgrp = (osm_mgrp_t*)cl_qmap_head( &p_subn->mgrp_mlid_tbl );
while( p_next_mgrp != (osm_mgrp_t*)cl_qmap_end( &p_subn->mgrp_mlid_tbl ) )
{
@@ -167,10 +178,13 @@ osm_subn_destroy(
ib_api_status_t
osm_subn_init(
IN osm_subn_t* const p_subn,
+ IN osm_opensm_t * const p_osm,
IN const osm_subn_opt_t* const p_opt )
{
cl_status_t status;
+ p_subn->p_osm = p_osm;
+
status = cl_ptr_vector_init( &p_subn->node_lid_tbl,
OSM_SUBNET_VECTOR_MIN_SIZE,
OSM_SUBNET_VECTOR_GROW_SIZE );
@@ -431,6 +445,8 @@ osm_subn_set_default_opt(
p_opt->dump_files_dir = OSM_DEFAULT_TMP_DIR;
p_opt->log_file = OSM_DEFAULT_LOG_FILE;
+ p_opt->partition_config_file = OSM_DEFAULT_PARTITION_CONFIG_FILE;
+ p_opt->no_partition_enforcement = FALSE;
p_opt->accum_log_file = TRUE;
p_opt->port_profile_switch_nodes = FALSE;
p_opt->max_port_profile = 0xffffffff;
@@ -762,6 +778,14 @@ osm_subn_parse_conf_file(
__osm_subn_opts_unpack_charp(
"log_file" , p_key, p_val, &p_opts->log_file);
+ __osm_subn_opts_unpack_charp(
+ "partition_config_file",
+ p_key, p_val, &p_opts->partition_config_file);
+
+ __osm_subn_opts_unpack_boolean(
+ "no_partition_enforcement",
+ p_key, p_val, &p_opts->no_partition_enforcement);
+
__osm_subn_opts_unpack_boolean(
"accum_log_file",
p_key, p_val, &p_opts->accum_log_file);
@@ -859,6 +883,16 @@ osm_subn_write_conf_file(
fprintf(
opts_file,
+ "#\n# PARTITIONING OPTIONS\n#\n"
+ "# Partition configuration file to be used\n"
+ "partition_config_file %s\n\n"
+ "# Disable partition enforcement by switches\n"
+ "no_partition_enforcement %s\n\n",
+ p_opts->partition_config_file,
+ p_opts->no_partition_enforcement ? "TRUE" : "FALSE");
+
+ fprintf(
+ opts_file,
"#\n# SWEEP OPTIONS\n#\n"
"# The number of seconds between subnet sweeps (0 disables it)\n"
"sweep_interval %u\n\n"
Index: opensm/osm_sa_lft_record.c
===================================================================
--- opensm/osm_sa_lft_record.c (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ opensm/osm_sa_lft_record.c (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -245,7 +245,7 @@ __osm_lftr_rcv_by_comp_mask(
{
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
"__osm_lftr_rcv_by_comp_mask: ERR 4405: "
- "Fail to find Port by Node Guid:0x%016" PRIx64
+ "Failed to find Port by Node Guid:0x%016" PRIx64
"\n",
cl_ntoh64( p_sw->p_node->node_info.node_guid )
);
@@ -255,14 +255,14 @@ __osm_lftr_rcv_by_comp_mask(
/* get the port 0 of the switch */
osm_port_get_lid_range_ho( p_port, &min_lid_ho, &max_lid_ho );
- /* check that the requestor physp and the current physp are under
+ /* check that the requester physp and the current physp are under
the same partition. */
p_physp = osm_port_get_default_phys_ptr( p_port );
if (! p_physp)
{
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
"__osm_lftr_rcv_by_comp_mask: ERR 4406: "
- "Fail to find default physical Port by Node Guid:0x%016" PRIx64
+ "Failed to find default physical Port by Node Guid:0x%016"
PRIx64
"\n",
cl_ntoh64( p_sw->p_node->node_info.node_guid )
);
@@ -340,7 +340,7 @@ osm_lftr_rcv_process(
CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_LFT_RECORD );
- /* update the requestor physical port. */
+ /* update the requester physical port. */
p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
p_rcv->p_subn,
osm_madw_get_mad_addr_ptr(p_madw) );
@@ -348,7 +348,7 @@ osm_lftr_rcv_process(
{
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
"osm_lftr_rcv_process: ERR 4407: "
- "Cannot find requestor physical port\n" );
+ "Cannot find requester physical port\n" );
goto Exit;
}
Index: opensm/osm_db_files.c
===================================================================
--- opensm/osm_db_files.c (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ opensm/osm_db_files.c (.../trunk/src/userspace/management/osm) (revision
6101)
@@ -197,7 +197,7 @@ osm_db_init(
{
osm_log( p_log, OSM_LOG_ERROR,
"osm_db_init: ERR 6101: "
- " Fail to create the db directory:%s\n",
+ " Failed to create the db directory:%s\n",
p_db_imp->db_dir_name);
OSM_LOG_EXIT( p_log );
return 1;
@@ -253,7 +253,7 @@ osm_db_domain_init(
{
osm_log( p_log, OSM_LOG_ERROR,
"osm_db_domain_init: ERR 6102: "
- " Fail to open the db file:%s\n",
+ " Failed to open the db file:%s\n",
p_domain_imp->file_name);
cl_free(p_domain_imp);
cl_free(p_domain);
@@ -308,7 +308,7 @@ osm_db_restore(
{
osm_log( p_log, OSM_LOG_ERROR,
"osm_db_restore: ERR 6103: "
- " Fail to open the db file:%s\n",
+ " Failed to open the db file:%s\n",
p_domain_imp->file_name);
status = 1;
goto Exit;
@@ -483,7 +483,7 @@ osm_db_store(
{
osm_log( p_log, OSM_LOG_ERROR,
"osm_db_store: ERR 6107: "
- " Fail to open the db file:%s for writing\n",
+ " Failed to open the db file:%s for writing\n",
p_domain_imp->file_name);
status = 1;
goto Exit;
@@ -498,7 +498,7 @@ osm_db_store(
{
osm_log( p_log, OSM_LOG_ERROR,
"osm_db_store: ERR 6109: "
- " Fail to remove file:%s (err:%u)\n",
+ " Failed to remove file:%s (err:%u)\n",
p_domain_imp->file_name, status);
}
@@ -507,7 +507,7 @@ osm_db_store(
{
osm_log( p_log, OSM_LOG_ERROR,
"osm_db_store: ERR 6108: "
- " Fail to rename the db file to:%s (err:%u)\n",
+ " Failed to rename the db file to:%s (err:%u)\n",
p_domain_imp->file_name, status);
}
Exit:
Index: opensm/osm_prtn_config.c
===================================================================
--- opensm/osm_prtn_config.c (.../branches/1.0/src/userspace/management/osm)
(revision 0)
+++ opensm/osm_prtn_config.c (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -0,0 +1,411 @@
+/*
+ * Copyright (c) 2006 Voltaire, Inc. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses. You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * $Id$
+ */
+
+
+/*
+ * Abstract:
+ * Implementation of opensm partition management configuration
+ *
+ * Environment:
+ * Linux User Mode
+ *
+ * $Revision$
+ */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <ctype.h>
+
+#include <iba/ib_types.h>
+#include <opensm/osm_partition.h>
+#include <opensm/osm_subnet.h>
+#include <opensm/osm_log.h>
+
+
+#if __WORDSIZE == 64
+#define STRTO_IB_NET64(str, end, base) strtoul(str, end, base)
+#else
+#define STRTO_IB_NET64(str, end, base) strtoull(str, end, base)
+#endif
+
+#define PARSERR(log, lnum, fmt, arg...) { \
+ osm_log(log, OSM_LOG_ERROR, \
+ "\nPARSE ERROR: line %d: " fmt "\n", (lnum), ##arg ); \
+ fprintf(stderr, \
+ "\nPARSE ERROR: line %d: " fmt "\n", (lnum), ##arg ); \
+}
+
+#define PARSEWARN(log, lnum, fmt, arg...) \
+ osm_log(log, OSM_LOG_VERBOSE, \
+ "PARSE WARN: line %d: " fmt , (lnum), ##arg )
+
+/*
+ */
+
+
+struct part_conf {
+ osm_log_t *p_log;
+ osm_subn_t *p_subn;
+ osm_prtn_t *p_prtn;
+ unsigned is_ipoib, mtu, rate;
+};
+
+
+extern osm_prtn_t *osm_prtn_make_new(osm_log_t *p_log, osm_subn_t *p_subn,
+ const char *name, uint16_t pkey);
+extern ib_api_status_t osm_prtn_add_all(osm_log_t *p_log,
+ osm_subn_t *p_subn,
+ osm_prtn_t *p, boolean_t full);
+extern ib_api_status_t osm_prtn_add_port(osm_log_t *p_log,
+ osm_subn_t *p_subn, osm_prtn_t *p,
+ ib_net64_t guid, boolean_t full);
+extern ib_api_status_t osm_prtn_add_mcgroup(osm_log_t *p_log,
+ osm_subn_t *p_subn, osm_prtn_t *p,
+ unsigned is_ipoib, uint8_t rate,
+ uint8_t mtu);
+
+static int partition_create(unsigned lineno, struct part_conf *conf,
+ char *name, char *id, char *flag, char *flag_val)
+{
+ uint16_t pkey;
+
+ if (!id && name && isdigit(*name)) {
+ id = name;
+ name = NULL;
+ }
+
+ if (id) {
+ char *end;
+ pkey = strtoul(id, &end, 0);
+ if (end == id || *end)
+ return -1;
+ } else
+ pkey = 0;
+
+ conf->p_prtn = osm_prtn_make_new(conf->p_log, conf->p_subn,
+ name, cl_hton16(pkey));
+ if (!conf->p_prtn)
+ return -1;
+
+ if (conf->is_ipoib)
+ osm_prtn_add_mcgroup(conf->p_log, conf->p_subn, conf->p_prtn,
+ conf->is_ipoib, conf->rate, conf->mtu);
+
+ return 0;
+}
+
+static int partition_add_flag(unsigned lineno, struct part_conf *conf,
+ char *flag, char *val)
+{
+ int len = strlen(flag);
+ if (!strncmp(flag, "ipoib", len)) {
+ conf->is_ipoib = 1;
+ } else if (!strncmp(flag, "mtu", len)) {
+ if (!val || (conf->mtu = strtoul(val, NULL, 0)) == 0)
+ PARSEWARN(conf->p_log, lineno,
+ "flag \'mtu\' requires valid value"
+ " - skipped.\n");
+ } else if (!strncmp(flag, "rate", len)) {
+ if (!val || (conf->rate = strtoul(val, NULL, 0)) == 0)
+ PARSEWARN(conf->p_log, lineno,
+ "flag \'rate\' requires valid value"
+ " - skipped.\n");
+ } else {
+ PARSEWARN(conf->p_log, lineno,
+ "unrecognized partition flag \'%s\'"
+ " - ignored.\n", flag);
+ }
+ return 0;
+}
+
+static int partition_add_port(unsigned lineno, struct part_conf *conf,
+ char *name, char *flag)
+{
+ osm_prtn_t *p = conf->p_prtn;
+ ib_net64_t guid;
+ boolean_t full = FALSE;
+
+ if (!name || !*name || !strncmp(name, "NONE", strlen(name)))
+ return 0;
+
+ if (flag) {
+ if (!strncmp(flag, "full", strlen(flag)))
+ full = TRUE;
+ else if (strncmp(flag, "limited", strlen(flag))) {
+ PARSEWARN(conf->p_log, lineno,
+ "unrecognized port flag \'%s\' -"
+ " suppose \'limited\'\n", flag);
+ }
+ }
+
+ if (!strncmp(name, "ALL", strlen(name))) {
+ return osm_prtn_add_all(conf->p_log, conf->p_subn, p,
+ full) == IB_SUCCESS ? 0 : -1;
+ } else if (!strncmp(name, "SELF", strlen(name))) {
+ guid = cl_ntoh64(conf->p_subn->sm_port_guid);
+ } else {
+ char *end;
+ guid = STRTO_IB_NET64(name, &end, 0);
+ if (!guid || *end)
+ return -1;
+ }
+
+ if (osm_prtn_add_port(conf->p_log, conf->p_subn, p,
+ cl_hton64(guid), full) != IB_SUCCESS)
+ return -1;
+
+ return 0;
+}
+
+
+/* conf file parser */
+
+#define STRIP_HEAD_SPACES(p) while (*(p) == ' ' || *(p) == '\t' || \
+ *(p) == '\n') { (p)++; }
+#define STRIP_TAIL_SPACES(p) { char *q = (p) + strlen(p); \
+ while ( q != (p) && ( *q == '\0' || \
+ *q == ' ' || *q == '\t' || \
+ *q == '\n')) { *q-- = '\0'; }; }
+
+static int parse_name_token(char *str, char **name, char **val)
+{
+ int len = 0;
+ char *p, *q;
+
+ *name = *val = NULL;
+
+ p = str;
+
+ while (*p == ' ' || *p == '\t' || *p == '\n')
+ p++;
+
+ q = strchr(p, '=');
+ if (q)
+ *q++ = '\0';
+
+ len = strlen(str) + 1;
+ str = q;
+
+ q = p + strlen(p);
+ while ( q != p &&
+ ( *q == '\0' || *q == ' ' || *q == '\t' || *q == '\n'))
+ *q-- = '\0';
+
+ *name = p;
+
+ p = str;
+ if (!p)
+ return len;
+
+ while (*p == ' ' || *p == '\t' || *p == '\n')
+ p++;
+
+ q = p + strlen(p);
+ len += q - str + 1;
+ while ( q != p &&
+ ( *q == '\0' || *q == ' ' || *q == '\t' || *q == '\n'))
+ *q-- = '\0';
+ *val = p;
+
+ return len;
+}
+
+static struct part_conf *new_part_conf(osm_log_t *p_log, osm_subn_t *p_subn)
+{
+ static struct part_conf part;
+ struct part_conf *conf = ∂
+
+ memset(conf, 0, sizeof(*conf));
+ conf->p_log = p_log;
+ conf->p_subn = p_subn;
+ conf->p_prtn = NULL;
+ return conf;
+}
+
+static int flush_part_conf(struct part_conf *conf)
+{
+ memset(conf, 0, sizeof(*conf));
+ return 0;
+}
+
+static int parse_part_conf(struct part_conf *conf, char *str, int lineno)
+{
+ int ret, len = 0;
+ char *name, *id, *flag, *flval;
+ char *q, *p;
+
+ p = str;
+ if (*p == '\t' || *p == '\0' || *p == '\n')
+ p++;
+
+ len += p - str;
+ str = p;
+
+ if (conf->p_prtn)
+ goto skip_header;
+
+ q = strchr(p, ':');
+ if (!q) {
+ PARSERR(conf->p_log, lineno,
+ "no partition definition found\n");
+ return -1;
+ }
+
+ *q++ = '\0';
+ str = q;
+
+ name = id = flag = flval = NULL;
+
+ q = strchr(p, ',');
+ if (q)
+ *q = '\0';
+
+ ret = parse_name_token(p, &name, &id);
+ p += ret;
+ len += ret;
+
+ while (q) {
+ flag = flval = NULL;
+ q = strchr(p, ',');
+ if (q)
+ *q++ = '\0';
+ ret = parse_name_token(p, &flag, &flval);
+ if (!flag) {
+ PARSERR(conf->p_log, lineno,
+ "bad partition flags\n");
+ return -1;
+ }
+ p += ret;
+ len += ret;
+ partition_add_flag(lineno, conf, flag, flval);
+ }
+
+ if (p != str || (partition_create(lineno, conf,
+ name, id, flag, flval) < 0)) {
+ PARSERR(conf->p_log, lineno,
+ "bad partition definition\n");
+ return -1;
+ }
+
+ skip_header:
+ do {
+ name = flag = NULL;
+ q = strchr(p, ',');
+ if (q)
+ *q++ = '\0';
+ ret = parse_name_token(p, &name, &flag);
+ if (partition_add_port(lineno, conf, name, flag) < 0) {
+ PARSERR(conf->p_log, lineno,
+ "bad PortGUID\n");
+ return -1;
+ }
+ p += ret;
+ len += ret;
+ } while (q);
+
+ return len;
+}
+
+int osm_prtn_config_parse_file(osm_log_t *p_log, osm_subn_t *p_subn,
+ const char *file_name)
+{
+ char line[1024];
+ struct part_conf *conf = NULL;
+ FILE *file;
+ int lineno;
+
+ file = fopen(file_name, "r");
+ if (!file) {
+ osm_log(p_log, OSM_LOG_VERBOSE,
+ "osm_prtn_config_parse_file: "
+ "Cannot open config file \'%s\': %s\n",
+ file_name, strerror(errno));
+ return -1;
+ }
+
+ lineno = 0;
+
+ while (fgets(line, sizeof(line) - 1, file) != NULL) {
+ char *q, *p = line;
+
+ lineno++;
+
+ p = line;
+
+ q = strchr(p, '#');
+ if (q)
+ *q = '\0';
+
+ do {
+ int len;
+ while (*p == ' ' || *p == '\t' || *p == '\n')
+ p++;
+ if (*p == '\0')
+ break;
+
+ if (!conf &&
+ !(conf = new_part_conf(p_log, p_subn))) {
+ PARSERR(p_log, lineno,
+ "internal: cannot create config.\n");
+ break;
+ }
+
+ q = strchr(p, ';');
+ if (q)
+ *q = '\0';
+
+ len = parse_part_conf(conf, p, lineno);
+ if (len < 0) {
+ break;
+ }
+
+ p += len;
+
+ if (q) {
+ flush_part_conf(conf);
+ conf = NULL;
+ }
+ } while (q);
+ }
+
+ fclose(file);
+
+ return 0;
+}
Property changes on: opensm/osm_prtn_config.c
___________________________________________________________________
Name: svn:keywords
+ Id
Index: opensm/osm_sa_portinfo_record.c
===================================================================
--- opensm/osm_sa_portinfo_record.c
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ opensm/osm_sa_portinfo_record.c (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -547,7 +547,7 @@ __osm_sa_pir_by_comp_mask(
if( !osm_physp_is_valid( p_physp ) )
continue;
- /* if the requestor and the p_physp don't share a pkey -
+ /* if the requester and the p_physp don't share a pkey -
continue */
if (!osm_physp_share_pkey(p_rcv->p_log, p_req_physp, p_physp ) )
continue;
@@ -612,7 +612,7 @@ osm_pir_rcv_process(
CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_PORTINFO_RECORD );
- /* update the requestor physical port. */
+ /* update the requester physical port. */
p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
p_rcv->p_subn,
osm_madw_get_mad_addr_ptr(p_madw) );
@@ -620,7 +620,7 @@ osm_pir_rcv_process(
{
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
"osm_pir_rcv_process: ERR 2104: "
- "Cannot find requestor physical port\n" );
+ "Cannot find requester physical port\n" );
goto Exit;
}
Index: opensm/osm_sa_service_record.c
===================================================================
--- opensm/osm_sa_service_record.c
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ opensm/osm_sa_service_record.c (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -176,7 +176,7 @@ __match_service_pkey_with_ports_pkey(
ib_net64_t service_guid;
osm_port_t *service_port;
- /* update the requestor physical port. */
+ /* update the requester physical port. */
p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
p_rcv->p_subn,
osm_madw_get_mad_addr_ptr(p_madw) );
@@ -184,14 +184,14 @@ __match_service_pkey_with_ports_pkey(
{
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
"__match_service_pkey_with_ports_pkey: ERR 2404: "
- "Cannot find requestor physical port\n" );
+ "Cannot find requester physical port\n" );
valid = FALSE;
goto Exit;
}
if((comp_mask & IB_SR_COMPMASK_SPKEY) == IB_SR_COMPMASK_SPKEY)
{
- /* We have a ServiceP_Key - check matching on requestor port, and
+ /* We have a ServiceP_Key - check matching on requester port, and
ServiceGid port (if such exists) */
/* Make sure it matches the p_req_physp */
if (!osm_physp_has_pkey(p_rcv->p_log, p_service_rec->service_pkey,
p_req_physp ))
@@ -501,7 +501,6 @@ __get_matching_sr(
ib_net64_t comp_mask = p_sr_item->comp_mask;
const osm_physp_t* p_req_physp = p_ctxt->p_req_physp;
-
if((comp_mask & IB_SR_COMPMASK_SID) == IB_SR_COMPMASK_SID)
{
if(p_sr_item->p_service_rec->service_id !=
@@ -728,7 +727,7 @@ __get_matching_sr(
return;
}
- /* Check that the requestor port has the pkey which is the service_pkey.
+ /* Check that the requester port has the pkey which is the service_pkey.
If not - then it cannot receive this ServiceRecord. */
/* The check is relevant only if the service_pkey is valid */
if (!ib_pkey_is_invalid(p_svcr->service_record.service_pkey))
@@ -739,7 +738,7 @@ __get_matching_sr(
{
osm_log( p_sr_item->p_rcv->p_log, OSM_LOG_VERBOSE,
"__get_matching_sr: "
- "requestor port doesn't have the service_pkey: 0x%X\n",
+ "requester port doesn't have the service_pkey: 0x%X\n",
cl_ntoh16(p_svcr->service_record.service_pkey) );
return;
}
@@ -782,7 +781,7 @@ osm_sr_rcv_process_get_method(
CL_ASSERT( p_madw );
- /* update the requestor physical port. */
+ /* update the requester physical port. */
p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
p_rcv->p_subn,
osm_madw_get_mad_addr_ptr(p_madw) );
@@ -790,7 +789,7 @@ osm_sr_rcv_process_get_method(
{
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
"osm_sr_rcv_process_get_method: ERR 2409: "
- "Cannot find requestor physical port\n" );
+ "Cannot find requester physical port\n" );
goto Exit;
}
Index: opensm/osm_sa_pkey_record.c
===================================================================
--- opensm/osm_sa_pkey_record.c
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ opensm/osm_sa_pkey_record.c (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -292,7 +292,7 @@ __osm_sa_pkey_by_comp_mask(
if( !osm_physp_is_valid( p_physp ) )
continue;
- /* if the requestor and the p_physp don't share a pkey -
+ /* if the requester and the p_physp don't share a pkey -
continue */
if (!osm_physp_share_pkey(p_rcv->p_log, p_req_physp, p_physp ) )
continue;
@@ -356,7 +356,7 @@ osm_pkey_rec_rcv_process(
CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_PKEY_TBL_RECORD );
- /* update the requestor physical port. */
+ /* update the requester physical port. */
p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
p_rcv->p_subn,
osm_madw_get_mad_addr_ptr(p_madw) );
@@ -364,7 +364,7 @@ osm_pkey_rec_rcv_process(
{
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
"osm_pkey_rec_rcv_process: ERR 4604: "
- "Cannot find requestor physical port\n" );
+ "Cannot find requester physical port\n" );
goto Exit;
}
@@ -382,14 +382,14 @@ osm_pkey_rec_rcv_process(
/*
p819 - P_KeyTableRecords shall only be provided in response
to trusted requests.
- Check that the requestor is a trusted one.
+ Check that the requester is a trusted one.
*/
if ( p_rcvd_mad->sm_key != p_rcv->p_subn->opt.sm_key )
{
- /* This is not a trusted requestor! */
+ /* This is not a trusted requester! */
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
"osm_pkey_rec_rcv_process ERR 4608: "
- "Request from non-trusted requestor: "
+ "Request from non-trusted requester: "
"Given SM_Key:0x%016" PRIx64 "\n",
cl_ntoh64(p_rcvd_mad->sm_key) );
osm_sa_send_error( p_rcv->p_resp, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);
Index: opensm/osm_opensm.c
===================================================================
--- opensm/osm_opensm.c (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ opensm/osm_opensm.c (.../trunk/src/userspace/management/osm) (revision
6101)
@@ -137,18 +137,6 @@ osm_opensm_destroy(
/**********************************************************************
**********************************************************************/
-static void
-osm_opensm_create_mcgroups(
- IN osm_opensm_t * const p_osm,
- IN const osm_subn_opt_t * const p_opt )
-{
- OSM_LOG_ENTER( &p_osm->log, osm_opensm_create_mcgroups );
- osm_sa_create_template_record_ipoib( &p_osm->sa, p_opt );
- OSM_LOG_EXIT( &p_osm->log );
-}
-
-/**********************************************************************
- **********************************************************************/
ib_api_status_t
osm_opensm_init(
IN osm_opensm_t * const p_osm,
@@ -215,7 +203,7 @@ osm_opensm_init(
if( status != IB_SUCCESS )
goto Exit;
- status = osm_subn_init( &p_osm->subn, p_opt );
+ status = osm_subn_init( &p_osm->subn, p_osm, p_opt );
if( status != IB_SUCCESS )
goto Exit;
@@ -266,8 +254,6 @@ osm_opensm_init(
if( status != IB_SUCCESS )
goto Exit;
- osm_opensm_create_mcgroups( p_osm, p_opt );
-
/* HACK - the UpDown manager should have been a part of the osm_sm_t */
/* Init updn struct */
p_osm->p_updn_ucast_routing = updn_construct( );
Index: opensm/osm_sa_slvl_record.c
===================================================================
--- opensm/osm_sa_slvl_record.c
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ opensm/osm_sa_slvl_record.c (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -272,7 +272,7 @@ __osm_sa_slvl_by_comp_mask(
if( !osm_physp_is_valid( p_in_physp ) )
continue;
- /* if the requestor and the p_out_physp don't share a pkey -
+ /* if the requester and the p_out_physp don't share a pkey -
continue */
if (!osm_physp_share_pkey(p_rcv->p_log, p_req_physp, p_out_physp ) )
continue;
@@ -336,7 +336,7 @@ osm_slvl_rec_rcv_process(
CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_SLVL_RECORD );
- /* update the requestor physical port. */
+ /* update the requester physical port. */
p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
p_rcv->p_subn,
osm_madw_get_mad_addr_ptr(p_madw) );
@@ -344,7 +344,7 @@ osm_slvl_rec_rcv_process(
{
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
"osm_slvl_rec_rcv_process: ERR 2603: "
- "Cannot find requestor physical port\n" );
+ "Cannot find requester physical port\n" );
goto Exit;
}
Index: opensm/osm_sa.c
===================================================================
--- opensm/osm_sa.c (.../branches/1.0/src/userspace/management/osm) (revision
6101)
+++ opensm/osm_sa.c (.../trunk/src/userspace/management/osm) (revision 6101)
@@ -503,110 +503,3 @@ osm_sa_bind(
OSM_LOG_EXIT( p_sa->p_log );
return( status );
}
-
-/**********************************************************************
- **********************************************************************/
-
-ib_gid_t osm_ipoib_mgid = {
- {
- 0xff, /* multicast field */
- 0x12, /* non-permanent bit,scope */
- 0x40, 0x1b, /* IPv4 signature */
- 0xff, 0xff, /* 16 bits of P_Key (to be filled in) */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 48 bits of zeros */
- 0xff, 0xff, 0xff, 0xff, /* 32 bit IPv4 broadcast address */
- },
-};
-
-/*
- * HACK: Until TS resolves their noncompliant join compmask
- * we have to pre-define the MGID
- */
-ib_gid_t osm_ts_ipoib_mgid = {
- {
- 0xff, /* multicast field */
- 0x12, /* non-permanent bit,scope */
- 0x40, 0x1b, /* IPv4 signature */
- 0xff, 0xff, /* 16 bits of P_Key (to be filled in) */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 48 bits of zeros */
- 0x00, 0x00, 0x00, 0x01, /* 32 bit IPv4 broadcast address */
- },
-};
-
-void
-osm_sa_create_template_record_ipoib(
- IN osm_sa_t* const p_sa,
- IN const osm_subn_opt_t* const p_opt )
-{
- ib_member_rec_t mc_rec;
-
- osm_log( p_sa->p_log, OSM_LOG_FUNCS,
- "osm_sa_create_template_record_ipoib: [\n" );
-
- UNUSED_PARAM( p_opt );
- cl_memclr(&mc_rec, sizeof(mc_rec));
-
- /*
- * Fill in the default MC Member record
- */
- mc_rec.mgid = osm_ipoib_mgid;
- mc_rec.mtu = 4; /* 2048 Bytes */
- mc_rec.qkey = CL_HTON32(0x0b1b); /* This value is pushed into the mad, and
thus needs
- to be in network order */
- mc_rec.pkey = IB_DEFAULT_PKEY;
- mc_rec.rate = 0x3; /* 10Gb/sec */
- mc_rec.pkt_life = OSM_DEFAULT_SUBNET_TIMEOUT;
- mc_rec.sl_flow_hop = OSM_DEFAULT_SL << 28;
- /* Note: scope needs to be consistent with MGID */
- mc_rec.scope_state = 0x21;
-
- osm_sa_add_well_known_mc_record(&p_sa->mcmr_rcv, &mc_rec);
-
- /*
- * HACK: Until TS resolves their noncompliant join compmask
- * we have to pre-define the MGID
- */
- mc_rec.mgid = osm_ts_ipoib_mgid;
- osm_sa_add_well_known_mc_record(&p_sa->mcmr_rcv, &mc_rec);
-
- osm_log( p_sa->p_log, OSM_LOG_FUNCS,
- "osm_sa_create_template_record_ipoib: ]\n" );
-
-}
-
-/**********************************************************************
- **********************************************************************/
-void
-osm_sa_add_well_known_mc_record(
- osm_mcmr_recv_t* const p_mcmr,
- const ib_member_rec_t * const p_well_know_mc_rec)
-{
-
- osm_mgrp_t * p_mgrp = NULL;
- ib_api_status_t status;
- ib_net64_t comp_mask;
-
- comp_mask = IB_MCR_COMPMASK_MTU | IB_MCR_COMPMASK_RATE;
- status = osm_mcmr_rcv_create_new_mgrp(
- p_mcmr,
- comp_mask,
- p_well_know_mc_rec,
- NULL,
- &p_mgrp);
- if(p_mgrp)
- {
- p_mgrp->well_known = TRUE;
- }
- else
- {
- osm_log( p_mcmr->p_log, OSM_LOG_DEBUG,
- "osm_sa_add_well_known_mc_record:"
- "failed to create a well known group\n");
-
- }
-
-}
-
-/**********************************************************************
- **********************************************************************/
-
Index: opensm/osm_sminfo_rcv.c
===================================================================
--- opensm/osm_sminfo_rcv.c (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ opensm/osm_sminfo_rcv.c (.../trunk/src/userspace/management/osm) (revision
6101)
@@ -169,7 +169,7 @@ __osm_sminfo_rcv_process_get_request(
p_rcv->p_subn->opt.sm_priority << 4);
/*
p.750 row 11 - Return 0 for the SM key unless we authenticate the
- requestor as the master SM.
+ requester as the master SM.
*/
p_remote_smi = ib_smp_get_payload_ptr ( osm_madw_get_smp_ptr (p_madw) );
if (ib_sminfo_get_state( p_remote_smi ) == IB_SMINFO_STATE_MASTER )
@@ -181,7 +181,7 @@ __osm_sminfo_rcv_process_get_request(
}
else
{
- /* The requestor is not authenticated as master - set sm_key to zero. */
+ /* The requester is not authenticated as master - set sm_key to zero. */
osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
"__osm_sminfo_rcv_process_get_request: "
"Responding to SM not master with zero sm_key\n" );
@@ -287,7 +287,7 @@ __osm_sminfo_rcv_process_set_request(
p_rcv->p_subn->opt.sm_priority << 4);
/*
p.750 row 11 - Return 0 for the SM key unless we authenticate the
- requestor as the master SM.
+ requester as the master SM.
*/
p_remote_smi = ib_smp_get_payload_ptr ( osm_madw_get_smp_ptr (p_madw) );
if (ib_sminfo_get_state( p_remote_smi ) == IB_SMINFO_STATE_MASTER )
@@ -299,7 +299,7 @@ __osm_sminfo_rcv_process_set_request(
}
else
{
- /* The requestor is not authenticated as master - set sm_key to zero. */
+ /* The requester is not authenticated as master - set sm_key to zero. */
osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
"__osm_sminfo_rcv_process_set_request: "
"Responding to SM not master with zero sm_key\n" );
Index: opensm/osm_sa_sminfo_record.c
===================================================================
--- opensm/osm_sa_sminfo_record.c
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ opensm/osm_sa_sminfo_record.c (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -151,7 +151,7 @@ osm_smir_rcv_process(
p_sa_mad = osm_madw_get_sa_mad_ptr( p_madw );
p_sminfo_rec = (ib_sminfo_record_t*)ib_sa_mad_get_payload_ptr( p_sa_mad );
- /* update the requestor physical port. */
+ /* update the requester physical port. */
p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
p_rcv->p_subn,
osm_madw_get_mad_addr_ptr(p_madw) );
@@ -159,7 +159,7 @@ osm_smir_rcv_process(
{
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
"osm_smir_rcv_process: ERR 2803: "
- "Cannot find requestor physical port\n" );
+ "Cannot find requester physical port\n" );
goto Exit;
}
Index: opensm/osm_trap_rcv.c
===================================================================
--- opensm/osm_trap_rcv.c (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ opensm/osm_trap_rcv.c (.../trunk/src/userspace/management/osm) (revision
6101)
@@ -139,7 +139,6 @@ osm_trap_rcv_aging_tracker_callback(
port_num = (uint8_t)(( key & 0x00FF000000000000ULL) >> 48);
p_physp = __get_physp_by_lid_and_num( p_rcv, lid, port_num );
-
if (!p_physp)
{
osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
@@ -485,7 +484,7 @@ __osm_trap_rcv_process_request(
{
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
"__osm_trap_rcv_process_request: ERR 3804: "
- "Received the trap %u times continuously\n",
+ "Received trap %u times consecutively\n",
num_received);
/*
* If the trap provides info about a bad port
@@ -505,7 +504,7 @@ __osm_trap_rcv_process_request(
{
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
"__osm_trap_rcv_process_request: ERR 3805: "
- "Fail to find physical port by lid:0x%02X num:%u\n",
+ "Failed to find physical port by lid:0x%02X num:%u\n",
cl_ntoh16(p_ntci->data_details.ntc_129_131.lid),
p_ntci->data_details.ntc_129_131.port_num
);
Index: opensm/osm_prtn.c
===================================================================
--- opensm/osm_prtn.c (.../branches/1.0/src/userspace/management/osm)
(revision 0)
+++ opensm/osm_prtn.c (.../trunk/src/userspace/management/osm) (revision 6101)
@@ -0,0 +1,365 @@
+/*
+ * Copyright (c) 2006 Voltaire, Inc. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses. You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * $Id$
+ */
+
+
+/*
+ * Abstract:
+ * Implementation of osm_prtn_t.
+ * This object represents an IBA partition.
+ * This object is part of the opensm family of objects.
+ *
+ * Environment:
+ * Linux User Mode
+ *
+ * $Revision$
+ */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+
+#include <string.h>
+#include <stdio.h>
+#include <sys/stat.h>
+
+#include <iba/ib_types.h>
+#include <opensm/osm_opensm.h>
+#include <opensm/osm_partition.h>
+#include <opensm/osm_node.h>
+#include <opensm/osm_sa.h>
+#include <opensm/osm_multicast.h>
+
+
+extern int osm_prtn_config_parse_file(osm_log_t * const p_log,
+ osm_subn_t * const p_subn,
+ const char *file_name);
+
+static uint16_t global_pkey_counter;
+
+/*
+ *
+ */
+
+osm_prtn_t* osm_prtn_new(
+ IN const char *name,
+ IN const uint16_t pkey )
+{
+ osm_prtn_t *p = cl_zalloc(sizeof(*p));
+ if (!p)
+ return NULL;
+ p->pkey = pkey;
+ cl_map_construct(&p->full_guid_tbl);
+ cl_map_init(&p->full_guid_tbl, 32);
+ cl_map_construct(&p->part_guid_tbl);
+ cl_map_init(&p->part_guid_tbl, 32);
+
+ if (name && *name)
+ strncpy(p->name, name, sizeof(p->name));
+ else
+ snprintf(p->name, sizeof(p->name), "%04x", cl_ntoh16(pkey));
+
+ return p;
+}
+
+void osm_prtn_delete(
+ IN OUT osm_prtn_t** const pp_prtn )
+{
+ osm_prtn_t *p = *pp_prtn;
+
+ cl_map_remove_all(&p->full_guid_tbl);
+ cl_map_destroy(&p->full_guid_tbl);
+ cl_map_remove_all(&p->part_guid_tbl);
+ cl_map_destroy(&p->part_guid_tbl);
+ cl_free(p);
+ *pp_prtn = NULL;
+}
+
+ib_api_status_t osm_prtn_add_port(osm_log_t *p_log, osm_subn_t *p_subn,
+ osm_prtn_t *p, ib_net64_t guid, boolean_t full)
+{
+ cl_qmap_t *p_port_tbl = &p_subn->port_guid_tbl;
+ ib_api_status_t status = IB_SUCCESS;
+ cl_map_t *p_tbl;
+ osm_port_t *p_port;
+ osm_physp_t *p_physp;
+
+ p_port = (osm_port_t *)cl_qmap_get(p_port_tbl, guid);
+ if (!p_port || p_port == (osm_port_t *)cl_qmap_end(p_port_tbl)) {
+ osm_log(p_log, OSM_LOG_VERBOSE, "osm_prtn_add_port: "
+ "port 0x%" PRIx64 " not found\n",
+ cl_ntoh64(guid));
+ return status;
+ }
+
+ p_physp = osm_port_get_default_phys_ptr(p_port);
+ if (!p_physp) {
+ osm_log(p_log, OSM_LOG_VERBOSE, "osm_prtn_add_port: "
+ "no physical for port 0x%" PRIx64 "\n",
+ cl_ntoh64(guid));
+ return status;
+ }
+
+ if (osm_prtn_is_guid(p, guid)) {
+ osm_log(p_log, OSM_LOG_VERBOSE, "osm_prtn_add_port: "
+ "port 0x%" PRIx64 " already in "
+ "partition \'%s\' (%04x). Will overwrite\n",
+ cl_ntoh64(guid), p->name, cl_ntoh16(p->pkey));
+ }
+
+ p_tbl = (full == TRUE) ? &p->full_guid_tbl : &p->part_guid_tbl ;
+
+ if (cl_map_insert(p_tbl, guid, p_physp) == NULL)
+ return IB_INSUFFICIENT_MEMORY;
+
+ return status;
+}
+
+ib_api_status_t osm_prtn_add_all(osm_log_t *p_log, osm_subn_t *p_subn,
+ osm_prtn_t *p, boolean_t full)
+{
+ cl_qmap_t *p_port_tbl = &p_subn->port_guid_tbl;
+ cl_map_item_t *p_item;
+ osm_port_t *p_port;
+ ib_api_status_t status = IB_SUCCESS;
+
+ p_item = cl_qmap_head(p_port_tbl);
+ while (p_item != cl_qmap_end(p_port_tbl)) {
+ p_port = (osm_port_t *)p_item;
+ p_item = cl_qmap_next(p_item);
+ status = osm_prtn_add_port(p_log, p_subn, p,
+ osm_port_get_guid(p_port), full);
+ if (status != IB_SUCCESS)
+ goto _err;
+ }
+
+ _err:
+ return status;
+}
+
+
+static const ib_gid_t osm_ipoib_mgid = {
+ {
+ 0xff, /* multicast field */
+ 0x12, /* non-permanent bit,scope */
+ 0x40, 0x1b, /* IPv4 signature */
+ 0xff, 0xff, /* 16 bits of P_Key (to be filled in) */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 48 bits of zeros */
+ 0xff, 0xff, 0xff, 0xff, /* 32 bit IPv4 broadcast address */
+ },
+};
+
+/*
+ * HACK: Until TS resolves their noncompliant join compmask,
+ * we have to pre-define the MGID
+ */
+static const ib_gid_t osm_ts_ipoib_mgid = {
+ {
+ 0xff, /* multicast field */
+ 0x12, /* non-permanent bit,scope */
+ 0x40, 0x1b, /* IPv4 signature */
+ 0xff, 0xff, /* 16 bits of P_Key (to be filled in) */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 48 bits of zeros */
+ 0x00, 0x00, 0x00, 0x01, /* 32 bit IPv4 broadcast address */
+ },
+};
+
+
+ib_api_status_t osm_prtn_add_mcgroup(osm_log_t *p_log,
+ osm_subn_t *p_subn, osm_prtn_t *p,
+ unsigned is_ipoib, uint8_t rate, uint8_t mtu)
+{
+ ib_member_rec_t mc_rec;
+ ib_net64_t comp_mask;
+ ib_net16_t pkey;
+ osm_mgrp_t *p_mgrp = NULL;
+ osm_sa_t *p_sa = &p_subn->p_osm->sa;
+ ib_api_status_t status = IB_SUCCESS;
+
+ pkey = cl_hton16(cl_ntoh16(p->pkey) | 0x8000);
+
+ cl_memclr(&mc_rec, sizeof(mc_rec));
+
+ mc_rec.mgid = osm_ipoib_mgid; /* this is ipv4 broadcast */
+ cl_memcpy(&mc_rec.mgid.raw[4], &pkey, sizeof(pkey));
+
+ mc_rec.qkey = CL_HTON32(0x0b1b);
+ mc_rec.mtu = mtu ? mtu : 4; /* 2048 Bytes */
+ mc_rec.tclass = 0;
+ mc_rec.pkey = pkey;
+ mc_rec.rate = rate ? rate : 0x3; /* 10Gb/sec */
+ mc_rec.pkt_life = OSM_DEFAULT_SUBNET_TIMEOUT;
+ mc_rec.sl_flow_hop = OSM_DEFAULT_SL << 28;
+ /* Note: scope needs to be consistent with MGID */
+ mc_rec.scope_state = 0x21;
+
+ /* don't update rate, mtu */
+ comp_mask = IB_MCR_COMPMASK_MTU | IB_MCR_COMPMASK_RATE;
+ status = osm_mcmr_rcv_find_or_create_new_mgrp(&p_sa->mcmr_rcv,
+ comp_mask, &mc_rec, &p_mgrp);
+ if (!p_mgrp || status != IB_SUCCESS)
+ osm_log( p_log, OSM_LOG_ERROR,
+ "osm_prtn_add_mcgroup: "
+ "Failed to create MC group with pkey %04x\n",
+ cl_ntoh16(pkey));
+ if (p_mgrp)
+ p_mgrp->well_known = TRUE;
+
+ /* workaround for TS */ /* FIXME: remove this upon TS fixes */
+ mc_rec.mgid = osm_ts_ipoib_mgid;
+ cl_memcpy(&mc_rec.mgid.raw[4], &pkey, sizeof(pkey));
+ status = osm_mcmr_rcv_find_or_create_new_mgrp(&p_sa->mcmr_rcv,
+ comp_mask, &mc_rec, &p_mgrp);
+ if (p_mgrp)
+ p_mgrp->well_known = TRUE;
+
+ return status;
+}
+
+static uint16_t __generate_pkey(osm_subn_t *p_subn)
+{
+ uint16_t pkey;
+
+ cl_qmap_t *m = &p_subn->prtn_pkey_tbl;
+ while (global_pkey_counter < cl_ntoh16(IB_DEFAULT_PARTIAL_PKEY) - 1) {
+ pkey = ++global_pkey_counter;
+ pkey = cl_hton16(pkey);
+ if (cl_qmap_get(m, pkey) == cl_qmap_end(m))
+ return pkey;
+ }
+ return 0;
+}
+
+osm_prtn_t *osm_prtn_make_new(osm_log_t *p_log, osm_subn_t *p_subn,
+ const char *name, uint16_t pkey)
+{
+ osm_prtn_t *p = NULL, *p_check;
+
+ if (pkey == 0 && !(pkey = __generate_pkey(p_subn)))
+ return NULL;
+
+ if (cl_ntoh16(pkey) & 0x8000) {
+ pkey = cl_hton16(cl_ntoh16(pkey) & ~0x8000);
+ osm_log(p_log, OSM_LOG_VERBOSE,
+ "osm_prtn_make_new: pkey stripped for"
+ " partition \'%s\' (%04x)\n",
+ name, cl_ntoh16(pkey));
+ }
+
+ p = osm_prtn_new(name, pkey);
+ if (!p) {
+ osm_log(p_log, OSM_LOG_ERROR,
+ "osm_prtn_make_new: Unable to create"
+ " partition \'%s\' (%04x)\n",
+ name, cl_ntoh16(pkey));
+ return NULL;
+ }
+
+ p_check = (osm_prtn_t *)cl_qmap_insert(&p_subn->prtn_pkey_tbl,
+ p->pkey, &p->map_item);
+ if (p != p_check) {
+ osm_log(p_log, OSM_LOG_VERBOSE,
+ "osm_prtn_make_new: Duplicated partition"
+ " definition: \'%s\' (%04x) prev name \'%s\'"
+ " - will use it\n",
+ name, cl_ntoh16(pkey), p_check->name);
+ osm_prtn_delete(&p);
+ p = p_check;
+ }
+
+ return p;
+}
+
+static ib_api_status_t osm_prtn_make_default(osm_log_t * const p_log,
+ osm_subn_t * const p_subn,
+ boolean_t no_config)
+{
+ ib_api_status_t status = IB_UNKNOWN_ERROR;
+ osm_prtn_t *p;
+
+ p = osm_prtn_make_new(p_log, p_subn, "Default", IB_DEFAULT_PARTIAL_PKEY);
+ if (!p)
+ goto _err;
+ status = osm_prtn_add_all(p_log, p_subn, p, no_config);
+ if (status != IB_SUCCESS)
+ goto _err;
+ cl_map_remove(&p->part_guid_tbl, p_subn->sm_port_guid);
+ status = osm_prtn_add_port(p_log, p_subn, p, p_subn->sm_port_guid, TRUE);
+
+ if (no_config)
+ osm_prtn_add_mcgroup(p_log, p_subn, p, 1, 0, 0);
+
+ _err:
+ return status;
+}
+
+ib_api_status_t osm_prtn_make_partitions(osm_log_t * const p_log,
+ osm_subn_t * const p_subn)
+{
+ struct stat statbuf;
+ const char *file_name;
+ boolean_t is_config = TRUE;
+ ib_api_status_t status = IB_SUCCESS;
+ osm_prtn_t *p, *p_next;
+
+ file_name = p_subn->opt.partition_config_file ?
+ p_subn->opt.partition_config_file :
+ "/etc/osm-partitions.conf";
+ if (stat(file_name, &statbuf))
+ is_config = FALSE;
+
+ /* cl_qmap uses self addresses so we cannot just save
+ qmap state and clean it later, so clean all now */
+ p_next = (osm_prtn_t *)cl_qmap_head(&p_subn->prtn_pkey_tbl);
+ while (p_next != (osm_prtn_t *)cl_qmap_end(&p_subn->prtn_pkey_tbl)) {
+ p = p_next;
+ p_next = (osm_prtn_t *)cl_qmap_next(&p->map_item);
+ osm_prtn_delete(&p);
+ }
+ cl_qmap_init(&p_subn->prtn_pkey_tbl);
+
+ global_pkey_counter = 0;
+
+ status = osm_prtn_make_default(p_log, p_subn, !is_config);
+ if (status != IB_SUCCESS)
+ goto _err;
+
+ if (is_config && osm_prtn_config_parse_file(p_log, p_subn, file_name)) {
+ osm_log(p_log, OSM_LOG_VERBOSE,
+ "osm_prtn_make_partitions: Partition configuration "
+ "was not fully processed\n");
+ }
+
+ _err:
+ return status;
+}
Property changes on: opensm/osm_prtn.c
___________________________________________________________________
Name: svn:keywords
+ Id
Index: opensm/osm_ucast_mgr.c
===================================================================
--- opensm/osm_ucast_mgr.c (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ opensm/osm_ucast_mgr.c (.../trunk/src/userspace/management/osm) (revision
6101)
@@ -242,7 +242,7 @@ osm_ucast_mgr_dump_ucast_routes(
{
osm_log( p_mgr->p_log, OSM_LOG_ERROR,
"osm_ucast_mgr_dump_ucast_routes: ERR 3A12: "
- "Fail to open fdb file (%s)\n",
+ "Failed to open fdb file (%s)\n",
file_name );
goto Exit;
}
Index: opensm/osm_sa_informinfo.c
===================================================================
--- opensm/osm_sa_informinfo.c (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ opensm/osm_sa_informinfo.c (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -130,7 +130,7 @@ __validate_ports_access_rights(
IN osm_infr_t* p_infr_rec)
{
boolean_t valid = TRUE;
- osm_physp_t* p_requestor_physp;
+ osm_physp_t* p_requester_physp;
osm_port_t* p_port;
osm_physp_t* p_physp;
ib_net64_t portguid;
@@ -142,8 +142,8 @@ __validate_ports_access_rights(
OSM_LOG_ENTER( p_rcv->p_log, __validate_ports_access_rights );
- /* get the requestor physp from the request address */
- p_requestor_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
+ /* get the requester physp from the request address */
+ p_requester_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
p_rcv->p_subn,
&p_infr_rec->report_addr );
@@ -169,13 +169,13 @@ __validate_ports_access_rights(
/* get the destination informInfo physical port */
p_physp = osm_port_get_default_phys_ptr(p_port);
- /* make sure that the requestor and destination port can access each
other
+ /* make sure that the requester and destination port can access each
other
according to the current partitioning. */
- if (! osm_physp_share_pkey( p_rcv->p_log, p_physp, p_requestor_physp))
+ if (! osm_physp_share_pkey( p_rcv->p_log, p_physp, p_requester_physp))
{
osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
"__validate_ports_access_rights: "
- "port and requestor don't share pkey\n" );
+ "port and requester don't share pkey\n" );
valid = FALSE;
goto Exit;
}
@@ -194,7 +194,7 @@ __validate_ports_access_rights(
lid_range_end = lid_range_begin;
/* go over all defined lids within the range and make sure that the
- requestor port can access them according to current partitioning. */
+ requester port can access them according to current partitioning. */
for ( lid = lid_range_begin ; lid <= lid_range_end ; lid++ )
{
p_tbl = &p_rcv->p_subn->port_lid_tbl;
@@ -216,13 +216,13 @@ __validate_ports_access_rights(
continue;
p_physp = osm_port_get_default_phys_ptr(p_port);
- /* make sure that the requestor and destination port can access each
other
+ /* make sure that the requester and destination port can access each
other
according to the current partitioning. */
- if (! osm_physp_share_pkey( p_rcv->p_log, p_physp, p_requestor_physp))
+ if (! osm_physp_share_pkey( p_rcv->p_log, p_physp, p_requester_physp))
{
osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
"__validate_ports_access_rights: "
- "port and requestor don't share pkey\n" );
+ "port and requester don't share pkey\n" );
valid = FALSE;
goto Exit;
}
@@ -443,7 +443,7 @@ osm_infr_rcv_process_set_method(
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
"osm_infr_rcv_process_set_method: ERR 4305: "
- "Fail to validate a new inform object\n");
+ "Failed to validate a new inform object\n");
/* o13-13.1.1: we need to set the subscribe bit to 0 */
p_recvd_inform_info->subscribe = 0;
@@ -466,7 +466,7 @@ osm_infr_rcv_process_set_method(
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
"osm_infr_rcv_process_set_method: ERR 4306: "
- "Fail to create a new inform object\n");
+ "Failed to create a new inform object\n");
/* o13-13.1.1: we need to set the subscribe bit to 0 */
p_recvd_inform_info->subscribe = 0;
@@ -501,7 +501,7 @@ osm_infr_rcv_process_set_method(
/* No Such Item - So Error */
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
"osm_infr_rcv_process_set_method: ERR 4307: "
- "Fail to Un-Subscribe to non exiting inform object\n");
+ "Failed to UnSubscribe to non exiting inform object\n");
/* o13-13.1.1: we need to set the subscribe bit to 0 */
p_recvd_inform_info->subscribe = 0;
Index: opensm/osm_ucast_updn.c
===================================================================
--- opensm/osm_ucast_updn.c (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ opensm/osm_ucast_updn.c (.../trunk/src/userspace/management/osm) (revision
6101)
@@ -549,7 +549,7 @@ updn_init(
{
osm_log( &osm.log, OSM_LOG_ERROR,
"osm_opensm_init : ERR AA02: "
- "Fail to open guid list file (%s)\n",
+ "Failed to open guid list file (%s)\n",
osm.subn.opt.updn_guid_file);
status = IB_NOT_FOUND;
goto Exit;
Index: opensm/osm_sa_node_record.c
===================================================================
--- opensm/osm_sa_node_record.c
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ opensm/osm_sa_node_record.c (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -236,7 +236,7 @@ __osm_nr_rcv_create_nr(
if( !osm_physp_is_valid( p_physp ) )
continue;
- /* Check to see if the found p_physp and the requestor physp
+ /* Check to see if the found p_physp and the requester physp
share a pkey. If not - continue */
if (!osm_physp_share_pkey( p_rcv->p_log, p_physp, p_req_physp ) )
continue;
@@ -446,7 +446,7 @@ osm_nr_rcv_process(
CL_ASSERT( p_rcvd_mad->attr_id == IB_MAD_ATTR_NODE_RECORD );
- /* update the requestor physical port. */
+ /* update the requester physical port. */
p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
p_rcv->p_subn,
osm_madw_get_mad_addr_ptr(p_madw) );
@@ -454,7 +454,7 @@ osm_nr_rcv_process(
{
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
"osm_nr_rcv_process: ERR 1D04: "
- "Cannot find requestor physical port\n" );
+ "Cannot find requester physical port\n" );
goto Exit;
}
Index: opensm/osm_pkey.c
===================================================================
--- opensm/osm_pkey.c (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ opensm/osm_pkey.c (.../trunk/src/userspace/management/osm) (revision 6101)
@@ -198,38 +198,39 @@ static boolean_t __osm_match_pkey (
/**********************************************************************
**********************************************************************/
boolean_t
-osm_physp_share_pkey(
- IN osm_log_t* p_log,
- IN const osm_physp_t* const p_physp_1,
- IN const osm_physp_t* const p_physp_2 ) {
+osm_physp_share_this_pkey(
+ IN const osm_physp_t* const p_physp1,
+ IN const osm_physp_t* const p_physp2,
+ IN const ib_net16_t pkey)
+{
+ ib_net16_t *pkey1, *pkey2;
+
+ pkey1 = cl_map_get( &(osm_physp_get_pkey_tbl(p_physp1))->keys,
+ ib_pkey_get_base(pkey));
+ pkey2 = cl_map_get( &(osm_physp_get_pkey_tbl(p_physp2))->keys,
+ ib_pkey_get_base(pkey));
+ return (pkey1 && pkey2 && __osm_match_pkey(pkey1, pkey2));
+}
+/**********************************************************************
+ **********************************************************************/
+ib_net16_t
+osm_physp_find_common_pkey(
+ IN const osm_physp_t* const p_physp1,
+ IN const osm_physp_t* const p_physp2 )
+{
ib_net16_t *pkey1, *pkey2;
uint64_t pkey1_base, pkey2_base;
const osm_pkey_tbl_t *pkey_tbl1, *pkey_tbl2;
cl_map_iterator_t map_iter1, map_iter2;
- OSM_LOG_ENTER( p_log, osm_physp_share_pkey );
+ pkey_tbl1 = osm_physp_get_pkey_tbl(p_physp1);
+ pkey_tbl2 = osm_physp_get_pkey_tbl(p_physp2);
- pkey_tbl1 = osm_physp_get_pkey_tbl(p_physp_1);
- pkey_tbl2 = osm_physp_get_pkey_tbl(p_physp_2);
-
- /*
- The spec: 10.9.2 does not require each phys port to have PKey Table.
- So actually if it does not - we would need to use the default port
- instead.
+ map_iter1 = cl_map_head(&pkey_tbl1->keys);
+ map_iter2 = cl_map_head(&pkey_tbl2->keys);
- HACK: meanwhile we will ignore the check
- */
- if (cl_is_map_empty(&pkey_tbl1->keys) || cl_is_map_empty(&pkey_tbl2->keys))
- {
- OSM_LOG_EXIT( p_log );
- return(TRUE);
- }
-
/* we rely on the fact the map are sorted by pkey */
- map_iter1 = cl_map_head( &pkey_tbl1->keys );
- map_iter2 = cl_map_head( &pkey_tbl2->keys );
-
while ( (map_iter1 != cl_map_end( &pkey_tbl1->keys )) &&
(map_iter2 != cl_map_end( &pkey_tbl2->keys )))
{
@@ -237,16 +238,8 @@ osm_physp_share_pkey(
pkey2 = (ib_net16_t *)cl_map_obj( map_iter2 );
if (__osm_match_pkey(pkey1, pkey2))
- {
+ return *pkey1;
- osm_log( p_log, OSM_LOG_DEBUG,
- "osm_physp_share_pkey: "
- "Matched pkeys: 0x%04x 0x%04x\n",
- cl_ntoh16(*pkey1), cl_ntoh16(*pkey2));
- OSM_LOG_EXIT( p_log );
- return(TRUE);
- }
-
/* advance the lower value if they are not equal */
pkey1_base = cl_map_key( map_iter1 );
pkey2_base = cl_map_key( map_iter2 );
@@ -261,12 +254,35 @@ osm_physp_share_pkey(
map_iter1 = cl_map_next( map_iter1 );
}
- osm_log( p_log, OSM_LOG_DEBUG,
- "osm_physp_share_pkey: "
- "Ports do not share a pkey\n");
+ return 0;
+}
- OSM_LOG_EXIT( p_log );
- return(FALSE);
+/**********************************************************************
+ **********************************************************************/
+boolean_t
+osm_physp_share_pkey(
+ IN osm_log_t* p_log,
+ IN const osm_physp_t* const p_physp_1,
+ IN const osm_physp_t* const p_physp_2 )
+{
+ const osm_pkey_tbl_t *pkey_tbl1, *pkey_tbl2;
+
+ if (p_physp_1 == p_physp_2)
+ return TRUE;
+
+ pkey_tbl1 = osm_physp_get_pkey_tbl(p_physp_1);
+ pkey_tbl2 = osm_physp_get_pkey_tbl(p_physp_2);
+
+ /*
+ The spec: 10.9.2 does not require each phys port to have PKey Table.
+ So actually if it does not, we need to use the default port instead.
+
+ HACK: meanwhile we will ignore the check
+ */
+ if (cl_is_map_empty(&pkey_tbl1->keys) || cl_is_map_empty(&pkey_tbl2->keys))
+ return TRUE;
+
+ return !ib_pkey_is_invalid(osm_physp_find_common_pkey(p_physp_1,
p_physp_2));
}
/**********************************************************************
Index: opensm/osm_sa_link_record.c
===================================================================
--- opensm/osm_sa_link_record.c
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ opensm/osm_sa_link_record.c (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -769,7 +769,7 @@ osm_lr_rcv_process(
CL_ASSERT( p_sa_mad->attr_id == IB_MAD_ATTR_LINK_RECORD );
- /* update the requestor physical port. */
+ /* update the requester physical port. */
p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
p_rcv->p_subn,
osm_madw_get_mad_addr_ptr(p_madw) );
@@ -777,7 +777,7 @@ osm_lr_rcv_process(
{
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
"osm_lr_rcv_process: ERR 1805: "
- "Cannot find requestor physical port\n" );
+ "Cannot find requester physical port\n" );
goto Exit;
}
Index: opensm/osm_sm_mad_ctrl.c
===================================================================
--- opensm/osm_sm_mad_ctrl.c (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ opensm/osm_sm_mad_ctrl.c (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -855,7 +855,7 @@ __osm_sm_mad_ctrl_send_err_cb(
{
osm_log( p_ctrl->p_log, OSM_LOG_ERROR,
"__osm_sm_mad_ctrl_send_err_cb: ERR 3114: "
- "Fail to find the corresponding phys port\n");
+ "Failed to find the corresponding phys port\n");
}
else
{
Index: opensm/main.c
===================================================================
--- opensm/main.c (.../branches/1.0/src/userspace/management/osm) (revision
6101)
+++ opensm/main.c (.../trunk/src/userspace/management/osm) (revision 6101)
@@ -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.
*
@@ -44,10 +44,6 @@
*
* $Revision: 1.23 $
*/
-#ifdef __WIN__
-#pragma warning(disable : 4996)
-#endif
-
#if HAVE_CONFIG_H
# include <config.h>
#endif /* HAVE_CONFIG_H */
@@ -234,6 +230,13 @@ show_usage(void)
" This option will cause deletion of the log file\n"
" (if it previously exists). By default, the log file\n"
" is accumulative.\n\n");
+ printf( "-P\n"
+ "--Pconfig\n"
+ " This option defines the optional partition configuration
file.\n"
+ " The default name is \'" OSM_DEFAULT_PARTITION_CONFIG_FILE "\'.
\n\n");
+ printf( "-N\n"
+ "--no_part_enforce\n"
+ " This option disables partition enforcement on switch
external ports.\n\n");
printf( "-y\n"
"--stay_on_fatal\n"
" This option will cause SM not to exit on fatal
initialization\n"
@@ -520,7 +523,7 @@ main(
boolean_t cache_options = FALSE;
char *ignore_guids_file_name = NULL;
uint32_t val;
- const char * const short_option = "i:f:ed:g:l:s:t:a:uvVhorcyx";
+ const char * const short_option = "i:f:ed:g:l:s:t:a:P:NuvVhorcyx";
/*
In the array below, the 2nd parameter specified the number
@@ -541,6 +544,8 @@ main(
{ "D", 1, NULL, 'D'},
{ "log_file", 1, NULL, 'f'},
{ "erase_log_file",0, NULL, 'e'},
+ { "Pconfig", 1, NULL, 'P'},
+ { "no_part_enforce",0,NULL, 'N'},
{ "maxsmps", 1, NULL, 'n'},
{ "console", 0, NULL, 'q'},
{ "V", 0, NULL, 'V'},
@@ -557,9 +562,7 @@ main(
{ NULL, 0, NULL, 0 } /* Required at the end of the array
*/
};
-#ifdef __WIN__
complib_init();
-#endif
/* Make sure that the opensm and complib were compiled using
same modes (debug/free) */
@@ -731,6 +734,14 @@ main(
printf(" Creating new log file\n");
break;
+ case 'P':
+ opt.partition_config_file = optarg;
+ break;
+
+ case 'N':
+ opt.no_partition_enforcement = TRUE;
+ break;
+
case 'y':
opt.exit_on_fatal = FALSE;
printf(" Staying on fatal initialization errors\n");
Index: opensm/osm_sa_mcmember_record.c
===================================================================
--- opensm/osm_sa_mcmember_record.c
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ opensm/osm_sa_mcmember_record.c (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -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.
*
@@ -420,7 +420,7 @@ __cleanup_mgrp(
/*********************************************************************
Add a port to the group. Calculating its PROXY_JOIN by the Port and
-requestor gids.
+requester gids.
**********************************************************************/
static
ib_api_status_t
@@ -432,15 +432,15 @@ __add_new_mgrp_port(
OUT osm_mcm_port_t **pp_mcmr_port)
{
boolean_t proxy_join;
- ib_gid_t requestor_gid;
+ ib_gid_t requester_gid;
- /* set the proxy_join if the requestor gid is not identical to the
+ /* set the proxy_join if the requester gid is not identical to the
joined gid */
- requestor_gid = osm_get_gid_by_mad_addr( p_rcv->p_log,
+ requester_gid = osm_get_gid_by_mad_addr( p_rcv->p_log,
p_rcv->p_subn,
p_mad_addr );
- if (! cl_memcmp(&p_recvd_mcmember_rec->port_gid, &requestor_gid,
+ if (! cl_memcmp(&p_recvd_mcmember_rec->port_gid, &requester_gid,
sizeof(ib_gid_t)))
{
proxy_join = FALSE;
@@ -451,7 +451,7 @@ __add_new_mgrp_port(
else
{
/* The port is not the one specified in PortGID.
- The check that the requestor is in the same partition as
+ The check that the requester is in the same partition as
the PortGID is done before - just need to update the proxy_join. */
proxy_join = TRUE;
osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
@@ -768,7 +768,7 @@ __validate_modify(IN osm_mcmr_recv_t* co
if ( (*pp_mcm_port)->proxy_join == FALSE )
{
/* The proxy_join is not set. Modifying can by done only
- if the requestor GID == PortGID */
+ if the requester GID == PortGID */
request_gid = osm_get_gid_by_mad_addr(p_rcv->p_log,
p_rcv->p_subn,
p_mad_addr );
@@ -788,7 +788,7 @@ __validate_modify(IN osm_mcmr_recv_t* co
else
{
/* the proxy_join is set. Modification allowed only if the
- requestor is part of the partition for this MCMemberRecord */
+ requester is part of the partition for this MCMemberRecord */
p_request_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
p_rcv->p_subn,
p_mad_addr );
@@ -1102,7 +1102,7 @@ __mgrp_request_is_realizable(
use the smaller of the two:
a. one lower then the required
b. the mtu of the requesting port
- If the p_pi is NULL, this means there is no requestor port and
+ If the p_pi is NULL, this means there is no requester port and
just use mtu one lower than the required. */
if ( mtu_required > 1 )
{
@@ -1178,7 +1178,7 @@ __mgrp_request_is_realizable(
use the smaller of the two:
a. one lower then the required
b. the rate of the requesting port
- If the p_pi is NULL, this means there is no requestor port and
+ If the p_pi is NULL, this means there is no requester port and
just use rate one lower than the required. */
if ( rate_required > 2 )
@@ -1218,6 +1218,24 @@ __mgrp_request_is_realizable(
}
/**********************************************************************
+ Call this function to find or create a new mgrp.
+**********************************************************************/
+ib_api_status_t
+osm_mcmr_rcv_find_or_create_new_mgrp(
+ IN osm_mcmr_recv_t* const p_rcv,
+ IN ib_net64_t comp_mask,
+ IN ib_member_rec_t* const p_recvd_mcmember_rec,
+ OUT osm_mgrp_t **pp_mgrp)
+{
+ ib_api_status_t status;
+ status = __get_mgrp_by_mgid(p_rcv, p_recvd_mcmember_rec, pp_mgrp);
+ if (status == IB_SUCCESS)
+ return status;
+ return osm_mcmr_rcv_create_new_mgrp(p_rcv, comp_mask,
+ p_recvd_mcmember_rec, NULL, pp_mgrp);
+}
+
+/**********************************************************************
Call this function to create a new mgrp.
**********************************************************************/
ib_api_status_t
@@ -1581,7 +1599,7 @@ osm_mcmr_rcv_join_mgrp(
osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
"osm_mcmr_rcv_join_mgrp: "
- "Invalid portguid =< 0x%016" PRIx64 "\n",
+ "Unknown portguid 0x%016" PRIx64 "\n",
portguid);
sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
osm_sa_send_error( p_rcv->p_resp, p_madw, sa_status);
@@ -1589,7 +1607,7 @@ osm_mcmr_rcv_join_mgrp(
}
p_physp = osm_port_get_default_phys_ptr(p_port);
- /* Check that the p_physp and the requestor physp are in the same
+ /* Check that the p_physp and the requester physp are in the same
partition. */
p_request_physp =
osm_get_physp_by_mad_addr(p_rcv->p_log,
@@ -1607,7 +1625,7 @@ osm_mcmr_rcv_join_mgrp(
osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
"osm_mcmr_rcv_join_mgrp: "
- "port and requestor don't share pkey\n" );
+ "port and requester don't share pkey\n" );
sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
osm_sa_send_error( p_rcv->p_resp, p_madw, sa_status);
goto Exit;
@@ -1868,7 +1886,7 @@ __osm_mcmr_rcv_new_mcmr(
cl_memclr( &p_rec_item->rec, sizeof( p_rec_item->rec ) );
- /* HACK: Not trusted requestors should result with 0 Join
+ /* HACK: Not trusted requesters should result with 0 Join
State, Port Guid, and Proxy */
p_rec_item->rec = *p_rcvd_rec;
cl_qlist_insert_tail( p_list, (cl_list_item_t*)&p_rec_item->pool_item );
@@ -1931,7 +1949,7 @@ __osm_sa_mcm_by_comp_mask_cb(
cl_memcmp(&p_rcvd_rec->mlid, &p_mgrp->mcmember_rec.mlid,
sizeof(uint16_t)))
goto Exit;
- /* if the requestor physical port doesn't have the pkey that is defined for
+ /* if the requester physical port doesn't have the pkey that is defined for
the group - exit. */
if (! osm_physp_has_pkey( p_rcv->p_log, p_mgrp->mcmember_rec.pkey,
p_req_physp ))
@@ -2114,7 +2132,7 @@ osm_mcmr_query_mgrp(IN osm_mcmr_recv_t*
*/
trusted_req = (p_rcvd_mad->sm_key != 0);
- /* update the requestor physical port. */
+ /* update the requester physical port. */
p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
p_rcv->p_subn,
osm_madw_get_mad_addr_ptr(p_madw) );
@@ -2122,7 +2140,7 @@ osm_mcmr_query_mgrp(IN osm_mcmr_recv_t*
{
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
"osm_mcmr_query_mgrp: ERR 1B04: "
- "Cannot find requestor physical port\n" );
+ "Cannot find requester physical port\n" );
goto Exit;
}
Index: opensm/osm_drop_mgr.c
===================================================================
--- opensm/osm_drop_mgr.c (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ opensm/osm_drop_mgr.c (.../trunk/src/userspace/management/osm) (revision
6101)
@@ -636,7 +636,7 @@ osm_drop_mgr_process(
/*
Go over all the nodes. If the node is a switch - make sure
- there is also a switch record for it, and portInfo record for
+ there is also a switch record for it, and a portInfo record for
port zero of of the node.
If not - this means that there was some error in getting the data
of this node. Drop the node.
Index: opensm/Makefile.am
===================================================================
--- opensm/Makefile.am (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ opensm/Makefile.am (.../trunk/src/userspace/management/osm) (revision
6101)
@@ -81,6 +81,7 @@ opensm_SOURCES = main.c osm_console.c os
osm_state_mgr_ctrl.c osm_subnet.c \
osm_sweep_fail_ctrl.c osm_sw_info_rcv.c \
osm_sw_info_rcv_ctrl.c osm_switch.c \
+ osm_prtn.c osm_prtn_config.c \
osm_trap_rcv.c osm_trap_rcv_ctrl.c \
osm_ucast_mgr.c osm_ucast_updn.c \
osm_vl15intf.c osm_vl_arb_rcv.c\
Index: opensm/osm_sa_path_record.c
===================================================================
--- opensm/osm_sa_path_record.c
(.../branches/1.0/src/userspace/management/osm) (revision 6101)
+++ opensm/osm_sa_path_record.c (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -173,6 +173,7 @@ __osm_pr_rcv_get_path_parms(
const cl_qmap_t* p_sw_tbl;
ib_api_status_t status = IB_SUCCESS;
+ ib_net16_t pkey;
uint8_t mtu;
uint8_t rate;
uint8_t pkt_life;
@@ -554,13 +555,38 @@ __osm_pr_rcv_get_path_parms(
}
}
+ if (status != IB_SUCCESS)
+ goto Exit;
+
p_parms->mtu = mtu;
p_parms->rate = rate;
- p_parms->pkey = IB_DEFAULT_PKEY;
/* the pkt_life */
p_parms->pkt_life = pkt_life;
p_parms->sl = OSM_DEFAULT_SL;
+ if (comp_mask & IB_PR_COMPMASK_RAWTRAFFIC &&
+ cl_ntoh32(p_pr->hop_flow_raw)&(1<<31))
+ pkey = 0;
+ else if(comp_mask & IB_PR_COMPMASK_PKEY) {
+ pkey = p_pr->pkey;
+ if (!osm_physp_share_this_pkey(p_physp, p_dest_physp, pkey)) {
+ osm_log( p_rcv->p_log, OSM_LOG_ERROR,
+ "__osm_pr_rcv_get_path_parms: ERR 1F1A: "
+ "Ports do not share specified P_Key\n");
+ status = IB_NOT_FOUND;
+ }
+ }
+ else {
+ pkey = osm_physp_find_common_pkey(p_physp, p_dest_physp);
+ if (!pkey) {
+ osm_log( p_rcv->p_log, OSM_LOG_ERROR,
+ "__osm_pr_rcv_get_path_parms: ERR 1F1B: "
+ "Ports do not have any shared P_Keys\n");
+ status = IB_NOT_FOUND;
+ }
+ }
+ p_parms->pkey = pkey;
+
Exit:
OSM_LOG_EXIT( p_rcv->p_log );
return( status );
@@ -748,7 +774,7 @@ __osm_pr_rcv_get_port_pair_paths(
osm_port_share_pkey(p_rcv->p_log, p_req_port, p_dest_port) == FALSE ||
osm_port_share_pkey(p_rcv->p_log, p_src_port, p_dest_port) == FALSE )
{
- /* One of the pairs don't share a pkey - the path is disqualified.
+ /* One of the pairs doesn't share a pkey so the path is disqualified.
Exit */
goto Exit;
}
@@ -975,18 +1001,6 @@ __osm_pr_rcv_get_end_points(
into the endpoints.
*/
- if( comp_mask & IB_PR_COMPMASK_PKEY )
- {
- if( p_pr->pkey != IB_DEFAULT_PKEY )
- {
- if ( p_sa_mad->method == IB_MAD_METHOD_GET )
- sa_status = IB_SA_MAD_STATUS_NO_RECORDS;
- *pp_src_port = 0;
- *pp_dest_port = 0;
- goto Exit;
- }
- }
-
if( comp_mask & IB_PR_COMPMASK_SL )
{
if( p_pr->sl != OSM_DEFAULT_SL )
@@ -1110,7 +1124,7 @@ static void
__osm_pr_rcv_process_world(
IN osm_pr_rcv_t* const p_rcv,
IN const osm_madw_t* const p_madw,
- IN const osm_port_t* const requestor_port,
+ IN const osm_port_t* const requester_port,
IN const ib_net64_t comp_mask,
IN cl_qlist_t* const p_list )
{
@@ -1136,7 +1150,7 @@ __osm_pr_rcv_process_world(
p_src_port = (osm_port_t*)cl_qmap_head( p_tbl );
while( p_src_port != (osm_port_t*)cl_qmap_end( p_tbl ) )
{
- __osm_pr_rcv_get_port_pair_paths( p_rcv, p_madw, requestor_port,
p_src_port,
+ __osm_pr_rcv_get_port_pair_paths( p_rcv, p_madw, requester_port,
p_src_port,
p_dest_port, comp_mask, p_list );
p_src_port = (osm_port_t*)cl_qmap_next( &p_src_port->map_item );
@@ -1154,7 +1168,7 @@ static void
__osm_pr_rcv_process_half(
IN osm_pr_rcv_t* const p_rcv,
IN const osm_madw_t* const p_madw,
- IN const osm_port_t* const requestor_port,
+ IN const osm_port_t* const requester_port,
IN const osm_port_t* const p_src_port,
IN const osm_port_t* const p_dest_port,
IN const ib_net64_t comp_mask,
@@ -1180,7 +1194,7 @@ __osm_pr_rcv_process_half(
p_port = (osm_port_t*)cl_qmap_head( p_tbl );
while( p_port != (osm_port_t*)cl_qmap_end( p_tbl ) )
{
- __osm_pr_rcv_get_port_pair_paths( p_rcv, p_madw , requestor_port,
p_src_port,
+ __osm_pr_rcv_get_port_pair_paths( p_rcv, p_madw , requester_port,
p_src_port,
p_port, comp_mask, p_list );
p_port = (osm_port_t*)cl_qmap_next( &p_port->map_item );
}
@@ -1193,7 +1207,7 @@ __osm_pr_rcv_process_half(
p_port = (osm_port_t*)cl_qmap_head( p_tbl );
while( p_port != (osm_port_t*)cl_qmap_end( p_tbl ) )
{
- __osm_pr_rcv_get_port_pair_paths( p_rcv, p_madw, requestor_port,
p_port,
+ __osm_pr_rcv_get_port_pair_paths( p_rcv, p_madw, requester_port,
p_port,
p_dest_port, comp_mask, p_list );
p_port = (osm_port_t*)cl_qmap_next( &p_port->map_item );
}
@@ -1208,7 +1222,7 @@ static void
__osm_pr_rcv_process_pair(
IN osm_pr_rcv_t* const p_rcv,
IN const osm_madw_t* const p_madw,
- IN const osm_port_t* const requestor_port,
+ IN const osm_port_t* const requester_port,
IN const osm_port_t* const p_src_port,
IN const osm_port_t* const p_dest_port,
IN const ib_net64_t comp_mask,
@@ -1216,7 +1230,7 @@ __osm_pr_rcv_process_pair(
{
OSM_LOG_ENTER( p_rcv->p_log, __osm_pr_rcv_process_pair );
- __osm_pr_rcv_get_port_pair_paths( p_rcv, p_madw, requestor_port,
p_src_port,
+ __osm_pr_rcv_get_port_pair_paths( p_rcv, p_madw, requester_port,
p_src_port,
p_dest_port, comp_mask, p_list );
OSM_LOG_EXIT( p_rcv->p_log );
@@ -1659,22 +1673,22 @@ osm_pr_rcv_process(
const osm_port_t* p_dest_port;
cl_qlist_t pr_list;
ib_net16_t sa_status;
- osm_port_t* requestor_port;
+ osm_port_t* requester_port;
OSM_LOG_ENTER( p_rcv->p_log, osm_pr_rcv_process );
CL_ASSERT( p_madw );
- /* update the requestor physical port. */
- requestor_port =
+ /* update the requester physical port. */
+ requester_port =
osm_get_port_by_mad_addr(p_rcv->p_log,
p_rcv->p_subn,
osm_madw_get_mad_addr_ptr(p_madw) );
- if (requestor_port == NULL)
+ if (requester_port == NULL)
{
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
"osm_pr_rcv_process: ERR 1F16: "
- "Cannot find requestor physical port\n" );
+ "Cannot find requester physical port\n" );
goto Exit;
}
@@ -1729,22 +1743,22 @@ osm_pr_rcv_process(
if( p_src_port )
{
if( p_dest_port )
- __osm_pr_rcv_process_pair( p_rcv, p_madw, requestor_port, p_src_port,
p_dest_port,
+ __osm_pr_rcv_process_pair( p_rcv, p_madw, requester_port, p_src_port,
p_dest_port,
p_sa_mad->comp_mask, &pr_list );
else
- __osm_pr_rcv_process_half( p_rcv, p_madw, requestor_port, p_src_port,
NULL,
+ __osm_pr_rcv_process_half( p_rcv, p_madw, requester_port, p_src_port,
NULL,
p_sa_mad->comp_mask, &pr_list );
}
else
{
if( p_dest_port )
- __osm_pr_rcv_process_half( p_rcv, p_madw, requestor_port, NULL,
p_dest_port,
+ __osm_pr_rcv_process_half( p_rcv, p_madw, requester_port, NULL,
p_dest_port,
p_sa_mad->comp_mask, &pr_list );
else
/*
Katie, bar the door!
*/
- __osm_pr_rcv_process_world( p_rcv, p_madw, requestor_port,
+ __osm_pr_rcv_process_world( p_rcv, p_madw, requester_port,
p_sa_mad->comp_mask, &pr_list );
}
goto Unlock;
Index: opensm/osm_pkey_mgr.c
===================================================================
--- opensm/osm_pkey_mgr.c (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ opensm/osm_pkey_mgr.c (.../trunk/src/userspace/management/osm) (revision
6101)
@@ -56,6 +56,7 @@
#include <complib/cl_debug.h>
#include <opensm/osm_node.h>
#include <opensm/osm_pkey_mgr.h>
+#include <opensm/osm_partition.h>
/**********************************************************************
**********************************************************************/
@@ -107,121 +108,320 @@ osm_pkey_mgr_init(
/**********************************************************************
**********************************************************************/
-boolean_t
+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,
+ IN const uint16_t block_index )
+{
+ osm_madw_context_t context;
+ osm_node_t *p_node = osm_physp_get_node_ptr( p_physp );
+ uint32_t attr_mod;
+
+ context.pkey_context.node_guid = osm_node_get_node_guid( p_node );
+ context.pkey_context.port_guid = osm_physp_get_port_guid( p_physp );
+ context.pkey_context.set_method = TRUE;
+ 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 ),
+ ( uint8_t * ) block, sizeof( *block ),
+ IB_MAD_ATTR_P_KEY_TABLE,
+ cl_hton32( attr_mod ), CL_DISP_MSGID_NONE, &context );
+}
+
+/**********************************************************************
+ **********************************************************************/
+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,
+ IN const boolean_t enforce)
+{
+ osm_madw_context_t context;
+ uint8_t payload[IB_SMP_DATA_SIZE];
+ ib_port_info_t *p_pi;
+
+ if (!(p_pi = osm_physp_get_port_info_ptr(p_physp)))
+ return IB_ERROR;
+
+ if ((p_pi->vl_enforce & 0xc) == (0xc)*(enforce == TRUE))
+ return IB_SUCCESS;
+
+ cl_memclr( payload, IB_SMP_DATA_SIZE );
+ cl_memcpy( payload, p_pi, sizeof(ib_port_info_t) );
+
+ p_pi = (ib_port_info_t*)payload;
+ if (enforce == TRUE)
+ p_pi->vl_enforce |= 0xc;
+ else
+ p_pi->vl_enforce &= ~0xc;
+ p_pi->state_info2 = 0;
+ ib_port_info_set_port_state( p_pi, IB_LINK_NO_CHANGE );
+
+ context.pi_context.node_guid =
osm_node_get_node_guid( osm_physp_get_node_ptr( p_physp ) );
+ context.pi_context.port_guid = osm_physp_get_port_guid( p_physp );
+ context.pi_context.set_method = TRUE;
+ context.pi_context.update_master_sm_base_lid = FALSE;
+ 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 ),
+ payload, sizeof(payload),
+ IB_MAD_ATTR_PORT_INFO,
+ cl_hton32(osm_physp_get_port_num( p_physp )),
+ CL_DISP_MSGID_NONE, &context );
+}
+
+/**********************************************************************
+ **********************************************************************/
+
+/*
+ * Send a new entry for the pkey table for this port when this pkey
+ * does not exist. Update existed entry when membership was changed.
+ */
+
+static boolean_t
__osm_pkey_mgr_process_physical_port(
IN const osm_pkey_mgr_t * const p_mgr,
- IN osm_node_t * p_node,
- IN uint8_t port_num,
+ IN const ib_net16_t pkey,
IN osm_physp_t * p_physp )
{
- boolean_t return_val = FALSE; /* TRUE if IB_DEFAULT_PKEY was inserted */
- osm_madw_context_t context;
+ boolean_t return_val = FALSE; /* TRUE if pkey was inserted or updated */
+ ib_api_status_t status;
+ osm_node_t *p_node = osm_physp_get_node_ptr( p_physp );
ib_pkey_table_t *block = NULL;
uint16_t block_index;
uint16_t num_of_blocks;
const osm_pkey_tbl_t *p_pkey_tbl;
- uint32_t attr_mod;
+ ib_net16_t *p_orig_pkey;
uint32_t i;
- ib_net16_t pkey;
- ib_api_status_t status;
- boolean_t block_with_empty_entry_found;
+ boolean_t block_found = FALSE;
OSM_LOG_ENTER( p_mgr->p_log, __osm_pkey_mgr_process_physical_port );
- /*
- * Send a new entry for the pkey table for this node that includes
- * IB_DEFAULT_PKEY when IB_DEFAULT_PARTIAL_PKEY or IB_DEFAULT_PKEY
- * don't exist
- */
- if ( ( osm_physp_has_pkey( p_mgr->p_log,
- IB_DEFAULT_PKEY,
- p_physp ) == FALSE ) &&
- ( osm_physp_has_pkey( p_mgr->p_log,
- IB_DEFAULT_PARTIAL_PKEY, p_physp ) == FALSE ) )
- {
- context.pkey_context.node_guid = osm_node_get_node_guid( p_node );
- context.pkey_context.port_guid = osm_physp_get_port_guid( p_physp );
- context.pkey_context.set_method = TRUE;
-
- p_pkey_tbl = osm_physp_get_pkey_tbl( p_physp );
- num_of_blocks = osm_pkey_tbl_get_num_blocks( p_pkey_tbl );
- block_with_empty_entry_found = FALSE;
+ p_pkey_tbl = osm_physp_get_pkey_tbl( p_physp );
+ num_of_blocks = osm_pkey_tbl_get_num_blocks( p_pkey_tbl );
+
+ p_orig_pkey = cl_map_get( &p_pkey_tbl->keys, ib_pkey_get_base( pkey ) );
+ if ( p_orig_pkey && *p_orig_pkey == pkey )
+ {
+ 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_physical_port: "
+ "No need to insert pkey %04x for node 0x%016" PRIx64
+ " port %u\n",
+ cl_ntoh16( pkey ),
+ cl_ntoh64( osm_node_get_node_guid( p_node ) ),
+ osm_physp_get_port_num( p_physp ) );
+ }
+ goto _done;
+ }
+ else if ( !p_orig_pkey )
+ {
for ( block_index = 0; block_index < num_of_blocks; block_index++ )
{
block = osm_pkey_tbl_block_get( p_pkey_tbl, block_index );
for ( i = 0; i < IB_NUM_PKEY_ELEMENTS_IN_BLOCK; i++ )
{
- pkey = block->pkey_entry[i];
- if ( ib_pkey_is_invalid( pkey ) )
+ if ( ib_pkey_is_invalid( block->pkey_entry[i] ) )
{
- block->pkey_entry[i] = IB_DEFAULT_PKEY;
- block_with_empty_entry_found = TRUE;
+ block->pkey_entry[i] = pkey;
+ block_found = TRUE;
break;
}
}
- if ( block_with_empty_entry_found )
+ if ( block_found )
{
break;
}
}
-
- if ( block_with_empty_entry_found == FALSE )
- {
- osm_log( p_mgr->p_log, OSM_LOG_ERROR,
- "__osm_pkey_mgr_process_physical_port: ERR 0501: "
- "No empty entry was found to insert IB_DEFAULT_PKEY for
node "
- "0x%016" PRIx64 " and port %u\n",
- cl_ntoh64( osm_node_get_node_guid( p_node ) ), port_num );
- }
- else
+ }
+ else
+ {
+ *p_orig_pkey = pkey;
+ for ( block_index = 0; block_index < num_of_blocks; block_index++ )
{
- /* Building the attribute modifier */
- if ( osm_node_get_type( p_node ) == IB_NODE_TYPE_SWITCH )
- {
- /* Port num | Block Index */
- attr_mod = port_num << 16 | block_index;
- }
- else
+ block = osm_pkey_tbl_block_get( p_pkey_tbl, block_index );
+ i = p_orig_pkey - block->pkey_entry;
+ if ( i < IB_NUM_PKEY_ELEMENTS_IN_BLOCK )
{
- attr_mod = block_index;
+ block_found = TRUE;
+ break;
}
+ }
+ }
- status = osm_req_set( p_mgr->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 );
- return_val = TRUE; /*IB_DEFAULT_PKEY was inserted */
+ if ( block_found == FALSE )
+ {
+ osm_log( p_mgr->p_log, OSM_LOG_ERROR,
+ "__osm_pkey_mgr_process_physical_port: ERR 0501: "
+ "No empty entry was found to insert %04x for node "
+ "0x%016" PRIx64 " port %u\n",
+ cl_ntoh16( pkey ),
+ cl_ntoh64( osm_node_get_node_guid( p_node ) ),
+ osm_physp_get_port_num( p_physp ) );
+ goto _done;
+ }
- 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_physical_port: "
- "IB_DEFAULT_PKEY was inserted for node 0x%016" PRIx64
- " and port %u\n",
+ status =
+ osm_pkey_mgr_update_pkey_entry( p_mgr, 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 "
+ "pkey table block %d for node 0x%016" PRIx64 " port %u\n",
+ block_index,
+ cl_ntoh64( osm_node_get_node_guid( p_node ) ),
+ osm_physp_get_port_num( p_physp ) );
+ goto _done;
+ }
+
+ return_val = TRUE; /* pkey was inserted/updated */
+
+ 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_physical_port: "
+ "%04x was inserted for node 0x%016" PRIx64
+ " port %u\n",
+ cl_ntoh16( pkey ),
+ cl_ntoh64( osm_node_get_node_guid( p_node ) ),
+ osm_physp_get_port_num( p_physp ) );
+ }
+
+ _done:
+ OSM_LOG_EXIT( p_mgr->p_log );
+ return ( return_val );
+}
+
+
+/**********************************************************************
+ **********************************************************************/
+static void
+osm_pkey_mgr_update_peer_port(
+ const osm_pkey_mgr_t * const p_mgr,
+ const osm_port_t * const p_port )
+{
+ osm_physp_t *p, *peer;
+ osm_node_t *p_node;
+ ib_pkey_table_t *block, *peer_block;
+ const osm_pkey_tbl_t *p_pkey_tbl, *p_peer_pkey_tbl;
+ uint16_t block_index;
+ uint16_t num_of_blocks;
+ ib_api_status_t status = IB_SUCCESS;
+
+ p = osm_port_get_default_phys_ptr( p_port );
+ if ( !osm_physp_is_valid( p ) )
+ return;
+ peer = osm_physp_get_remote( p );
+ if ( !peer || !osm_physp_is_valid( peer ) )
+ return;
+ p_node = osm_physp_get_node_ptr( peer );
+ if ( osm_node_get_type( p_node ) == IB_NODE_TYPE_CA )
+ return;
+
+ if (p_mgr->p_subn->opt.no_partition_enforcement == TRUE)
+ goto _enforce_port;
+
+ p_pkey_tbl = osm_physp_get_pkey_tbl( p );
+ p_peer_pkey_tbl = osm_physp_get_pkey_tbl( peer );
+ num_of_blocks = osm_pkey_tbl_get_num_blocks( p_pkey_tbl );
+ if ( num_of_blocks > osm_pkey_tbl_get_num_blocks( p_peer_pkey_tbl ) )
+ num_of_blocks = osm_pkey_tbl_get_num_blocks( p_peer_pkey_tbl );
+
+ for ( block_index = 0; block_index < num_of_blocks; block_index++ )
+ {
+ block = osm_pkey_tbl_block_get( p_pkey_tbl, block_index );
+ peer_block = osm_pkey_tbl_block_get( p_peer_pkey_tbl, block_index );
+ if ( cl_memcmp( peer_block, block, sizeof( *block ) ) )
+ {
+ cl_memcpy( peer_block, block, sizeof( *block ) );
+ status =
+ osm_pkey_mgr_update_pkey_entry( p_mgr, 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 "
+ "pkey table block %d for node 0x%016" PRIx64
+ " port %u\n",
+ block_index,
cl_ntoh64( osm_node_get_node_guid( p_node ) ),
- port_num );
- }
+ osm_physp_get_port_num( peer ) );
}
}
- else
+
+ if ( num_of_blocks && status == IB_SUCCESS &&
+ osm_log_is_active( p_mgr->p_log, OSM_LOG_VERBOSE ) )
{
- /* default key or partial default key already exist */
- if ( osm_log_is_active( p_mgr->p_log, OSM_LOG_VERBOSE ) )
+ osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
+ "osm_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 ) ),
+ osm_physp_get_port_num( peer ) );
+ }
+
+ _enforce_port:
+ if (osm_pkey_mgr_enforce_partition( p_mgr, peer,
+ p_mgr->p_subn->opt.no_partition_enforcement == FALSE ) !=
+ 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 "
+ "node 0x%016" PRIx64 " port %u\n",
+ cl_ntoh64( osm_node_get_node_guid( p_node ) ),
+ osm_physp_get_port_num( peer ) );
+ }
+}
+
+/**********************************************************************
+ **********************************************************************/
+static boolean_t
+osm_pkey_mgr_process_partition_table(
+ const osm_pkey_mgr_t * const p_mgr,
+ const osm_prtn_t * const p_prtn,
+ const boolean_t full )
+{
+ const cl_map_t *p_tbl = full ?
+ &p_prtn->full_guid_tbl : &p_prtn->part_guid_tbl;
+ cl_map_iterator_t i, i_next;
+ ib_net16_t pkey = p_prtn->pkey;
+ osm_physp_t *p_physp;
+ boolean_t result = FALSE;
+
+ if ( full )
+ pkey = cl_hton16( cl_ntoh16( pkey ) | 0x8000 );
+
+ i_next = cl_map_head( p_tbl );
+ while ( i_next != cl_map_end( p_tbl ) )
+ {
+ i = i_next;
+ 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 ) )
{
- osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
- "__osm_pkey_mgr_process_physical_port: "
- "No need to insert IB_DEFAULT_PKEY for node 0x%016" PRIx64
- " port %u\n",
- cl_ntoh64( osm_node_get_node_guid( p_node ) ), port_num );
+ 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: "
+ "Adding %04x for pkey table of node "
+ "0x%016" PRIx64 " port %u\n",
+ cl_ntoh16( pkey ),
+ cl_ntoh64( osm_node_get_node_guid
+ ( osm_physp_get_node_ptr( p_physp ) ) ),
+ osm_physp_get_port_num( p_physp ) );
}
}
- OSM_LOG_EXIT( p_mgr->p_log );
- return ( return_val );
+ return result;
}
/**********************************************************************
@@ -230,51 +430,55 @@ osm_signal_t
osm_pkey_mgr_process(
IN const osm_pkey_mgr_t * const p_mgr )
{
- cl_qmap_t *p_node_guid_tbl;
- osm_node_t *p_node;
- osm_node_t *p_next_node;
- uint8_t port_num;
- osm_physp_t *p_physp;
+ cl_qmap_t *p_tbl;
+ cl_map_item_t *p_next;
+ osm_prtn_t *p_prtn;
+ osm_port_t *p_port;
osm_signal_t result = OSM_SIGNAL_DONE;
CL_ASSERT( p_mgr );
OSM_LOG_ENTER( p_mgr->p_log, osm_pkey_mgr_process );
- p_node_guid_tbl = &p_mgr->p_subn->node_guid_tbl;
-
CL_PLOCK_EXCL_ACQUIRE( p_mgr->p_lock );
- p_next_node = ( osm_node_t * ) cl_qmap_head( p_node_guid_tbl );
- while ( p_next_node != ( osm_node_t * ) cl_qmap_end( p_node_guid_tbl ) )
+ if ( osm_prtn_make_partitions( p_mgr->p_log, p_mgr->p_subn ) !=
IB_SUCCESS )
{
- p_node = p_next_node;
- p_next_node = ( osm_node_t * ) cl_qmap_next( &p_next_node->map_item );
+ osm_log( p_mgr->p_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_next = cl_qmap_head( p_tbl );
+ while ( p_next != cl_qmap_end( p_tbl ) )
+ {
+ 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 ) )
+ result = OSM_SIGNAL_DONE_PENDING;
+ if ( osm_pkey_mgr_process_partition_table( p_mgr, p_prtn, TRUE ) )
+ result = OSM_SIGNAL_DONE_PENDING;
+ }
+
+ p_tbl = &p_mgr->p_subn->port_guid_tbl;
- for ( port_num = 0; port_num < osm_node_get_num_physp( p_node );
- port_num++ )
+ p_next = cl_qmap_head( p_tbl );
+ while ( p_next != cl_qmap_end( p_tbl ) )
+ {
+ p_port = ( osm_port_t * ) p_next;
+ p_next = cl_qmap_next( p_next );
+
+ if ( osm_node_get_type( osm_port_get_parent_node( p_port ) ) !=
+ IB_NODE_TYPE_SWITCH )
{
- p_physp = osm_node_get_physp_ptr( p_node, port_num );
- if ( osm_physp_is_valid( p_physp ) )
- {
- if ( __osm_pkey_mgr_process_physical_port
- ( p_mgr, p_node, port_num, p_physp ) )
- {
- 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: "
- "Adding IB_DEFAULT_PKEY for pkey table of node "
- "0x%016" PRIx64 " port %u\n",
- cl_ntoh64( osm_node_get_node_guid( p_node ) ),
- port_num );
- }
- result = OSM_SIGNAL_DONE_PENDING;
- }
- }
+ osm_pkey_mgr_update_peer_port( p_mgr, p_port );
}
}
+ _err:
CL_PLOCK_RELEASE( p_mgr->p_lock );
OSM_LOG_EXIT( p_mgr->p_log );
return ( result );
Index: doc/partition-config.txt
===================================================================
--- doc/partition-config.txt (.../branches/1.0/src/userspace/management/osm)
(revision 0)
+++ doc/partition-config.txt (.../trunk/src/userspace/management/osm)
(revision 6101)
@@ -0,0 +1,98 @@
+OpenSM Partitions configuration
+===============================
+
+The default name of OpenSM partitions configuration file is
+'/etc/osm-partitions.txt'. The default may be changed by using
+--Pconfig (-P) option with OpenSM.
+
+The default partition will be created by OpenSM unconditionally even
+when partition configuration file does not exist or cannot be accessed.
+
+The default partition has P_Key value 0x7fff. OpenSM's port will have
+full membership in default partition. All other end ports will have
+partial membership.
+
+
+File Format
+===========
+
+Comments:
+--------
+
+Line content followed after '#' character is comment and ignored by
+parser.
+
+
+General file format:
+-------------------
+
+<Partition Definition>:<PortGUIDs list> ;
+
+
+Partition Definition:
+--------------------
+
+[PartitionName][=PKey][,flag[=value]]
+
+PartitionName - free string, will be used with logging. When omitted
+ empty string will be used.
+PKey - P_Key value for this partition. Only low 15 bits will
+ be used. When omitted will be autogenerated.
+flag - used to indicate IPoIB capability of this partition.
+
+Currently recognized flags are:
+
+ipoib - indicates that this partition may be used for IPoIB, as
+ result IPoIB capable MC group will be created.
+rate=<val> - specifies rate for this IPoIB MC group (default is 3 (10GBps))
+mtu=<val> - specifies MTU for this IPoIB MC group (default is 4 (2048))
+
+Note that values for 'rate' and 'mtu' should be specified as defined in
+IBTA specification (for example mtu=4 for 2048).
+
+
+PortGUIDs list:
+--------------
+
+[PortGUID[=full|=limited]] [,PortGUID[=full|=limited]] [,PortGUID] ...
+
+PortGUID - GUID of partition member EndPort. Hexadecimal numbers
+ should start from 0x, decimal numbers are accepted too.
+full or - indicates full or limited membership for this port. When
+ limited omitted (or unrecognized) limited membership is assumed.
+
+There are two useful keywords for PortGUID definition:
+
+- 'ALL' means all end ports in this subnet.
+- 'SELF' means subnet manager's port.
+
+Empty list means no ports in this partition.
+
+
+Notes:
+-----
+
+White spaces are permitted between delimiters ('=', ',',':',';').
+
+The Line can be wrapped after ':' followed after Partition Definition and
+between.
+
+PartitionName does not need to be unique, PKey does need to be unique.
+If PKey is repeated then those partition configurations will be merged
+and first PartitionName will be used (see also next note).
+
+It is possible to split partition configuration in more than one
+definition, but then PKey should be explicitly specified (otherwise
+different PKey values will be generated for those definitions).
+
+
+Examples:
+--------
+
+Default=0x7fff : ALL, SELF=full ;
+
+NewPartition , ipoib : 0x123456=full, 0x3456789034=limi, 0x2134af2306 ;
+
+YetAnotherOne = 0x300 : SELF=full ;
+YetAnotherOne = 0x300 : ALL=limited ;
+
Index: doc/OpenSM_PKey_Mgr.txt
===================================================================
--- doc/OpenSM_PKey_Mgr.txt (.../branches/1.0/src/userspace/management/osm)
(revision 6101)
+++ doc/OpenSM_PKey_Mgr.txt (.../trunk/src/userspace/management/osm) (revision
6101)
@@ -11,7 +11,7 @@ Phase 1 functionality:
Supported Policy:
1. EndPort partition groups are to be defined by listing the
- PortGUIDs as full and partial members.
+ PortGUIDs as full and limited members.
2. Each partition group might be assigned an explicit P_Key (only the 15
LSB bits are valid) or the SM will assign it randomly.
@@ -40,7 +40,7 @@ Functionality:
3. Each EndPort will be assigned P_Keys as follows:
- a. Default partition group partial membership as defined by rule #4 below.
+ a. Default partition group limited membership as defined by rule #4 below.
(only the SM port will get 0xffff).
b. P_Keys for all partition groups it is part of as defined in
@@ -54,7 +54,7 @@ Functionality:
4. Each Switch Leaf Port (a switch port that is connected to an
EndPort) should be configured according to the same rules that
apply to the EndPort connected to that switch port.
- This actually enables un-authorized port isolation (with future
+ This actually enables unauthorized port isolation (with future
usage of M_Key and ProtectBits).
5. Policy entries matching a non EndPort will be flagged as
@@ -66,7 +66,7 @@ Functionality:
7. Each partition that is marked to support IPoIB should define a
broadcast MGRP. If the partition does not support IPoIB, it should
- define a dummay MGRP with parameters blocking IPoIB drivers from
+ define a dummy MGRP with parameters blocking IPoIB drivers from
registering to it.
Phase 2 functionality:
Property changes on:
___________________________________________________________________
Name: svn:ignore
+ aclocal.m4
autom4te.cache
config.log
config.status
configure
Makefile
Makefile.in
More information about the general
mailing list