[ofw] opensm patches

Leonid Keller leonid at mellanox.co.il
Mon Sep 26 09:39:19 PDT 2011


They were to be taken there.
Hal knows better.
I've taken them several days before they went upstream.

From: Smith, Stan [mailto:stan.smith at intel.com]
Sent: Monday, September 26, 2011 7:08 PM
To: Leonid Keller
Cc: ofw_list
Subject: RE: opensm patches

Thank you Leo.
Am I correct in understanding these patches are all in OpenSM 3.3.11 release?
Are there additional FDR related patches elsewhere in the OFED for Windows stack?

Stan.

From: Leonid Keller [mailto:leonid at mellanox.co.il]
Sent: Monday, September 26, 2011 1:22 AM
To: Smith, Stan
Cc: ofw_list
Subject: FDR: opensm patches

Hi Stan,

I did porting of FDR-related opensm patches yet before they went upstream.
I thought, maybe you will find it interesting to look at them.

==================================================================================================
Opensm FDR-related patches, done on base of the following:

[OPENSM] FDR: Changes for FDR and FDR10 support

commit 480de4ae8e75b7cc6fd19f1235b8c7ed974843c0
Author: Hal Rosenstock <hal at dev.mellanox.co.il<mailto:hal at dev.mellanox.co.il>>
Date:   Wed Jul 13 19:37:01 2011 -0400

    opensm: Use forward extensible and safer way to compare mkey_lmc field in PortInfo attribute

    Rather than memcmp'ing the entire field, compare the two fields ignoring the
    reserved field (which may some day be used). This makes SMs coded this
    way better handle such a future spec expansion.

    This change also gets this code closer to supporting M_KeyProtectBits.


commit f999195c2b80a89d70c20295bd876db253ba771c
Author: Hal Rosenstock <hal at dev.mellanox.co.il<mailto:hal at dev.mellanox.co.il>>
Date:   Mon Jul 18 07:45:28 2011 -0400

    OpenSM: Add infrastructure for "full" SM PortInfo and SA PortInfoRecord attributes

    to accomodate IBA extended link speeds

    Also, some other cosmetic changes (formatting, etc.)


commit b8c7632fe0c8be2467bc3063610e528f8bc4daf6
Author: Hal Rosenstock <hal at dev.mellanox.co.il<mailto:hal at dev.mellanox.co.il>>
Date:   Tue Jul 26 08:31:13 2011 -0400

    opensm/osm_[lid pkey]_mgr.c: Remove no longer needed memset

    at the end of PortInfo as PortInfo now takes up the full size of SMP data


commit 2f32ea8526e7c14216341011be1501dcf94bdab7
Author: Hal Rosenstock <hal at dev.mellanox.co.il<mailto:hal at dev.mellanox.co.il>>
Date:   Tue Jul 26 11:23:51 2011 -0400

    opensm/osm_sa_mcmember_record.c: Proper rate comparison and selection


commit 45111c29b93b14effbb024e5c72b0c163dfcfbb5
Author: Hal Rosenstock <hal at dev.mellanox.co.il<mailto:hal at dev.mellanox.co.il>>
Date:   Tue Jul 26 11:23:46 2011 -0400

    opensm/osm_sa_path_record.c: Proper rate comparison and selection


commit e26fe06a942dc92de9471b110d2d8475ae3b2c2f
Author: Hal Rosenstock <hal at dev.mellanox.co.il<mailto:hal at dev.mellanox.co.il>>
Date:   Tue Jul 26 12:24:47 2011 -0400

    opensm/osm_sa_multipath_record.c: Proper rate comparison and selection



commit f427600259f3c7b3ba6518b4ecadd5201e1b0fda
Author: Hal Rosenstock <hal at dev.mellanox.co.il<mailto:hal at dev.mellanox.co.il>>
Date:   Thu Jul 28 09:59:10 2011 -0400

    opensm/osm_sa_class_port_info.c: Minor simplification to setting CapabilityMask2


commit cc7ff0751ff23ca6e7c9dc5f261c1fb865ca2c15
Author: Hal Rosenstock <hal at dev.mellanox.co.il<mailto:hal at dev.mellanox.co.il>>
Date:   Fri Jul 29 08:36:47 2011 -0400

    opensm/osm_helper: Add rate related routines

    for proper comparison and selector operation

    Rate enum was never is ascending order of actual underlying rates
    but even worse with newly added extended link speeds.


commit a33a8af18c502cfb1162f4b36735a474dbc276c2
Author: Hal Rosenstock <hal at dev.mellanox.co.il<mailto:hal at dev.mellanox.co.il>>
Date:   Tue Aug 9 10:30:45 2011 -0400

    opensm: Add extended link speeds support
==================================================================================





Index: B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/include/opensm/osm_subnet.h
===================================================================
--- B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/include/opensm/osm_subnet.h               (revision 8756)
+++ B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/include/opensm/osm_subnet.h            (revision 8757)
@@ -158,6 +158,7 @@
                boolean_t lmc_esp0;
                uint8_t max_op_vls;
                uint8_t force_link_speed;
+             uint8_t force_link_speed_ext;
                boolean_t reassign_lids;
                boolean_t ignore_other_sm;
                boolean_t single_thread;
Index: B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/include/opensm/osm_helper.h
===================================================================
--- B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/include/opensm/osm_helper.h                (revision 8756)
+++ B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/include/opensm/osm_helper.h             (revision 8757)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2010 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) 2009 HNR Consulting. All rights reserved.
  *
@@ -493,7 +493,7 @@

 const char *osm_get_lwa_str(IN uint8_t lwa);

-const char *osm_get_lsa_str(IN uint8_t lsa);
+const char *osm_get_lsa_str(IN uint8_t lsa, IN uint8_t lsea, IN uint8_t state);

 /****f* IBA Base: Types/osm_get_sm_mgr_signal_str
 * NAME
@@ -541,5 +541,85 @@
 * SEE ALSO
 *********/

+/****f* IBA Base: Types/ib_path_compare_rates
+* NAME
+*           ib_path_compare_rates
+*
+* DESCRIPTION
+*           Compares the encoded values for two path rates and
+*           return value is based on the ordered comparison of
+*           the path rates (or path rate equivalents).
+*
+* SYNOPSIS
+*/
+int ib_path_compare_rates(IN const int rate1, IN const int rate2);
+
+/*
+* PARAMETERS
+*           rate1
+*                           [in] Encoded path rate 1.
+*
+*           rate2
+*                           [in] Encoded path rate 2.
+*
+* RETURN VALUES
+*           Returns an int indicating less than (-1), equal to (0), or
+*           greater than (1) rate1 as compared with rate2.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_path_rate_get_prev
+* NAME
+*           ib_path_rate_get_prev
+*
+* DESCRIPTION
+*           Obtains encoded rate for the rate previous to the one requested.
+*
+* SYNOPSIS
+*/
+int ib_path_rate_get_prev(IN const int rate);
+
+/*
+* PARAMETERS
+*           rate
+*                           [in] Encoded path rate.
+*
+* RETURN VALUES
+*           Returns an int indicating encoded rate or
+*           0 if none can be found.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_path_rate_get_next
+* NAME
+*           ib_path_rate_get_next
+*
+* DESCRIPTION
+*           Obtains encoded rate for the rate subsequent to the one requested.
+*
+* SYNOPSIS
+*/
+int ib_path_rate_get_next(IN const int rate);
+
+/*
+* PARAMETERS
+*           rate
+*                           [in] Encoded path rate.
+*
+* RETURN VALUES
+*           Returns an int indicating encoded rate or
+*           0 if none can be found.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
 END_C_DECLS
 #endif                                                  /* _OSM_HELPER_H_ */
Index: B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/include/opensm/osm_base.h
===================================================================
--- B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/include/opensm/osm_base.h   (revision 8756)
+++ B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/include/opensm/osm_base.h                (revision 8757)
@@ -806,6 +806,30 @@
 #define OSM_CAP2_IS_HIERARCHY_SUPPORTED (1 << 4)
 /***********/

