Skip to contentSkip to conversation

opensm: add force_link_speed_file config option.

PATCH New Ira Weiny 1 participant 1 message Oct 15, 2009 InfiniBand

lore
Share & tools
lore

Ira Weiny

author
#0 lore raw

PATCH v2 1/1 opensm: add force_link_speed_file config option.

From: Ira Weiny <[email protected]>
Date: Wed, 14 Oct 2009 16:09:25 -0700
Subject: [PATCH] opensm: add force_link_speed_file config option.

From the config file help:

# Optional file used to override individual port GUIDs and speeds to be forced. # Port GUIDs which are _not_ listed in this file will be set to "force_link_speed" # Speeds specified in this file may be higher or lower than the global # setting (force_link_speed) above
# File Format:
# # comment
# <port_guid> [<setting>] [# comment]
# ...
# if the optional <setting> is not specified the default (15) will be used

This option along with the force_link_speed option can be used to override the PortInfo:LinkSpeedSupported option for hardware which is not operating properly. Previously one could only force a singe speed across a fabric. With this option one can set speeds on an individual port basis.

Changes in V2:
Free memory and destroy force_link_speed_except_guids map object on shutdown.

---
 opensm/include/opensm/osm_base.h   |   10 ++++
 opensm/include/opensm/osm_sm.h     |    1 +
 opensm/include/opensm/osm_subnet.h |    6 ++
 opensm/opensm/osm_link_mgr.c       |   22 +++++++-
 opensm/opensm/osm_sm.c             |   15 ++++++
 opensm/opensm/osm_subnet.c         |   99 +++++++++++++++++++++++++++++++++++-
 6 files changed, 148 insertions(+), 5 deletions(-)
opensm/include/opensm/osm_base.h +10 -0
index 06223ce..5457bc6 100644
@@ -146,6 +146,16 @@ BEGIN_C_DECLS
 * SYNOPSIS
 */
 #define OSM_DEFAULT_MAX_OP_VLS 5
+/****s* OpenSM: Base/OSM_DEFAULT_FORCE_LINK_SPEED
+* NAME
+*	OSM_DEFAULT_FORCE_LINK_SPEED
+*
+* DESCRIPTION
+*	Default force link speed value
+*
+* SYNOPSIS
+*/
+#define OSM_DEFAULT_FORCE_LINK_SPEED 15
 /********/
 /****s* OpenSM: Base/OSM_DEFAULT_SL
 * NAME
opensm/include/opensm/osm_sm.h +1 -0
index e653d49..7086ca6 100644
@@ -143,6 +143,7 @@ typedef struct osm_sm {
 	cl_disp_reg_handle_t slvl_disp_h;
 	cl_disp_reg_handle_t vla_disp_h;
 	cl_disp_reg_handle_t pkey_disp_h;
+	cl_map_t force_link_speed_except_guids;
 } osm_sm_t;
 /*
 * FIELDS
opensm/include/opensm/osm_subnet.h +6 -0
index 9488225..5353298 100644
@@ -154,6 +154,7 @@ typedef struct osm_subn_opt {
 	boolean_t lmc_esp0;
 	uint8_t max_op_vls;
 	uint8_t force_link_speed;
+	char *force_link_speed_file;
 	boolean_t reassign_lids;
 	boolean_t ignore_other_sm;
 	boolean_t single_thread;
@@ -469,6 +470,11 @@ typedef struct osm_subn_opt {
 *	Subnet object
 *********/
 
+typedef struct force_speed_exception {
+	uint64_t port_guid;
+	uint8_t val;
+} force_speed_exception_t;
+
 /****s* OpenSM: Subnet/osm_subn_t
 * NAME
 *	osm_subn_t
opensm/opensm/osm_link_mgr.c +19 -3
index c9bdfee..21dcc50 100644
@@ -106,6 +106,8 @@ static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,
 	boolean_t esp0 = FALSE, send_set = FALSE;
 	osm_physp_t *p_remote_physp;
 	int ret = 0;
+	uint8_t force_link_speed;
+	force_speed_exception_t *except;
 
 	OSM_LOG_ENTER(sm->p_log);
 
@@ -326,12 +328,26 @@ static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,
 			   sizeof(p_pi->link_width_enabled)))
 			send_set = TRUE;
 
-		if (sm->p_subn->opt.force_link_speed &&
-		    (sm->p_subn->opt.force_link_speed != 15 ||
+		/* use the force link speed set in the config */
+		force_link_speed = sm->p_subn->opt.force_link_speed;
+		/* unless this port guid is in our "except"ion file */
+		if ((except = cl_map_get(
+				&sm->force_link_speed_except_guids,
+				cl_ntoh64(p_physp->port_guid)))
+					!= NULL) {
+			force_link_speed = except->val;
+			OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
+				"Skipping force_link_speed on GUID 0x%016"
+				PRIx64 " (%d)\n",
+			       cl_ntoh64(p_physp->port_guid),
+			       force_link_speed);
+		}
+
+		if (force_link_speed &&
+		     (force_link_speed != OSM_DEFAULT_FORCE_LINK_SPEED ||
 		     ib_port_info_get_link_speed_enabled(p_pi) !=
 		     ib_port_info_get_link_speed_sup(p_pi))) {
 			ib_port_info_set_link_speed_enabled(p_pi,
-							    sm->p_subn->opt.
 							    force_link_speed);
 			if (memcmp(&p_pi->link_speed, &p_old_pi->link_speed,
 				   sizeof(p_pi->link_speed)))
opensm/opensm/osm_sm.c +15 -0
index f780124..53deb20 100644
@@ -168,6 +168,8 @@ void osm_sm_construct(IN osm_sm_t * p_sm)
 	osm_sm_mad_ctrl_construct(&p_sm->mad_ctrl);
 	osm_lid_mgr_construct(&p_sm->lid_mgr);
 	osm_ucast_mgr_construct(&p_sm->ucast_mgr);
+	cl_map_construct(&p_sm->force_link_speed_except_guids);
+	cl_map_init(&p_sm->force_link_speed_except_guids, 10);
 }
 
 /**********************************************************************
@@ -223,6 +225,10 @@ void osm_sm_shutdown(IN osm_sm_t * p_sm)
  **********************************************************************/
 void osm_sm_destroy(IN osm_sm_t * p_sm)
 {
+	force_speed_exception_t *except = NULL;
+	cl_map_t *map = &p_sm->force_link_speed_except_guids;
+	cl_map_iterator_t head;
+
 	OSM_LOG_ENTER(p_sm->p_log);
 	osm_lid_mgr_destroy(&p_sm->lid_mgr);
 	osm_ucast_mgr_destroy(&p_sm->ucast_mgr);
@@ -235,6 +241,15 @@ void osm_sm_destroy(IN osm_sm_t * p_sm)
 	cl_spinlock_destroy(&p_sm->state_lock);
 	free(p_sm->mlids_req);
 
+	head = cl_map_head(map);
+	while (head != cl_map_end(map)) {
+		except = (force_speed_exception_t *)cl_map_obj(head);
+		cl_map_remove_item(map, head);
+		free(except);
+		head = cl_map_head(map);
+	}
+	cl_map_destroy(map);
+
 	osm_log(p_sm->p_log, OSM_LOG_SYS, "Exiting SM\n");	/* Format Waived */
 	OSM_LOG_EXIT(p_sm->p_log);
 }
opensm/opensm/osm_subnet.c +97 -2

149 lines not on this page · raw message

Signature · 6 lines
1.5.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html