All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hal Rosenstock <hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
To: Alex Netes <alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>,
	"linux-rdma
	(linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH] opensm: Only log SM PORT "state" when it changes
Date: Fri, 30 Sep 2011 11:41:59 -0400	[thread overview]
Message-ID: <4E85E347.3030005@dev.mellanox.co.il> (raw)


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

             reply	other threads:[~2011-09-30 15:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-30 15:41 Hal Rosenstock [this message]
     [not found] ` <4E85E347.3030005-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2011-09-30 16:03   ` [PATCH] opensm: Only log SM PORT "state" when it changes Roland Dreier
2011-11-02 13:59   ` Alex Netes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E85E347.3030005@dev.mellanox.co.il \
    --to=hal-ldsdmyg8hgv8yrgs2mwiifqbs+8scbdb@public.gmane.org \
    --cc=alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.