Skip to contentSkip to conversation

opensm: MFT distribution improvement

PATCH New Alex Netes 1 participant 1 message Jun 2, 2010 InfiniBand

lore
Share & tools
lore

Alex Netes

author
#0 lore raw

PATCH 1/1 opensm: MFT distribution improvement

The patch reduces the number of MFT set MADs beeing send, by sending only blocks that have been changed since the last time same block was issued.

---
 opensm/include/opensm/osm_mcast_tbl.h |   49 ++++++++++++++-
 opensm/opensm/osm_dump.c              |    2 +-
 opensm/opensm/osm_mcast_mgr.c         |   15 +++++-
 opensm/opensm/osm_mcast_tbl.c         |  104 ++++++++++++++++++++-------------
 4 files changed, 124 insertions(+), 46 deletions(-)
opensm/include/opensm/osm_mcast_tbl.h +45 -4
index 37e2c26..f1f12ad 100644
@@ -76,7 +76,9 @@ typedef struct osm_mcast_fwdbl {
 	uint16_t num_entries;
 	uint16_t max_mlid_ho;
 	uint16_t mft_depth;
-	uint16_t(*p_mask_tbl)[][IB_MCAST_POSITION_MAX + 1];
+	uint16_t(*p_new_mask_tbl)[][IB_MCAST_BLOCK_SIZE*(IB_MCAST_POSITION_MAX + 1)];
+	uint16_t(*p_mask_tbl)[][IB_MCAST_BLOCK_SIZE*(IB_MCAST_POSITION_MAX + 1)];
+	uint16_t is_first_block[IB_MCAST_MAX_BLOCK_ID];
 } osm_mcast_tbl_t;
 /*
 * FIELDS
@@ -104,11 +106,20 @@ typedef struct osm_mcast_fwdbl {
 *		Number of MLIDs in the currently allocated multicast port mask
 *		table.
 *
-*	p_mask_tbl
-*		Pointer to a two dimensional array of port_masks for this switch.
-*		The first dimension is MLID offset, second dimension is mask position.
+*	p_new_mask_tbl
+*		Pointer to a two dimensional array of (IB_MCAST_POSITION_MAX + 1)
+*		MFT blocks. The first dimensional is MFT block offset, second dimension
+*		is (IB_MCAST_POSITION_MAX + 1) MFT blocks of the same mlid offset.
 *		This pointer is null for switches that do not support multicast.
 *
+*	p_mask_tbl
+*		Pointer to a table, that is being filled when MFT table is recieved
+*		after applying the tables to the switches.
+*
+*	is_first_block
+*		Table that for each block indicates whether it's being issued for
+*		the first time.
+*
 * SEE ALSO
 *********/
 
@@ -482,5 +493,35 @@ osm_mcast_tbl_get_max_position(IN osm_mcast_tbl_t * p_tbl)
 * SEE ALSO
 *********/
 
+/****f* OpenSM: Forwarding Table/osm_mcast_tbl_diff
+* NAME
+*	osm_mcast_cmpr_tbl_block
+*
+* DESCRIPTION
+*	Compares between two multicast forwarding table blocks.
+*
+* SYNOPSIS
+*/
+boolean_t osm_mcast_tbl_diff(IN osm_mcast_tbl_t * p_tbl,
+				   IN int16_t block_num, IN uint8_t position);
+/*
+* PARAMETERS
+*	p_tbl
+*		[in] Pointer to an osm_mcast_tbl_t object.
+*
+*	p_block
+*		[in] Pointer to the Forwarding Table block.
+*
+*	block_num
+*		[in] Block number of this block.
+*
+* RETURN VALUES
+*	Returns TRUE if block is not idnetical in p_new_mask_tbl
+*	and p_mask_tbl. FALSE otherwise.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
 END_C_DECLS
 #endif				/* _OSM_MCAST_TBL_H_ */
opensm/opensm/osm_dump.c +1 -1
index fe2c3bc..adad23c 100644
@@ -263,7 +263,7 @@ static void dump_mcast_routes(cl_map_item_t * item, FILE * file, void *cxt)
 			while (position <= p_tbl->max_position) {
 				mask_entry =
 				    cl_ntoh16((*p_tbl->
-					       p_mask_tbl)[mlid_ho][position]);
+					       p_new_mask_tbl)[mlid_ho][position]);
 				if (mask_entry == 0) {
 					position++;
 					continue;
opensm/opensm/osm_mcast_mgr.c +14 -1
index 322635d..d5a49bf 100644
@@ -380,8 +380,20 @@ static int mcast_mgr_set_mft_block(osm_sm_t * sm, IN osm_switch_t * p_sw,
 
 	p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);
 
+	/*
+	  Send MFT block only if one of the following persists:
+	  1) There is a connectiviry change in the switch.
+	  2) This is the first time, the block is sent.
+	  3) New block is different than the previous time the
+	     block was sent.
+	 */
+
 	if (osm_mcast_tbl_get_block(p_tbl, (uint16_t) block_num,
-				    (uint8_t) position, block)) {
+				    (uint8_t) position, block) &&
+				    p_sw->need_update != 0 ||
+				    p_tbl->is_first_block[block_num] ||
+				    osm_mcast_tbl_diff(p_tbl,
+						       uint16_t) block_num,(uint8_t) position))) {
 		block_id_ho = block_num + (position << 28);
 
 		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
@@ -1045,6 +1057,7 @@ static int mcast_mgr_set_mftables(osm_sm_t * sm)
 					p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);
 					if (++p_sw->mft_position > p_tbl->max_position) {
 						p_sw->mft_position = 0;
+						p_tbl->is_first_block[block_num] = 0;
 						p_sw->mft_block_num++;
 					}
 				}
opensm/opensm/osm_mcast_tbl.c +64 -40

203 lines not on this page · raw message

Signature · 6 lines
1.7.0

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html