<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel rdf:about="http://blog.gmane.org/gmane.linux.drivers.openib">
    <title>gmane.linux.drivers.openib</title>
    <link>http://blog.gmane.org/gmane.linux.drivers.openib</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.drivers.openib/65596"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.drivers.openib/65579"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.drivers.openib/65569"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.drivers.openib/65563"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.drivers.openib/65558"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.drivers.openib/65557"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.drivers.openib/65551"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.drivers.openib/65550"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.drivers.openib/65548"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.drivers.openib/65547"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.drivers.openib/65545"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.drivers.openib/65544"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.drivers.openib/65542"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.drivers.openib/65536"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.drivers.openib/65531"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.drivers.openib/65530"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.drivers.openib/65526"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.drivers.openib/65523"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.drivers.openib/65522"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.drivers.openib/65521"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://comments.gmane.org/gmane.linux.drivers.openib/65596">
    <title>[ofa-general] ofa_1_5_kernel 20090930-0200 daily build status</title>
    <link>http://comments.gmane.org/gmane.linux.drivers.openib/65596</link>
    <description>&lt;pre&gt;This email was generated automatically, please do not reply


git_url: git://git.openfabrics.org/ofed_1_5/linux-2.6.git
git_branch: ofed_kernel_1_5

Common build parameters: 

Passed:
Passed on i686 with linux-2.6.19
Passed on i686 with linux-2.6.18
Passed on i686 with linux-2.6.21.1
Passed on i686 with linux-2.6.24
Passed on i686 with linux-2.6.26
Passed on i686 with linux-2.6.22
Passed on i686 with linux-2.6.27
Passed on x86_64 with linux-2.6.16.60-0.21-smp
Passed on x86_64 with linux-2.6.18
Passed on x86_64 with linux-2.6.18-164.el5
Passed on x86_64 with linux-2.6.18-128.el5
Passed on x86_64 with linux-2.6.18-93.el5
Passed on x86_64 with linux-2.6.20
Passed on x86_64 with linux-2.6.19
Passed on x86_64 with linux-2.6.21.1
Passed on x86_64 with linux-2.6.24
Passed on x86_64 with linux-2.6.22
Passed on x86_64 with linux-2.6.25
Passed on x86_64 with linux-2.6.26
Passed on x86_64 with linux-2.6.27
Passed on x86_64 with linux-2.6.9-67.ELsmp
Passed on x86_64 with linux-2.6.9-78.ELsmp
Passed on ia64 with linux-2.6.18
Passed on ia64 with linux-2.6.21.1
Passed on ia64 with linux-2.6.19
Passed on ia64 with linux-2.6.24
Passed on ia64 with linux-2.6.23
Passed on ia64 with linux-2.6.22
Passed on ia64 with linux-2.6.26
Passed on ia64 with linux-2.6.25
Passed on ppc64 with linux-2.6.18
Passed on ppc64 with linux-2.6.19

Failed:
&lt;/pre&gt;</description>
    <dc:creator>Vladimir Sokolovsky (Mellanox</dc:creator>
    <dc:date>2009-09-30T10:13:35</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.drivers.openib/65579">
    <title>[ofa-general] getting path to backport directory (fwd)</title>
    <link>http://comments.gmane.org/gmane.linux.drivers.openib/65579</link>
    <description>&lt;pre&gt;
A general question on getting the correct backport.

On my machine, if I do "uname -r" I get
2.6.18-128.el5

If I do "cat /etc/redhat-release" I get
CentOs release 5.3 (Final)

If I look in "/usr/src/ofa_kernel/kernel_addons/backport"
the subdirectory I need to use for the current kernel is:
2.6.18-EL5.3

My question:  Is there somewhere in the system where I can
find (or generate) the string "2.6.18-EL5.3"?
I want to put that in my scripts so they will automatically
pick it up whenever we change versions (as we just did when
going to Centos -- it used to be 2.6.18-EL5.2 in the RedHat
version we were running before).  At present I have to edit
these scripts by hand, and that's a lousy way to do business.

Thanks,
Bob Russell
&lt;/pre&gt;</description>
    <dc:creator>Robert D. Russell</dc:creator>
    <dc:date>2009-09-29T20:25:36</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.drivers.openib/65569">
    <title>[ofa-general] Ib_iser error with OFED 1.5.1 and centos 5.3</title>
    <link>http://comments.gmane.org/gmane.linux.drivers.openib/65569</link>
    <description>&lt;pre&gt;Can some please give me a little insight on this issue 

&lt;/pre&gt;</description>
    <dc:creator>Chris Andrews</dc:creator>
    <dc:date>2009-09-29T17:56:39</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.drivers.openib/65563">
    <title>[ofa-general] This list expires... tomorrow?</title>
    <link>http://comments.gmane.org/gmane.linux.drivers.openib/65563</link>
    <description>&lt;pre&gt;What happens to this list after tomorrow?  (i.e., general&amp;lt; at &amp;gt;lists.openfabrics.org 
)  Will mails bounce?

The intent is that all mails to the "general" list should be sent to  
the linux-rdma list instead, right?

&lt;/pre&gt;</description>
    <dc:creator>Jeff Squyres</dc:creator>
    <dc:date>2009-09-29T16:16:39</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.drivers.openib/65558">
    <title>[ofa-general] [PATCH 2/2 v4] opensm: Compression of multicast group according to pkey</title>
    <link>http://comments.gmane.org/gmane.linux.drivers.openib/65558</link>
    <description>&lt;pre&gt;Additional data structure added:
1. Map of all partition keys opened in the fabric.
2. Map of all multicast group boxes shared same pkey.
MLID assignment for multicast groups works in a usual manner,
allocating free entry for newly created group.
Proposed compression algorithm starts working when there are no more
free entries in the mlid array. List of MLIDs for new multicast group
will be chosen from the pkey indexed map according to the requested
pkey. MLID which shares minimum number of ports will be given to newly
created multicast group.

Signed-off-by: Slava Strebkov &amp;lt;slavas&amp;lt; at &amp;gt;voltaire.com&amp;gt;
---
 opensm/include/opensm/osm_multicast.h  |  135 ++++++++++++++++++++++++++++++++
 opensm/include/opensm/osm_subnet.h     |   36 +++++++++
 opensm/opensm/osm_multicast.c          |  103 ++++++++++++++++++++++++
 opensm/opensm/osm_sa_mcmember_record.c |   28 ++++---
 opensm/opensm/osm_subnet.c             |    8 ++
 5 files changed, 299 insertions(+), 11 deletions(-)

diff --git a/opensm/include/opensm/osm_multicast.h b/opensm/include/opensm/osm_multicast.h
index d4daf4b..1ced651 100644
--- a/opensm/include/opensm/osm_multicast.h
+++ b/opensm/include/opensm/osm_multicast.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -148,6 +148,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; typedef struct osm_mgrp_box {
 cl_qlist_t mgrp_list;
 ib_net16_t mlid;
 osm_mtree_node_t *p_root;
+cl_map_item_t mlid_item;
 } osm_mgrp_box_t;
 /*
 * FIELDS
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -167,6 +168,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; typedef struct osm_mgrp_box {
 *for this multicast group.  The nodes of the tree represent
 *switches.  Member ports are not represented in the tree.
 *
+*mlid_item
+*list item in list of boxes shared same pkey.
+*
 * SEE ALSO
 *********/
 /****s* OpenSM: Multicast group Port /osm_mgrp_port_t
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -498,5 +502,136 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void osm_mgrp_box_delete(IN osm_subn_t * p_subn,
 * SEE ALSO
 *
 *********/
+
+/****f* OpenSM: Subnet/osm_mlid_pkey_delete
+* NAME
+*osm_mlid_pkey_delete
+*
+* DESCRIPTION
+*Frees the objects.
+*
+* SYNOPSIS
+*/
+void osm_mlid_pkey_delete(osm_mlid_pkey_t *p_mlid_pkey);
+/*
+* PARAMETERS
+*p_mlid_pkey
+*[in] Pointer to an osm_mlid_pkey_t object
+*
+* RETURN VALUES
+*None.
+*
+* NOTES
+*
+* SEE ALSO
+*osm_mlid_pkey_new
+*********/
+
+/****f* OpenSM: Subnet/osm_mlid_pkey_new
+* NAME
+*osm_mlid_pkey_new
+*
+* DESCRIPTION
+*Creates new object of osm_mlid_pkey_t.
+*
+* SYNOPSIS
+*/
+osm_mlid_pkey_t *osm_mlid_pkey_new(IN ib_net16_t pkey);
+/*
+* PARAMETERS
+*pkey
+*[in] Partition key for the object
+*
+* RETURN VALUES
+*Pointer to osm_mlid_pkey_t, or NULL.
+*
+* SEE ALSO
+*osm_mlid_pkey_delete
+*********/
+
+/****f* OpenSM: Subnet/osm_mlid_pkey_add_box
+* NAME
+*osm_mlid_pkey_add_box
+*
+* DESCRIPTION
+*Adds osm_mgrp_box_t object to map
+*
+* SYNOPSIS
+*/
+void osm_mlid_pkey_add_box(osm_mgrp_box_t *p_mgrp_box,
+ib_net16_t pkey, osm_subn_t *p_subn);
+/*
+* PARAMETERS
+*p_mgrp_box
+*[in] Pointer to osm_mgrp_box_t
+*
+*pkey
+*[in] Partition key for the object
+*
+*p_subn
+*[in] Pointer to an osm_subn_t object
+*
+* RETURN VALUES
+*None.
+*
+* SEE ALSO
+*osm_mlid_pkey_remove_box
+*********/
+
+/****f* OpenSM: Subnet/osm_mlid_pkey_remove_box
+* NAME
+*osm_mlid_pkey_remove_box
+*
+* DESCRIPTION
+*removes osm_mgrp_box_t object from map
+*
+* SYNOPSIS
+*/
+void osm_mlid_pkey_remove_box(osm_mgrp_box_t *p_mgrp_box,
+ib_net16_t pkey, osm_subn_t  *p_subn);
+/*
+* PARAMETERS
+*p_mgrp_box
+*[in] Pointer to osm_mgrp_box_t
+*
+*pkey
+*[in] Partition key for the object
+*
+*p_subn
+*[in] Pointer to an osm_subn_t object
+*
+* RETURN VALUES
+*None.
+*
+* SEE ALSO
+*osm_mlid_pkey_add_box
+*********/
+
+/****f* OpenSM: Subnet/osm_mlid_pkey_get_existed_mlid
+* NAME
+*osm_mlid_pkey_get_existed_mlid
+*
+* DESCRIPTION
+*return used mlid  with miminum ports, matched by pkey
+*
+* SYNOPSIS
+*/
+ib_net16_t osm_mlid_pkey_get_existed_mlid(IN osm_subn_t *p_subn, IN
+ib_net16_t pkey);
+/*
+* PARAMETERS
+*
+*p_subn
+*[in] Pointer to an osm_subn_t object
+*
+*pkey
+*[in] Partition key for the object
+*
+* RETURN VALUES
+*matched mlid or 0 if not found
+*
+* SEE ALSO
+*osm_mlid_pkey_add_box
+*********/
 END_C_DECLS
 #endif/* _OSM_MULTICAST_H_ */
diff --git a/opensm/include/opensm/osm_subnet.h b/opensm/include/opensm/osm_subnet.h
index fe4695f..d6ed9da 100644
--- a/opensm/include/opensm/osm_subnet.h
+++ b/opensm/include/opensm/osm_subnet.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -129,6 +129,37 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; typedef struct osm_qos_options {
 *
 *********/
 
+/****s* OpenSM: Subnet/osm_mlid_pkey_t
+* NAME
+*osm_mlid_pkey_t
+*
+* DESCRIPTION
+*Structure combines all MLIDs opened on same pkey value.
+*Used for mgid to mlid compresion
+*
+* SYNOPSIS
+*/
+typedef struct osm_mlid_pkey {
+cl_map_item_t pkey_item;
+ib_net16_t pkey;
+cl_qmap_t mlid_box_map;
+} osm_mlid_pkey_t;
+/*
+* FIELDS
+*pkey_item
+*Map Item for qmap linkage.  Must be first element!!
+*Indexed by pkey.
+*
+*pkey
+*Partition key (P_Key) for multicast group(s).
+*
+*mlid_box_map
+*Map of osm_mgrp_box_t objects. Indexed by mlid
+*
+* SEE ALSO
+*osm_mgrp_box_t
+*********/
+
 /****s* OpenSM: Subnet/osm_subn_opt_t
 * NAME
 *osm_subn_opt_t
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -515,6 +546,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; typedef struct osm_subn {
 unsigned need_update;
 cl_fmap_t mgrp_mgid_tbl;
 void *mboxes[IB_LID_MCAST_END_HO - IB_LID_MCAST_START_HO + 1];
+cl_qmap_t mlid_pkey_tbl;
 } osm_subn_t;
 /*
 * FIELDS
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -639,6 +671,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; typedef struct osm_subn {
 *Array of pointers to all Multicast Group Box objects in the subnet.
 *Indexed by MLID offset from base MLID.
 *
+*mlid_pkey_tbl
+*Map of osm_pkey_mlid_t objects. Arranged by mgrp pkey value.
+*Contains MLIDs for mgroups with same pkey.
+*
 * SEE ALSO
 *Subnet object
 *********/
diff --git a/opensm/opensm/osm_multicast.c b/opensm/opensm/osm_multicast.c
index 01c90d8..7e25b10 100644
--- a/opensm/opensm/osm_multicast.c
+++ b/opensm/opensm/osm_multicast.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -386,3 +386,106 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void osm_mgrp_box_delete(IN osm_subn_t *p_subn, ib_net16_t mlid)
 p_subn-&amp;gt;mboxes[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO] = NULL;
 free(p_mgrp_box);
 }
+
+/**********************************************************************
+**********************************************************************/
+void osm_mlid_pkey_delete(osm_mlid_pkey_t *p_mlid_pkey)
+{
+cl_qmap_remove_all(&amp;amp;p_mlid_pkey-&amp;gt;mlid_box_map);
+free(p_mlid_pkey);
+}
+
+/**********************************************************************
+**********************************************************************/
+osm_mlid_pkey_t *osm_mlid_pkey_new(ib_net16_t pkey)
+{
+osm_mlid_pkey_t *p_mlid_pkey = calloc(1,sizeof(osm_mlid_pkey_t));
+if (!p_mlid_pkey) {
+return NULL;
+}
+cl_qmap_init(&amp;amp;p_mlid_pkey-&amp;gt;mlid_box_map);
+p_mlid_pkey-&amp;gt;pkey = pkey;
+return p_mlid_pkey;
+}
+
+/**********************************************************************
+**********************************************************************/
+void osm_mlid_pkey_add_box(osm_mgrp_box_t *p_mgrp_box,
+ib_net16_t pkey,  osm_subn_t  *p_subn)
+{
+osm_mlid_pkey_t *p_mlid_pkey = (osm_mlid_pkey_t*)
+cl_qmap_get(&amp;amp;p_subn-&amp;gt;mlid_pkey_tbl,0x7fff &amp;amp; cl_ntoh16(pkey));
+if (p_mlid_pkey != (osm_mlid_pkey_t*)cl_qmap_end(&amp;amp;p_subn-&amp;gt;mlid_pkey_tbl)) {
+cl_qmap_insert(&amp;amp;p_mlid_pkey-&amp;gt;mlid_box_map, p_mgrp_box-&amp;gt;mlid,
+&amp;amp;p_mgrp_box-&amp;gt;mlid_item);
+}
+else {
+p_mlid_pkey = osm_mlid_pkey_new(pkey);
+if (p_mlid_pkey) {
+cl_qmap_insert(&amp;amp;p_mlid_pkey-&amp;gt;mlid_box_map, p_mgrp_box-&amp;gt;mlid,
+&amp;amp;p_mgrp_box-&amp;gt;mlid_item);
+cl_qmap_insert(&amp;amp;p_subn-&amp;gt;mlid_pkey_tbl, 0x7fff &amp;amp; cl_ntoh16(pkey),
+&amp;amp;p_mlid_pkey-&amp;gt;pkey_item);
+}
+}
+}
+
+/**********************************************************************
+**********************************************************************/
+void osm_mlid_pkey_remove_box(osm_mgrp_box_t *p_mgrp_box,
+ib_net16_t pkey, osm_subn_t  *p_subn)
+{
+osm_mlid_pkey_t *p_mlid_pkey = (osm_mlid_pkey_t*)
+cl_qmap_get(&amp;amp;p_subn-&amp;gt;mlid_pkey_tbl, 0x7fff &amp;amp; cl_ntoh16(pkey));
+if (p_mlid_pkey != (osm_mlid_pkey_t*)cl_qmap_end(&amp;amp;p_subn-&amp;gt;mlid_pkey_tbl)) {
+cl_qmap_remove_item(&amp;amp;p_mlid_pkey-&amp;gt;mlid_box_map, &amp;amp;p_mgrp_box-&amp;gt;mlid_item);
+if (!cl_qmap_count(&amp;amp;p_mlid_pkey-&amp;gt;mlid_box_map)) {
+/* no more groups with given pkey exist */
+osm_mlid_pkey_delete(p_mlid_pkey);
+}
+}
+}
+
+/**********************************************************************
+**********************************************************************/
+static ib_net16_t osm_mlid_pkey_get_mlid(IN osm_mlid_pkey_t *p_mlid_pkey)
+{
+cl_map_item_t *p_item;
+osm_mgrp_box_t *p_mgrp_box;
+osm_mgrp_box_t *p_matched_box = NULL;
+size_t port_count = 0;
+for (p_item = cl_qmap_head(&amp;amp;p_mlid_pkey-&amp;gt;mlid_box_map);
+p_item != cl_qmap_end(&amp;amp;p_mlid_pkey-&amp;gt;mlid_box_map);
+p_item = cl_qmap_next(p_item)) {
+p_mgrp_box = (osm_mgrp_box_t*)
+PARENT_STRUCT(p_item, osm_mgrp_box_t,mlid_item);
+if (!port_count) {
+/* init p_matched_holder and count */
+port_count = cl_qmap_count(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map);
+p_matched_box = p_mgrp_box;
+}
+else {
+if (port_count &amp;gt; cl_qmap_count(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map)) {
+port_count = cl_qmap_count(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map);
+p_matched_box = p_mgrp_box;
+}
+}
+}
+if (p_matched_box) {
+return p_matched_box-&amp;gt;mlid;
+}
+return 0;
+}
+
+/**********************************************************************
+**********************************************************************/
+ib_net16_t osm_mlid_pkey_get_existed_mlid(IN osm_subn_t  *p_subn, IN ib_net16_t pkey)
+{
+osm_mlid_pkey_t *p_mlid_pkey =
+(osm_mlid_pkey_t*)cl_qmap_get(&amp;amp;p_subn-&amp;gt;mlid_pkey_tbl, 0x7fff &amp;amp; cl_ntoh16(pkey));
+if (p_mlid_pkey != (osm_mlid_pkey_t*)cl_qmap_end(&amp;amp;p_subn-&amp;gt;mlid_pkey_tbl)) {
+/* found obect with mgroups matched requested pkey */
+return osm_mlid_pkey_get_mlid(p_mlid_pkey);
+}
+return 0;
+}
diff --git a/opensm/opensm/osm_sa_mcmember_record.c b/opensm/opensm/osm_sa_mcmember_record.c
index b39f986..fad8248 100644
--- a/opensm/opensm/osm_sa_mcmember_record.c
+++ b/opensm/opensm/osm_sa_mcmember_record.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -730,13 +730,14 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; ib_api_status_t osm_mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
      IN const osm_physp_t * p_physp,
      OUT osm_mgrp_t ** pp_mgrp)
 {
-ib_net16_t mlid,existed_mlid;
+ib_net16_t mlid;
 unsigned zero_mgid, i;
 uint8_t scope;
 ib_gid_t *p_mgid;
 osm_mgrp_box_t *p_mgrp_box;
 ib_api_status_t status = IB_SUCCESS;
 ib_member_rec_t mcm_rec = *p_recvd_mcmember_rec;/* copy for modifications */
+boolean_t new_mlid = TRUE;
 
 OSM_LOG_ENTER(sa-&amp;gt;p_log);
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -754,15 +755,22 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; ib_api_status_t osm_mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
  */
 mlid = get_new_mlid(sa, mcm_rec.mlid);
 if (mlid == 0) {
-OSM_LOG(sa-&amp;gt;p_log, OSM_LOG_ERROR, "ERR 1B19: "
-"get_new_mlid failed request mlid 0x%04x\n",
-cl_ntoh16(mcm_rec.mlid));
-status = IB_SA_MAD_STATUS_NO_RESOURCES;
-goto Exit;
+/* try to add mcgroup to existed mlid */
+mlid = osm_mlid_pkey_get_existed_mlid(sa-&amp;gt;p_subn, mcm_rec.pkey);
+if (mlid ==  0) {
+OSM_LOG(sa-&amp;gt;p_log, OSM_LOG_ERROR, "ERR 1B19: "
+"get_new_mlid failed request mlid 0x%04x\n",
+cl_ntoh16(mcm_rec.mlid));
+status = IB_SA_MAD_STATUS_NO_RESOURCES;
+goto Exit;
+}
+new_mlid = FALSE;
+OSM_LOG(sa-&amp;gt;p_log, OSM_LOG_DEBUG,
+"Found existed mlid 0x%X\n", cl_ntoh16(mlid));
 }
 
 OSM_LOG(sa-&amp;gt;p_log, OSM_LOG_DEBUG,
-"Obtained new mlid 0x%X\n", cl_ntoh16(mlid));
+"Obtained mlid 0x%X\n", cl_ntoh16(mlid));
 
 /* we need to create the new MGID if it was not defined */
 if (zero_mgid) {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -812,10 +820,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; ib_api_status_t osm_mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
 goto Exit;
 }
 