+/****d* OpenSM: Base/OSM_CAP2_IS_FULL_PORTINFO_REC_SUPPORTED
+* Name
+*           OSM_CAP2_IS_FULL_PORTINFO_REC_SUPPORTED
+*
+* DESCRIPTION
+*           Full PortInfoRecords supported
+*
+* SYNOPSIS
+*/
+#define OSM_CAP2_IS_FULL_PORTINFO_REC_SUPPORTED (1 << 6)
+/***********/
+
+/****d* OpenSM: Base/OSM_CAP2_IS_EXTENDED_SPEEDS_SUPPORTED
+* Name
+*           OSM_CAP2_IS_EXTENDED_SPEEDS_SUPPORTED
+*
+* DESCRIPTION
+*           Extended Link Speeds supported
+*
+* SYNOPSIS
+*/
+#define OSM_CAP2_IS_EXTENDED_SPEEDS_SUPPORTED (1 << 7)
+/***********/
+
 /****d* OpenSM: Base/osm_signal_t
 * NAME
 *            osm_signal_t
Index: B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/libopensm/osm_helper.c
===================================================================
--- B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/libopensm/osm_helper.c            (revision 8756)
+++ B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/libopensm/osm_helper.c         (revision 8757)
@@ -632,10 +632,10 @@
                          "IB_PORT_CAP_RESV13\n", &total_len ) != IB_SUCCESS )
       return;
   }
-  if( p_pi->capability_mask & IB_PORT_CAP_RESV14 )
+  if( p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS )
   {
     if( osm_dbg_do_line( &p_local, buf_size, p_prefix_str,
-                         "IB_PORT_CAP_RESV14\n", &total_len ) != IB_SUCCESS )
+                         "IB_PORT_CAP_HAS_EXT_SPEEDS\n", &total_len ) != IB_SUCCESS )
       return;
   }
   if( p_pi->capability_mask & IB_PORT_CAP_RESV15 )
Index: B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_sa_multipath_record.c
===================================================================
--- B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_sa_multipath_record.c    (revision 8756)
+++ B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_sa_multipath_record.c (revision 8757)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2007 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.
  *
  * This software is available to you under a choice of one of two
@@ -156,11 +156,11 @@
                                                                                      OUT osm_path_parms_t * p_parms)
 {
                const osm_node_t *p_node;
-              const osm_physp_t *p_physp;
+             const osm_physp_t *p_physp, *p_physp0;
                const osm_physp_t *p_src_physp;
                const osm_physp_t *p_dest_physp;
                const osm_prtn_t *p_prtn = NULL;
-              const ib_port_info_t *p_pi;
+             const ib_port_info_t *p_pi, *p_pi0;
                ib_slvl_table_t *p_slvl_tbl;
                ib_api_status_t status = IB_SUCCESS;
                uint8_t mtu;
@@ -188,7 +188,8 @@
                p_pi = &p_physp->port_info;

                mtu = ib_port_info_get_mtu_cap(p_pi);
-              rate = ib_port_info_compute_rate(p_pi);
+             rate = ib_port_info_compute_rate(p_pi,
+                                                                             p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);

                /*
                   Mellanox Tavor device performance is better using 1K MTU.
@@ -360,8 +361,12 @@
                                if (mtu > ib_port_info_get_mtu_cap(p_pi))
                                                mtu = ib_port_info_get_mtu_cap(p_pi);

-                              if (rate > ib_port_info_compute_rate(p_pi))
-                                              rate = ib_port_info_compute_rate(p_pi);
+                             p_physp0 = osm_node_get_physp_ptr((osm_node_t *)p_node, 0);
+                             p_pi0 = &p_physp0->port_info;
+                             if (ib_path_compare_rates(rate,  ib_port_info_compute_rate(p_pi,
+                                                             p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS)) > 0)
+                                             rate = ib_port_info_compute_rate(p_pi,
+                                                             p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);

                                /*
                                   Continue with the egress port on this switch.
@@ -383,8 +388,12 @@
                                if (mtu > ib_port_info_get_mtu_cap(p_pi))
                                                mtu = ib_port_info_get_mtu_cap(p_pi);

-                              if (rate > ib_port_info_compute_rate(p_pi))
-                                              rate = ib_port_info_compute_rate(p_pi);
+                             p_physp0 = osm_node_get_physp_ptr((osm_node_t *)p_node, 0);
+                             p_pi0 = &p_physp0->port_info;
+                             if (ib_path_compare_rates(rate, ib_port_info_compute_rate(p_pi,
+                                                             p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS)) > 0)
+                                             rate = ib_port_info_compute_rate(p_pi,
+                                                             p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);

                                if (sa->p_subn->opt.qos) {
                                                /*
@@ -416,8 +425,10 @@
                if (mtu > ib_port_info_get_mtu_cap(p_pi))
                                mtu = ib_port_info_get_mtu_cap(p_pi);

-              if (rate > ib_port_info_compute_rate(p_pi))
-                              rate = ib_port_info_compute_rate(p_pi);
+             if (ib_path_compare_rates(rate, ib_port_info_compute_rate(p_pi,
+                                             p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS)) > 0)
+                             rate = ib_port_info_compute_rate(p_pi,
+                                             p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);

                OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
                                "Path min MTU = %u, min rate = %u\n", mtu, rate);
@@ -442,7 +453,7 @@
                                                mtu = p_qos_level->mtu_limit;

                                if (p_qos_level->rate_limit_set
-                                  && (rate > p_qos_level->rate_limit))
+                                             && (ib_path_compare_rates(rate, p_qos_level->rate_limit) > 0))
                                                rate = p_qos_level->rate_limit;

                                if (p_qos_level->sl_set) {
@@ -506,23 +517,22 @@
                                required_rate = ib_multipath_rec_rate(p_mpr);
                                switch (ib_multipath_rec_rate_sel(p_mpr)) {
                                case 0:  /* must be greater than */
-                                              if (rate <= required_rate)
+                                             if (ib_path_compare_rates(rate, required_rate) <= 0)
                                                                status = IB_NOT_FOUND;
                                                break;

                                case 1:  /* must be less than */
-                                              if (rate >= required_rate) {
+                                             if (ib_path_compare_rates(rate, required_rate) >= 0) {
                                                                /* adjust the rate to use the highest rate
                                                                   lower then the required one */
-                                                              if (required_rate > 2)
-                                                                              rate = required_rate - 1;
-                                                              else
+                                                             rate = ib_path_rate_get_prev(required_rate);
+                                                             if (!rate)
                                                                                status = IB_NOT_FOUND;
                                                }
                                                break;

                                case 2:  /* exact match */
-                                              if (rate < required_rate)
+                                             if (ib_path_compare_rates(rate, required_rate))
                                                                status = IB_NOT_FOUND;
                                                else
                                                                rate = required_rate;
Index: B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_subnet.c
===================================================================
--- B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_subnet.c                (revision 8756)
+++ B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_subnet.c             (revision 8757)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2010 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 System Fabric Works, Inc. All rights reserved.
@@ -309,6 +309,7 @@
                { "lmc_esp0", OPT_OFFSET(lmc_esp0), opts_parse_boolean, NULL, 1 },
                { "max_op_vls", OPT_OFFSET(max_op_vls), opts_parse_uint8, NULL, 1 },
                { "force_link_speed", OPT_OFFSET(force_link_speed), opts_parse_uint8, NULL, 1 },
+             { "force_link_speed_ext", OPT_OFFSET(force_link_speed_ext), opts_parse_uint8, NULL, 1 },
                { "reassign_lids", OPT_OFFSET(reassign_lids), opts_parse_boolean, NULL, 1 },
                { "ignore_other_sm", OPT_OFFSET(ignore_other_sm), opts_parse_boolean, NULL, 1 },
                { "single_thread", OPT_OFFSET(single_thread), opts_parse_boolean, NULL, 0 },
@@ -686,6 +687,7 @@
                p_opt->lmc_esp0 = FALSE;
                p_opt->max_op_vls = OSM_DEFAULT_MAX_OP_VLS;
                p_opt->force_link_speed = 15;
+             p_opt->force_link_speed_ext = 31;
                p_opt->reassign_lids = FALSE;
                p_opt->ignore_other_sm = FALSE;
                p_opt->single_thread = FALSE;
@@ -1070,6 +1072,14 @@
                                p_opts->force_link_speed = IB_PORT_LINK_SPEED_ENABLED_MASK;
                }

+             if ((31 < p_opts->force_link_speed_ext) ||
+                             (p_opts->force_link_speed_ext > 3 && p_opts->force_link_speed_ext < 30)) {
+                             log_report(" Invalid Cached Option Value:force_link_speed_ext = %u:"
+                                                "Using Default:%u\n", p_opts->force_link_speed_ext,
+                                                31);
+                             p_opts->force_link_speed_ext = 31;
+             }
+
                if (p_opts->max_wire_smps == 0)
                                p_opts->max_wire_smps = 0x7FFFFFFF;
                else if (p_opts->max_wire_smps > 0x7FFFFFFF) {
@@ -1320,6 +1330,16 @@
                                "#    2,4,6,8-14 Reserved\n"
                                "#    Default 15: set to PortInfo:LinkSpeedSupported\n"
                                "force_link_speed %u\n\n"
+                             "# Force PortInfo:LinkSpeedExtEnabled on ports\n"
+                             "# If 0, don't modify PortInfo:LinkSpeedExtEnabled on port\n"
+                             "# Otherwise, use value for PortInfo:LinkSpeedExtEnabled on port\n"
+                             "# Values are (MgtWG RefID #4722)\n"
+                             "#             1: 14.0625 Gbps\n"
+                             "#             2: 25.78125 Gbps\n"
+                             "#             3: 14.0625 Gbps or 25.78125 Gbps\n"
+                             "#             30: Disable extended link speeds\n"
+                             "#             Default 31: set to PortInfo:LinkSpeedExtSupported\n"
+                             "force_link_speed_ext %u\n\n"
                                "# The subnet_timeout code that will be set for all the ports\n"
                                "# The actual timeout is 4.096usec * 2^<subnet_timeout>\n"
                                "subnet_timeout %u\n\n"
@@ -1343,6 +1363,7 @@
                                p_opts->leaf_head_of_queue_lifetime,
                                p_opts->max_op_vls,
                                p_opts->force_link_speed,
+                             p_opts->force_link_speed_ext,
                                p_opts->subnet_timeout,
                                p_opts->local_phy_errors_threshold,
                                p_opts->overrun_errors_threshold);
Index: B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_dump.c
===================================================================
--- B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_dump.c  (revision 8756)
+++ B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_dump.c               (revision 8757)
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 2009 Sun Microsystems, 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) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -365,6 +365,7 @@
                osm_node_t *p_nbnode;
                osm_physp_t *p_physp, *p_default_physp, *p_rphysp;
                uint8_t link_speed_act;
+             char *link_speed_act_str;

                if (!p_node->node_info.num_ports)
                                return;
@@ -441,7 +442,26 @@
                                port_state = ib_port_info_get_port_state(&p_physp->port_info);
                                link_speed_act =
                                    ib_port_info_get_link_speed_active(&p_physp->port_info);
+                             if (link_speed_act == IB_LINK_SPEED_ACTIVE_2_5)
+                                             link_speed_act_str = "2.5";
+                             else if (link_speed_act == IB_LINK_SPEED_ACTIVE_5)
+                                             link_speed_act_str = "5";
+                             else if (link_speed_act == IB_LINK_SPEED_ACTIVE_10)
+                                             link_speed_act_str = "10";
+                             else
+                                             link_speed_act_str = "??";

+                             if (p_default_physp->port_info.capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) {
+                                             link_speed_act =
+                                                             ib_port_info_get_link_speed_ext_active(&p_physp->port_info);
+                                             if (link_speed_act == IB_LINK_SPEED_EXT_ACTIVE_14)
+                                                             link_speed_act_str = "14";
+                                             else if (link_speed_act == IB_LINK_SPEED_EXT_ACTIVE_25)
+                                                             link_speed_act_str = "25";
+                                             else if (link_speed_act != IB_LINK_SPEED_EXT_ACTIVE_NONE)
+                                                             link_speed_act_str = "??";
+                             }
+
                                fprintf(file, "PHY=%s LOG=%s SPD=%s\n",
                                                p_physp->port_info.link_width_active == 1 ? "1x" :
                                                p_physp->port_info.link_width_active == 2 ? "4x" :
@@ -450,9 +470,7 @@
                                                port_state == IB_LINK_ACTIVE ? "ACT" :
                                                port_state == IB_LINK_ARMED ? "ARM" :
                                                port_state == IB_LINK_INIT ? "INI" : "DWN",
-                                              link_speed_act == 1 ? "2.5" :
-                                              link_speed_act == 2 ? "5" :
-                                              link_speed_act == 4 ? "10" : "??");
+                                             link_speed_act_str);
                }
 }

@@ -511,7 +529,9 @@
                                                                (ib_port_info_get_neighbor_mtu(p_pi)),
                                                                osm_get_lwa_str(p_pi->link_width_active),
                                                                osm_get_lsa_str
-                                                              (ib_port_info_get_link_speed_active(p_pi)));
+                                                             (ib_port_info_get_link_speed_active(p_pi),
+                                                             ib_port_info_get_link_speed_ext_active(p_pi),
+                                                             ib_port_info_get_port_state(p_pi)));
                                else
                                                fprintf(file, "      :     :     ");

Index: B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_helper.c
===================================================================
--- B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_helper.c (revision 8756)
+++ B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_helper.c              (revision 8757)
@@ -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) 2009 HNR Consulting. All rights reserved.
  * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
@@ -439,6 +439,27 @@

 #define OSM_SA_ATTR_STR_UNKNOWN_VAL 0xF4

+static int ordered_rates[] = {
+             0, 0,        /*  0, 1 - reserved */
+             1,            /*  2 - 2.5 Gbps */
+             3,            /*  3 - 10  Gbps */
+             6,            /*  4 - 30  Gbps */
+             2,            /*  5 - 5   Gbps */
+             5,            /*  6 - 20  Gbps */
+             8,            /*  7 - 40  Gbps */
+             9,            /*  8 - 60  Gbps */
+             11,          /*  9 - 80  Gbps */
+             12,          /* 10 - 120 Gbps */
+             4,            /* 11 -  14 Gbps (17 Gbps equiv) */
+             10,          /* 12 -  56 Gbps (68 Gbps equiv) */
+             14,          /* 13 - 112 Gbps (136 Gbps equiv) */
+             15,          /* 14 - 158 Gbps (204 Gbps equiv) */
+             7,            /* 15 -  25 Gbps (31.25 Gbps equiv) */
+             13,          /* 16 - 100 Gbps (125 Gbps equiv) */
+             16,          /* 17 - 200 Gbps (250 Gbps equiv) */
+             17           /* 18 - 300 Gbps (375 Gbps equiv) */
+};
+
 static int sprint_uint8_arr(char *buf, size_t size,
                                                    const uint8_t * arr, size_t len)
 {
@@ -653,9 +674,9 @@
                                                                &total_len) != IB_SUCCESS)
                                                return;
                }
-              if (p_pi->capability_mask & IB_PORT_CAP_RESV14) {
+             if (p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) {
                                if (dbg_do_line(&p_local, buf_size, p_prefix_str,
-                                                              "IB_PORT_CAP_RESV14\n",
+                                                             "IB_PORT_CAP_HAS_EXT_SPEEDS\n",
                                                                &total_len) != IB_SUCCESS)
                                                return;
                }
@@ -773,6 +794,7 @@

                                osm_log(p_log, log_level,
                                                "PortInfo dump:\n"
+
                                                "\t\t\t\tport number.............%u\n"
                                                "\t\t\t\tnode_guid...............0x%016" PRIx64 "\n"
                                                "\t\t\t\tport_guid...............0x%016" PRIx64 "\n"
@@ -811,7 +833,10 @@
                                                "\t\t\t\tresp_time_value.........0x%X\n"
                                                "\t\t\t\terror_threshold.........0x%X\n"
                                                "\t\t\t\tmax_credit_hint.........0x%X\n"
-                                              "\t\t\t\tlink_round_trip_latency.0x%X\n",
+                                             "\t\t\t\tlink_round_trip_latency.0x%X\n"
+                                             "\t\t\t\tlink_speed_ext_active....0x%X\n"
+                                             "\t\t\t\tlink_speed_ext_supported.0x%X\n"
+                                             "\t\t\t\tlink_speed_ext_enabled...0x%X\n",
                                                port_num, cl_ntoh64(node_guid), cl_ntoh64(port_guid),
                                                cl_ntoh64(p_pi->m_key), cl_ntoh64(p_pi->subnet_prefix),
                                                cl_ntoh16(p_pi->base_lid),
@@ -834,9 +859,13 @@
                                                cl_ntoh16(p_pi->q_key_violations), p_pi->guid_cap,
                                                ib_port_info_get_client_rereg(p_pi),
                                                ib_port_info_get_mcast_pkey_trap_suppress(p_pi),
-                                              ib_port_info_get_timeout(p_pi), p_pi->resp_time_value,
+                                             ib_port_info_get_timeout(p_pi),
+                                             ib_port_info_get_resp_time_value(p_pi),
                                                p_pi->error_threshold, cl_ntoh16(p_pi->max_credit_hint),
-                                              cl_ntoh32(p_pi->link_rt_latency));
+                                             cl_ntoh32(p_pi->link_rt_latency),
+                                             ib_port_info_get_link_speed_ext_active(p_pi),
+                                             ib_port_info_get_link_speed_ext_sup(p_pi),
+                                             p_pi->link_speed_ext_enabled);

                                /*  show the capabilities mask */
                                if (p_pi->capability_mask) {
@@ -858,43 +887,51 @@
                                osm_log(p_log, log_level,
                                                "PortInfo Record dump:\n"
                                                "\t\t\t\tRID\n"
-                                              "\t\t\t\tEndPortLid..............%u\n"
-                                              "\t\t\t\tPortNum.................%u\n"
-                                              "\t\t\t\tOptions.................0x%X\n"
+                                             "\t\t\t\tEndPortLid...............%u\n"
+                                             "\t\t\t\tPortNum..................%u\n"
+                                             "\t\t\t\tOptions..................0x%X\n"
                                                "\t\t\t\tPortInfo dump:\n"
-                                              "\t\t\t\tm_key...................0x%016" PRIx64 "\n"
-                                              "\t\t\t\tsubnet_prefix...........0x%016" PRIx64 "\n"
-                                              "\t\t\t\tbase_lid................%u\n"
-                                              "\t\t\t\tmaster_sm_base_lid......%u\n"
-                                              "\t\t\t\tcapability_mask.........0x%X\n"
-                                              "\t\t\t\tdiag_code...............0x%X\n"
-                                              "\t\t\t\tm_key_lease_period......0x%X\n"
-                                              "\t\t\t\tlocal_port_num..........%u\n"
-                                              "\t\t\t\tlink_width_enabled......0x%X\n"
-                                              "\t\t\t\tlink_width_supported....0x%X\n"
-                                              "\t\t\t\tlink_width_active.......0x%X\n"
-                                              "\t\t\t\tlink_speed_supported....0x%X\n"
-                                              "\t\t\t\tport_state..............%s\n"
-                                              "\t\t\t\tstate_info2.............0x%X\n"
-                                              "\t\t\t\tm_key_protect_bits......0x%X\n"
-                                              "\t\t\t\tlmc.....................0x%X\n"
-                                              "\t\t\t\tlink_speed..............0x%X\n"
-                                              "\t\t\t\tmtu_smsl................0x%X\n"
-                                              "\t\t\t\tvl_cap_init_type........0x%X\n"
-                                              "\t\t\t\tvl_high_limit...........0x%X\n"
-                                              "\t\t\t\tvl_arb_high_cap.........0x%X\n"
-                                              "\t\t\t\tvl_arb_low_cap..........0x%X\n"
-                                              "\t\t\t\tinit_rep_mtu_cap........0x%X\n"
-                                              "\t\t\t\tvl_stall_life...........0x%X\n"
-                                              "\t\t\t\tvl_enforce..............0x%X\n"
-                                              "\t\t\t\tm_key_violations........0x%X\n"
-                                              "\t\t\t\tp_key_violations........0x%X\n"
-                                              "\t\t\t\tq_key_violations........0x%X\n"
-                                              "\t\t\t\tguid_cap................0x%X\n"
-                                              "\t\t\t\tsubnet_timeout..........0x%X\n"
-                                              "\t\t\t\tresp_time_value.........0x%X\n"
-                                              "\t\t\t\terror_threshold.........0x%X\n",
+                                             "\t\t\t\tm_key....................0x%016" PRIx64 "\n"
+                                             "\t\t\t\tsubnet_prefix............0x%016" PRIx64 "\n"
+                                             "\t\t\t\tbase_lid.................%u\n"
+                                             "\t\t\t\tmaster_sm_base_lid.......%u\n"
+                                             "\t\t\t\tcapability_mask..........0x%X\n"
+                                             "\t\t\t\tdiag_code................0x%X\n"
+                                             "\t\t\t\tm_key_lease_period.......0x%X\n"
+                                             "\t\t\t\tlocal_port_num...........%u\n"
+                                             "\t\t\t\tlink_width_enabled.......0x%X\n"
+                                             "\t\t\t\tlink_width_supported.....0x%X\n"
+                                             "\t\t\t\tlink_width_active........0x%X\n"
+                                             "\t\t\t\tlink_speed_supported.....0x%X\n"
+                                             "\t\t\t\tport_state...............%s\n"
+                                             "\t\t\t\tstate_info2..............0x%X\n"
+                                             "\t\t\t\tm_key_protect_bits.......0x%X\n"
+                                             "\t\t\t\tlmc......................0x%X\n"
+                                             "\t\t\t\tlink_speed...............0x%X\n"
+                                             "\t\t\t\tmtu_smsl.................0x%X\n"
+                                             "\t\t\t\tvl_cap_init_type.........0x%X\n"
+                                             "\t\t\t\tvl_high_limit............0x%X\n"
+                                             "\t\t\t\tvl_arb_high_cap..........0x%X\n"
+                                             "\t\t\t\tvl_arb_low_cap...........0x%X\n"
+                                             "\t\t\t\tinit_rep_mtu_cap.........0x%X\n"
+                                             "\t\t\t\tvl_stall_life............0x%X\n"
+                                             "\t\t\t\tvl_enforce...............0x%X\n"
+                                             "\t\t\t\tm_key_violations.........0x%X\n"
+                                             "\t\t\t\tp_key_violations.........0x%X\n"
+                                             "\t\t\t\tq_key_violations.........0x%X\n"
+                                             "\t\t\t\tguid_cap.................0x%X\n"
+                                             "\t\t\t\tclient_reregister........0x%X\n"
+                                             "\t\t\t\tmcast_pkey_trap_suppr....0x%X\n"
+                                             "\t\t\t\tsubnet_timeout...........0x%X\n"
+                                             "\t\t\t\tresp_time_value..........0x%X\n"
+                                             "\t\t\t\terror_threshold..........0x%X\n"
+                                             "\t\t\t\tmax_credit_hint..........0x%X\n"
+                                             "\t\t\t\tlink_round_trip_latency..0x%X\n"
+                                             "\t\t\t\tlink_speed_ext_active....0x%X\n"
+                                             "\t\t\t\tlink_speed_ext_supported.0x%X\n"
+                                             "\t\t\t\tlink_speed_ext_enabled...0x%X\n",
                                                cl_ntoh16(p_pir->lid), p_pir->port_num, p_pir->options,
+                                             cl_ntoh16(p_pir->lid), p_pir->port_num, p_pir->options,
                                                cl_ntoh64(p_pi->m_key), cl_ntoh64(p_pi->subnet_prefix),
                                                cl_ntoh16(p_pi->base_lid),
                                                cl_ntoh16(p_pi->master_sm_base_lid),
@@ -914,8 +951,13 @@
                                                cl_ntoh16(p_pi->m_key_violations),
                                                cl_ntoh16(p_pi->p_key_violations),
                                                cl_ntoh16(p_pi->q_key_violations), p_pi->guid_cap,
-                                              ib_port_info_get_timeout(p_pi), p_pi->resp_time_value,
-                                              p_pi->error_threshold);
+                                             ib_port_info_get_timeout(p_pi),
+                                             ib_port_info_get_resp_time_value(p_pi),
+                                             p_pi->error_threshold, cl_ntoh16(p_pi->max_credit_hint),
+                                             cl_ntoh32(p_pi->link_rt_latency),
+                                             ib_port_info_get_link_speed_ext_active(p_pi),
+                                             ib_port_info_get_link_speed_ext_sup(p_pi),
+                                             p_pi->link_speed_ext_enabled);

                                /*  show the capabilities mask */
                                if (p_pi->capability_mask) {
@@ -2195,19 +2237,28 @@
 }

 static const char *lsa_str_fixed_width[] = {
-              "???",
+             "Ext",
                "2.5",
                "5  ",
                "???",
                "10 "
 };

-const char *osm_get_lsa_str(IN uint8_t lsa)
+static const char *lsea_str_fixed_width[] = {
+             "Std",
+             "14 ",
+             "25 "
+};
+
+const char *osm_get_lsa_str(IN uint8_t lsa, IN uint8_t lsea, IN uint8_t state)
 {
-              if (lsa > 4)
-                              return lsa_str_fixed_width[0];
-              else
+             if (lsa > IB_LINK_SPEED_ACTIVE_10)
+                             return lsa_str_fixed_width[3];
+             if (lsea == IB_LINK_SPEED_EXT_ACTIVE_NONE)
                                return lsa_str_fixed_width[lsa];
+             if (lsea > IB_LINK_SPEED_EXT_ACTIVE_25)
+                             return lsa_str_fixed_width[3];
+             return lsea_str_fixed_width[lsea];
 }

 static const char *sm_mgr_signal_str[] = {
@@ -2246,3 +2297,64 @@
                    sm_mgr_state_str[state] :
                    sm_mgr_state_str[ARR_SIZE(sm_mgr_state_str) - 1];
 }
