From patchwork Thu Apr 4 11:10:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 2391971 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id C31323FD1A for ; Thu, 4 Apr 2013 11:10:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757413Ab3DDLKe (ORCPT ); Thu, 4 Apr 2013 07:10:34 -0400 Received: from mail-bk0-f50.google.com ([209.85.214.50]:35316 "EHLO mail-bk0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757405Ab3DDLKe (ORCPT ); Thu, 4 Apr 2013 07:10:34 -0400 Received: by mail-bk0-f50.google.com with SMTP id jg1so1411861bkc.9 for ; Thu, 04 Apr 2013 04:10:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding:x-gm-message-state; bh=HTGTo9X6XEDIebLrvOicgmkoDwapVQss7m9L6kaXJ90=; b=icz0zGvjYCq8vZlGviDrJYic3nQjqI0TKEN6LT5VreXdLslLDOpeFPw3gzJFaBMuL8 1totrz8rmglo+XoMBnilbLTQU978JussC0nSzjqYFCT1GTWFjbucTiVR6WD/WhjKs9mw 0Yb7H+kMyFLIrJqaxDuChuoDdrqAre9sSszQL8MbBT6LP4EbduojY5c8EapnPo/WMpLo b/QrbP1+GQlmlbJMYXl0LN4hCGR/ZY3VH6jBg8Jg7g/3XsgTV5kZHZbG+kRokYP9vCaF Cob8+VFCLy8zHOdYNXiB6nhhavJyNDYfM69t8/N+g9eTqXmjFmb+0PaOQxvffzxitUCe IRlQ== X-Received: by 10.204.202.133 with SMTP id fe5mr4007793bkb.59.1365073832097; Thu, 04 Apr 2013 04:10:32 -0700 (PDT) Received: from [192.168.1.102] (c-71-234-225-85.hsd1.ct.comcast.net. [71.234.225.85]) by mx.google.com with ESMTPS id m11sm4111009bkz.0.2013.04.04.04.10.30 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Apr 2013 04:10:31 -0700 (PDT) Message-ID: <515D5FA5.1000809@dev.mellanox.co.il> Date: Thu, 04 Apr 2013 07:10:29 -0400 From: Hal Rosenstock User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: "linux-rdma (linux-rdma@vger.kernel.org)" Subject: [PATCH opensm] Change LFT event to be per block/per switch rather than just per switch X-Gm-Message-State: ALoCoQmrfr65cHXXFLMCXQssD/Dhh5+crv48W9PI2EgJ8WWteVJjYzTEoRfAvjUIJJCG3YX5MoP3 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Eliminates expensive LFT comparison to determine changed blocks Signed-off-by: Hal Rosenstock --- -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/opensm/osm_event_plugin.h b/include/opensm/osm_event_plugin.h index c9a904b..3ece2f0 100644 --- a/include/opensm/osm_event_plugin.h +++ b/include/opensm/osm_event_plugin.h @@ -39,6 +39,7 @@ #include #include #include +#include #ifdef __cplusplus # define BEGIN_C_DECLS extern "C" { @@ -87,6 +88,18 @@ typedef struct osm_epi_port_id { char node_name[OSM_EPI_NODE_NAME_LEN]; } osm_epi_port_id_t; +typedef enum { + LFT_CHANGED_LFT_TOP = (1 << 0), + LFT_CHANGED_BLOCK = (1 << 1) +} osm_epi_lft_change_flags_t; + +typedef struct osm_epi_lft_change_event { + osm_switch_t *p_sw; + osm_epi_lft_change_flags_t flags; + uint16_t lft_top; + uint32_t block_num; +} osm_epi_lft_change_event_t; + /** ========================================================================= * Port error event * OSM_EVENT_ID_PORT_COUNTER diff --git a/include/opensm/osm_madw.h b/include/opensm/osm_madw.h index 5d78eaa..fd6ba7f 100644 --- a/include/opensm/osm_madw.h +++ b/include/opensm/osm_madw.h @@ -229,6 +229,7 @@ typedef struct osm_si_context { ib_net64_t node_guid; boolean_t set_method; boolean_t light_sweep; + boolean_t lft_top_change; } osm_si_context_t; /*********/ diff --git a/include/opensm/osm_switch.h b/include/opensm/osm_switch.h index 6e8a87e..41ac959 100644 --- a/include/opensm/osm_switch.h +++ b/include/opensm/osm_switch.h @@ -104,7 +104,6 @@ typedef struct osm_switch { uint8_t *lft; uint8_t *new_lft; uint16_t lft_size; - unsigned lft_change; osm_mcast_tbl_t mcast_tbl; int32_t mft_block_num; uint32_t mft_position; diff --git a/opensm/osm_lin_fwd_rcv.c b/opensm/osm_lin_fwd_rcv.c index f13b9a8..dd18c09 100644 --- a/opensm/osm_lin_fwd_rcv.c +++ b/opensm/osm_lin_fwd_rcv.c @@ -51,6 +51,8 @@ #define FILE_ID OSM_FILE_LIN_FWD_RCV_C #include #include +#include +#include void osm_lft_rcv_process(IN void *context, IN void *data) { @@ -62,6 +64,7 @@ void osm_lft_rcv_process(IN void *context, IN void *data) osm_lft_context_t *p_lft_context; uint8_t *p_block; ib_net64_t node_guid; + osm_epi_lft_change_event_t lft_change; ib_api_status_t status; CL_ASSERT(sm); @@ -89,7 +92,17 @@ void osm_lft_rcv_process(IN void *context, IN void *data) "0x%" PRIx64 "\n", cl_ntoh64(node_guid)); } else { status = osm_switch_set_lft_block(p_sw, p_block, block_num); - if (status != IB_SUCCESS) { + if (status == IB_SUCCESS) { + if (sm->p_subn->first_time_master_sweep == FALSE) { + lft_change.p_sw = p_sw; + lft_change.flags = LFT_CHANGED_BLOCK; + lft_change.lft_top = 0; + lft_change.block_num = block_num; + osm_opensm_report_event(sm->p_subn->p_osm, + OSM_EVENT_ID_LFT_CHANGE, + &lft_change); + } + } else { OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0402: " "Setting forwarding table block failed (%s)" ", Switch 0x%" PRIx64 " %s\n", diff --git a/opensm/osm_mcast_mgr.c b/opensm/osm_mcast_mgr.c index fea0a69..135b174 100644 --- a/opensm/osm_mcast_mgr.c +++ b/opensm/osm_mcast_mgr.c @@ -1070,6 +1070,7 @@ static void mcast_mgr_set_mfttop(IN osm_sm_t * sm, IN osm_switch_t * p_sw) context.si_context.light_sweep = FALSE; context.si_context.node_guid = osm_node_get_node_guid(p_node); context.si_context.set_method = TRUE; + context.si_context.lft_top_change = FALSE; status = osm_req_set(sm, p_path, (uint8_t *) & si, sizeof(si), IB_MAD_ATTR_SWITCH_INFO, diff --git a/opensm/osm_node_info_rcv.c b/opensm/osm_node_info_rcv.c index cb96f29..592f2de 100644 --- a/opensm/osm_node_info_rcv.c +++ b/opensm/osm_node_info_rcv.c @@ -552,6 +552,7 @@ static void ni_rcv_process_switch(IN osm_sm_t * sm, IN osm_node_t * p_node, context.si_context.node_guid = osm_node_get_node_guid(p_node); context.si_context.set_method = FALSE; context.si_context.light_sweep = FALSE; + context.si_context.lft_top_change = FALSE; /* Request a SwitchInfo attribute */ status = osm_req_get(sm, path, IB_MAD_ATTR_SWITCH_INFO, diff --git a/opensm/osm_state_mgr.c b/opensm/osm_state_mgr.c index 8229b06..1b73834 100644 --- a/opensm/osm_state_mgr.c +++ b/opensm/osm_state_mgr.c @@ -138,6 +138,7 @@ static void state_mgr_get_sw_info(IN cl_map_item_t * p_object, IN void *context) mad_context.si_context.node_guid = osm_node_get_node_guid(p_node); mad_context.si_context.set_method = FALSE; mad_context.si_context.light_sweep = TRUE; + mad_context.si_context.lft_top_change = FALSE; status = osm_req_get(sm, p_dr_path, IB_MAD_ATTR_SWITCH_INFO, 0, OSM_MSG_LIGHT_SWEEP_FAIL, &mad_context); diff --git a/opensm/osm_sw_info_rcv.c b/opensm/osm_sw_info_rcv.c index 84e7fe0..4381cbe 100644 --- a/opensm/osm_sw_info_rcv.c +++ b/opensm/osm_sw_info_rcv.c @@ -288,6 +288,7 @@ static boolean_t si_rcv_process_existing(IN osm_sm_t * sm, ib_switch_info_t *p_si; osm_si_context_t *p_si_context; ib_smp_t *p_smp; + osm_epi_lft_change_event_t lft_change; boolean_t is_change_detected = FALSE; OSM_LOG_ENTER(sm->p_log); @@ -317,6 +318,17 @@ static boolean_t si_rcv_process_existing(IN osm_sm_t * sm, } } + if (sm->p_subn->first_time_master_sweep == FALSE && + p_si_context->set_method && p_si_context->lft_top_change) { + lft_change.p_sw = p_sw; + lft_change.flags = LFT_CHANGED_LFT_TOP; + lft_change.lft_top = cl_ntoh16(p_si->lin_top); + lft_change.block_num = 0; + osm_opensm_report_event(sm->p_subn->p_osm, + OSM_EVENT_ID_LFT_CHANGE, + &lft_change); + } + OSM_LOG_EXIT(sm->p_log); return is_change_detected; } diff --git a/opensm/osm_ucast_mgr.c b/opensm/osm_ucast_mgr.c index 7130ccf..12db434 100644 --- a/opensm/osm_ucast_mgr.c +++ b/opensm/osm_ucast_mgr.c @@ -918,8 +918,6 @@ static void ucast_mgr_set_fwd_top(IN cl_map_item_t * p_map_item, p_path = osm_physp_get_dr_path_ptr(osm_node_get_physp_ptr(p_node, 0)); - p_sw->lft_change = 0; - /* Set the top of the unicast forwarding table. */ @@ -928,8 +926,9 @@ static void ucast_mgr_set_fwd_top(IN cl_map_item_t * p_map_item, if (lin_top != si.lin_top) { set_swinfo_require = TRUE; si.lin_top = lin_top; - p_sw->lft_change = 1; - } + context.si_context.lft_top_change = TRUE; + } else + context.si_context.lft_top_change = FALSE; /* check to see if the change state bit is on. If it is - then we need to clear it. */ @@ -966,7 +965,7 @@ static void ucast_mgr_set_fwd_top(IN cl_map_item_t * p_map_item, } static int set_lft_block(IN osm_switch_t *p_sw, IN osm_ucast_mgr_t *p_mgr, - IN uint16_t block_id_ho, IN unsigned last_block) + IN uint16_t block_id_ho) { uint8_t block[IB_SMP_DATA_SIZE]; osm_madw_context_t context; @@ -996,8 +995,6 @@ static int set_lft_block(IN osm_switch_t *p_sw, IN osm_ucast_mgr_t *p_mgr, IB_SMP_DATA_SIZE))) return 0; - p_sw->lft_change = 1; - OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG, "Writing FT block %u to switch 0x%" PRIx64 "\n", block_id_ho, cl_ntoh64(context.lft_context.node_guid)); @@ -1008,11 +1005,6 @@ static int set_lft_block(IN osm_switch_t *p_sw, IN osm_ucast_mgr_t *p_mgr, cl_hton32(block_id_ho), CL_DISP_MSGID_NONE, &context); - if (!p_mgr->p_subn->first_time_master_sweep && - block_id_ho == last_block && p_sw->lft_change) - osm_opensm_report_event(p_mgr->p_subn->p_osm, - OSM_EVENT_ID_LFT_CHANGE, p_sw); - if (status != IB_SUCCESS) { OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 3A05: " "Sending linear fwd. tbl. block failed (%s)\n", @@ -1033,8 +1025,7 @@ static void ucast_mgr_pipeline_fwd_tbl(osm_ucast_mgr_t * p_mgr) for (i = 0; i < max_block; i++) for (item = cl_qmap_head(tbl); item != cl_qmap_end(tbl); item = cl_qmap_next(item)) - set_lft_block((osm_switch_t *)item, p_mgr, - i, max_block - 1); + set_lft_block((osm_switch_t *)item, p_mgr, i); } void osm_ucast_mgr_set_fwd_tables(osm_ucast_mgr_t * p_mgr) diff --git a/osmeventplugin/src/osmeventplugin.c b/osmeventplugin/src/osmeventplugin.c index fed2bac..fc27c5a 100644 --- a/osmeventplugin/src/osmeventplugin.c +++ b/osmeventplugin/src/osmeventplugin.c @@ -156,11 +156,13 @@ static void handle_trap_event(_log_events_t *log, ib_mad_notice_attr_t *p_ntc) /** ========================================================================= */ -static void handle_lft_change_event(_log_events_t *log, osm_switch_t *p_sw) +static void handle_lft_change_event(_log_events_t *log, + osm_epi_lft_change_event_t *lft_change) { fprintf(log->log_file, - "LFT changed for switch 0x%" PRIx64 "\n", - cl_ntoh64(osm_node_get_node_guid(p_sw->p_node))); + "LFT changed for switch 0x%" PRIx64 " flags 0x%x LFTTop %u block %d\n", + cl_ntoh64(osm_node_get_node_guid(lft_change->p_sw->p_node)), + lft_change->flags, lft_change->lft_top, lft_change->block_num); } /** ========================================================================= @@ -201,7 +203,7 @@ static void report(void *_log, osm_epi_event_id_t event_id, void *event_data) fprintf(log->log_file, "SA DB dump file updated\n"); break; case OSM_EVENT_ID_LFT_CHANGE: - handle_lft_change_event(log, (osm_switch_t *) event_data); + handle_lft_change_event(log, (osm_epi_lft_change_event_t *) event_data); break; case OSM_EVENT_ID_MAX: default: