[openib-general] [PATCH 4/5] opensm: clean non used LFT entries, update only changed blocks
Sasha Khapyorsky
sashak at voltaire.com
Sun Nov 26 14:30:03 PST 2006
This uses temporary buffer (one per OpenSM) for LFT entries generation.
In this way old (actually "invalid") LFT entries are not preserved
anymore and we can send update requests for only changed LFT blocks
rather than whole table rewriting.
Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
osm/include/opensm/osm_switch.h | 33 +++++++++++++++++++++++++++++++++
osm/include/opensm/osm_ucast_mgr.h | 4 ++++
osm/opensm/osm_switch.c | 2 +-
osm/opensm/osm_ucast_mgr.c | 24 +++++++++++++++++++-----
4 files changed, 57 insertions(+), 6 deletions(-)
diff --git a/osm/include/opensm/osm_switch.h b/osm/include/opensm/osm_switch.h
index b846229..4c8e1aa 100644
--- a/osm/include/opensm/osm_switch.h
+++ b/osm/include/opensm/osm_switch.h
@@ -978,6 +978,39 @@ osm_switch_set_path(
* SEE ALSO
*********/
+/****f* OpenSM: Switch/osm_switch_count_path
+* NAME
+* osm_switch_count_path
+*
+* DESCRIPTION
+* Counts this path in port profile.
+*
+* SYNOPSIS
+*/
+static inline void
+osm_switch_count_path(
+ IN osm_switch_t* const p_sw,
+ IN const uint8_t port
+ )
+{
+ osm_port_prof_path_count_inc( &p_sw->p_prof[port] );
+}
+/*
+* PARAMETERS
+* p_sw
+* [in] Pointer to the switch object.
+*
+* port
+* [in] Port to count path.
+*
+* RETURN VALUE
+* None.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
/****f* OpenSM: Switch/osm_switch_set_ft_block
* NAME
* osm_switch_set_ft_block
diff --git a/osm/include/opensm/osm_ucast_mgr.h b/osm/include/opensm/osm_ucast_mgr.h
index d322ccc..b2a3a82 100644
--- a/osm/include/opensm/osm_ucast_mgr.h
+++ b/osm/include/opensm/osm_ucast_mgr.h
@@ -105,6 +105,7 @@ typedef struct _osm_ucast_mgr
osm_req_t *p_req;
osm_log_t *p_log;
cl_plock_t *p_lock;
+ uint8_t *lft_buf;
} osm_ucast_mgr_t;
/*
* FIELDS
@@ -120,6 +121,9 @@ typedef struct _osm_ucast_mgr
* p_lock
* Pointer to the serializing lock.
*
+* lft_buf
+* LFT buffer - used during LFT calculation/setup.
+*
* SEE ALSO
* Unicast Manager object
*********/
diff --git a/osm/opensm/osm_switch.c b/osm/opensm/osm_switch.c
index 2a9a7ac..844a727 100644
--- a/osm/opensm/osm_switch.c
+++ b/osm/opensm/osm_switch.c
@@ -199,7 +199,7 @@ osm_switch_get_fwd_tbl_block(
if( base_lid_ho <= max_lid_ho )
{
- memset( p_block, 0, IB_SMP_DATA_SIZE );
+ memset( p_block, 0xff, IB_SMP_DATA_SIZE );
/*
Determine the range of LIDs we can return with this block.
*/
diff --git a/osm/opensm/osm_ucast_mgr.c b/osm/opensm/osm_ucast_mgr.c
index 7bac313..2263a4d 100644
--- a/osm/opensm/osm_ucast_mgr.c
+++ b/osm/opensm/osm_ucast_mgr.c
@@ -93,6 +93,9 @@ osm_ucast_mgr_destroy(
OSM_LOG_ENTER( p_mgr->p_log, osm_ucast_mgr_destroy );
+ if (p_mgr->lft_buf)
+ free(p_mgr->lft_buf);
+
OSM_LOG_EXIT( p_mgr->p_log );
}
@@ -121,6 +124,10 @@ osm_ucast_mgr_init(
p_mgr->p_lock = p_lock;
p_mgr->p_req = p_req;
+ p_mgr->lft_buf = malloc(IB_LID_UCAST_END_HO + 1);
+ if (!p_mgr->lft_buf)
+ return IB_INSUFFICIENT_MEMORY;
+
OSM_LOG_EXIT( p_mgr->p_log );
return( status );
}
@@ -848,7 +855,9 @@ __osm_ucast_mgr_process_port(
We have selected the port for this LID.
Write it to the forwarding tables.
*/
- osm_switch_set_path( p_sw, lid_ho, port, is_ignored_by_port_prof );
+ p_mgr->lft_buf[lid_ho] = port;
+ if (!is_ignored_by_port_prof)
+ osm_switch_count_path(p_sw, port);
}
Exit:
@@ -940,8 +949,13 @@ __osm_ucast_mgr_set_table(
context.lft_context.node_guid = osm_node_get_node_guid( p_node );
context.lft_context.set_method = TRUE;
- while( osm_switch_get_fwd_tbl_block( p_sw, block_id_ho, block ) )
+ for (block_id_ho = 0;
+ osm_switch_get_fwd_tbl_block( p_sw, block_id_ho, block ) ;
+ block_id_ho++ )
{
+ if (!memcmp(block, p_mgr->lft_buf + block_id_ho * 64, 64))
+ continue;
+
if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
{
osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
@@ -951,7 +965,7 @@ __osm_ucast_mgr_set_table(
status = osm_req_set( p_mgr->p_req,
p_path,
- block,
+ p_mgr->lft_buf + block_id_ho * 64,
sizeof(block),
IB_MAD_ATTR_LIN_FWD_TBL,
cl_hton32( block_id_ho ),
@@ -965,8 +979,6 @@ __osm_ucast_mgr_set_table(
"Sending linear fwd. tbl. block failed (%s)\n",
ib_get_err_str( status ) );
}
-
- block_id_ho++;
}
OSM_LOG_EXIT( p_mgr->p_log );
@@ -1000,6 +1012,8 @@ __osm_ucast_mgr_process_tbl(
cl_ntoh64( osm_node_get_node_guid( p_node ) ));
}
+ memset(p_mgr->lft_buf, 0xff, IB_LID_UCAST_END_HO + 1);
+
p_port_tbl = &p_mgr->p_subn->port_guid_tbl;
/*
--
1.4.4
More information about the general
mailing list