+
+
+int ib_path_compare_rates(IN const int rate1, IN const int rate2)
+{
+             int orate1 = 0, orate2 = 0;
+
+             CL_ASSERT(rate1 >= IB_MIN_RATE && rate1 <= IB_MAX_RATE);
+             CL_ASSERT(rate2 >= IB_MIN_RATE && rate2 <= IB_MAX_RATE);
+
+             if (rate1 <= IB_MAX_RATE)
+                             orate1 = ordered_rates[rate1];
+             if (rate2 <= IB_MAX_RATE)
+                             orate2 = ordered_rates[rate2];
+             if (orate1 < orate2)
+                             return -1;
+             if (orate1 == orate2)
+                             return 0;
+             return 1;
+}
+
+static int find_ordered_rate(IN const int rate)
+{
+             int i;
+
+             for (i = IB_MIN_RATE; i <= IB_MAX_RATE; i++) {
+                             if (ordered_rates[i] == rate)
+                                             return i;
+             }
+             return 0;
+}
+
+int ib_path_rate_get_prev(IN const int rate)
+{
+             int orate;
+
+             CL_ASSERT(rate >= IB_MIN_RATE && rate <= IB_MAX_RATE);
+
+             if (rate <= IB_MIN_RATE)
+                             return 0;
+             if (rate > IB_MAX_RATE)
+                             return 0;
+             orate = ordered_rates[rate];
+             orate--;
+             return find_ordered_rate(orate);
+}
+
+int ib_path_rate_get_next(IN const int rate)
+{
+             int orate;
+
+             CL_ASSERT(rate >= IB_MIN_RATE && rate <= IB_MAX_RATE);
+
+             if (rate < IB_MIN_RATE)
+                             return 0;
+             if (rate >= IB_MAX_RATE)
+                             return 0;
+             orate = ordered_rates[rate];
+             orate++;
+             return find_ordered_rate(orate);
+}
+
Index: B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_sa_portinfo_record.c
===================================================================
--- B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_sa_portinfo_record.c       (revision 8756)
+++ B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_sa_portinfo_record.c    (revision 8757)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2007 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.
  *
  * This software is available to you under a choice of one of two
@@ -74,10 +74,12 @@

 static ib_api_status_t pir_rcv_new_pir(IN osm_sa_t * sa,
                                                                       IN const osm_physp_t * p_physp,
-                                                                     IN cl_qlist_t * p_list,
+                                                                                IN osm_pir_search_ctxt_t * p_ctxt,
                                                                       IN ib_net16_t const lid)
 {
                osm_pir_item_t *p_rec_item;
+             ib_port_info_t *p_pi;
+             osm_physp_t *p_physp0;
                ib_api_status_t status = IB_SUCCESS;

                OSM_LOG_ENTER(sa->p_log);
@@ -100,9 +102,35 @@

                p_rec_item->rec.lid = lid;
                p_rec_item->rec.port_info = p_physp->port_info;
+             if (p_ctxt->comp_mask & IB_PIR_COMPMASK_OPTIONS)
+                             p_rec_item->rec.options = p_ctxt->p_rcvd_rec->options;
+             if ((p_ctxt->comp_mask & IB_PIR_COMPMASK_OPTIONS) == 0 ||
+                             (p_ctxt->p_rcvd_rec->options & 0x80) == 0) {
+                             /* Does requested port have an extended link speed active ? */
+                             if (osm_node_get_type(p_physp->p_node) ==
+                                             IB_NODE_TYPE_SWITCH) {
+                                             p_physp0 = osm_node_get_physp_ptr(p_ctxt->p_req_physp->p_node, 0);
+                                             p_pi = &p_physp0->port_info;
+                             } else
+                                             p_pi = (ib_port_info_t *) &p_physp->port_info;
+                             if ((p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) > 0) {
+                                             if (ib_port_info_get_link_speed_ext_active(&p_physp->port_info)) {
+                                                             /* Add QDR bits to original link speed components */
+                                                             p_pi = &p_rec_item->rec.port_info;
+                                                             ib_port_info_set_link_speed_enabled(p_pi,
+                                                                                                                                             ib_port_info_get_link_speed_enabled(p_pi) | IB_LINK_SPEED_ACTIVE_10);
+                                                             p_pi->state_info1 =
+                                                                             (uint8_t) ((p_pi->state_info1 & IB_PORT_STATE_MASK) |
+                                                                                                (ib_port_info_get_link_speed_sup(p_pi) | IB_LINK_SPEED_ACTIVE_10) << IB_PORT_LINK_SPEED_SHIFT);
+                                                             p_pi->link_speed =
+                                                                             (uint8_t) ((p_pi->link_speed & IB_PORT_LINK_SPEED_ENABLED_MASK) |
+                                                                                                (ib_port_info_get_link_speed_active(p_pi) | IB_LINK_SPEED_ACTIVE_10) << IB_PORT_LINK_SPEED_SHIFT);
+                                             }
+                             }
+             }
                p_rec_item->rec.port_num = osm_physp_get_port_num(p_physp);

-              cl_qlist_insert_tail(p_list, &p_rec_item->list_item);
+             cl_qlist_insert_tail(p_ctxt->p_list, &p_rec_item->list_item);

 Exit:
                OSM_LOG_EXIT(sa->p_log);
@@ -147,7 +175,7 @@
                                                goto Exit;
                }

-              pir_rcv_new_pir(sa, p_physp, p_ctxt->p_list, cl_hton16(base_lid_ho));
+             pir_rcv_new_pir(sa, p_physp, p_ctxt, cl_hton16(base_lid_ho));

 Exit:
                OSM_LOG_EXIT(sa->p_log);
@@ -160,6 +188,8 @@
                ib_net64_t comp_mask;
                const ib_port_info_t *p_comp_pi;
                const ib_port_info_t *p_pi;
+             const osm_physp_t * p_physp0;
+             ib_net32_t cap_mask;

                OSM_LOG_ENTER(sa->p_log);

@@ -373,6 +403,30 @@
                                                goto Exit;
                }

+             if (osm_node_get_type(p_physp->p_node) == IB_NODE_TYPE_SWITCH) {
+                             p_physp0 = osm_node_get_physp_ptr(p_physp->p_node, 0);
+                             cap_mask = p_physp0->port_info.capability_mask;
+             } else
+                             cap_mask = p_pi->capability_mask;
+             if (comp_mask & IB_PIR_COMPMASK_LINKSPDEXTACT) {
+                             if (((cap_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) > 0) &&
+                                             (ib_port_info_get_link_speed_ext_active(p_comp_pi) !=
+                                             ib_port_info_get_link_speed_ext_active(p_pi)))
+                                             goto Exit;
+             }
+             if (comp_mask & IB_PIR_COMPMASK_LINKSPDEXTSUPP) {
+                             if (((cap_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) > 0) &&
+                                             (ib_port_info_get_link_speed_ext_sup(p_comp_pi) !=
+                                             ib_port_info_get_link_speed_ext_sup(p_pi)))
+                                             goto Exit;
+             }
+             if (comp_mask & IB_PIR_COMPMASK_LINKSPDEXTENAB) {
+                             if (((cap_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) > 0) &&
+                                             (ib_port_info_get_link_speed_ext_enabled(p_comp_pi) !=
+                                             ib_port_info_get_link_speed_ext_enabled(p_pi)))
+                                             goto Exit;
+             }
+
                sa_pir_create(sa, p_physp, p_ctxt);

 Exit:
Index: B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_sa_class_port_info.c
===================================================================
--- B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_sa_class_port_info.c        (revision 8756)
+++ B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_sa_class_port_info.c     (revision 8757)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2007 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.
  *
  * This software is available to you under a choice of one of two
@@ -73,6 +73,7 @@
                ib_sa_mad_t *p_resp_sa_mad;
                ib_class_port_info_t *p_resp_cpi;
                ib_gid_t zero_gid;
+             uint32_t cap_mask2;
                uint8_t rtv;

                OSM_LOG_ENTER(sa->p_log);
@@ -156,11 +157,12 @@
                p_resp_cpi->cap_mask = OSM_CAP_IS_SUBN_GET_SET_NOTICE_SUP |
                    OSM_CAP_IS_PORT_INFO_CAPMASK_MATCH_SUPPORTED;
 #endif
