All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] opensm: Only log SM PORT "state" when it changes
@ 2011-09-30 15:41 Hal Rosenstock
       [not found] ` <4E85E347.3030005-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Hal Rosenstock @ 2011-09-30 15:41 UTC (permalink / raw)
  To: Alex Netes
  Cc: Roland Dreier,
	linux-rdma (linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)


rather than every sweep time
so don't spam syslog and opensm.log when port stays down

Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
diff --git a/include/opensm/osm_subnet.h b/include/opensm/osm_subnet.h
index 8bbce7c..2e88479 100644
--- a/include/opensm/osm_subnet.h
+++ b/include/opensm/osm_subnet.h
@@ -548,6 +548,7 @@ typedef struct osm_subn {
 	ib_net16_t master_sm_base_lid;
 	ib_net16_t sm_base_lid;
 	ib_net64_t sm_port_guid;
+	uint8_t last_sm_port_state;
 	uint8_t sm_state;
 	osm_subn_opt_t opt;
 	struct osm_qos_policy *p_qos_policy;
@@ -607,6 +608,10 @@ typedef struct osm_subn {
 *	sm_port_guid
 *		This SM's own port GUID.
 *
+*	last_sm_port_state
+*		Last state of this SM's port.
+*		0 is down and 1 is up.
+*
 *	sm_state
 *		The high-level state of the SM.  This value is made available
 *		in the SMInfo attribute.
diff --git a/opensm/osm_state_mgr.c b/opensm/osm_state_mgr.c
index dd308f2..b413709 100644
--- a/opensm/osm_state_mgr.c
+++ b/opensm/osm_state_mgr.c
@@ -1198,8 +1198,12 @@ repeat_discovery:
 		return;
 
 	if (state_mgr_is_sm_port_down(sm) == TRUE) {
-		osm_log(sm->p_log, OSM_LOG_SYS, "SM port is down\n");
-		OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE, "SM PORT DOWN");
+		if (sm->p_subn->last_sm_port_state) {
+			sm->p_subn->last_sm_port_state = 0;
+			osm_log(sm->p_log, OSM_LOG_SYS, "SM port is down\n");
+			OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,
+					"SM PORT DOWN");
+		}
 
 		/* Run the drop manager - we want to clear all records */
 		osm_drop_mgr_process(sm);
@@ -1210,6 +1214,13 @@ repeat_discovery:
 		osm_opensm_report_event(sm->p_subn->p_osm,
 				OSM_EVENT_ID_STATE_CHANGE, NULL);
 		return;
+	} else {
+		if (!sm->p_subn->last_sm_port_state) {
+			sm->p_subn->last_sm_port_state = 1;
+			osm_log(sm->p_log, OSM_LOG_SYS, "SM port is up\n");
+			OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,
+					"SM PORT UP");
+		}
 	}
 
 	status = state_mgr_sweep_hop_1(sm);
diff --git a/opensm/osm_subnet.c b/opensm/osm_subnet.c
index 8d636bc..11d7cf5 100644
--- a/opensm/osm_subnet.c
+++ b/opensm/osm_subnet.c
@@ -563,6 +563,7 @@ ib_api_status_t osm_subn_init(IN osm_subn_t * p_subn, IN osm_opensm_t * p_osm,
 	/* we assume master by default - so we only need to set it true if STANDBY */
 	p_subn->coming_out_of_standby = FALSE;
 	p_subn->sweeping_enabled = TRUE;
+	p_subn->last_sm_port_state = 1;
 
 	return IB_SUCCESS;
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] opensm: Only log SM PORT "state" when it changes
       [not found] ` <4E85E347.3030005-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
@ 2011-09-30 16:03   ` Roland Dreier
  2011-11-02 13:59   ` Alex Netes
  1 sibling, 0 replies; 3+ messages in thread
From: Roland Dreier @ 2011-09-30 16:03 UTC (permalink / raw)
  To: Hal Rosenstock
  Cc: Alex Netes,
	linux-rdma (linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)

Very fast service, thanks Hal!

I'll try this out today but I'm sure it's exactly what we would want.

 - R.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] opensm: Only log SM PORT "state" when it changes
       [not found] ` <4E85E347.3030005-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
  2011-09-30 16:03   ` Roland Dreier
@ 2011-11-02 13:59   ` Alex Netes
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Netes @ 2011-11-02 13:59 UTC (permalink / raw)
  To: Hal Rosenstock
  Cc: Roland Dreier,
	linux-rdma (linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)

Hi Hal,

On 11:41 Fri 30 Sep     , Hal Rosenstock wrote:
> 
> rather than every sweep time
> so don't spam syslog and opensm.log when port stays down
> 
> Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-02 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-30 15:41 [PATCH] opensm: Only log SM PORT "state" when it changes Hal Rosenstock
     [not found] ` <4E85E347.3030005-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2011-09-30 16:03   ` Roland Dreier
2011-11-02 13:59   ` Alex Netes

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.