diff mbox

opensm: Proper mfttop initialization when starting/restarting

Message ID 4D8D1161.7020900@dev.mellanox.co.il (mailing list archive)
State Accepted
Delegated to: Alex Netes
Headers show

Commit Message

Hal Rosenstock March 25, 2011, 10:04 p.m. UTC
None
diff mbox

Patch

diff --git a/opensm/include/opensm/osm_sm.h b/opensm/include/opensm/osm_sm.h
index 50e0dd9..dae68da 100644
--- a/opensm/include/opensm/osm_sm.h
+++ b/opensm/include/opensm/osm_sm.h
@@ -126,6 +126,7 @@  typedef struct osm_sm {
      cl_dispatcher_t *p_disp;
      cl_plock_t *p_lock;
      atomic32_t sm_trans_id;
+    uint16_t mlids_init_max;
      unsigned mlids_req_max;
      uint8_t *mlids_req;
      osm_sm_mad_ctrl_t mad_ctrl;
diff --git a/opensm/opensm/osm_mcast_mgr.c b/opensm/opensm/osm_mcast_mgr.c
index bdfef40..a023ae2 100644
--- a/opensm/opensm/osm_mcast_mgr.c
+++ b/opensm/opensm/osm_mcast_mgr.c
@@ -1,6 +1,6 @@ 
  /*
   * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
   * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
   * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
   * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
@@ -1022,7 +1022,7 @@  static void mcast_mgr_set_mfttop(IN osm_sm_t * sm, 
IN osm_switch_t * p_sw)
      osm_madw_context_t context;
      ib_api_status_t status;
      ib_switch_info_t si;
-    uint16_t mcast_top;
+    ib_net16_t mcast_top;

      OSM_LOG_ENTER(sm->p_log);

@@ -1041,11 +1041,15 @@  static void mcast_mgr_set_mfttop(IN osm_sm_t * 
sm, IN osm_switch_t * p_sw)
             Set the top of the multicast forwarding table.
           */
          si = p_sw->switch_info;
-        if (p_tbl->max_block_in_use == -1)
-            mcast_top = cl_hton16(IB_LID_MCAST_START_HO - 1);
-        else
-            mcast_top = cl_hton16(IB_LID_MCAST_START_HO +
-                          (p_tbl->max_block_in_use + 1) * 
IB_MCAST_BLOCK_SIZE - 1);
+        if (sm->p_subn->first_time_master_sweep == TRUE)
+            mcast_top = cl_hton16(sm->mlids_init_max);
+        else {
+            if (p_tbl->max_block_in_use == -1)
+                mcast_top = cl_hton16(IB_LID_MCAST_START_HO - 1);
+            else
+                mcast_top = cl_hton16(IB_LID_MCAST_START_HO +
+                              (p_tbl->max_block_in_use + 1) * 
IB_MCAST_BLOCK_SIZE - 1);
+        }
          if (mcast_top == si.mcast_top)
              return;

diff --git a/opensm/opensm/osm_sa.c b/opensm/opensm/osm_sa.c
index 92ac3d7..fe40b77 100644
--- a/opensm/opensm/osm_sa.c
+++ b/opensm/opensm/osm_sa.c
@@ -1109,6 +1109,8 @@  int osm_sa_db_file_load(osm_opensm_t * p_osm)
                            well_known);
              if (!p_mgrp)
                  rereg_clients = 1;
+            if (cl_ntoh16(mlid) > p_osm->sm.mlids_init_max)
+                p_osm->sm.mlids_init_max = cl_ntoh16(mlid);
          } else if (p_mgrp && !strncmp(p, "mcm_port", 8)) {
              ib_member_rec_t mcmr;
              ib_net64_t guid;