+             cap_mask2 = OSM_CAP2_IS_MCAST_TOP_SUPPORTED |
+                                             OSM_CAP2_IS_FULL_PORTINFO_REC_SUPPORTED |
+                                             OSM_CAP2_IS_EXTENDED_SPEEDS_SUPPORTED;
                if (sa->p_subn->opt.qos)
-                              ib_class_set_cap_mask2(p_resp_cpi, OSM_CAP2_IS_QOS_SUPPORTED |
-                                                                                                 OSM_CAP2_IS_MCAST_TOP_SUPPORTED);
-              else
-                              ib_class_set_cap_mask2(p_resp_cpi, OSM_CAP2_IS_MCAST_TOP_SUPPORTED);
+                             cap_mask2 |= OSM_CAP2_IS_QOS_SUPPORTED;
+             ib_class_set_cap_mask2(p_resp_cpi, cap_mask2);

                if (!sa->p_subn->opt.disable_multicast)
                                p_resp_cpi->cap_mask |= OSM_CAP_IS_UD_MCAST_SUP;
Index: B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_link_mgr.c
===================================================================
--- B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_link_mgr.c             (revision 8756)
+++ B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_link_mgr.c          (revision 8757)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2007 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) 2009 Sun Microsystems, Inc. All rights reserved.
  *
@@ -95,8 +95,10 @@
                ib_api_status_t status;
                uint8_t port_num, mtu, op_vls, smsl = OSM_DEFAULT_SL;
                boolean_t esp0 = FALSE, send_set = FALSE;
-              osm_physp_t *p_remote_physp;
+             osm_physp_t *p_remote_physp, *physp0;
+             int qdr_change = 0;
                int ret = 0;
+             ib_net32_t attr_mod, cap_mask;

                OSM_LOG_ENTER(sm->p_log);

@@ -231,16 +233,14 @@
                                                                   sizeof(p_pi->m_key_lease_period)))
                                                                send_set = TRUE;

-                                              if (esp0 == FALSE)
-                                                              p_pi->mkey_lmc = sm->p_subn->opt.lmc;
-                                              else {
-                                                              if (sm->p_subn->opt.lmc_esp0)
-                                                                              p_pi->mkey_lmc = sm->p_subn->opt.lmc;
-                                                              else
-                                                                              p_pi->mkey_lmc = 0;
-                                              }
-                                              if (memcmp(&p_pi->mkey_lmc, &p_old_pi->mkey_lmc,
-                                                                 sizeof(p_pi->mkey_lmc)))
+                                             /* M_KeyProtectBits are currently always zero */
+                                             p_pi->mkey_lmc = 0;
+                                             if (esp0 == FALSE || sm->p_subn->opt.lmc_esp0)
+                                                             ib_port_info_set_lmc(p_pi, sm->p_subn->opt.lmc);
+                                             if (ib_port_info_get_lmc(p_old_pi) !=
+                                                             ib_port_info_get_lmc(p_pi) ||
+                                                             ib_port_info_get_mpb(p_old_pi) !=
+                                                             ib_port_info_get_mpb(p_pi))
                                                                send_set = TRUE;

                                                ib_port_info_set_timeout(p_pi,
@@ -327,10 +327,56 @@
                                                                                                                    sm->p_subn->opt.
                                                                                                                    force_link_speed);
                                                if (memcmp(&p_pi->link_speed, &p_old_pi->link_speed,
-                                                                 sizeof(p_pi->link_speed)))
+                                                                sizeof(p_pi->link_speed))) {
                                                                send_set = TRUE;
+                                                             /* Determine whether QDR in LSE is being changed */
+                                                             if ((ib_port_info_get_link_speed_enabled(p_pi) &
+                                                                             IB_LINK_SPEED_ACTIVE_10 &&
+                                                                             !(ib_port_info_get_link_speed_enabled(p_old_pi) &
+                                                                               IB_LINK_SPEED_ACTIVE_10)) ||
+                                                                             ((!(ib_port_info_get_link_speed_enabled(p_pi) &
+                                                                                IB_LINK_SPEED_ACTIVE_10) &&
+                                                                               ib_port_info_get_link_speed_enabled(p_old_pi) &
+                                                                               IB_LINK_SPEED_ACTIVE_10)))
+                                                             qdr_change = 1;
+                                             }
                                }

+                             if (osm_node_get_type(p_physp->p_node) == IB_NODE_TYPE_SWITCH) {
+                                             physp0 = osm_node_get_physp_ptr(p_physp->p_node, 0);
+                                             cap_mask = physp0->port_info.capability_mask;
+                             } else
+                                             cap_mask = p_pi->capability_mask;
+                             if (!(cap_mask & IB_PORT_CAP_HAS_EXT_SPEEDS))
+                                             qdr_change = 0;
+
+                             /* Do peer ports support extended link speeds ? */
+                             if (port_num != 0 && p_remote_physp) {
+                                             osm_physp_t *rphysp0;
+                                             ib_net32_t rem_cap_mask;
+
+                                             if (osm_node_get_type(p_remote_physp->p_node) ==
+                                                             IB_NODE_TYPE_SWITCH) {
+                                                             rphysp0 = osm_node_get_physp_ptr(p_remote_physp->p_node, 0);
+                                                             rem_cap_mask = rphysp0->port_info.capability_mask;
+                                             } else
+                                                             rem_cap_mask = p_remote_physp->port_info.capability_mask;
+
+                                             if (cap_mask & IB_PORT_CAP_HAS_EXT_SPEEDS &&
+                                                             rem_cap_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) {
+                                                             if (sm->p_subn->opt.force_link_speed_ext &&
+                                                                             (sm->p_subn->opt.force_link_speed_ext != IB_LINK_SPEED_EXT_SET_LSES ||
+                                                                             p_pi->link_speed_ext_enabled !=
+                                                                             ib_port_info_get_link_speed_sup(p_pi))) {
+                                                                             p_pi->link_speed_ext_enabled = sm->p_subn->opt.force_link_speed_ext;
+                                                                             if (memcmp(&p_pi->link_speed_ext_enabled,
+                                                                                                &p_old_pi->link_speed_ext_enabled,
+                                                                                                sizeof(p_pi->link_speed_ext_enabled)))
+                                                                                             send_set = TRUE;
+                                                             }
+                                             }
+                             }
+
                                /* calc new op_vls and mtu */
                                op_vls =
                                    osm_physp_calc_link_op_vls(sm->p_log, sm->p_subn, p_physp);
@@ -384,9 +430,13 @@
                if (!send_set)
                                goto Exit;

+             attr_mod = cl_hton32(port_num);
+             if (qdr_change)
+                             attr_mod |= cl_hton32(1 << 31); /* AM SMSupportExtendedSpeeds */
+
                status = osm_req_set(sm, osm_physp_get_dr_path_ptr(p_physp),
                                                     payload, sizeof(payload), IB_MAD_ATTR_PORT_INFO,
-                                                   cl_hton32(port_num), CL_DISP_MSGID_NONE, &context);
+                                                             attr_mod, CL_DISP_MSGID_NONE, &context);
                if (status)
                                ret = -1;

Index: B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_console.c
===================================================================
--- B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_console.c               (revision 8756)
+++ B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_console.c            (revision 8757)
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2005-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2009 HNR Consulting. All rights reserved.
+ * Copyright (c) 2010,2011 Mellanox Technologies LTD. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -661,6 +662,8 @@
                uint64_t ports_sdr;
                uint64_t ports_ddr;
                uint64_t ports_qdr;
+             uint64_t ports_fdr;
+             uint64_t ports_edr;
                uint64_t ports_unknown_speed;
                uint64_t ports_reduced_speed;
                port_report_t *reduced_speed_ports;