-/* check if there is mgrp_box matched to requested mgid */
-if (0 != (existed_mlid = osm_mgrp_box_get_mlid_by_mgid(sa-&amp;gt;p_subn, p_mgid))) {
-mlid = existed_mlid;
-}
 /* create a new MC Group */
 *pp_mgrp = osm_mgrp_new(mlid);
 if (*pp_mgrp == NULL) {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -859,6 +863,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; ib_api_status_t osm_mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
 cl_fmap_insert(&amp;amp;sa-&amp;gt;p_subn-&amp;gt;mgrp_mgid_tbl,
        &amp;amp;(*pp_mgrp)-&amp;gt;mcmember_rec.mgid, &amp;amp;(*pp_mgrp)-&amp;gt;map_item);
 sa-&amp;gt;p_subn-&amp;gt;mboxes[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO] = p_mgrp_box;
+if (new_mlid)
+osm_mlid_pkey_add_box(p_mgrp_box,(*pp_mgrp)-&amp;gt;mcmember_rec.pkey, sa-&amp;gt;p_subn);
 cl_qlist_insert_tail(&amp;amp;p_mgrp_box-&amp;gt;mgrp_list, &amp;amp;(*pp_mgrp)-&amp;gt;box_item);
 Exit:
 OSM_LOG_EXIT(sa-&amp;gt;p_log);
diff --git a/opensm/opensm/osm_subnet.c b/opensm/opensm/osm_subnet.c
index 61d766a..02989fa 100644
--- a/opensm/opensm/osm_subnet.c
+++ b/opensm/opensm/osm_subnet.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -416,6 +416,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void osm_subn_construct(IN osm_subn_t * const p_subn)
 cl_qmap_init(&amp;amp;p_subn-&amp;gt;rtr_guid_tbl);
 cl_qmap_init(&amp;amp;p_subn-&amp;gt;prtn_pkey_tbl);
 cl_fmap_init(&amp;amp;p_subn-&amp;gt;mgrp_mgid_tbl, compar_mgids);
+cl_qmap_init(&amp;amp;p_subn-&amp;gt;mlid_pkey_tbl);
 }
 
 /**********************************************************************
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -431,6 +432,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void osm_subn_destroy(IN osm_subn_t * const p_subn)
 osm_mgrp_t *p_mgrp;
 osm_infr_t *p_infr, *p_next_infr;
 osm_mgrp_box_t *p_mgrp_box;
+osm_mlid_pkey_t *p_mlid_pkey;
 
 /* it might be a good idea to de-allocate all known objects */
 p_next_node = (osm_node_t *) cl_qmap_head(&amp;amp;p_subn-&amp;gt;node_guid_tbl);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -472,6 +474,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void osm_subn_destroy(IN osm_subn_t * const p_subn)
 osm_prtn_delete(&amp;amp;p_prtn);
 }
 
