From patchwork Fri Feb 19 01:31:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Kepner X-Patchwork-Id: 80520 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1J1mBki030260 for ; Fri, 19 Feb 2010 01:48:11 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753137Ab0BSBsK (ORCPT ); Thu, 18 Feb 2010 20:48:10 -0500 Received: from relay3.sgi.com ([192.48.152.1]:40424 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753053Ab0BSBsJ (ORCPT ); Thu, 18 Feb 2010 20:48:09 -0500 Received: from localhost (sshcf.sgi.com [198.149.20.12]) by relay3.corp.sgi.com (Postfix) with ESMTP id 092F5AC00A; Thu, 18 Feb 2010 17:48:07 -0800 (PST) Date: Thu, 18 Feb 2010 17:31:07 -0800 From: Arthur Kepner To: linux-rdma Cc: Dale Talcott Subject: [PATCH/RFC] opensm: toggle sweeping Message-ID: <20100219013107.GD20950@sgi.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 19 Feb 2010 01:48:11 +0000 (UTC) diff --git a/opensm/opensm/main.c b/opensm/opensm/main.c index f9a33af..ee29d22 100644 --- a/opensm/opensm/main.c +++ b/opensm/opensm/main.c @@ -86,6 +86,12 @@ static void mark_usr1_flag(int signum) osm_usr1_flag = 1; } +int sweeping = 1; +static void toggle_sweeping(int signum) +{ + sweeping = !sweeping; +} + static sigset_t saved_sigset; static void block_signals() @@ -99,6 +105,7 @@ static void block_signals() #ifndef HAVE_OLD_LINUX_THREADS sigaddset(&set, SIGUSR1); #endif + sigaddset(&set, SIGUSR2); pthread_sigmask(SIG_SETMASK, &set, &saved_sigset); } @@ -118,6 +125,8 @@ static void setup_signals() act.sa_handler = mark_usr1_flag; sigaction(SIGUSR1, &act, NULL); #endif + act.sa_handler = toggle_sweeping; + sigaction(SIGUSR2, &act, NULL); pthread_sigmask(SIG_SETMASK, &saved_sigset, NULL); } @@ -494,6 +503,7 @@ static int daemonize(osm_opensm_t * osm) int osm_manager_loop(osm_subn_opt_t * p_opt, osm_opensm_t * p_osm) { int console_init_flag = 0; + int prev_sweeping = sweeping; if (is_console_enabled(p_opt)) { if (!osm_console_init(p_opt, &p_osm->console, &p_osm->log)) @@ -520,6 +530,12 @@ int osm_manager_loop(osm_subn_opt_t * p_opt, osm_opensm_t * p_osm) p_osm->subn.force_heavy_sweep = TRUE; osm_opensm_sweep(p_osm); } + if (prev_sweeping != sweeping) { + prev_sweeping = sweeping; + OSM_LOG(&p_osm->log, OSM_LOG_INFO, + "Sweeping is now %s\n", + (sweeping ? "enabled" : "disabled") ); + } } if (is_console_enabled(p_opt)) osm_console_exit(&p_osm->console, &p_osm->log); diff --git a/opensm/opensm/osm_state_mgr.c b/opensm/opensm/osm_state_mgr.c index e43463f..e8eb47b 100644 --- a/opensm/opensm/osm_state_mgr.c +++ b/opensm/opensm/osm_state_mgr.c @@ -1405,6 +1405,7 @@ static void do_process_mgrp_queue(osm_sm_t * sm) void osm_state_mgr_process(IN osm_sm_t * sm, IN osm_signal_t signal) { + extern int sweeping; CL_ASSERT(sm); OSM_LOG_ENTER(sm->p_log); @@ -1415,7 +1416,13 @@ void osm_state_mgr_process(IN osm_sm_t * sm, IN osm_signal_t signal) switch (signal) { case OSM_SIGNAL_SWEEP: - do_sweep(sm); + if (!sweeping) + OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "sweeping disabled - " + "ignoring signal %s in state %s\n", + osm_get_sm_signal_str(signal), + osm_get_sm_mgr_state_str(sm->p_subn->sm_state)); + else + do_sweep(sm); break; case OSM_SIGNAL_IDLE_TIME_PROCESS_REQUEST: do_process_mgrp_queue(sm); diff --git a/opensm/opensm/osm_trap_rcv.c b/opensm/opensm/osm_trap_rcv.c index 52f8832..09cdd35 100644 --- a/opensm/opensm/osm_trap_rcv.c +++ b/opensm/opensm/osm_trap_rcv.c @@ -338,6 +338,7 @@ static void trap_rcv_process_request(IN osm_sm_t * sm, boolean_t physp_change_trap = FALSE; uint64_t event_wheel_timeout = OSM_DEFAULT_TRAP_SUPRESSION_TIMEOUT; boolean_t run_heavy_sweep = FALSE; + extern int sweeping; OSM_LOG_ENTER(sm->p_log); @@ -522,23 +523,30 @@ static void trap_rcv_process_request(IN osm_sm_t * sm, check_sweep: /* do a sweep if we received a trap */ if (sm->p_subn->opt.sweep_on_trap) { - /* if this is trap number 128 or run_heavy_sweep is TRUE - - update the force_heavy_sweep flag of the subnet. - Sweep also on traps 144 - these traps signal a change of - certain port capabilities. - TODO: In the future this can be changed to just getting - PortInfo on this port instead of sweeping the entire subnet. */ - if (ib_notice_is_generic(p_ntci) && - (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 128 || - cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 144 || - run_heavy_sweep)) { - OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, - "Forcing heavy sweep. Received trap:%u\n", + if (!sweeping) { + OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "sweeping disabled - " + "ignoring trap %u\n", + cl_ntoh16(p_ntci->g_or_v.generic.trap_num)); + } else { + /* if this is trap number 128 or run_heavy_sweep is + * TRUE - update the force_heavy_sweep flag of the + * subnet. Sweep also on traps 144 - these traps signal + * a change of certain port capabilities. + * TODO: In the future this can be changed to just + * getting PortInfo on this port instead of sweeping + * the entire subnet. */ + if (ib_notice_is_generic(p_ntci) && + (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 128 || + cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 144 || + run_heavy_sweep)) { + OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, + "Forcing heavy sweep. Received trap:%u\n", cl_ntoh16(p_ntci->g_or_v.generic.trap_num)); - sm->p_subn->force_heavy_sweep = TRUE; + sm->p_subn->force_heavy_sweep = TRUE; + } + osm_sm_signal(sm, OSM_SIGNAL_SWEEP); } - osm_sm_signal(sm, OSM_SIGNAL_SWEEP); } /* If we reached here due to trap 129/130/131 - do not need to do