@@ -673,6 +676,8 @@
 {
                fabric_stats_t *fs = (fabric_stats_t *) context;
                osm_node_t *node = (osm_node_t *) p_map_item;
+             osm_physp_t *physp0;
+             ib_port_info_t *pi0;
                uint8_t num_ports = osm_node_get_num_physp(node);
                uint8_t port = 0;

@@ -683,6 +688,12 @@

                fs->total_nodes++;

+             if (osm_node_get_type(node) == IB_NODE_TYPE_SWITCH) {
+                             physp0 = osm_node_get_physp_ptr(node, 0);
+                             pi0 = &physp0->port_info;
+             } else
+                             pi0 = NULL;
+
                for (port = 1; port < num_ports; port++) {
                                osm_physp_t *phys = osm_node_get_physp_ptr(node, port);
                                ib_port_info_t *pi = NULL;
@@ -696,7 +707,9 @@
                                if (!phys)
                                                continue;

-                              pi = &(phys->port_info);
+                             pi = &phys->port_info;
+                             if (!pi0)
+                                             pi0 = pi;
                                active_speed = ib_port_info_get_link_speed_active(pi);
                                enabled_speed = ib_port_info_get_link_speed_enabled(pi);
                                active_width = pi->link_width_active;
@@ -726,12 +739,38 @@
                                                fs->ports_ddr++;
                                                break;
                                case IB_LINK_SPEED_ACTIVE_10:
-                                              fs->ports_qdr++;
+                                             if (!(pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) ||
+                                                             ((pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) &&
+                                                             !ib_port_info_get_link_speed_ext_active(pi)))
+                                                             fs->ports_qdr++;
                                                break;
                                default:
                                                fs->ports_unknown_speed++;
                                                break;
                                }
+                             if (pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS &&
+                                             ib_port_info_get_link_speed_ext_sup(pi) &&
+                                             (enabled_speed = pi->link_speed_ext_enabled) != IB_LINK_SPEED_EXT_DISABLE &&
+                                             active_speed == IB_LINK_SPEED_ACTIVE_10) {
+                                             active_speed = ib_port_info_get_link_speed_ext_active(pi);
+                                             if ((enabled_speed ^ active_speed) > active_speed) {
+                                                             __tag_port_report(&(fs->reduced_speed_ports),
+                                                                                               cl_ntoh64(node->node_info.node_guid),
+                                                                                               port, node->print_desc);
+                                                             fs->ports_reduced_speed++;
+                                             }
+                                             switch (active_speed) {
+                                             case IB_LINK_SPEED_EXT_ACTIVE_14:
+                                                             fs->ports_fdr++;
+                                                             break;
+                                             case IB_LINK_SPEED_EXT_ACTIVE_25:
+                                                             fs->ports_edr++;
+                                                             break;
+                                             default:
+                                                             fs->ports_unknown_speed++;
+                                                             break;
+                                             }
+                             }
                                switch (active_width) {
                                case IB_LINK_WIDTH_ACTIVE_1X:
                                                fs->ports_1X++;
@@ -825,6 +864,10 @@
                                fprintf(out, "   %" PRIu64 " at 5.0 Gbps\n", fs.ports_ddr);
                if (fs.ports_qdr)
                                fprintf(out, "   %" PRIu64 " at 10.0 Gbps\n", fs.ports_qdr);
+             if (fs.ports_fdr)
+                             fprintf(out, "      %" PRIu64 " at 14.0625 Gbps\n", fs.ports_fdr);
+             if (fs.ports_edr)
+                             fprintf(out, "      %" PRIu64 " at 25.78125 Gbps\n", fs.ports_edr);

                if (fs.ports_disabled + fs.ports_reduced_speed + fs.ports_reduced_width
                    > 0) {
Index: B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_sa_mcmember_record.c
===================================================================
--- B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_sa_mcmember_record.c                (revision 8756)
+++ B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_sa_mcmember_record.c             (revision 8757)
@@ -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.
  *
@@ -285,7 +285,7 @@
                                rate_mgrp = (uint8_t) (p_mgrp->mcmember_rec.rate & 0x3F);
                                switch (rate_sel) {
                                case 0:  /* Greater than RATE specified */
-                                              if (rate_mgrp <= rate_required) {
+                                             if (ib_path_compare_rates(rate_mgrp, rate_required) <= 0) {
                                                                OSM_LOG(p_log, OSM_LOG_VERBOSE,
                                                                                "Requested mcast group has RATE %x, "
                                                                                "which is not greater than %x\n",
@@ -294,7 +294,7 @@
                                                }
                                                break;
                                case 1:  /* Less than RATE specified */
-                                              if (rate_mgrp >= rate_required) {
+                                             if (ib_path_compare_rates(rate_mgrp, rate_required) >= 0) {
                                                                OSM_LOG(p_log, OSM_LOG_VERBOSE,
                                                                                "Requested mcast group has RATE %x, "
                                                                                "which is not less than %x\n",
@@ -303,7 +303,7 @@
                                                }
                                                break;
                                case 2:  /* Exactly RATE specified */
-                                              if (rate_mgrp != rate_required) {
+                                             if (ib_path_compare_rates(rate_mgrp, rate_required)) {
                                                                OSM_LOG(p_log, OSM_LOG_VERBOSE,
                                                                                "Requested mcast group has RATE %x, "
                                                                                "which is not equal to %x\n",
@@ -327,6 +327,7 @@
                                                                    const osm_mgrp_t * p_mgrp,
                                                                    const osm_physp_t * p_physp)
 {
+             const ib_port_info_t *p_pi;
                uint8_t mtu_required;
                uint8_t mtu_mgrp;
                uint8_t rate_required;
@@ -341,9 +342,11 @@
                                return FALSE;
                }

-              rate_required = ib_port_info_compute_rate(&p_physp->port_info);
+             p_pi = &p_physp->port_info;
+             rate_required = ib_port_info_compute_rate(p_pi,
+                                                                                               p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);
                rate_mgrp = (uint8_t) (p_mgrp->mcmember_rec.rate & 0x3F);
-              if (rate_required < rate_mgrp) {
+             if (ib_path_compare_rates(rate_required, rate_mgrp) < 0) {
                                OSM_LOG(p_log, OSM_LOG_VERBOSE,
                                                "Port's RATE %x is less than %x\n",
                                                rate_required, rate_mgrp);
@@ -635,6 +638,7 @@
                uint8_t mtu_required, mtu, port_mtu;
                uint8_t rate_sel = 2;       /* exactly */
                uint8_t rate_required, rate, port_rate;
+             const ib_port_info_t *p_pi;
                osm_log_t *p_log = sa->p_log;

                OSM_LOG_ENTER(sa->p_log);
@@ -652,7 +656,8 @@
                 * masked in.
                 */

-              port_mtu = p_physp ? ib_port_info_get_mtu_cap(&p_physp->port_info) : 0;
+             p_pi = &p_physp->port_info;
+             port_mtu = p_physp ? ib_port_info_get_mtu_cap(p_pi) : 0;
                if (!(comp_mask & IB_MCR_COMPMASK_MTU) ||
                    !(comp_mask & IB_MCR_COMPMASK_MTU_SEL) ||
                    (mtu_sel = (p_mcm_rec->mtu >> 6)) == 3)
@@ -689,7 +694,7 @@
                                default:
                                                break;
                                }
-                              /* make sure it still be in the range */
+                             /* make sure it still is in the range */
                                if (mtu < IB_MIN_MTU || mtu > IB_MAX_MTU) {
                                                OSM_LOG(p_log, OSM_LOG_VERBOSE,
                                                                "Calculated MTU %x is out of range\n", mtu);
@@ -699,7 +704,8 @@
                p_mcm_rec->mtu = (mtu_sel << 6) | mtu;

                port_rate =
-                  p_physp ? ib_port_info_compute_rate(&p_physp->port_info) : 0;
+                             p_physp ? ib_port_info_compute_rate(p_pi,
+                                                                                             p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) : 0;
                if (!(comp_mask & IB_MCR_COMPMASK_RATE)
                    || !(comp_mask & IB_MCR_COMPMASK_RATE_SEL)
                    || (rate_sel = (p_mcm_rec->rate >> 6)) == 3)
@@ -709,7 +715,7 @@
                                rate = rate_required;
                                switch (rate_sel) {
                                case 0:  /* Greater than RATE specified */
-                                              if (port_rate && rate_required >= port_rate) {
+                                             if (ib_path_compare_rates(rate_required, port_rate) >= 0) {
                                                                OSM_LOG(p_log, OSM_LOG_VERBOSE,
                                                                                "Requested RATE %x >= the port\'s rate:%x\n",
                                                                                rate_required, port_rate);
@@ -718,19 +724,20 @@
                                                /* we provide the largest RATE possible if we can */
                                                if (port_rate)
                                                                rate = port_rate;
-                                              else if (rate_required < sa->p_subn->min_ca_rate)
+                                             else if (ib_path_compare_rates(rate_required,
+                                                                                                                sa->p_subn->min_ca_rate) < 0)
                                                                rate = sa->p_subn->min_ca_rate;
                                                else
-                                                              rate++;
+                                                             rate = ib_path_rate_get_next(rate);
                                                break;
                                case 1:  /* Less than RATE specified */
                                                /* use the smaller of the two:
                                                   a. one lower then the required
                                                   b. the rate of the requesting port (if exists) */
-                                              if (port_rate && rate_required > port_rate)
+                                             if (ib_path_compare_rates(rate_required, port_rate) > 0)
                                                                rate = port_rate;
                                                else
-                                                              rate--;
+                                                             rate = ib_path_rate_get_prev(rate);
                                                break;
                                case 2:  /* Exactly RATE specified */
                                default:
Index: B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_port_info_rcv.c
===================================================================
--- B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_port_info_rcv.c  (revision 8756)
+++ B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_port_info_rcv.c               (revision 8757)
@@ -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) 2009 HNR Consulting. All rights reserved.
  *
@@ -101,7 +101,8 @@
                                                sm->p_subn->min_ca_mtu = mtu;
                                }

-                              rate = ib_port_info_compute_rate(p_pi);
+                             rate = ib_port_info_compute_rate(p_pi,
+                                                                                             p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);
                                if (rate < sm->p_subn->min_ca_rate) {
                                                OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
                                                                "Setting endport minimal rate to:%u defined by port:0x%"
Index: B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_pkey_mgr.c
===================================================================
--- B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_pkey_mgr.c          (revision 8756)
+++ B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_pkey_mgr.c       (revision 8757)
@@ -203,8 +203,6 @@
                }

                memcpy(payload, p_pi, sizeof(ib_port_info_t));
-              memset(payload + sizeof(ib_port_info_t), 0,
-                     IB_SMP_DATA_SIZE - sizeof(ib_port_info_t));

                p_pi = (ib_port_info_t *) payload;
                if (enforce == TRUE)
Index: B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_lid_mgr.c
===================================================================
--- B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_lid_mgr.c               (revision 8756)
+++ B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_lid_mgr.c            (revision 8757)
@@ -838,8 +838,6 @@
                 */

                memcpy(payload, p_old_pi, sizeof(ib_port_info_t));
-              memset(payload + sizeof(ib_port_info_t), 0,
-                     IB_SMP_DATA_SIZE - sizeof(ib_port_info_t));

                /*
                   Should never write back a value that is bigger then 3 in
@@ -907,10 +905,12 @@
                                                   sizeof(p_pi->link_width_enabled)))
                                                send_set = TRUE;

-                              /* M_KeyProtectBits are always zero */
+                             /* M_KeyProtectBits are currently always zero */
                                p_pi->mkey_lmc = p_mgr->p_subn->opt.lmc;
-                              if (memcmp(&p_pi->mkey_lmc, &p_old_pi->mkey_lmc,
-                                                 sizeof(p_pi->mkey_lmc)))
+                             if (ib_port_info_get_lmc(p_pi) !=
+                                             ib_port_info_get_lmc(p_old_pi) ||
+                                             ib_port_info_get_mpb(p_pi) !=
+                                             ib_port_info_get_mpb(p_old_pi))
                                                send_set = TRUE;

                                /* calc new op_vls and mtu */
@@ -989,10 +989,12 @@

                                /* Determine if enhanced switch port 0 and if so set LMC */
                                if (osm_switch_sp0_is_lmc_capable(p_node->sw, p_mgr->p_subn)) {
-                                              /* M_KeyProtectBits are always zero */
+                                             /* M_KeyProtectBits are currently always zero */
                                                p_pi->mkey_lmc = p_mgr->p_subn->opt.lmc;
-                                              if (memcmp(&p_pi->mkey_lmc, &p_old_pi->mkey_lmc,
-                                                                 sizeof(p_pi->mkey_lmc)))
+                                             if (ib_port_info_get_lmc(p_pi) !=
+                                                             ib_port_info_get_lmc(p_old_pi) ||
+                                                             ib_port_info_get_mpb(p_pi) !=
+                                                             ib_port_info_get_mpb(p_old_pi))
                                                                send_set = TRUE;
                                }
                }
Index: B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_sa_path_record.c
===================================================================
--- B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_sa_path_record.c              (revision 8756)
+++ B:/users/leonid/svn/winib/branches/fdr/ulp/opensm/user/opensm/osm_sa_path_record.c           (revision 8757)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2007 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 HNR Consulting. All rights reserved.
@@ -158,12 +158,12 @@
                                                                                     OUT osm_path_parms_t * p_parms)
 {
                const osm_node_t *p_node;
-              const osm_physp_t *p_physp;
+             const osm_physp_t *p_physp, *p_physp0;
                const osm_physp_t *p_src_physp;
                const osm_physp_t *p_dest_physp;
                const osm_prtn_t *p_prtn = NULL;
                osm_opensm_t *p_osm;
-              const ib_port_info_t *p_pi;
+             const ib_port_info_t *p_pi, *p_pi0;
                ib_api_status_t status = IB_SUCCESS;
                ib_net16_t pkey;
                uint8_t mtu;
@@ -193,7 +193,8 @@
                p_osm = sa->p_subn->p_osm;

                mtu = ib_port_info_get_mtu_cap(p_pi);
-              rate = ib_port_info_compute_rate(p_pi);
+             rate = ib_port_info_compute_rate(p_pi,
+                                                                             p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);

                /*
                   Mellanox Tavor device performance is better using 1K MTU.
@@ -347,8 +348,12 @@
                                if (mtu > ib_port_info_get_mtu_cap(p_pi))
                                                mtu = ib_port_info_get_mtu_cap(p_pi);

-                              if (rate > ib_port_info_compute_rate(p_pi))
-                                              rate = ib_port_info_compute_rate(p_pi);
+                             p_physp0 = osm_node_get_physp_ptr((osm_node_t *)p_node, 0);
+                             p_pi0 = &p_physp0->port_info;
+                             if (ib_path_compare_rates(rate, ib_port_info_compute_rate(p_pi,
+                                                             p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS)) > 0)
+                                             rate = ib_port_info_compute_rate(p_pi,
+                                                             p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);

                                /*
                                   Continue with the egress port on this switch.
@@ -370,8 +375,12 @@
                                if (mtu > ib_port_info_get_mtu_cap(p_pi))
                                                mtu = ib_port_info_get_mtu_cap(p_pi);

-                              if (rate > ib_port_info_compute_rate(p_pi))
-                                              rate = ib_port_info_compute_rate(p_pi);
+                             p_physp0 = osm_node_get_physp_ptr((osm_node_t *)p_node, 0);
+                             p_pi0 = &p_physp0->port_info;
+                             if (ib_path_compare_rates(rate, ib_port_info_compute_rate(p_pi,
+                                                             p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS)) > 0)
+                                             rate = ib_port_info_compute_rate(p_pi,
+                                                             p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);

                                if (sa->p_subn->opt.qos) {
                                                /*
@@ -423,8 +432,10 @@
                if (mtu > ib_port_info_get_mtu_cap(p_pi))
                                mtu = ib_port_info_get_mtu_cap(p_pi);

-              if (rate > ib_port_info_compute_rate(p_pi))
-                              rate = ib_port_info_compute_rate(p_pi);
+             if (ib_path_compare_rates(rate, ib_port_info_compute_rate(p_pi,
+                                             p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS)) > 0)
+                             rate = ib_port_info_compute_rate(p_pi,
+                                             p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);

                OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
                                "Path min MTU = %u, min rate = %u\n", mtu, rate);
@@ -449,7 +460,7 @@
                                                mtu = p_qos_level->mtu_limit;

                                if (p_qos_level->rate_limit_set
-                                  && (rate > p_qos_level->rate_limit))
+                                             && (ib_path_compare_rates(rate, p_qos_level->rate_limit) > 0))
                                                rate = p_qos_level->rate_limit;

                                if (p_qos_level->sl_set) {
@@ -527,23 +538,22 @@
                                required_rate = ib_path_rec_rate(p_pr);
                                switch (ib_path_rec_rate_sel(p_pr)) {
                                case 0:  /* must be greater than */
-                                              if (rate <= required_rate)
+                                             if (ib_path_compare_rates(rate, required_rate) <= 0)
                                                                status = IB_NOT_FOUND;
                                                break;

                                case 1:  /* must be less than */
-                                              if (rate >= required_rate) {
+                                             if (ib_path_compare_rates(rate, required_rate) >= 0) {
                                                                /* adjust the rate to use the highest rate
                                                                   lower then the required one */
-                                                              if (required_rate > 2)
-                                                                              rate = required_rate - 1;
-                                                              else
+                                                             rate = ib_path_rate_get_prev(required_rate);
+                                                             if (!rate)
                                                                                status = IB_NOT_FOUND;
                                                }
                                                break;

                                case 2:  /* exact match */
-                                              if (rate < required_rate)
+                                             if (ib_path_compare_rates(rate, required_rate))
                                                                status = IB_NOT_FOUND;
                                                else
                                                                rate = required_rate;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20110926/76aa0a80/attachment.html>


More information about the ofw mailing list