+p_mlid_pkey = (osm_mlid_pkey_t*)cl_qmap_head(&amp;amp;p_subn-&amp;gt;mlid_pkey_tbl);
+while (p_mlid_pkey != (osm_mlid_pkey_t*)cl_qmap_end(&amp;amp;p_subn-&amp;gt;mlid_pkey_tbl)) {
+cl_qmap_remove_item(&amp;amp;p_subn-&amp;gt;mlid_pkey_tbl, (cl_map_item_t*)p_mlid_pkey);
+osm_mlid_pkey_delete(p_mlid_pkey);
+p_mlid_pkey = (osm_mlid_pkey_t*)cl_qmap_head(&amp;amp;p_subn-&amp;gt;mlid_pkey_tbl);
+}
 
 for (i = 0; i &amp;lt;= p_subn-&amp;gt;max_mcast_lid_ho - IB_LID_MCAST_START_HO;
      i++) {
&lt;/pre&gt;</description>
    <dc:creator>Slava Strebkov</dc:creator>
    <dc:date>2009-09-29T13:54:12</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.drivers.openib/65557">
    <title>[ofa-general] [PATCH 1/2 v4] opensm: Storage organization formulticast groups</title>
    <link>http://comments.gmane.org/gmane.linux.drivers.openib/65557</link>
    <description>&lt;pre&gt;Main purpose is to prepare infrastructure for (many) mgids to one mlid
compression. Proposed the following changes:
1.Element in mlid array is now a multicast group box.
2.mgrp_box keeps a list of mgroups sharing same mlid.
With introduction of compression, there will be many
multicast groups per mlid. Current implementation keeps
one mgid to one mlid ratio.
3.mgrp_box has a map of ports sharing same mlid. Ports sorted
by port guid. Port map is necessary for building spanning
tree per mgroup_box, not just for single mgroup.
4.Element in port map keeps a list of mgroups opened by this port.
This allows quick deletion of mgroups when port changes
state to DOWN.
5.Multicast processing functions use mgroup_box object instead
of mgroup.

Signed-off-by: Slava Strebkov &amp;lt;slavas&amp;lt; at &amp;gt;voltaire.com&amp;gt;
---
 opensm/include/opensm/osm_multicast.h  |  130 ++++++++++++++++++++++++++++++--
 opensm/include/opensm/osm_subnet.h     |   49 ++++++++++---
 opensm/opensm/osm_drop_mgr.c           |    2 +-
 opensm/opensm/osm_mcast_mgr.c          |  110 +++++++++++++--------------
 opensm/opensm/osm_multicast.c          |  108 ++++++++++++++++++++++++--
 opensm/opensm/osm_qos_policy.c         |   39 ++++++----
 opensm/opensm/osm_sa.c                 |   32 +++-----
 opensm/opensm/osm_sa_mcmember_record.c |   53 ++++++++++---
 opensm/opensm/osm_sa_path_record.c     |   32 ++++++--
 opensm/opensm/osm_subnet.c             |   33 +++++++--
 10 files changed, 440 insertions(+), 148 deletions(-)

diff --git a/opensm/include/opensm/osm_multicast.h b/opensm/include/opensm/osm_multicast.h
index 32bcb78..d4daf4b 100644
--- a/opensm/include/opensm/osm_multicast.h
+++ b/opensm/include/opensm/osm_multicast.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -97,8 +97,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; BEGIN_C_DECLS
 */
 typedef struct osm_mgrp {
 cl_fmap_item_t map_item;
+cl_list_item_t box_item;
 ib_net16_t mlid;
-osm_mtree_node_t *p_root;
 cl_qmap_t mcm_port_tbl;
 ib_member_rec_t mcmember_rec;
 boolean_t well_known;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -109,15 +109,13 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; typedef struct osm_mgrp {
 *map_item
 *Map Item for fmap linkage.  Must be first element!!
 *
+*box_item
+*List Item for the group in mgroup box
+*
 *mlid
 *The network ordered LID of this Multicast Group (must be
 *&amp;gt;= 0xC000).
 *
-*p_root
-*Pointer to the root "tree node" in the single spanning tree
-*for this multicast group.  The nodes of the tree represent
-*switches.  Member ports are not represented in the tree.
-*
 *mcm_port_tbl
 *Table (sorted by port GUID) of osm_mcm_port_t objects
 *representing the member ports of this multicast group.
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -133,6 +131,71 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; typedef struct osm_mgrp {
 * SEE ALSO
 *********/
 
+/****s* OpenSM: Multicast Group Holder/osm_mgrp_box_t
+* NAME
+*osm_mgrp_box_t
+*
+* DESCRIPTION
+*Holder for mgroups.
+*
+*The osm_mgrp_box_t object should be treated as opaque and should
+*be manipulated only through the provided functions.
+*
+* SYNOPSIS
+*/
+typedef struct osm_mgrp_box {
+cl_qmap_t mgrp_port_map;
+cl_qlist_t mgrp_list;
+ib_net16_t mlid;
+osm_mtree_node_t *p_root;
+} osm_mgrp_box_t;
+/*
+* FIELDS
+*mgrp_port_map
+*Map sorted by GUID of osm_mgrp_port_t objects represents
+*ports to be routed with same mlid
+*
+*mgrp_list
+*List of mgroups having same mlid
+*
+*mlid
+*The network ordered LID of this Multicast Group (must be
+*&amp;gt;= 0xC000).
+*
+*p_root
+*Pointer to the root "tree node" in the single spanning tree
+*for this multicast group.  The nodes of the tree represent
+*switches.  Member ports are not represented in the tree.
+*
+* SEE ALSO
+*********/
+/****s* OpenSM: Multicast group Port /osm_mgrp_port_t
+* NAME
+*osm_mgrp_port_t
+*
+* DESCRIPTION
+*Holder for pointers to mgroups and port guid.
+*
+*
+* SYNOPSIS
+*/
+typedef struct osm_mgrp_port {
+cl_map_item_t guid_item;
+unsigned num_groups;
+osm_port_t *p_port;
+} osm_mgrp_port_t;
+/*
+* FIELDS
+*guid_item
+*Map for ports. Must be first element
+*
+*num_mgroups
+*Number of mgroups opened by this port
+*
+*p_mcm_port
+*pointer to osm_mcm_port_t object
+*
+*/
 /****f* OpenSM: Multicast Group/osm_mgrp_new
 * NAME
 *osm_mgrp_new
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -382,5 +445,58 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void osm_mgrp_remove_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,
   osm_mcm_port_t * mcm_port, ib_member_rec_t * mcmr);
 void osm_mgrp_cleanup(osm_subn_t * subn, osm_mgrp_t * mpgr);
 
+/****f* OpenSM: Multicast Group Box /osm_mgrp_box_new
+* NAME
+*osm_mgrp_box_new
+*
+* DESCRIPTION
+*Allocates and initializes a Multicast Group Box for use.
+*
+* SYNOPSIS
+*/
+osm_mgrp_box_t *osm_mgrp_box_new(IN osm_subn_t * p_subn,
+IN ib_net16_t mlid);
+/*
+* PARAMETERS
+*p_subn
+*(in) pointer to osm_subnet
+*mlid
+*[in] Multicast LID for this multicast group box.
+*
+* RETURN VALUES
+*pointer to initialized osm_mgrp_box_t
+*or NULL, if unsuccessful
+*
+* SEE ALSO
+*Multicast Group Box, osm_mgrp_box_delete
+*********/
+/****f* OpenSM: Multicast Group Box /osm_mgrp_box_delete
+* NAME
+*osm_mgrp_box_delete
+*
+* DESCRIPTION
+*Removes  entry from  array of boxes
+*Removes port from mgroup port list
+*
+* SYNOPSIS
+*/
+void osm_mgrp_box_delete(IN osm_subn_t * p_subn,
+IN ib_net16_t mlid);
+/*
+* PARAMETERS
+*p_subn
+*[in] Pointer to  osm_subnet
+*
+*mlid
+*[in] box's mlid
+*
+* RETURN VALUES
+*None.
+*
+* NOTES
+*
+* SEE ALSO
+*
+*********/
 END_C_DECLS
 #endif/* _OSM_MULTICAST_H_ */
diff --git a/opensm/include/opensm/osm_subnet.h b/opensm/include/opensm/osm_subnet.h
index 6c20de8..fe4695f 100644
--- a/opensm/include/opensm/osm_subnet.h
+++ b/opensm/include/opensm/osm_subnet.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -69,6 +69,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; BEGIN_C_DECLS
 #define OSM_SUBNET_VECTOR_CAPACITY256
 struct osm_opensm;
 struct osm_qos_policy;
+struct osm_mgrp_box;
 
 /****h* OpenSM/Subnet
 * NAME
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -513,7 +514,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; typedef struct osm_subn {
 boolean_t coming_out_of_standby;
 unsigned need_update;
 cl_fmap_t mgrp_mgid_tbl;
-void *mgroups[IB_LID_MCAST_END_HO - IB_LID_MCAST_START_HO + 1];
+void *mboxes[IB_LID_MCAST_END_HO - IB_LID_MCAST_START_HO + 1];
 } osm_subn_t;
 /*
 * FIELDS
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -634,8 +635,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; typedef struct osm_subn {
 *This flag should be on during first non-master heavy
 *(including pre-master discovery stage)
 *
-*mgroups
-*Array of pointers to all Multicast Group objects in the subnet.
+*mboxes
+*Array of pointers to all Multicast Group Box objects in the subnet.
 *Indexed by MLID offset from base MLID.
 *
 * SEE ALSO
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -935,21 +936,21 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; struct osm_port *osm_get_port_by_guid(IN osm_subn_t const *p_subn,
 *osm_port_t
 *********/
 
-/****f* OpenSM: Subnet/osm_get_mgrp_by_mlid
+/****f* OpenSM: Subnet/osm_get_mgrp_box_by_mlid
 * NAME
-*osm_get_mgrp_by_mlid
+*osm_get_mgrp_box_by_mlid
 *
 * DESCRIPTION
-*The looks for the given multicast group in the subnet table by mlid.
+*The looks for the given multicast group box in the subnet table by mlid.
 *NOTE: this code is not thread safe. Need to grab the lock before
 *calling it.
 *
 * SYNOPSIS
 */
 static inline
-struct osm_mgrp *osm_get_mgrp_by_mlid(osm_subn_t const *p_subn, ib_net16_t mlid)
+struct osm_mgrp_box *osm_get_mgrp_box_by_mlid(osm_subn_t const *p_subn, ib_net16_t mlid)
 {
-return p_subn-&amp;gt;mgroups[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO];
+return p_subn-&amp;gt;mboxes[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO];
 }
 /*
 * PARAMETERS
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -960,7 +961,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; struct osm_mgrp *osm_get_mgrp_by_mlid(osm_subn_t const *p_subn, ib_net16_t mlid)
 *[in] The multicast group mlid in network order
 *
 * RETURN VALUES
-*The multicast group structure pointer if found. NULL otherwise.
+*The multicast group box structure pointer if found. NULL otherwise.
 *********/
 
 /****f* OpenSM: Helper/osm_get_physp_by_mad_addr
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1116,5 +1117,33 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int osm_subn_write_conf_file(char *file_name, IN osm_subn_opt_t * const p_opt);
 *********/
 int osm_subn_verify_config(osm_subn_opt_t * const p_opt);
 
+ib_net16_t osm_mgrp_box_get_mlid(IN struct osm_mgrp_box *p_mgrp_box);
+
+/****f* OpenSM: Subnet/osm_mgrp_box_get_mlid_by_mgid
+* NAME
+*       osm_mgrp_box_get_mlid_by_mgid
+*
+* DESCRIPTION
+*       The looks for multicast group by mgid. Returns mlid of found group
+*or 0 if no group found.
+*NOTE: this code is not thread safe. Need to grab the lock before
+*calling it.
+*
+* SYNOPSIS
+*/
+ib_net16_t osm_mgrp_box_get_mlid_by_mgid(IN osm_subn_t const *p_subn,
+IN const ib_gid_t * const p_mgid);
+/*
+* PARAMETERS
+*p_subn
+*[in] Pointer to an osm_subn_t object
+*
+*p_mgid
+*[in] Pointer to  multicast group mgid
+*
+* RETURN VALUES
+*The multicast group mlid if found. 0 otherwise.
+*********/
+
 END_C_DECLS
 #endif/* _OSM_SUBNET_H_ */
diff --git a/opensm/opensm/osm_drop_mgr.c b/opensm/opensm/osm_drop_mgr.c
index 4f98cc9..c86ee72 100644
--- a/opensm/opensm/osm_drop_mgr.c
+++ b/opensm/opensm/osm_drop_mgr.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
diff --git a/opensm/opensm/osm_mcast_mgr.c b/opensm/opensm/osm_mcast_mgr.c
index 3894677..4fbae91 100644
--- a/opensm/opensm/osm_mcast_mgr.c
+++ b/opensm/opensm/osm_mcast_mgr.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -111,14 +111,14 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void mcast_mgr_purge_tree_node(IN osm_mtree_node_t * p_mtn)
 
 /**********************************************************************
  **********************************************************************/
-static void mcast_mgr_purge_tree(osm_sm_t * sm, IN osm_mgrp_t * p_mgrp)
+static void mcast_mgr_purge_tree(osm_sm_t * sm, IN osm_mgrp_box_t * p_mgrp_box)
 {
 OSM_LOG_ENTER(sm-&amp;gt;p_log);
 
-if (p_mgrp-&amp;gt;p_root)
-mcast_mgr_purge_tree_node(p_mgrp-&amp;gt;p_root);
+if (p_mgrp_box-&amp;gt;p_root)
+mcast_mgr_purge_tree_node(p_mgrp_box-&amp;gt;p_root);
 
-p_mgrp-&amp;gt;p_root = NULL;
+p_mgrp_box-&amp;gt;p_root = NULL;
 
 OSM_LOG_EXIT(sm-&amp;gt;p_log);
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -126,28 +126,26 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void mcast_mgr_purge_tree(osm_sm_t * sm, IN osm_mgrp_t * p_mgrp)
 /**********************************************************************
  **********************************************************************/
 static float osm_mcast_mgr_compute_avg_hops(osm_sm_t * sm,
-    const osm_mgrp_t * p_mgrp,
+    const osm_mgrp_box_t * p_mgrp_box,
     const osm_switch_t * p_sw)
 {
 float avg_hops = 0;
 uint32_t hops = 0;
 uint32_t num_ports = 0;
-const osm_mcm_port_t *p_mcm_port;
-const cl_qmap_t *p_mcm_tbl;
+const osm_mgrp_port_t *p_box_port;
 
 OSM_LOG_ENTER(sm-&amp;gt;p_log);
 
-p_mcm_tbl = &amp;amp;p_mgrp-&amp;gt;mcm_port_tbl;
 
 /*
    For each member of the multicast group, compute the
    number of hops to its base LID.
  */
-for (p_mcm_port = (osm_mcm_port_t *) cl_qmap_head(p_mcm_tbl);
-     p_mcm_port != (osm_mcm_port_t *) cl_qmap_end(p_mcm_tbl);
-     p_mcm_port =
-     (osm_mcm_port_t *) cl_qmap_next(&amp;amp;p_mcm_port-&amp;gt;map_item)) {
-hops += osm_switch_get_port_least_hops(p_sw, p_mcm_port-&amp;gt;port);
+for (p_box_port = (osm_mgrp_port_t *) cl_qmap_head(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map);
+     p_box_port != (osm_mgrp_port_t *) cl_qmap_end(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map);
+     p_box_port =
+     (osm_mgrp_port_t *) cl_qmap_next(&amp;amp;p_box_port-&amp;gt;guid_item)) {
+hops += osm_switch_get_port_least_hops(p_sw, p_box_port-&amp;gt;p_port);
 num_ports++;
 }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -168,27 +166,27 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static float osm_mcast_mgr_compute_avg_hops(osm_sm_t * sm,
  of the group HCAs
  **********************************************************************/
 static float osm_mcast_mgr_compute_max_hops(osm_sm_t * sm,
-    const osm_mgrp_t * p_mgrp,
+    const osm_mgrp_box_t * p_mgrp_box,
     const osm_switch_t * p_sw)
 {
 uint32_t max_hops = 0;
 uint32_t hops = 0;
-const osm_mcm_port_t *p_mcm_port;
-const cl_qmap_t *p_mcm_tbl;
+const osm_mgrp_port_t *p_box_port;
+const cl_qmap_t *p_box_port_tbl;
 
 OSM_LOG_ENTER(sm-&amp;gt;p_log);
 
-p_mcm_tbl = &amp;amp;p_mgrp-&amp;gt;mcm_port_tbl;
+p_box_port_tbl = &amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map;
 
 /*
    For each member of the multicast group, compute the
    number of hops to its base LID.
  */
-for (p_mcm_port = (osm_mcm_port_t *) cl_qmap_head(p_mcm_tbl);
-     p_mcm_port != (osm_mcm_port_t *) cl_qmap_end(p_mcm_tbl);
-     p_mcm_port =
-     (osm_mcm_port_t *) cl_qmap_next(&amp;amp;p_mcm_port-&amp;gt;map_item)) {
-hops = osm_switch_get_port_least_hops(p_sw, p_mcm_port-&amp;gt;port);
+for (p_box_port = (osm_mgrp_port_t *) cl_qmap_head(p_box_port_tbl);
+     p_box_port != (osm_mgrp_port_t *) cl_qmap_end(p_box_port_tbl);
+     p_box_port =
+     (osm_mgrp_port_t *) cl_qmap_next(&amp;amp;p_box_port-&amp;gt;guid_item)) {
+hops = osm_switch_get_port_least_hops(p_sw, p_box_port-&amp;gt;p_port);
 if (hops &amp;gt; max_hops)
 max_hops = hops;
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -210,7 +208,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static float osm_mcast_mgr_compute_max_hops(osm_sm_t * sm,
    of the multicast group.
 **********************************************************************/
 static osm_switch_t *mcast_mgr_find_optimal_switch(osm_sm_t * sm,
-   const osm_mgrp_t * p_mgrp)
+   const osm_mgrp_box_t * p_mgrp_box)
 {
 cl_qmap_t *p_sw_tbl;
 const osm_switch_t *p_sw;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -227,7 +225,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static osm_switch_t *mcast_mgr_find_optimal_switch(osm_sm_t * sm,
 
 p_sw_tbl = &amp;amp;sm-&amp;gt;p_subn-&amp;gt;sw_guid_tbl;
 
-CL_ASSERT(!osm_mgrp_is_empty(p_mgrp));
+CL_ASSERT(!osm_mgrp_is_empty(p_mgrp_box));
 
 for (p_sw = (osm_switch_t *) cl_qmap_head(p_sw_tbl);
      p_sw != (osm_switch_t *) cl_qmap_end(p_sw_tbl);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -236,9 +234,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static osm_switch_t *mcast_mgr_find_optimal_switch(osm_sm_t * sm,
 continue;
 
 if (use_avg_hops)
-hops = osm_mcast_mgr_compute_avg_hops(sm, p_mgrp, p_sw);
+hops = osm_mcast_mgr_compute_avg_hops(sm, p_mgrp_box, p_sw);
 else
-hops = osm_mcast_mgr_compute_max_hops(sm, p_mgrp, p_sw);
+hops = osm_mcast_mgr_compute_max_hops(sm, p_mgrp_box, p_sw);
 
 OSM_LOG(sm-&amp;gt;p_log, OSM_LOG_DEBUG,
 "Switch 0x%016" PRIx64 ", hops = %f\n",
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -267,7 +265,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static osm_switch_t *mcast_mgr_find_optimal_switch(osm_sm_t * sm,
    This function returns the existing or optimal root swtich for the tree.
 **********************************************************************/
 static osm_switch_t *mcast_mgr_find_root_switch(osm_sm_t * sm,
-const osm_mgrp_t * p_mgrp)
+const osm_mgrp_box_t * p_mgrp_box)
 {
 const osm_switch_t *p_sw = NULL;
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -279,7 +277,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static osm_switch_t *mcast_mgr_find_root_switch(osm_sm_t * sm,
    the root will be always on the first switch attached to it.
    - Very bad ...
  */
-p_sw = mcast_mgr_find_optimal_switch(sm, p_mgrp);
+p_sw = mcast_mgr_find_optimal_switch(sm, p_mgrp_box);
 
 OSM_LOG_EXIT(sm-&amp;gt;p_log);
 return (osm_switch_t *) p_sw;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -354,7 +352,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static int mcast_mgr_set_mft_block(osm_sm_t * sm, IN osm_switch_t * p_sw,
   spanning tree that eminate from this switch.  On input, the p_list
   contains the group members that must be routed from this switch.
 **********************************************************************/
-static void mcast_mgr_subdivide(osm_sm_t * sm, osm_mgrp_t * p_mgrp,
+static void mcast_mgr_subdivide(osm_sm_t * sm, osm_mgrp_box_t * p_mgrp_box,
 osm_switch_t * p_sw, cl_qlist_t * p_list,
 cl_qlist_t * list_array, uint8_t array_size)
 {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -365,7 +363,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void mcast_mgr_subdivide(osm_sm_t * sm, osm_mgrp_t * p_mgrp,
 
 OSM_LOG_ENTER(sm-&amp;gt;p_log);
 
-mlid_ho = cl_ntoh16(osm_mgrp_get_mlid(p_mgrp));
+mlid_ho = cl_ntoh16(osm_mgrp_box_get_mlid(p_mgrp_box));
 
 /*
    For Multicast Groups, we want not to count on previous
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -455,7 +453,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void mcast_mgr_purge_list(osm_sm_t * sm, cl_qlist_t * p_list)
 
   The function returns the newly created mtree node element.
 **********************************************************************/
-static osm_mtree_node_t *mcast_mgr_branch(osm_sm_t * sm, osm_mgrp_t * p_mgrp,
+static osm_mtree_node_t *mcast_mgr_branch(osm_sm_t * sm, osm_mgrp_box_t * p_mgrp_box,
   osm_switch_t * p_sw,
   cl_qlist_t * p_list, uint8_t depth,
   uint8_t upstream_port,
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -481,7 +479,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static osm_mtree_node_t *mcast_mgr_branch(osm_sm_t * sm, osm_mgrp_t * p_mgrp,
 
 node_guid = osm_node_get_node_guid(p_sw-&amp;gt;p_node);
 node_guid_ho = cl_ntoh64(node_guid);
-mlid_ho = cl_ntoh16(osm_mgrp_get_mlid(p_mgrp));
+mlid_ho = cl_ntoh16(osm_mgrp_box_get_mlid(p_mgrp_box));
 
 OSM_LOG(sm-&amp;gt;p_log, OSM_LOG_VERBOSE,
 "Routing MLID 0x%X through switch 0x%" PRIx64
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -558,7 +556,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static osm_mtree_node_t *mcast_mgr_branch(osm_sm_t * sm, osm_mgrp_t * p_mgrp,
 for (i = 0; i &amp;lt; max_children; i++)
 cl_qlist_init(&amp;amp;list_array[i]);
 
-mcast_mgr_subdivide(sm, p_mgrp, p_sw, p_list, list_array, max_children);
+mcast_mgr_subdivide(sm, p_mgrp_box, p_sw, p_list, list_array, max_children);
 
 p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -641,7 +639,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static osm_mtree_node_t *mcast_mgr_branch(osm_sm_t * sm, osm_mgrp_t * p_mgrp,
 CL_ASSERT(p_remote_physp);
 
 p_mtn-&amp;gt;child_array[i] =
-    mcast_mgr_branch(sm, p_mgrp, p_remote_node-&amp;gt;sw,
+    mcast_mgr_branch(sm, p_mgrp_box, p_remote_node-&amp;gt;sw,
      p_port_list, depth,
      osm_physp_get_port_num
      (p_remote_physp), p_max_depth);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -677,11 +675,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; Exit:
 /**********************************************************************
  **********************************************************************/
 static ib_api_status_t mcast_mgr_build_spanning_tree(osm_sm_t * sm,
-     osm_mgrp_t * p_mgrp)
+     osm_mgrp_box_t * p_mgrp_box)
 {
-const cl_qmap_t *p_mcm_tbl;
-const osm_mcm_port_t *p_mcm_port;
 uint32_t num_ports;
+const osm_mgrp_port_t *p_mgrp_port;
 cl_qlist_t port_list;
 osm_switch_t *p_sw;
 osm_mcast_work_obj_t *p_wobj;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -699,14 +696,13 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static ib_api_status_t mcast_mgr_build_spanning_tree(osm_sm_t * sm,
    on multicast forwarding table information if the user wants to
    preserve existing multicast routes.
  */
-mcast_mgr_purge_tree(sm, p_mgrp);
+mcast_mgr_purge_tree(sm, p_mgrp_box);
 
-p_mcm_tbl = &amp;amp;p_mgrp-&amp;gt;mcm_port_tbl;
-num_ports = cl_qmap_count(p_mcm_tbl);
+num_ports = cl_qmap_count(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map);
 if (num_ports == 0) {
 OSM_LOG(sm-&amp;gt;p_log, OSM_LOG_VERBOSE,
 "MLID 0x%X has no members - nothing to do\n",
-cl_ntoh16(osm_mgrp_get_mlid(p_mgrp)));
+cl_ntoh16(osm_mgrp_box_get_mlid(p_mgrp_box)));
 goto Exit;
 }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -726,11 +722,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static ib_api_status_t mcast_mgr_build_spanning_tree(osm_sm_t * sm,
    Locate the switch around which to create the spanning
    tree for this multicast group.
  */
-p_sw = mcast_mgr_find_root_switch(sm, p_mgrp);
+p_sw = mcast_mgr_find_root_switch(sm, p_mgrp_box);
 if (p_sw == NULL) {
 OSM_LOG(sm-&amp;gt;p_log, OSM_LOG_ERROR, "ERR 0A08: "
 "Unable to locate a suitable switch for group 0x%X\n",
-cl_ntoh16(osm_mgrp_get_mlid(p_mgrp)));
+cl_ntoh16(osm_mgrp_box_get_mlid(p_mgrp_box)));
 status = IB_ERROR;
 goto Exit;
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -738,20 +734,20 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static ib_api_status_t mcast_mgr_build_spanning_tree(osm_sm_t * sm,
 /*
    Build the first "subset" containing all member ports.
  */
-for (p_mcm_port = (osm_mcm_port_t *) cl_qmap_head(p_mcm_tbl);
-     p_mcm_port != (osm_mcm_port_t *) cl_qmap_end(p_mcm_tbl);
-     p_mcm_port =
-     (osm_mcm_port_t *) cl_qmap_next(&amp;amp;p_mcm_port-&amp;gt;map_item)) {
+for (p_mgrp_port = (osm_mgrp_port_t *) cl_qmap_head(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map);
+     p_mgrp_port != (osm_mgrp_port_t *) cl_qmap_end(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map);
+     p_mgrp_port =
+     (osm_mgrp_port_t *) cl_qmap_next(&amp;amp;p_mgrp_port-&amp;gt;guid_item)) {
 /*
    Acquire the port object for this port guid, then create
    the new worker object to build the list.
  */
-p_wobj = mcast_work_obj_new(p_mcm_port-&amp;gt;port);
+p_wobj = mcast_work_obj_new(p_mgrp_port-&amp;gt;p_port);
 if (p_wobj == NULL) {
 OSM_LOG(sm-&amp;gt;p_log, OSM_LOG_ERROR, "ERR 0A10: "
 "Insufficient memory to route port 0x%016"
 PRIx64 "\n",
-cl_ntoh64(osm_port_get_guid(p_mcm_port-&amp;gt;port)));
+cl_ntoh64(p_mgrp_port-&amp;gt;p_port-&amp;gt;guid));
 continue;
 }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -759,12 +755,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static ib_api_status_t mcast_mgr_build_spanning_tree(osm_sm_t * sm,
 }
 
 count = cl_qlist_count(&amp;amp;port_list);
-p_mgrp-&amp;gt;p_root = mcast_mgr_branch(sm, p_mgrp, p_sw, &amp;amp;port_list, 0, 0,
+p_mgrp_box-&amp;gt;p_root = mcast_mgr_branch(sm, p_mgrp_box, p_sw, &amp;amp;port_list, 0, 0,
   &amp;amp;max_depth);
 
 OSM_LOG(sm-&amp;gt;p_log, OSM_LOG_VERBOSE,
 "Configured MLID 0x%X for %u ports, max tree depth = %u\n",
-cl_ntoh16(osm_mgrp_get_mlid(p_mgrp)), count, max_depth);
+cl_ntoh16(osm_mgrp_box_get_mlid(p_mgrp_box)), count, max_depth);
 
 Exit:
 OSM_LOG_EXIT(sm-&amp;gt;p_log);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -971,7 +967,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; Exit:
 static ib_api_status_t mcast_mgr_process_mlid(osm_sm_t * sm, uint16_t mlid)
 {
 ib_api_status_t status = IB_SUCCESS;
-osm_mgrp_t *mgrp;
+osm_mgrp_box_t *p_mgrp_box;
 
 OSM_LOG_ENTER(sm-&amp;gt;p_log);
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -983,9 +979,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static ib_api_status_t mcast_mgr_process_mlid(osm_sm_t * sm, uint16_t mlid)
    port in the group. */
 mcast_mgr_clear(sm, mlid);
 
-mgrp = osm_get_mgrp_by_mlid(sm-&amp;gt;p_subn, cl_hton16(mlid));
-if (mgrp) {
-status = mcast_mgr_build_spanning_tree(sm, mgrp);
+p_mgrp_box = osm_get_mgrp_box_by_mlid(sm-&amp;gt;p_subn, cl_hton16(mlid));
+if (p_mgrp_box) {
+status = mcast_mgr_build_spanning_tree(sm, p_mgrp_box);
 if (status != IB_SUCCESS)
 OSM_LOG(sm-&amp;gt;p_log, OSM_LOG_ERROR, "ERR 0A17: "
 "Unable to create spanning tree (%s) for mlid "
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1065,7 +1061,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int osm_mcast_mgr_process(osm_sm_t * sm)
 
 for (i = 0; i &amp;lt;= sm-&amp;gt;p_subn-&amp;gt;max_mcast_lid_ho - IB_LID_MCAST_START_HO;
      i++)
-if (sm-&amp;gt;p_subn-&amp;gt;mgroups[i] || sm-&amp;gt;mlids_req[i])
+if (sm-&amp;gt;p_subn-&amp;gt;mboxes[i] || sm-&amp;gt;mlids_req[i])
 mcast_mgr_process_mlid(sm, i + IB_LID_MCAST_START_HO);
 
 memset(sm-&amp;gt;mlids_req, 0, sm-&amp;gt;mlids_req_max);
diff --git a/opensm/opensm/osm_multicast.c b/opensm/opensm/osm_multicast.c
index 5a10003..01c90d8 100644
--- a/opensm/opensm/osm_multicast.c
+++ b/opensm/opensm/osm_multicast.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -51,6 +51,18 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #include &amp;lt;opensm/osm_inform.h&amp;gt;
 #include &amp;lt;opensm/osm_opensm.h&amp;gt;
 
+static osm_mgrp_port_t *osm_mgrp_port_new(osm_port_t *p_port)
+{
+osm_mgrp_port_t *p_mgrp_port =
+(osm_mgrp_port_t *) malloc(sizeof(osm_mgrp_port_t));
+if (!p_mgrp_port) {
+return NULL;
+}
+memset(p_mgrp_port, 0, sizeof(*p_mgrp_port));
+p_mgrp_port-&amp;gt;p_port = p_port;
+return p_mgrp_port;
+}
+
 /**********************************************************************
  **********************************************************************/
 void osm_mgrp_delete(IN osm_mgrp_t * p_mgrp)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -69,8 +81,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void osm_mgrp_delete(IN osm_mgrp_t * p_mgrp)
     (osm_mcm_port_t *) cl_qmap_next(&amp;amp;p_mcm_port-&amp;gt;map_item);
 osm_mcm_port_delete(p_mcm_port);
 }
-/* destroy the mtree_node structure */
-osm_mtree_destroy(p_mgrp-&amp;gt;p_root);
 
 free(p_mgrp);
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -99,8 +109,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void osm_mgrp_cleanup(osm_subn_t * subn, osm_mgrp_t * mgrp)
 if (mgrp-&amp;gt;full_members)
 return;
 
-osm_mtree_destroy(mgrp-&amp;gt;p_root);
-mgrp-&amp;gt;p_root = NULL;
 
 while (cl_qmap_count(&amp;amp;mgrp-&amp;gt;mcm_port_tbl)) {
 mcm_port = (osm_mcm_port_t *)cl_qmap_head(&amp;amp;mgrp-&amp;gt;mcm_port_tbl);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -114,7 +122,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void osm_mgrp_cleanup(osm_subn_t * subn, osm_mgrp_t * mgrp)
 return;
 
 cl_fmap_remove_item(&amp;amp;subn-&amp;gt;mgrp_mgid_tbl, &amp;amp;mgrp-&amp;gt;map_item);
-subn-&amp;gt;mgroups[cl_ntoh16(mgrp-&amp;gt;mlid) - IB_LID_MCAST_START_HO] = NULL;
 free(mgrp);
 }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -157,6 +164,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; osm_mcm_port_t *osm_mgrp_add_port(IN osm_subn_t * subn, osm_log_t * log,
 cl_map_item_t *prev_item;
 uint8_t prev_join_state = 0, join_state = mcmr-&amp;gt;scope_state;
 uint8_t prev_scope;
+osm_mgrp_box_t *p_mgrp_box;
 
 if (osm_log_is_active(log, OSM_LOG_VERBOSE)) {
 char gid_str[INET6_ADDRSTRLEN];
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -193,7 +201,20 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; osm_mcm_port_t *osm_mgrp_add_port(IN osm_subn_t * subn, osm_log_t * log,
       prev_join_state | join_state);
 } else {
 cl_qlist_insert_tail(&amp;amp;port-&amp;gt;mcm_list, &amp;amp;mcm_port-&amp;gt;list_item);
-osm_sm_reroute_mlid(&amp;amp;subn-&amp;gt;p_osm-&amp;gt;sm, mgrp-&amp;gt;mlid);
+p_mgrp_box = osm_get_mgrp_box_by_mlid(subn, mgrp-&amp;gt;mlid);
+osm_mgrp_port_t *p_mgrp_port = (osm_mgrp_port_t *)
+cl_qmap_get(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map, ib_gid_get_guid(&amp;amp;mcm_port-&amp;gt;port_gid));
+if (p_mgrp_port ==
+(osm_mgrp_port_t *) cl_qmap_end(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map)) {
+/* new port to mlid */
+p_mgrp_port = osm_mgrp_port_new(mcm_port-&amp;gt;port);
+if (!p_mgrp_port) {
+return NULL;
+}
+cl_qmap_insert(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map,
+ib_gid_get_guid(&amp;amp;mcm_port-&amp;gt;port_gid), &amp;amp;p_mgrp_port-&amp;gt;guid_item);
+}
+osm_sm_reroute_mlid(&amp;amp;subn-&amp;gt;p_osm-&amp;gt;sm, p_mgrp_box-&amp;gt;mlid);
 }
 
 /* o15.0.1.11: copy the join state */
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -214,6 +235,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void osm_mgrp_remove_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,
 {
 uint8_t join_state = mcmr-&amp;gt;scope_state &amp;amp; 0xf;
 uint8_t port_join_state, new_join_state;
+osm_mgrp_box_t *p_mgrp_box;
 
 /*
  * according to the same o15-0.1.14 we get the stored
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -222,6 +244,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void osm_mgrp_remove_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,
  */
 port_join_state = mcm_port-&amp;gt;scope_state &amp;amp; 0x0F;
 new_join_state = port_join_state &amp;amp; ~join_state;
+p_mgrp_box = osm_get_mgrp_box_by_mlid(subn, mgrp-&amp;gt;mlid);
 
 if (osm_log_is_active(log, OSM_LOG_VERBOSE)) {
 char gid_str[INET6_ADDRSTRLEN];
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -242,14 +265,27 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void osm_mgrp_remove_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,
 port_join_state, new_join_state);
 mcmr-&amp;gt;scope_state = mcm_port-&amp;gt;scope_state;
 } else {
+osm_mgrp_port_t *p_mgrp_port;
 mcmr-&amp;gt;scope_state = mcm_port-&amp;gt;scope_state;
 OSM_LOG(log, OSM_LOG_DEBUG, "removing port 0x%" PRIx64 "\n",
 cl_ntoh64(mcm_port-&amp;gt;port-&amp;gt;guid));
 cl_qmap_remove_item(&amp;amp;mgrp-&amp;gt;mcm_port_tbl, &amp;amp;mcm_port-&amp;gt;map_item);
 cl_qlist_remove_item(&amp;amp;mcm_port-&amp;gt;port-&amp;gt;mcm_list,
      &amp;amp;mcm_port-&amp;gt;list_item);
+p_mgrp_port = (osm_mgrp_port_t *)
+cl_qmap_get(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map, mcm_port-&amp;gt;port-&amp;gt;guid);
+if (p_mgrp_port !=
+(osm_mgrp_port_t *) cl_qmap_end(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map)) {
+p_mgrp_port-&amp;gt;num_groups--;
+if (0 == p_mgrp_port-&amp;gt;num_groups) {
+/* No mgroups registered on this port for current mlid */
+cl_qmap_remove_item(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map,
+&amp;amp;p_mgrp_port-&amp;gt;guid_item);
+free(p_mgrp_port);
+}
+}
 osm_mcm_port_delete(mcm_port);
-osm_sm_reroute_mlid(&amp;amp;subn-&amp;gt;p_osm-&amp;gt;sm, mgrp-&amp;gt;mlid);
+osm_sm_reroute_mlid(&amp;amp;subn-&amp;gt;p_osm-&amp;gt;sm, p_mgrp_box-&amp;gt;mlid);
 }
 
 /* no more full members so the group will be deleted after re-route
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -258,6 +294,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void osm_mgrp_remove_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,
     !(new_join_state &amp;amp; IB_JOIN_STATE_FULL) &amp;amp;&amp;amp;
     --mgrp-&amp;gt;full_members == 0) {
 mgrp_send_notice(subn, log, mgrp, 67);
+cl_qlist_remove_item(&amp;amp;p_mgrp_box-&amp;gt;mgrp_list, &amp;amp;mgrp-&amp;gt;box_item);
+if (0 == cl_qlist_count(&amp;amp;p_mgrp_box-&amp;gt;mgrp_list)) {
+/* empty mgrp_box */
+osm_mgrp_box_delete(subn,p_mgrp_box-&amp;gt;mlid);
+}
+
 osm_mgrp_cleanup(subn, mgrp);
 }
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -266,8 +308,16 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void osm_mgrp_delete_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,
   ib_net64_t port_guid)
 {
 ib_member_rec_t mcmrec;
-cl_map_item_t *item = cl_qmap_get(&amp;amp;mgrp-&amp;gt;mcm_port_tbl, port_guid);
+osm_mgrp_box_t *p_mgrp_box;
+osm_mgrp_port_t *p_mgrp_port;
 
+cl_map_item_t *item = cl_qmap_get(&amp;amp;mgrp-&amp;gt;mcm_port_tbl, port_guid);
+p_mgrp_box = osm_get_mgrp_box_by_mlid(subn, mgrp-&amp;gt;mlid);
+p_mgrp_port = (osm_mgrp_port_t *)
+cl_qmap_remove(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map, port_guid);
+if (p_mgrp_port != (osm_mgrp_port_t *)cl_qmap_end(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map)) {
+free(p_mgrp_port);
+}
 if (item != cl_qmap_end(&amp;amp;mgrp-&amp;gt;mcm_port_tbl)) {
 mcmrec.scope_state = 0xf;
 osm_mgrp_remove_port(subn, log, mgrp, (osm_mcm_port_t *) item,
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -296,3 +346,43 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; boolean_t osm_mgrp_is_port_present(IN const osm_mgrp_t * p_mgrp,
 *pp_mcm_port = NULL;
 return FALSE;
 }
+
+/**********************************************************************
+ **********************************************************************/
+osm_mgrp_box_t *osm_mgrp_box_new(IN osm_subn_t * p_subn,ib_net16_t mlid)
+{
+osm_mgrp_box_t *p_mgrp_box;
+p_mgrp_box =
+p_subn-&amp;gt;mboxes[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO] =
+(osm_mgrp_box_t *) calloc(1,sizeof(*p_mgrp_box));
+if (!p_mgrp_box)
+return NULL;
+p_mgrp_box-&amp;gt;mlid = mlid;
+cl_qmap_init(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map);
+cl_qlist_init(&amp;amp;p_mgrp_box-&amp;gt;mgrp_list);
+return p_mgrp_box;
+}
+
+/**********************************************************************
+ **********************************************************************/
+void osm_mgrp_box_delete(IN osm_subn_t *p_subn, ib_net16_t mlid)
+{
+osm_mgrp_port_t *p_osm_mgr_port;
+cl_map_item_t *p_item;
+osm_mgrp_box_t *p_mgrp_box =
+p_subn-&amp;gt;mboxes[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO];
+p_item = cl_qmap_head(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map);
+/* Delete ports shared same MLID */
+while (p_item != cl_qmap_end(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map)) {
+p_osm_mgr_port = (osm_mgrp_port_t *) p_item;
+cl_qmap_remove_item(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map, p_item);
+p_item = cl_qmap_head(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map);
+free(p_osm_mgr_port);
+}
+/* Remove mgrp from this MLID */
+cl_qlist_remove_all(&amp;amp;p_mgrp_box-&amp;gt;mgrp_list);
+/* Destroy the mtree_node structure */
+osm_mtree_destroy(p_mgrp_box-&amp;gt;p_root);
+p_subn-&amp;gt;mboxes[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO] = NULL;
+free(p_mgrp_box);
+}
diff --git a/opensm/opensm/osm_qos_policy.c b/opensm/opensm/osm_qos_policy.c
index 9b72293..6c0a1e6 100644
--- a/opensm/opensm/osm_qos_policy.c
+++ b/opensm/opensm/osm_qos_policy.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -773,6 +773,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void __qos_policy_validate_pkey(
 uint32_t flow;
 uint8_t hop;
 osm_mgrp_t * p_mgrp;
+osm_mgrp_box_t * p_mgrp_box;
+cl_list_item_t *p_item;
 
 if (!p_qos_policy || !p_qos_match_rule || !p_prtn)
 return;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -796,28 +798,33 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void __qos_policy_validate_pkey(
 if (!p_prtn-&amp;gt;mlid)
 return;
 
-p_mgrp = osm_get_mgrp_by_mlid(p_qos_policy-&amp;gt;p_subn, p_prtn-&amp;gt;mlid);
-if (!p_mgrp) {
+p_mgrp_box = osm_get_mgrp_box_by_mlid(p_qos_policy-&amp;gt;p_subn, p_prtn-&amp;gt;mlid);
+if (!p_mgrp_box) {
 OSM_LOG(&amp;amp;p_qos_policy-&amp;gt;p_subn-&amp;gt;p_osm-&amp;gt;log, OSM_LOG_ERROR,
-"ERR AC16: MCast group for partition with "
+"ERR AC16: MCast group box for partition with "
 "pkey 0x%04X not found\n",
 cl_ntoh16(p_prtn-&amp;gt;pkey));
 return;
 }
 
-CL_ASSERT((cl_ntoh16(p_mgrp-&amp;gt;mcmember_rec.pkey) &amp;amp; 0x7fff) ==
-  (cl_ntoh16(p_prtn-&amp;gt;pkey) &amp;amp; 0x7fff));
-
-ib_member_get_sl_flow_hop(p_mgrp-&amp;gt;mcmember_rec.sl_flow_hop,
-  &amp;amp;sl, &amp;amp;flow, &amp;amp;hop);
-if (sl != p_prtn-&amp;gt;sl) {
-OSM_LOG(&amp;amp;p_qos_policy-&amp;gt;p_subn-&amp;gt;p_osm-&amp;gt;log, OSM_LOG_DEBUG,
-"Updating MCGroup (MLID 0x%04x) SL to "
-"match partition SL (%u)\n",
-cl_hton16(p_mgrp-&amp;gt;mcmember_rec.mlid),
-p_prtn-&amp;gt;sl);
-p_mgrp-&amp;gt;mcmember_rec.sl_flow_hop =
+p_item = cl_qlist_head(&amp;amp;p_mgrp_box-&amp;gt;mgrp_list);
+while (p_item != cl_qlist_end(&amp;amp;p_mgrp_box-&amp;gt;mgrp_list)) {
+p_mgrp = (osm_mgrp_t *) PARENT_STRUCT(p_item, osm_mgrp_t,
+box_item);
+p_item = cl_qlist_next(p_item);
+CL_ASSERT((cl_ntoh16(p_mgrp-&amp;gt;mcmember_rec.pkey) &amp;amp; 0x7fff) ==
+(cl_ntoh16(p_prtn-&amp;gt;pkey) &amp;amp; 0x7fff));
+ib_member_get_sl_flow_hop(p_mgrp-&amp;gt;mcmember_rec.sl_flow_hop,
+&amp;amp;sl, &amp;amp;flow, &amp;amp;hop);
+if (sl != p_prtn-&amp;gt;sl) {
+OSM_LOG(&amp;amp;p_qos_policy-&amp;gt;p_subn-&amp;gt;p_osm-&amp;gt;log, OSM_LOG_DEBUG,
+"Updating MCGroup (MLID 0x%04x) SL to "
+"match partition SL (%u)\n",
+cl_hton16(p_mgrp-&amp;gt;mcmember_rec.mlid),
+p_prtn-&amp;gt;sl);
+p_mgrp-&amp;gt;mcmember_rec.sl_flow_hop =
 ib_member_set_sl_flow_hop(p_prtn-&amp;gt;sl, flow, hop);
+}
 }
 }
 
diff --git a/opensm/opensm/osm_sa.c b/opensm/opensm/osm_sa.c
index 02737c2..a5d8945 100644
--- a/opensm/opensm/osm_sa.c
+++ b/opensm/opensm/osm_sa.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -706,18 +706,17 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void sa_dump_all_sa(osm_opensm_t * p_osm, FILE * file)
 {
 struct opensm_dump_context dump_context;
 osm_mgrp_t *p_mgrp;
-int i;
 
 dump_context.p_osm = p_osm;
 dump_context.file = file;
 OSM_LOG(&amp;amp;p_osm-&amp;gt;log, OSM_LOG_DEBUG, "Dump multicast\n");
 cl_plock_acquire(&amp;amp;p_osm-&amp;gt;lock);
-for (i = 0; i &amp;lt;= p_osm-&amp;gt;subn.max_mcast_lid_ho - IB_LID_MCAST_START_HO;
-     i++) {
-p_mgrp = p_osm-&amp;gt;subn.mgroups[i];
-if (p_mgrp)
-sa_dump_one_mgrp(p_mgrp, &amp;amp;dump_context);
+p_mgrp = (osm_mgrp_t*)cl_fmap_head(&amp;amp;p_osm-&amp;gt;subn.mgrp_mgid_tbl);
+while (p_mgrp != (osm_mgrp_t*)cl_fmap_end(&amp;amp;p_osm-&amp;gt;subn.mgrp_mgid_tbl)) {
+sa_dump_one_mgrp(p_mgrp, &amp;amp;dump_context);
+p_mgrp = (osm_mgrp_t*) cl_fmap_next(&amp;amp;p_mgrp-&amp;gt;map_item);
 }
+
 OSM_LOG(&amp;amp;p_osm-&amp;gt;log, OSM_LOG_DEBUG, "Dump inform\n");
 cl_qlist_apply_func(&amp;amp;p_osm-&amp;gt;subn.sa_infr_list,
     sa_dump_one_inform, &amp;amp;dump_context);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -740,22 +739,15 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static osm_mgrp_t *load_mcgroup(osm_opensm_t * p_osm, ib_net16_t mlid,
 unsigned well_known)
 {
 ib_net64_t comp_mask;
-osm_mgrp_t *p_mgrp;
+osm_mgrp_t *p_mgrp = NULL;
+cl_fmap_item_t *p_fitem;
 
 cl_plock_excl_acquire(&amp;amp;p_osm-&amp;gt;lock);
 
-p_mgrp = osm_get_mgrp_by_mlid(&amp;amp;p_osm-&amp;gt;subn, mlid);
-if (p_mgrp) {
-if (!memcmp(&amp;amp;p_mgrp-&amp;gt;mcmember_rec.mgid, &amp;amp;p_mcm_rec-&amp;gt;mgid,
-    sizeof(ib_gid_t))) {
-OSM_LOG(&amp;amp;p_osm-&amp;gt;log, OSM_LOG_DEBUG,
-"mgrp %04x is already here.", cl_ntoh16(mlid));
-goto _out;
-}
-OSM_LOG(&amp;amp;p_osm-&amp;gt;log, OSM_LOG_VERBOSE,
-"mlid %04x is already used by another MC group. Will "
-"request clients reregistration.\n", cl_ntoh16(mlid));
-p_mgrp = NULL;
+p_fitem = cl_fmap_get(&amp;amp;p_osm-&amp;gt;subn.mgrp_mgid_tbl, &amp;amp;p_mcm_rec-&amp;gt;mgid);
+if (p_fitem != cl_fmap_end(&amp;amp;p_osm-&amp;gt;subn.mgrp_mgid_tbl)) {
+OSM_LOG(&amp;amp;p_osm-&amp;gt;log, OSM_LOG_DEBUG,
+"mgrp %04x is already here.", cl_ntoh16(mlid));
 goto _out;
 }
 
diff --git a/opensm/opensm/osm_sa_mcmember_record.c b/opensm/opensm/osm_sa_mcmember_record.c
index 8f7816b..b39f986 100644
--- a/opensm/opensm/osm_sa_mcmember_record.c
+++ b/opensm/opensm/osm_sa_mcmember_record.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -121,12 +121,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static ib_net16_t get_new_mlid(osm_sa_t * sa, ib_net16_t requested_mlid)
 
 if (requested_mlid &amp;amp;&amp;amp; cl_ntoh16(requested_mlid) &amp;gt;= IB_LID_MCAST_START_HO
     &amp;amp;&amp;amp; cl_ntoh16(requested_mlid) &amp;lt;= p_subn-&amp;gt;max_mcast_lid_ho
-    &amp;amp;&amp;amp; !osm_get_mgrp_by_mlid(p_subn, requested_mlid))
+    &amp;amp;&amp;amp; !osm_get_mgrp_box_by_mlid(p_subn, requested_mlid))
 return requested_mlid;
 
 max = p_subn-&amp;gt;max_mcast_lid_ho - IB_LID_MCAST_START_HO + 1;
 for (i = 0; i &amp;lt; max; i++)
-if (!sa-&amp;gt;p_subn-&amp;gt;mgroups[i])
+if (!sa-&amp;gt;p_subn-&amp;gt;mboxes[i])
 return cl_hton16(i + IB_LID_MCAST_START_HO);
 
 return 0;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -730,10 +730,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; ib_api_status_t osm_mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
      IN const osm_physp_t * p_physp,
      OUT osm_mgrp_t ** pp_mgrp)
 {
-ib_net16_t mlid;
+ib_net16_t mlid,existed_mlid;
 unsigned zero_mgid, i;
 uint8_t scope;
 ib_gid_t *p_mgid;
+osm_mgrp_box_t *p_mgrp_box;
 ib_api_status_t status = IB_SUCCESS;
 ib_member_rec_t mcm_rec = *p_recvd_mcmember_rec;/* copy for modifications */
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -811,6 +812,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; ib_api_status_t osm_mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
 goto Exit;
 }
 
+/* check if there is mgrp_box matched to requested mgid */
+if (0 != (existed_mlid = osm_mgrp_box_get_mlid_by_mgid(sa-&amp;gt;p_subn, p_mgid))) {
+mlid = existed_mlid;
+}
 /* create a new MC Group */
 *pp_mgrp = osm_mgrp_new(mlid);
 if (*pp_mgrp == NULL) {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -833,11 +838,28 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; ib_api_status_t osm_mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
 (*pp_mgrp)-&amp;gt;mcmember_rec.pkt_life &amp;amp;= 0x3f;
 (*pp_mgrp)-&amp;gt;mcmember_rec.pkt_life |= 2 &amp;lt;&amp;lt; 6;/* exactly */
 
+/* get mgrp_box for selected mlid */
+p_mgrp_box = osm_get_mgrp_box_by_mlid(sa-&amp;gt;p_subn, mlid);
+if (!p_mgrp_box) {
+OSM_LOG(sa-&amp;gt;p_log, OSM_LOG_DEBUG,
+"Creating new mgrp_box for mlid:0x%04x\n",
+cl_ntoh16(mlid));
+p_mgrp_box = osm_mgrp_box_new(sa-&amp;gt;p_subn, mlid);
+if (!p_mgrp_box) {
+OSM_LOG(sa-&amp;gt;p_log, OSM_LOG_ERROR, "ERR 1B08: "
+"osm_mgrp_box_new failed\n");
+osm_mgrp_delete(*pp_mgrp);
+free_mlid(sa, mlid);
+status = IB_INSUFFICIENT_MEMORY;
+goto Exit;
+}
+}
+
 /* Insert the new group in the data base */
 cl_fmap_insert(&amp;amp;sa-&amp;gt;p_subn-&amp;gt;mgrp_mgid_tbl,
        &amp;amp;(*pp_mgrp)-&amp;gt;mcmember_rec.mgid, &amp;amp;(*pp_mgrp)-&amp;gt;map_item);
-sa-&amp;gt;p_subn-&amp;gt;mgroups[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO] = *pp_mgrp;
-
+sa-&amp;gt;p_subn-&amp;gt;mboxes[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO] = p_mgrp_box;
+cl_qlist_insert_tail(&amp;amp;p_mgrp_box-&amp;gt;mgrp_list, &amp;amp;(*pp_mgrp)-&amp;gt;box_item);
 Exit:
 OSM_LOG_EXIT(sa-&amp;gt;p_log);
 return status;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1173,6 +1195,13 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
 goto Exit;
 }
 
+if (is_new_group) {
+osm_mgrp_port_t *p_mgrp_port;
+osm_mgrp_box_t *p_mgrp_box = osm_get_mgrp_box_by_mlid(sa-&amp;gt;p_subn, p_mgrp-&amp;gt;mlid);
+p_mgrp_port = (osm_mgrp_port_t *)
+cl_qmap_get(&amp;amp;p_mgrp_box-&amp;gt;mgrp_port_map, portguid);
+p_mgrp_port-&amp;gt;num_groups++;
+}
 /* Release the lock as we don't need it. */
 CL_PLOCK_RELEASE(sa-&amp;gt;p_lock);
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1386,7 +1415,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void mcmr_query_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
 osm_physp_t *p_req_physp;
 boolean_t trusted_req;
 osm_mgrp_t *p_mgrp;
-int i;
 
 OSM_LOG_ENTER(sa-&amp;gt;p_log);
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1415,12 +1443,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void mcmr_query_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
 CL_PLOCK_ACQUIRE(sa-&amp;gt;p_lock);
 
 /* simply go over all MCGs and match */
-for (i = 0; i &amp;lt;= sa-&amp;gt;p_subn-&amp;gt;max_mcast_lid_ho - IB_LID_MCAST_START_HO;
-     i++) {
-p_mgrp = sa-&amp;gt;p_subn-&amp;gt;mgroups[i];
-if (p_mgrp)
-mcmr_by_comp_mask(sa, p_rcvd_rec, comp_mask, p_mgrp,
-  p_req_physp, trusted_req, &amp;amp;rec_list);
+p_mgrp = (osm_mgrp_t *) cl_fmap_head(&amp;amp;sa-&amp;gt;p_subn-&amp;gt;mgrp_mgid_tbl);
+while (p_mgrp != (osm_mgrp_t *) cl_fmap_end(&amp;amp;sa-&amp;gt;p_subn-&amp;gt;mgrp_mgid_tbl)) {
+mcmr_by_comp_mask(sa, p_rcvd_rec, comp_mask, p_mgrp,
+p_req_physp, trusted_req, &amp;amp;rec_list);
+p_mgrp = (osm_mgrp_t *) cl_fmap_next(&amp;amp;p_mgrp-&amp;gt;map_item);
 }
 
 CL_PLOCK_RELEASE(sa-&amp;gt;p_lock);
diff --git a/opensm/opensm/osm_sa_path_record.c b/opensm/opensm/osm_sa_path_record.c
index 75d9516..6a63092 100644
--- a/opensm/opensm/osm_sa_path_record.c
+++ b/opensm/opensm/osm_sa_path_record.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc. All rights reserved.
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1433,12 +1433,13 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void pr_rcv_process_pair(IN osm_sa_t * sa, IN const osm_madw_t * p_madw,
 
 /**********************************************************************
  **********************************************************************/
-static osm_mgrp_t *pr_get_mgrp(IN osm_sa_t * sa, IN const osm_madw_t * p_madw)
+static osm_mgrp_box_t *pr_get_mgrp_box(IN osm_sa_t * sa, IN const osm_madw_t * p_madw)
 {
 ib_path_rec_t *p_pr;
 const ib_sa_mad_t *p_sa_mad;
 ib_net64_t comp_mask;
 osm_mgrp_t *mgrp = NULL;
+osm_mgrp_box_t *mgrp_box = NULL;
 
 p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
 p_pr = (ib_path_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1454,6 +1455,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static osm_mgrp_t *pr_get_mgrp(IN osm_sa_t * sa, IN const osm_madw_t * p_madw)
   sizeof gid_str));
 goto Exit;
 }
+if (mgrp)
+mgrp_box = osm_get_mgrp_box_by_mlid(sa-&amp;gt;p_subn, mgrp-&amp;gt;mlid);
 
 if (comp_mask &amp;amp; IB_PR_COMPMASK_DLID) {
 if (mgrp) {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1465,18 +1468,18 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static osm_mgrp_t *pr_get_mgrp(IN osm_sa_t * sa, IN const osm_madw_t * p_madw)
 "MC group MLID 0x%x does not match "
 "PathRecord destination LID 0x%x\n",
 mgrp-&amp;gt;mlid, p_pr-&amp;gt;dlid);
-mgrp = NULL;
+mgrp_box = NULL;
 goto Exit;
 }
 } else
-    if (!(mgrp = osm_get_mgrp_by_mlid(sa-&amp;gt;p_subn, p_pr-&amp;gt;dlid)))
+    if (!(mgrp_box = osm_get_mgrp_box_by_mlid(sa-&amp;gt;p_subn, p_pr-&amp;gt;dlid)))
 OSM_LOG(sa-&amp;gt;p_log, OSM_LOG_ERROR,
 "ERR 1F11: " "No MC group found for PathRecord "
 "destination LID 0x%x\n", p_pr-&amp;gt;dlid);
 }
 
 Exit:
-return mgrp;
+return mgrp_box;
 }
 
 /**********************************************************************
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1691,20 +1694,31 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; McastDest:
 OSM_LOG(sa-&amp;gt;p_log, OSM_LOG_DEBUG, "Multicast destination requested\n");
 {
 osm_mgrp_t *p_mgrp = NULL;
-ib_api_status_t status;
+ib_api_status_t status = IB_SUCCESS;
 osm_pr_item_t *p_pr_item;
 uint32_t flow_label;
 uint8_t sl;
 uint8_t hop_limit;
+cl_list_item_t *p_item;
+osm_mgrp_box_t *p_mgrp_box = NULL;
 
 /* First, get the MC info */
-p_mgrp = pr_get_mgrp(sa, p_madw);
+p_mgrp_box = pr_get_mgrp_box(sa, p_madw);
 
-if (!p_mgrp)
+if (!p_mgrp_box)
 goto Unlock;
 
 /* Make sure the rest of the PathRecord matches the MC group attributes */
-status = pr_match_mgrp_attributes(sa, p_madw, p_mgrp);
+for (p_item = cl_qlist_head(&amp;amp;p_mgrp_box-&amp;gt;mgrp_list);
+p_item != cl_qlist_end(&amp;amp;p_mgrp_box-&amp;gt;mgrp_list);
+p_item = cl_qlist_next(p_item)) {
+p_mgrp = (osm_mgrp_t*)PARENT_STRUCT(p_item, osm_mgrp_t,
+box_item);
+status = pr_match_mgrp_attributes(sa, p_madw, p_mgrp);
+if (status == IB_SUCCESS)
+break;
+}
+
 if (status != IB_SUCCESS) {
 OSM_LOG(sa-&amp;gt;p_log, OSM_LOG_ERROR, "ERR 1F19: "
 "MC group attributes don't match PathRecord request\n");
diff --git a/opensm/opensm/osm_subnet.c b/opensm/opensm/osm_subnet.c
index 8d63a75..61d766a 100644
--- a/opensm/opensm/osm_subnet.c
+++ b/opensm/opensm/osm_subnet.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -430,6 +430,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void osm_subn_destroy(IN osm_subn_t * const p_subn)
 osm_prtn_t *p_prtn, *p_next_prtn;
 osm_mgrp_t *p_mgrp;
 osm_infr_t *p_infr, *p_next_infr;
+osm_mgrp_box_t *p_mgrp_box;
 
 /* it might be a good idea to de-allocate all known objects */
 p_next_node = (osm_node_t *) cl_qmap_head(&amp;amp;p_subn-&amp;gt;node_guid_tbl);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -471,14 +472,19 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void osm_subn_destroy(IN osm_subn_t * const p_subn)
 osm_prtn_delete(&amp;amp;p_prtn);
 }
 
-cl_fmap_remove_all(&amp;amp;p_subn-&amp;gt;mgrp_mgid_tbl);
 
 for (i = 0; i &amp;lt;= p_subn-&amp;gt;max_mcast_lid_ho - IB_LID_MCAST_START_HO;
      i++) {
-p_mgrp = p_subn-&amp;gt;mgroups[i];
-p_subn-&amp;gt;mgroups[i] = NULL;
-if (p_mgrp)
-osm_mgrp_delete(p_mgrp);
+p_mgrp_box = p_subn-&amp;gt;mboxes[i];
+if (p_mgrp_box)
+osm_mgrp_box_delete(p_subn, p_mgrp_box-&amp;gt;mlid);
+}
+
+p_mgrp = (osm_mgrp_t*)cl_fmap_head(&amp;amp;p_subn-&amp;gt;mgrp_mgid_tbl);
+while (p_mgrp != (osm_mgrp_t*)cl_fmap_end(&amp;amp;p_subn-&amp;gt;mgrp_mgid_tbl)) {
+cl_fmap_remove_item(&amp;amp;p_subn-&amp;gt;mgrp_mgid_tbl, (cl_fmap_item_t*)p_mgrp);
+osm_mgrp_delete(p_mgrp);
+p_mgrp = (osm_mgrp_t*)cl_fmap_head(&amp;amp;p_subn-&amp;gt;mgrp_mgid_tbl);
 }
 
 p_next_infr = (osm_infr_t *) cl_qlist_head(&amp;amp;p_subn-&amp;gt;sa_infr_list);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1655,3 +1661,18 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int osm_subn_write_conf_file(char *file_name, IN osm_subn_opt_t *const p_opts)
 
 return 0;
 }
+
+ib_net16_t osm_mgrp_box_get_mlid(IN struct osm_mgrp_box *p_mgrp_box)
+{
+return (p_mgrp_box-&amp;gt;mlid);
+}
+
+ib_net16_t osm_mgrp_box_get_mlid_by_mgid(IN osm_subn_t const *p_subn,
+IN const ib_gid_t * const p_mgid)
+{
+osm_mgrp_t *p_mgrp = (osm_mgrp_t*)cl_fmap_get(&amp;amp;p_subn-&amp;gt;mgrp_mgid_tbl, p_mgid);
+if (p_mgrp != (osm_mgrp_t*)cl_fmap_end(&amp;amp;p_subn-&amp;gt;mgrp_mgid_tbl)) {
+return p_mgrp-&amp;gt;mlid;
+}
+return 0;
+}
&lt;/pre&gt;</description>
    <dc:creator>Slava Strebkov</dc:creator>
    <dc:date>2009-09-29T13:53:18</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.drivers.openib/65551">
    <title>[ofa-general] [PATCHv2] opensm/osm_mesh.c: Add dump_mesh routine atOSM_LOG_DEBUG level</title>
    <link>http://comments.gmane.org/gmane.linux.drivers.openib/65551</link>
    <description>&lt;pre&gt;
Signed-off-by: Hal Rosenstock &amp;lt;hal.rosenstock&amp;lt; at &amp;gt;gmail.com&amp;gt;
---
Changes since v1:
Use snprintf rather than sprintf
Also, moved output of ]

diff --git a/opensm/opensm/osm_mesh.c b/opensm/opensm/osm_mesh.c
index 260e2f8..53f0f58 100644
--- a/opensm/opensm/osm_mesh.c
+++ b/opensm/opensm/osm_mesh.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1565,6 +1565,63 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; err:
 return -1;
 }
 
+static void dump_mesh(lash_t *p_lash)
+{
+osm_log_t *p_log = &amp;amp;p_lash-&amp;gt;p_osm-&amp;gt;log;
+int sw;
+int num_switches = p_lash-&amp;gt;num_switches;
+int dimension;
+int i, j, k, n;
+switch_t *s, *s2;
+char buf[256];
+
+OSM_LOG_ENTER(p_log);
+
+for (sw = 0; sw &amp;lt; num_switches; sw++) {
+s = p_lash-&amp;gt;switches[sw];
+dimension = s-&amp;gt;node-&amp;gt;dimension;
+n = sprintf(buf, "[");
+for (i = 0; i &amp;lt; dimension; i++) {
+n += snprintf(buf + n, sizeof(buf) - n,
+      "%2d", s-&amp;gt;node-&amp;gt;coord[i]);
+if (n &amp;gt; sizeof(buf))
+n = sizeof(buf);
+if (i != dimension - 1) {
+n += snprintf(buf + n, sizeof(buf) - n, "%s", ",");
+if (n &amp;gt; sizeof(buf))
+n = sizeof(buf);
+}
+}
+n += snprintf(buf + n, sizeof(buf) - n, "]");
+if (n &amp;gt; sizeof(buf))
+n = sizeof(buf);
+for (j = 0; j &amp;lt; s-&amp;gt;node-&amp;gt;num_links; j++) {
+s2 = p_lash-&amp;gt;switches[s-&amp;gt;node-&amp;gt;links[j]-&amp;gt;switch_id];
+n += snprintf(buf + n, sizeof(buf) - n, " [%d]-&amp;gt;[", j);
+if (n &amp;gt; sizeof(buf))
+n = sizeof(buf);
+for (k = 0; k &amp;lt; dimension; k++) {
+n += snprintf(buf + n, sizeof(buf) - n, "%2d",
+      s2-&amp;gt;node-&amp;gt;coord[k]);
+if (n &amp;gt; sizeof(buf))
+n = sizeof(buf);
+if (k != dimension - 1) {
+n += snprintf(buf + n, sizeof(buf) - n,
+      ",");
+if (n &amp;gt; sizeof(buf))
+n = sizeof(buf);
+}
+}
+n += snprintf(buf + n, sizeof(buf) - n, "]");
+if (n &amp;gt; sizeof(buf))
+n = sizeof(buf);
+}
+OSM_LOG(p_log, OSM_LOG_DEBUG, "%s\n", buf);
+}
+
+OSM_LOG_EXIT(p_log);
+}
+
 /*
  * osm_do_mesh_analysis
  */
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1653,6 +1710,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int osm_do_mesh_analysis(lash_t *p_lash)
 OSM_LOG(p_log, OSM_LOG_INFO, "%s", buf);
 }
 
+if (osm_log_is_active(p_log, OSM_LOG_DEBUG))
+dump_mesh(p_lash);
+
 done:
 mesh_delete(mesh);
 OSM_LOG_EXIT(p_log);
&lt;/pre&gt;</description>
    <dc:creator>Hal Rosenstock</dc:creator>
    <dc:date>2009-09-29T10:53:02</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.drivers.openib/65550">
    <title>[ofa-general] ofa_1_5_kernel 20090929-0200 daily build status</title>
    <link>http://comments.gmane.org/gmane.linux.drivers.openib/65550</link>
    <description>&lt;pre&gt;This email was generated automatically, please do not reply


git_url: git://git.openfabrics.org/ofed_1_5/linux-2.6.git
git_branch: ofed_kernel_1_5

Common build parameters: 

Passed:
Passed on i686 with linux-2.6.18
Passed on i686 with linux-2.6.19
Passed on i686 with linux-2.6.21.1
Passed on i686 with linux-2.6.26
Passed on i686 with linux-2.6.24
Passed on i686 with linux-2.6.22
Passed on i686 with linux-2.6.27
Passed on x86_64 with linux-2.6.16.60-0.21-smp
Passed on x86_64 with linux-2.6.18
Passed on x86_64 with linux-2.6.18-164.el5
Passed on x86_64 with linux-2.6.18-128.el5
Passed on x86_64 with linux-2.6.18-93.el5
Passed on x86_64 with linux-2.6.19
Passed on x86_64 with linux-2.6.20
Passed on x86_64 with linux-2.6.21.1
Passed on x86_64 with linux-2.6.24
Passed on x86_64 with linux-2.6.22
Passed on x86_64 with linux-2.6.25
Passed on x86_64 with linux-2.6.26
Passed on x86_64 with linux-2.6.27
Passed on x86_64 with linux-2.6.9-67.ELsmp
Passed on x86_64 with linux-2.6.9-78.ELsmp
Passed on ia64 with linux-2.6.18
Passed on ia64 with linux-2.6.21.1
Passed on ia64 with linux-2.6.19
Passed on ia64 with linux-2.6.24
Passed on ia64 with linux-2.6.23
Passed on ia64 with linux-2.6.22
Passed on ia64 with linux-2.6.26
Passed on ia64 with linux-2.6.25
Passed on ppc64 with linux-2.6.18
Passed on ppc64 with linux-2.6.19

Failed:
&lt;/pre&gt;</description>
    <dc:creator>Vladimir Sokolovsky (Mellanox</dc:creator>
    <dc:date>2009-09-29T10:16:49</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.drivers.openib/65548">
    <title>[ofa-general] Ib_iser error with OFED 1.5.1 and centos 5.3</title>
    <link>http://comments.gmane.org/gmane.linux.drivers.openib/65548</link>
    <description>&lt;pre&gt;&lt;/pre&gt;</description>
    <dc:creator>Chris</dc:creator>
    <dc:date>2009-09-29T04:56:27</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.drivers.openib/65547">
    <title>[ofa-general] help install ofed 1.4 on Centos 5.2</title>
    <link>http://comments.gmane.org/gmane.linux.drivers.openib/65547</link>
    <description>&lt;pre&gt;&lt;/pre&gt;</description>
    <dc:creator>chris</dc:creator>
    <dc:date>2009-09-29T03:33:12</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.drivers.openib/65545">
    <title>[ofa-general] [PATCH 3/3] uDAPL v2: scm: tighten up socket options to insure similiar behavior on Windows and Linux.</title>
    <link>http://comments.gmane.org/gmane.linux.drivers.openib/65545</link>
    <description>&lt;pre&gt;
Add IPPROTO_TCP to create socket. Specify device IP address
when binding instead of INADDR_ANY and remove setsocketopt
REUSEADDR on the listen socket to avoid any issues with
portability. Don't want duplicate port bindings.

Signed-off-by: Arlin Davis &amp;lt;arlin.r.davis&amp;lt; at &amp;gt;intel.com&amp;gt;
---
 dapl/openib_scm/cm.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/dapl/openib_scm/cm.c b/dapl/openib_scm/cm.c
index 87f5446..dae1781 100644
--- a/dapl/openib_scm/cm.c
+++ b/dapl/openib_scm/cm.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -531,7 +531,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dapli_socket_connect(DAPL_EP * ep_ptr,
 
 /* create, connect, sockopt, and exchange QP information */
 if ((cm_ptr-&amp;gt;socket =
-     socket(AF_INET, SOCK_STREAM, 0)) == DAPL_INVALID_SOCKET) {
+     socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == DAPL_INVALID_SOCKET) {
 dapl_os_free(cm_ptr, sizeof(*cm_ptr));
 return DAT_INSUFFICIENT_RESOURCES;
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -815,7 +815,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dapli_socket_listen(DAPL_IA * ia_ptr, DAT_CONN_QUAL serviceID, DAPL_SP * sp_ptr)
 {
 struct sockaddr_in addr;
 ib_cm_srvc_handle_t cm_ptr = NULL;
-int opt = 1;
 DAT_RETURN dat_status = DAT_SUCCESS;
 
 dapl_dbg_log(DAPL_DBG_TYPE_EP,
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -831,19 +830,16 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dapli_socket_listen(DAPL_IA * ia_ptr, DAT_CONN_QUAL serviceID, DAPL_SP * sp_ptr)
 
 /* bind, listen, set sockopt, accept, exchange data */
 if ((cm_ptr-&amp;gt;socket =
-     socket(AF_INET, SOCK_STREAM, 0)) == DAPL_INVALID_SOCKET) {
+     socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == DAPL_INVALID_SOCKET) {
 dapl_log(DAPL_DBG_TYPE_ERR, " ERR: listen socket create: %s\n",
  strerror(errno));
 dat_status = DAT_INSUFFICIENT_RESOURCES;
 goto bail;
 }
 
-setsockopt(cm_ptr-&amp;gt;socket, SOL_SOCKET, SO_REUSEADDR,
-   (char *)&amp;amp;opt, sizeof(opt));
-
 addr.sin_port = htons(serviceID);
 addr.sin_family = AF_INET;
-addr.sin_addr.s_addr = INADDR_ANY;
+addr.sin_addr = ((struct sockaddr_in *) &amp;amp;ia_ptr-&amp;gt;hca_ptr-&amp;gt;hca_address)-&amp;gt;sin_addr;
 
 if ((bind(cm_ptr-&amp;gt;socket, (struct sockaddr *)&amp;amp;addr, sizeof(addr)) &amp;lt; 0)
     || (listen(cm_ptr-&amp;gt;socket, 128) &amp;lt; 0)) {
&lt;/pre&gt;</description>
    <dc:creator>Davis, Arlin R</dc:creator>
    <dc:date>2009-09-28T22:08:20</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.drivers.openib/65544">
    <title>[ofa-general] [PATCH 1/3] uDAPL v2: scm: improve serialization ofdestroy and state changes</title>
    <link>http://comments.gmane.org/gmane.linux.drivers.openib/65544</link>
    <description>&lt;pre&gt;
WinOF testing with slightly different scheduler and verbs
showed some issues with cleanup. Add better protection around
destroy and move state change before socket send to insure
correct state in multi-thread environment targeting the same
device on send and recv.

Change DCM_RTU_PENDING to DCM_REP_PENDING and
and add static definition to local routines for better
readability.

Signed-off-by: Arlin Davis &amp;lt;arlin.r.davis&amp;lt; at &amp;gt;intel.com&amp;gt;
---
 dapl/openib_common/dapl_ib_common.h |    4 +-
 dapl/openib_scm/cm.c                |  125 +++++++++++++++--------------------
 2 files changed, 56 insertions(+), 73 deletions(-)

diff --git a/dapl/openib_common/dapl_ib_common.h b/dapl/openib_common/dapl_ib_common.h
index 3cd8885..671073b 100644
--- a/dapl/openib_common/dapl_ib_common.h
+++ b/dapl/openib_common/dapl_ib_common.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -265,7 +265,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; typedef enum dapl_cm_state
 DCM_INIT,
 DCM_LISTEN,
 DCM_CONN_PENDING,
-DCM_RTU_PENDING,
+DCM_REP_PENDING,
 DCM_ACCEPTING,
 DCM_ACCEPTING_DATA,
 DCM_ACCEPTED,
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -356,7 +356,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; STATIC _INLINE_ char * dapl_cm_state_str(IN int st)
 "CM_INIT",
 "CM_LISTEN",
 "CM_CONN_PENDING",
-"CM_RTU_PENDING",
+"CM_REP_PENDING",
 "CM_ACCEPTING",
 "CM_ACCEPTING_DATA",
 "CM_ACCEPTED",
diff --git a/dapl/openib_scm/cm.c b/dapl/openib_scm/cm.c
index 2403918..87f5446 100644
--- a/dapl/openib_scm/cm.c
+++ b/dapl/openib_scm/cm.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -46,6 +46,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
  *
  **************************************************************************/
 
+#if defined(_WIN32)
+#define FD_SETSIZE 1024
+#define DAPL_FD_SETSIZE FD_SETSIZE
+#endif
+
 #include "dapl.h"
 #include "dapl_adapter_util.h"
 #include "dapl_evd_util.h"
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -314,12 +319,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void dapls_ib_cm_free(dp_ib_cm_handle_t cm_ptr, DAPL_EP *ep)
 cm_ptr-&amp;gt;ep = NULL;
 }
 
-/* close socket if still active */
-if (cm_ptr-&amp;gt;socket != DAPL_INVALID_SOCKET) {
-shutdown(cm_ptr-&amp;gt;socket, SHUT_RDWR);
-closesocket(cm_ptr-&amp;gt;socket);
-cm_ptr-&amp;gt;socket = DAPL_INVALID_SOCKET;
-}
 dapl_os_unlock(&amp;amp;cm_ptr-&amp;gt;lock);
 goto notify_thread;
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -404,25 +403,15 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; DAT_RETURN dapli_socket_disconnect(dp_ib_cm_handle_t cm_ptr)
 return DAT_SUCCESS;
 
 dapl_os_lock(&amp;amp;cm_ptr-&amp;gt;lock);
-if ((cm_ptr-&amp;gt;state == DCM_INIT) ||
-    (cm_ptr-&amp;gt;state == DCM_DISCONNECTED) ||
-    (cm_ptr-&amp;gt;state == DCM_DESTROY)) {
+if (cm_ptr-&amp;gt;state != DCM_CONNECTED) {
 dapl_os_unlock(&amp;amp;cm_ptr-&amp;gt;lock);
 return DAT_SUCCESS;
-} else {
-/* send disc date, close socket, schedule destroy */
-if (cm_ptr-&amp;gt;socket != DAPL_INVALID_SOCKET) {
-if (send(cm_ptr-&amp;gt;socket, (char *)&amp;amp;disc_data,
- sizeof(disc_data), 0) == -1)
-dapl_log(DAPL_DBG_TYPE_WARN,
- " cm_disc: write error = %s\n",
- strerror(errno));
-shutdown(cm_ptr-&amp;gt;socket, SHUT_RDWR);
-closesocket(cm_ptr-&amp;gt;socket);
-cm_ptr-&amp;gt;socket = DAPL_INVALID_SOCKET;
-}
-cm_ptr-&amp;gt;state = DCM_DISCONNECTED;
 }
+
+/* send disc date, close socket, schedule destroy */
+dapls_modify_qp_state(ep_ptr-&amp;gt;qp_handle, IBV_QPS_ERR, 0,0,0);
+cm_ptr-&amp;gt;state = DCM_DISCONNECTED;
+send(cm_ptr-&amp;gt;socket, (char *)&amp;amp;disc_data, sizeof(disc_data), 0);
 dapl_os_unlock(&amp;amp;cm_ptr-&amp;gt;lock);
 
 /* disconnect events for RC's only */
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -472,6 +461,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void dapli_socket_connected(dp_ib_cm_handle_t cm_ptr, int err)
 dapl_log(DAPL_DBG_TYPE_WARN,
  " CONN_PENDING: NODELAY setsockopt: %s\n",
  strerror(errno));
+
+cm_ptr-&amp;gt;state = DCM_REP_PENDING;
 
 /* send qp info and pdata to remote peer */
 exp = sizeof(ib_cm_msg_t) - DCM_MAX_PDATA_SIZE;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -509,9 +500,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void dapli_socket_connected(dp_ib_cm_handle_t cm_ptr, int err)
      htonll(cm_ptr-&amp;gt;msg.saddr.ib.gid.global.subnet_prefix),
      (unsigned long long)
      htonll(cm_ptr-&amp;gt;msg.saddr.ib.gid.global.interface_id));
-
-/* queue up to work thread to avoid blocking consumer */
-cm_ptr-&amp;gt;state = DCM_RTU_PENDING;
 return;
 
 bail:
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -745,14 +733,14 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void dapli_socket_connect_rtu(dp_ib_cm_handle_t cm_ptr)
 dapl_dbg_log(DAPL_DBG_TYPE_EP, " connect_rtu: send RTU\n");
 
 /* complete handshake after final QP state change, Just ver+op */
+cm_ptr-&amp;gt;state = DCM_CONNECTED;
 cm_ptr-&amp;gt;msg.op = ntohs(DCM_RTU);
 if (send(cm_ptr-&amp;gt;socket, (char *)&amp;amp;cm_ptr-&amp;gt;msg, 4, 0) == -1) {
 dapl_log(DAPL_DBG_TYPE_ERR,
  " CONN_RTU: write error = %s\n", strerror(errno));
 goto bail;
 }
-/* init cm_handle and post the event with private data */
-cm_ptr-&amp;gt;state = DCM_CONNECTED;
+/* post the event with private data */
 event = IB_CME_CONNECTED;
 dapl_dbg_log(DAPL_DBG_TYPE_EP, " ACTIVE: connected!\n");
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -807,9 +795,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; ud_bail:
 #endif
 {
 ep_ptr-&amp;gt;cm_handle = cm_ptr; /* only RC, multi CR's on UD */
-dapl_evd_connection_callback(cm_ptr,
-     event,
-     cm_ptr-&amp;gt;msg.p_data, ep_ptr);
+dapl_evd_connection_callback(cm_ptr, event, cm_ptr-&amp;gt;msg.p_data, ep_ptr);
 }
 return;
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -883,7 +869,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dapli_socket_listen(DAPL_IA * ia_ptr, DAT_CONN_QUAL serviceID, DAPL_SP * sp_ptr)
      ntohs(serviceID), cm_ptr, cm_ptr-&amp;gt;socket);
 
 return dat_status;
-      bail:
+bail:
 dapl_dbg_log(DAPL_DBG_TYPE_CM,
      " listen: ERROR on conn_qual 0x%x\n", serviceID);
 dapls_ib_cm_free(cm_ptr, cm_ptr-&amp;gt;ep);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1026,7 +1012,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; bail:
  * queue on work thread to receive RTU information to avoid blocking
  * user thread. 
  */
-DAT_RETURN
+static DAT_RETURN
 dapli_socket_accept_usr(DAPL_EP * ep_ptr,
 DAPL_CR * cr_ptr, DAT_COUNT p_size, DAT_PVOID p_data)
 {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1108,10 +1094,14 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dapli_socket_accept_usr(DAPL_EP * ep_ptr,
 local.daddr.so = ia_ptr-&amp;gt;hca_ptr-&amp;gt;hca_address;
 ((struct sockaddr_in *)&amp;amp;local.daddr.so)-&amp;gt;sin_port = 
 htons((uint16_t)cm_ptr-&amp;gt;sp-&amp;gt;conn_qual);
+cm_ptr-&amp;gt;ep = ep_ptr;
+cm_ptr-&amp;gt;hca = ia_ptr-&amp;gt;hca_ptr;
+cm_ptr-&amp;gt;state = DCM_ACCEPTED;
 
 local.p_size = htons(p_size);
 iov[0].iov_base = (void *)&amp;amp;local;
 iov[0].iov_len = exp;
+
 if (p_size) {
 iov[1].iov_base = p_data;
 iov[1].iov_len = p_size;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1139,14 +1129,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dapli_socket_accept_usr(DAPL_EP * ep_ptr,
      (unsigned long long)
      htonll(local.saddr.ib.gid.global.interface_id));
 
-/* save state and reference to EP, queue for RTU data */
-cm_ptr-&amp;gt;ep = ep_ptr;
-cm_ptr-&amp;gt;hca = ia_ptr-&amp;gt;hca_ptr;
-cm_ptr-&amp;gt;state = DCM_ACCEPTED;
-
 dapl_dbg_log(DAPL_DBG_TYPE_EP, " PASSIVE: accepted!\n");
 return DAT_SUCCESS;
-      bail:
+bail:
 dapls_ib_cm_free(cm_ptr, cm_ptr-&amp;gt;ep);
 dapls_modify_qp_state(ep_ptr-&amp;gt;qp_handle, IBV_QPS_ERR, 0, 0, 0);
 return DAT_INTERNAL_ERROR;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1155,7 +1140,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dapli_socket_accept_usr(DAPL_EP * ep_ptr,
 /*
  * PASSIVE: read RTU from active peer, post CONN event
  */
-void dapli_socket_accept_rtu(dp_ib_cm_handle_t cm_ptr)
+static void dapli_socket_accept_rtu(dp_ib_cm_handle_t cm_ptr)
 {
 int len;
 ib_cm_events_t event = IB_CME_CONNECTED;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1221,8 +1206,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void dapli_socket_accept_rtu(dp_ib_cm_handle_t cm_ptr)
                 closesocket(cm_ptr-&amp;gt;socket);
                 cm_ptr-&amp;gt;socket = DAPL_INVALID_SOCKET;
 cm_ptr-&amp;gt;state = DCM_RELEASED;
-} else {
+} else 
 #endif
+{
 cm_ptr-&amp;gt;ep-&amp;gt;cm_handle = cm_ptr; /* only RC, multi CR's on UD */
 dapls_cr_callback(cm_ptr, event, NULL, cm_ptr-&amp;gt;sp);
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1399,19 +1385,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dapls_ib_remove_conn_listener(IN DAPL_IA * ia_ptr, IN DAPL_SP * sp_ptr)
 
 /* close accepted socket, free cm_srvc_handle and return */
 if (cm_ptr != NULL) {
-if (cm_ptr-&amp;gt;socket != DAPL_INVALID_SOCKET) {
-shutdown(cm_ptr-&amp;gt;socket, SHUT_RDWR);
-closesocket(cm_ptr-&amp;gt;socket);
-cm_ptr-&amp;gt;socket = DAPL_INVALID_SOCKET;
-}
 /* cr_thread will free */
+dapl_os_lock(&amp;amp;cm_ptr-&amp;gt;lock);
 cm_ptr-&amp;gt;state = DCM_DESTROY;
 sp_ptr-&amp;gt;cm_srvc_handle = NULL;
-if (send(cm_ptr-&amp;gt;hca-&amp;gt;ib_trans.scm[1], 
- "w", sizeof "w", 0) == -1)
-dapl_log(DAPL_DBG_TYPE_CM,
- " cm_destroy: thread wakeup error = %s\n",
- strerror(errno));
+send(cm_ptr-&amp;gt;hca-&amp;gt;ib_trans.scm[1], "w", sizeof "w", 0);
+dapl_os_unlock(&amp;amp;cm_ptr-&amp;gt;lock);
 }
 return DAT_SUCCESS;
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1492,29 +1471,26 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dapls_ib_reject_connection(IN dp_ib_cm_handle_t cm_ptr,
         if (psize &amp;gt; DCM_MAX_PDATA_SIZE)
                 return DAT_LENGTH_ERROR;
 
-/* write reject data to indicate reject */
-if (cm_ptr-&amp;gt;socket != DAPL_INVALID_SOCKET) {
-cm_ptr-&amp;gt;msg.op = htons(DCM_REJ_USER);
-cm_ptr-&amp;gt;msg.p_size = htons(psize);
-
-iov[0].iov_base = (void *)&amp;amp;cm_ptr-&amp;gt;msg;
-iov[0].iov_len = sizeof(ib_cm_msg_t) - DCM_MAX_PDATA_SIZE;
-if (psize) {
-iov[1].iov_base = pdata;
-iov[1].iov_len = psize;
-writev(cm_ptr-&amp;gt;socket, iov, 2);
-} else {
-writev(cm_ptr-&amp;gt;socket, iov, 1);
-}
+dapl_os_lock(&amp;amp;cm_ptr-&amp;gt;lock);
 
-shutdown(cm_ptr-&amp;gt;socket, SHUT_RDWR);
-closesocket(cm_ptr-&amp;gt;socket);
-cm_ptr-&amp;gt;socket = DAPL_INVALID_SOCKET;
+/* write reject data to indicate reject */
+cm_ptr-&amp;gt;msg.op = htons(DCM_REJ_USER);
+cm_ptr-&amp;gt;msg.p_size = htons(psize);
+
+iov[0].iov_base = (void *)&amp;amp;cm_ptr-&amp;gt;msg;
+iov[0].iov_len = sizeof(ib_cm_msg_t) - DCM_MAX_PDATA_SIZE;
+if (psize) {
+iov[1].iov_base = pdata;
+iov[1].iov_len = psize;
+writev(cm_ptr-&amp;gt;socket, iov, 2);
+} else {
+writev(cm_ptr-&amp;gt;socket, iov, 1);
 }
 
 /* cr_thread will destroy CR */
 cm_ptr-&amp;gt;state = DCM_DESTROY;
 send(cm_ptr-&amp;gt;hca-&amp;gt;ib_trans.scm[1], "w", sizeof "w", 0);
+dapl_os_unlock(&amp;amp;cm_ptr-&amp;gt;lock);
 return DAT_SUCCESS;
 }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1734,19 +1710,25 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void cr_thread(void *arg)
 next_cr = dapl_llist_next_entry(&amp;amp;hca_ptr-&amp;gt;ib_trans.list,
 (DAPL_LLIST_ENTRY *) &amp;amp;
 cr-&amp;gt;entry);
+dapl_os_lock(&amp;amp;cr-&amp;gt;lock);
 if (cr-&amp;gt;state == DCM_DESTROY
     || hca_ptr-&amp;gt;ib_trans.cr_state != IB_THREAD_RUN) {
+dapl_os_unlock(&amp;amp;cr-&amp;gt;lock);
 dapl_llist_remove_entry(&amp;amp;hca_ptr-&amp;gt;ib_trans.list,
 (DAPL_LLIST_ENTRY *) &amp;amp;
 cr-&amp;gt;entry);
 dapl_dbg_log(DAPL_DBG_TYPE_CM, 
      " CR FREE: %p ep=%p st=%d sock=%d\n", 
      cr, cr-&amp;gt;ep, cr-&amp;gt;state, cr-&amp;gt;socket);
+shutdown(cr-&amp;gt;socket, SHUT_RDWR);
+closesocket(cr-&amp;gt;socket);
 dapl_os_free(cr, sizeof(*cr));
 continue;
 }
-if (cr-&amp;gt;socket == DAPL_INVALID_SOCKET) 
+if (cr-&amp;gt;socket == DAPL_INVALID_SOCKET) {
+dapl_os_unlock(&amp;amp;cr-&amp;gt;lock);
 continue;
+}
 
 event = (cr-&amp;gt;state == DCM_CONN_PENDING) ?
 DAPL_FD_WRITE : DAPL_FD_READ;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1757,10 +1739,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void cr_thread(void *arg)
  " -&amp;gt; %s\n", cr-&amp;gt;state, cr-&amp;gt;socket,
  inet_ntoa(((struct sockaddr_in *)
 &amp;amp;cr-&amp;gt;msg.daddr.so)-&amp;gt;sin_addr));
+dapl_os_unlock(&amp;amp;cr-&amp;gt;lock);
 dapls_ib_cm_free(cr, cr-&amp;gt;ep);
 continue;
 }
-
+dapl_os_unlock(&amp;amp;cr-&amp;gt;lock);
 dapl_dbg_log(DAPL_DBG_TYPE_CM,
      " poll cr=%p, sck=%d\n", cr, cr-&amp;gt;socket);
 dapl_os_unlock(&amp;amp;hca_ptr-&amp;gt;ib_trans.lock);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1784,7 +1767,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void cr_thread(void *arg)
 case DCM_ACCEPTED:
 dapli_socket_accept_rtu(cr);
 break;
-case DCM_RTU_PENDING:
+case DCM_REP_PENDING:
 dapli_socket_connect_rtu(cr);
 break;
 case DCM_CONNECTED:
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1846,7 +1829,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void cr_thread(void *arg)
 
 dapl_os_unlock(&amp;amp;hca_ptr-&amp;gt;ib_trans.lock);
 dapl_os_free(set, sizeof(struct dapl_fd_set));
-      out:
+out:
 hca_ptr-&amp;gt;ib_trans.cr_state = IB_THREAD_EXIT;
 dapl_dbg_log(DAPL_DBG_TYPE_UTIL, " cr_thread(hca %p) exit\n", hca_ptr);
 }
&lt;/pre&gt;</description>
    <dc:creator>Arlin Davis</dc:creator>
    <dc:date>2009-09-28T22:08:10</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.drivers.openib/65542">
    <title>[ofa-general] srp availability in OFED1.5</title>
    <link>http://comments.gmane.org/gmane.linux.drivers.openib/65542</link>
    <description>&lt;pre&gt;Will the srp module be included in the OFED 1.5 release?  If so, when?

&lt;/pre&gt;</description>
    <dc:creator>Hoot Thompson</dc:creator>
    <dc:date>2009-09-28T11:16:42</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.drivers.openib/65536">
    <title>[ofa-general] update problems after 1.5-daily install on CentOS 5.3</title>
    <link>http://comments.gmane.org/gmane.linux.drivers.openib/65536</link>
    <description>&lt;pre&gt;&lt;/pre&gt;</description>
    <dc:creator>viktor&lt; at &gt;viktormauch.de</dc:creator>
    <dc:date>2009-09-28T15:08:03</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.drivers.openib/65531">
    <title>[ofa-general] Srp in OFED 1.5</title>
    <link>http://comments.gmane.org/gmane.linux.drivers.openib/65531</link>
    <description>&lt;pre&gt;Will the srp module be available in the OFED 1.5 release?  If so, when?


&lt;/pre&gt;</description>
    <dc:creator>Hoot Thompson</dc:creator>
    <dc:date>2009-09-28T11:35:28</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.drivers.openib/65530">
    <title>[ofa-general] ofa_1_5_kernel 20090928-0200 daily build status</title>
    <link>http://comments.gmane.org/gmane.linux.drivers.openib/65530</link>
    <description>&lt;pre&gt;This email was generated automatically, please do not reply


git_url: git://git.openfabrics.org/ofed_1_5/linux-2.6.git
git_branch: ofed_kernel_1_5

Common build parameters: 

Passed:
Passed on i686 with linux-2.6.18
Passed on i686 with linux-2.6.21.1
Passed on i686 with linux-2.6.19
Passed on i686 with linux-2.6.26
Passed on i686 with linux-2.6.24
Passed on i686 with linux-2.6.22
Passed on i686 with linux-2.6.27
Passed on x86_64 with linux-2.6.16.60-0.21-smp
Passed on x86_64 with linux-2.6.18
Passed on x86_64 with linux-2.6.18-164.el5
Passed on x86_64 with linux-2.6.18-128.el5
Passed on x86_64 with linux-2.6.18-93.el5
Passed on x86_64 with linux-2.6.19
Passed on x86_64 with linux-2.6.21.1
Passed on x86_64 with linux-2.6.20
Passed on x86_64 with linux-2.6.24
Passed on x86_64 with linux-2.6.22
Passed on x86_64 with linux-2.6.25
Passed on x86_64 with linux-2.6.26
Passed on x86_64 with linux-2.6.27
Passed on x86_64 with linux-2.6.9-78.ELsmp
Passed on x86_64 with linux-2.6.9-67.ELsmp
Passed on ia64 with linux-2.6.21.1
Passed on ia64 with linux-2.6.18
Passed on ia64 with linux-2.6.19
Passed on ia64 with linux-2.6.23
Passed on ia64 with linux-2.6.24
Passed on ia64 with linux-2.6.22
Passed on ia64 with linux-2.6.26
Passed on ia64 with linux-2.6.25
Passed on ppc64 with linux-2.6.18
Passed on ppc64 with linux-2.6.19

Failed:
&lt;/pre&gt;</description>
    <dc:creator>Vladimir Sokolovsky (Mellanox</dc:creator>
    <dc:date>2009-09-28T10:08:47</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.drivers.openib/65526">
    <title>[ofa-general] help install ofed 1.4 on Centos 5.2</title>
    <link>http://comments.gmane.org/gmane.linux.drivers.openib/65526</link>
    <description>&lt;pre&gt;&lt;/pre&gt;</description>
    <dc:creator>chris</dc:creator>
    <dc:date>2009-09-27T20:42:40</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.drivers.openib/65523">
    <title>[ofa-general] ofa_1_5_kernel 20090927-0200 daily build status</title>
    <link>http://comments.gmane.org/gmane.linux.drivers.openib/65523</link>
    <description>&lt;pre&gt;This email was generated automatically, please do not reply


git_url: git://git.openfabrics.org/ofed_1_5/linux-2.6.git
git_branch: ofed_kernel_1_5

Common build parameters: 

Passed:
Passed on i686 with linux-2.6.18
Passed on i686 with linux-2.6.19
Passed on i686 with linux-2.6.21.1
Passed on i686 with linux-2.6.24
Passed on i686 with linux-2.6.26
Passed on i686 with linux-2.6.22
Passed on i686 with linux-2.6.27
Passed on x86_64 with linux-2.6.16.60-0.21-smp
Passed on x86_64 with linux-2.6.18
Passed on x86_64 with linux-2.6.18-164.el5
Passed on x86_64 with linux-2.6.18-128.el5
Passed on x86_64 with linux-2.6.18-93.el5
Passed on x86_64 with linux-2.6.19
Passed on x86_64 with linux-2.6.21.1
Passed on x86_64 with linux-2.6.20
Passed on x86_64 with linux-2.6.24
Passed on x86_64 with linux-2.6.25
Passed on x86_64 with linux-2.6.22
Passed on x86_64 with linux-2.6.26
Passed on x86_64 with linux-2.6.27
Passed on x86_64 with linux-2.6.9-78.ELsmp
Passed on x86_64 with linux-2.6.9-67.ELsmp
Passed on ia64 with linux-2.6.21.1
Passed on ia64 with linux-2.6.18
Passed on ia64 with linux-2.6.19
Passed on ia64 with linux-2.6.23
Passed on ia64 with linux-2.6.24
Passed on ia64 with linux-2.6.22
Passed on ia64 with linux-2.6.26
Passed on ia64 with linux-2.6.25
Passed on ppc64 with linux-2.6.18
Passed on ppc64 with linux-2.6.19

Failed:
&lt;/pre&gt;</description>
    <dc:creator>Vladimir Sokolovsky (Mellanox</dc:creator>
    <dc:date>2009-09-27T10:09:20</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.drivers.openib/65522">
    <title>[ofa-general] [PATCH] infiniband-diags/perfquery.c: Fix extendedcounter reset mask</title>
    <link>http://comments.gmane.org/gmane.linux.drivers.openib/65522</link>
    <description>&lt;pre&gt;
to not have any bits on for reserved components

Signed-off-by: Hal Rosenstock &amp;lt;hal.rosenstock&amp;lt; at &amp;gt;gmail.com&amp;gt;
---
diff --git a/infiniband-diags/src/perfquery.c b/infiniband-diags/src/perfquery.c
index d70af9e..5d4046b 100644
--- a/infiniband-diags/src/perfquery.c
+++ b/infiniband-diags/src/perfquery.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -91,6 +91,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; struct perf_count perf_count =
     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
 struct perf_count_ext perf_count_ext = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
 
+int not_def_mask = 0;
+
 #define ALL_PORTS 0xFF
 
 /* Notes: IB semantics is to cap counters if count has exceeded limits.
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -337,8 +339,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void reset_counters(int extended, int timeout, int mask,
    IB_GSI_PORT_COUNTERS, srcport))
 IBERROR("perf reset");
 } else {
-if (!performance_reset_via(pc, portid, port, mask, timeout,
-   IB_GSI_PORT_COUNTERS_EXT, srcport))
+if (!performance_reset_via(pc, portid, port,
+   not_def_mask ? mask : mask &amp;amp; 0xff,
+   timeout, IB_GSI_PORT_COUNTERS_EXT,
+   srcport))
 IBERROR("perf ext reset");
 }
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -476,8 +480,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; int main(int argc, char **argv)
 
 if (argc &amp;gt; 1)
 port = strtoul(argv[1], 0, 0);
-if (argc &amp;gt; 2)
+if (argc &amp;gt; 2) {
 mask = strtoul(argv[2], 0, 0);
+not_def_mask = 1;
+}
 
 srcport = mad_rpc_open_port(ibd_ca, ibd_ca_port, mgmt_classes, 4);
 if (!srcport)
&lt;/pre&gt;</description>
    <dc:creator>Hal Rosenstock</dc:creator>
    <dc:date>2009-09-26T21:17:26</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.drivers.openib/65521">
    <title>[ofa-general] [Bug 14235] New: SRP initiator lockup</title>
    <link>http://comments.gmane.org/gmane.linux.drivers.openib/65521</link>
    <description>&lt;pre&gt;http://bugzilla.kernel.org/show_bug.cgi?id=14235

           Summary: SRP initiator lockup
           Product: Drivers
           Version: 2.5
          Platform: All
        OS/Version: Linux
              Tree: Mainline
            Status: NEW
          Severity: high
          Priority: P1
         Component: Infiniband/RDMA
        AssignedTo: drivers_infiniband-rdma&amp;lt; at &amp;gt;kernel-bugs.osdl.org
        ReportedBy: bart.vanassche&amp;lt; at &amp;gt;gmail.com
        Regression: No


If an SRP target processes SRP I/O slow enough, the SRP initiator locks up.
This issue is 100% reproducible with the following setup:

Target:
* Kernel 2.6.30.4 with SCST patches applied and kernel debugging enabled.
* SCST r1153 with EXTRA_CFLAGS += -DCONFIG_SCST_TRACING -DCONFIG_SCST_DEBUG -g
added in srpt/src/Makefile and with EXTRA_CFLAGS += -DCONFIG_SCST_TRACING added
in scst/src/Makefile.
* ib_srpt loaded with kernel module parameters thread=0 and
processing_delay_in_us=500.

Initiator:
* Kernel 2.6.31.1 with kernel debugging enabled.
* SRP login has been performed as follows: rmmod ib_srp; modprobe ib_srp;
ibsrpdm -c | while read target_info; do echo "${target_info}"; echo
"${target_info}" &amp;gt; /sys/class/infiniband_srp/srp-mlx4_0-1/add_target; done
* After SRP login succeeded the following fio command was started:
fio --rw=rw --bs=64M --rwmixread=100 --numjobs=1 --iodepth=1 --sync=0
--direct=1 --ioengine=sync --filename=/dev/${srp_initiator_device} --name=test
--loops=1000 --runtime=600 --size=2G

After a few minutes fio locked up (I/O rate dropped from 1500 MB/s to 0 MB/s)
and the following kernel message started appearing periodically:

INFO: task fio:6389 blocked for more than 120 seconds.
"echo 0 &amp;gt; /proc/sys/kernel/hung_task_timeout_secs" disables this message.
fio           D 0000000000000000     0  6389   6388 0x00000000
 ffff880071dc5bd8 0000000000000046 ffff880071dc5b08 000000018107764d
 0000000000012cc0 000000000000de20 0000000000000001 ffff880070cd8000
 ffff880070cd83b0 0000000100000000 000000010001193e ffff88007fb99050
Call Trace:
 [&amp;lt;ffffffff812ec5e5&amp;gt;] ? _spin_unlock_irqrestore+0x65/0x80
 [&amp;lt;ffffffff812e9b37&amp;gt;] io_schedule+0x37/0x50
 [&amp;lt;ffffffff8110cff2&amp;gt;] __blockdev_direct_IO+0x692/0xd80
 [&amp;lt;ffffffff810e0357&amp;gt;] ? get_super+0x27/0xc0
 [&amp;lt;ffffffff8110b169&amp;gt;] blkdev_direct_IO+0x49/0x50
 [&amp;lt;ffffffff8110a1f0&amp;gt;] ? blkdev_get_blocks+0x0/0xc0
 [&amp;lt;ffffffff810a1799&amp;gt;] generic_file_aio_read+0x679/0x690
 [&amp;lt;ffffffff810dc35a&amp;gt;] ? __dentry_open+0x13a/0x340
 [&amp;lt;ffffffff810de091&amp;gt;] do_sync_read+0xf1/0x140
 [&amp;lt;ffffffff810775ed&amp;gt;] ? trace_hardirqs_on_caller+0x14d/0x1a0
 [&amp;lt;ffffffff810662f0&amp;gt;] ? autoremove_wake_function+0x0/0x40
 [&amp;lt;ffffffff810775ed&amp;gt;] ? trace_hardirqs_on_caller+0x14d/0x1a0
 [&amp;lt;ffffffff8107764d&amp;gt;] ? trace_hardirqs_on+0xd/0x10
 [&amp;lt;ffffffff810ded28&amp;gt;] vfs_read+0xc8/0x180
 [&amp;lt;ffffffff810deed0&amp;gt;] sys_read+0x50/0x90
 [&amp;lt;ffffffff8100be6b&amp;gt;] system_call_fastpath+0x16/0x1b
no locks held by fio/6389.

&lt;/pre&gt;</description>
    <dc:creator>bugzilla-daemon&lt; at &gt;bugzilla.kernel.org</dc:creator>
    <dc:date>2009-09-26T14:54:37</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.drivers.openib/65520">
    <title>[ofa-general] ofa_1_5_kernel 20090926-0200 daily build status</title>
    <link>http://comments.gmane.org/gmane.linux.drivers.openib/65520</link>
    <description>&lt;pre&gt;This email was generated automatically, please do not reply


git_url: git://git.openfabrics.org/ofed_1_5/linux-2.6.git
git_branch: ofed_kernel_1_5

Common build parameters: 

Passed:
Passed on i686 with linux-2.6.21.1
Passed on i686 with linux-2.6.19
Passed on i686 with linux-2.6.18
Passed on i686 with linux-2.6.26
Passed on i686 with linux-2.6.24
Passed on i686 with linux-2.6.22
Passed on i686 with linux-2.6.27
Passed on x86_64 with linux-2.6.16.60-0.21-smp
Passed on x86_64 with linux-2.6.18
Passed on x86_64 with linux-2.6.18-164.el5
Passed on x86_64 with linux-2.6.18-128.el5
Passed on x86_64 with linux-2.6.18-93.el5
Passed on x86_64 with linux-2.6.19
Passed on x86_64 with linux-2.6.21.1
Passed on x86_64 with linux-2.6.20
Passed on x86_64 with linux-2.6.24
Passed on x86_64 with linux-2.6.25
Passed on x86_64 with linux-2.6.22
Passed on x86_64 with linux-2.6.26
Passed on x86_64 with linux-2.6.27
Passed on x86_64 with linux-2.6.9-78.ELsmp
Passed on x86_64 with linux-2.6.9-67.ELsmp
Passed on ia64 with linux-2.6.19
Passed on ia64 with linux-2.6.18
Passed on ia64 with linux-2.6.21.1
Passed on ia64 with linux-2.6.23
Passed on ia64 with linux-2.6.24
Passed on ia64 with linux-2.6.22
Passed on ia64 with linux-2.6.26
Passed on ia64 with linux-2.6.25
Passed on ppc64 with linux-2.6.18
Passed on ppc64 with linux-2.6.19

Failed:
&lt;/pre&gt;</description>
    <dc:creator>Vladimir Sokolovsky (Mellanox</dc:creator>
    <dc:date>2009-09-26T10:07:02</dc:date>
  </item>
  <textinput rdf:about="http://search.gmane.org/?group=$group=gmane.linux.drivers.openib">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.linux.drivers.openib</link>
  </textinput>
</rdf:RDF>

