From patchwork Wed Mar 13 12:43:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 2263351 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 79F383FCF6 for ; Wed, 13 Mar 2013 12:43:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932074Ab3CMMnU (ORCPT ); Wed, 13 Mar 2013 08:43:20 -0400 Received: from mail-ee0-f46.google.com ([74.125.83.46]:45168 "EHLO mail-ee0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755167Ab3CMMnT (ORCPT ); Wed, 13 Mar 2013 08:43:19 -0400 Received: by mail-ee0-f46.google.com with SMTP id e49so449431eek.33 for ; Wed, 13 Mar 2013 05:43:18 -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=dDkZE+RqMOrklBcS7eB94wsB9HKmif00w5Mtl8y5tos=; b=Ee2o4Hbiiz08x0f0OJACMzWOMbsLK0tMnjvjIukwcl9s8FWOSH3LZhBMrQA6rg4Lqv OsZGHGS2Cn+5rHtbkpszbo9I8UFMYCns1/MHal0OKmZAKiqviMI5gcwjs4uy7wzo03N7 lOogiqiou5OiDA2sWWw7pyew9k+pec4ewj/rF+iyVXmmt0HVl3+Vk5JpAoK9/p/I/yjI 2reSV8+hn6mr3NJe2xwTsz1S5g/XZLr9dJq1jR7BH4hmAy5+SLj/PwMEHUkeROdq+AOF 62rW7EI45Lv67yb5d+izEYoNhIFYhADU7GZr1Qhl5JqbaUwPOwoKipzS6fkWSZcGQdK/ TNog== X-Received: by 10.14.193.134 with SMTP id k6mr59173667een.37.1363178598134; Wed, 13 Mar 2013 05:43:18 -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 t4sm35733759eel.0.2013.03.13.05.43.16 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 13 Mar 2013 05:43:17 -0700 (PDT) Message-ID: <51407462.8060900@dev.mellanox.co.il> Date: Wed, 13 Mar 2013 08:43:14 -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: Add support for LFT changed event X-Gm-Message-State: ALoCoQk0YFpuND4OUq1+2u7dWnrddHMl8glAbTmKxa2WRwI0XCjSJjz9Z89Oz/4wIfo8G5QDtz73 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Determine LFT changes based on tracking epoch whenever LFT block or LFTTop changes. Don't issue event on first time master sweep as use SUBNET UP event there. 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 6a99ed9..c9a904b 100644 --- a/include/opensm/osm_event_plugin.h +++ b/include/opensm/osm_event_plugin.h @@ -77,6 +77,7 @@ typedef enum { OSM_EVENT_ID_UCAST_ROUTING_DONE, OSM_EVENT_ID_STATE_CHANGE, OSM_EVENT_ID_SA_DB_DUMPED, + OSM_EVENT_ID_LFT_CHANGE, OSM_EVENT_ID_MAX } osm_epi_event_id_t; diff --git a/include/opensm/osm_switch.h b/include/opensm/osm_switch.h index 41ac959..1123f45 100644 --- a/include/opensm/osm_switch.h +++ b/include/opensm/osm_switch.h @@ -104,6 +104,8 @@ typedef struct osm_switch { uint8_t *lft; uint8_t *new_lft; uint16_t lft_size; + uint32_t lft_epoch_prev; + uint32_t lft_epoch; osm_mcast_tbl_t mcast_tbl; int32_t mft_block_num; uint32_t mft_position; diff --git a/opensm/osm_ucast_mgr.c b/opensm/osm_ucast_mgr.c index b4cf0f2..745cf9b 100644 --- a/opensm/osm_ucast_mgr.c +++ b/opensm/osm_ucast_mgr.c @@ -918,6 +918,8 @@ 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_epoch_prev = p_sw->lft_epoch; + /* Set the top of the unicast forwarding table. */ @@ -926,6 +928,7 @@ 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_epoch++; } /* check to see if the change state bit is on. If it is - then we @@ -963,7 +966,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 uint16_t block_id_ho, IN unsigned last_block) { uint8_t block[IB_SMP_DATA_SIZE]; osm_madw_context_t context; @@ -993,6 +996,8 @@ 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_epoch++; + 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)); @@ -1002,6 +1007,13 @@ static int set_lft_block(IN osm_switch_t *p_sw, IN osm_ucast_mgr_t *p_mgr, IB_SMP_DATA_SIZE, IB_MAD_ATTR_LIN_FWD_TBL, 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_epoch != p_sw->lft_epoch_prev) + 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", @@ -1022,7 +1034,8 @@ 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); + set_lft_block((osm_switch_t *)item, p_mgr, + i, max_block - 1); } 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 aaf7e80..fed2bac 100644 --- a/osmeventplugin/src/osmeventplugin.c +++ b/osmeventplugin/src/osmeventplugin.c @@ -156,6 +156,15 @@ 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) +{ + fprintf(log->log_file, + "LFT changed for switch 0x%" PRIx64 "\n", + cl_ntoh64(osm_node_get_node_guid(p_sw->p_node))); +} + +/** ========================================================================= + */ static void report(void *_log, osm_epi_event_id_t event_id, void *event_data) { _log_events_t *log = (_log_events_t *) _log; @@ -191,6 +200,9 @@ static void report(void *_log, osm_epi_event_id_t event_id, void *event_data) case OSM_EVENT_ID_SA_DB_DUMPED: 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); + break; case OSM_EVENT_ID_MAX: default: osm_log(log->osmlog, OSM_LOG_ERROR,