[openib-general] [PATCH] osm:Fix PathRecord bug in using MTU/rate/PktLife explicitly ignoring selectors

Eitan Zahavi eitan at mellanox.co.il
Sun Dec 24 04:40:18 PST 2006


Hi Hal,

OpenSM just uses the resulting path MTU/rate/pkt-life and fail the
query even though the selector might be allowing for selecting an
appropriate value.

I have made the attached ibis based program for testing MTU select.

After this fix the following results are obtained for a case of
path allowing maximal 2K MTU .

In standard mode:
------------------------------------------------------------
MTU greater then ... 256     (0x01) ->  equal to ....... 2K
MTU less then ...... 256     (0x41) ->  NO PATHS
MTU equal to ....... 256     (0x81) ->  equal to ....... 256
MTU largest possible 256     (0xc1) ->  equal to ....... 2K
MTU greater then ... 512     (0x02) ->  equal to ....... 2K
MTU less then ...... 512     (0x42) ->  equal to ....... 256
MTU equal to ....... 512     (0x82) ->  equal to ....... 512
MTU largest possible 512     (0xc2) ->  equal to ....... 2K
MTU greater then ... 1K      (0x03) ->  equal to ....... 2K
MTU less then ...... 1K      (0x43) ->  equal to ....... 512
MTU equal to ....... 1K      (0x83) ->  equal to ....... 1K
MTU largest possible 1K      (0xc3) ->  equal to ....... 2K
MTU greater then ... 2K      (0x04) ->  NO PATHS
MTU less then ...... 2K      (0x44) ->  equal to ....... 1K
MTU equal to ....... 2K      (0x84) ->  equal to ....... 2K
MTU largest possible 2K      (0xc4) ->  equal to ....... 2K
MTU greater then ... 4K      (0x05) ->  NO PATHS
MTU less then ...... 4K      (0x45) ->  equal to ....... 2K
MTU equal to ....... 4K      (0x85) ->  NO PATHS
MTU largest possible 4K      (0xc5) ->  equal to ....... 2K
============================================================

With enable_quirks (when one of the ends is a Tavor device):
------------------------------------------------------------
MTU greater then ... 256     (0x01) ->  equal to ....... 1K
MTU less then ...... 256     (0x41) ->  NO PATHS
MTU equal to ....... 256     (0x81) ->  equal to ....... 256
MTU largest possible 256     (0xc1) ->  equal to ....... 2K
MTU greater then ... 512     (0x02) ->  equal to ....... 1K
MTU less then ...... 512     (0x42) ->  equal to ....... 256
MTU equal to ....... 512     (0x82) ->  equal to ....... 512
MTU largest possible 512     (0xc2) ->  equal to ....... 2K
MTU greater then ... 1K      (0x03) ->  NO PATHS
MTU less then ...... 1K      (0x43) ->  equal to ....... 512
MTU equal to ....... 1K      (0x83) ->  equal to ....... 1K
MTU largest possible 1K      (0xc3) ->  equal to ....... 2K
MTU greater then ... 2K      (0x04) ->  NO PATHS
MTU less then ...... 2K      (0x44) ->  equal to ....... 1K
MTU equal to ....... 2K      (0x84) ->  equal to ....... 2K
MTU largest possible 2K      (0xc4) ->  equal to ....... 2K
MTU greater then ... 4K      (0x05) ->  NO PATHS
MTU less then ...... 4K      (0x45) ->  equal to ....... 1K
MTU equal to ....... 4K      (0x85) ->  NO PATHS
MTU largest possible 4K      (0xc5) ->  equal to ....... 2K
============================================================

Signed-off-by: Eitan Zahavi <eitan at mellanox.co.il>

---
commit 7a156fd924a543b9891c676024a3dd9a90f848a9
tree 43a00fa2792aeb7d5684c6817154c9338ca96ed9
parent 613e7eea4d14a69e1faaaf251cb88f40dfe5e5a6
author Eitan Zahavi <eitan at sw053.yok.mtl.com> Sun, 24 Dec 2006 14:31:21 
+0200
committer Eitan Zahavi <eitan at sw053.yok.mtl.com> Sun, 24 Dec 2006 
14:31:21 +0200

 osm/opensm/osm_sa_multipath_record.c |   83 
+++++++++++++++++++++++-----------
 osm/opensm/osm_sa_path_record.c      |   48 ++++++++++++++++----
 2 files changed, 93 insertions(+), 38 deletions(-)

diff --git a/osm/opensm/osm_sa_multipath_record.c 
b/osm/opensm/osm_sa_multipath_record.c
index 28a0190..3eb7a6d 100644
--- a/osm/opensm/osm_sa_multipath_record.c
+++ b/osm/opensm/osm_sa_multipath_record.c
@@ -615,20 +615,29 @@ __osm_mpr_rcv_get_path_parms(
     required_mtu = ib_multipath_rec_mtu( p_mpr );
     switch ( ib_multipath_rec_mtu_sel( p_mpr ) )
     {
-      case 0:    /* must be greater than */
+      case 0:  /* must be greater than */
         if ( mtu <= required_mtu )
           status = IB_NOT_FOUND;
         break;
 
-      case 1:    /* must be less than */
-        if ( mtu >= required_mtu )
-          status = IB_NOT_FOUND;
-        break;
-
-      case 2:    /* exact match */
-        if ( mtu != required_mtu )
-          status = IB_NOT_FOUND;
-        break;
+      case 1:  /* must be less than */
+         if( mtu >= required_mtu )
+         {
+            /* adjust to use the highest mtu
+               lower then the required one */
+            if (required_mtu > 1)
+               mtu = required_mtu - 1;
+            else
+               status = IB_NOT_FOUND;
+         }
+         break;
+
+      case 2:  /* exact match */
+         if( mtu < required_mtu )
+            status = IB_NOT_FOUND;
+         else
+            mtu = required_mtu;
+         break;
 
       case 3:    /* largest available */
         /* can't be disqualified by this one */
@@ -646,22 +655,31 @@ __osm_mpr_rcv_get_path_parms(
   if ( ( comp_mask & IB_MPR_COMPMASK_RATESELEC ) &&
        ( comp_mask & IB_PR_COMPMASK_RATE ) )
   {
-    required_rate = ib_multipath_rec_rate( p_mpr );
-    switch ( ib_multipath_rec_rate_sel( p_mpr ) )
-    {
-      case 0:    /* must be greater than */
+     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 )
-          status = IB_NOT_FOUND;
+           status = IB_NOT_FOUND;
         break;
-
-      case 1:    /* must be less than */
-        if ( rate >= required_rate )
-          status = IB_NOT_FOUND;
+       
+     case 1:   /* must be less than */
+        if( rate >= required_rate )
+        {
+           /* adjust the rate to use the highest rate
+              lower then the required one */
+           if (required_rate > 2)
+              rate = required_rate - 1;
+           else
+              status = IB_NOT_FOUND;
+        }
         break;
-
-      case 2:    /* exact match */
-        if ( rate != required_rate )
-          status = IB_NOT_FOUND;
+       
+     case 2:   /* exact match */
+        if( rate < required_rate )
+           status = IB_NOT_FOUND;
+        else
+           rate = required_rate;
         break;
 
       case 3:    /* largest available */
@@ -697,13 +715,22 @@ __osm_mpr_rcv_get_path_parms(
       break;
 
     case 1:    /* must be less than */
-      if ( pkt_life >= required_pkt_life )
-        status = IB_NOT_FOUND;
-      break;
+       if( pkt_life >= required_pkt_life )
+       {
+          /* adjust the lifetime to use the highest possible
+             lower then the required one */
+          if (required_pkt_life > 1)
+             pkt_life = required_pkt_life - 1;
+          else
+             status = IB_NOT_FOUND;
+       }
+       break;
 
     case 2:    /* exact match */
-      if ( pkt_life != required_pkt_life )
-        status = IB_NOT_FOUND;
+       if( pkt_life < required_pkt_life )
+          status = IB_NOT_FOUND;
+       else
+          pkt_life = required_pkt_life;
       break;
 
     case 3:    /* smallest available */
diff --git a/osm/opensm/osm_sa_path_record.c 
b/osm/opensm/osm_sa_path_record.c
index 7f4a1b6..6d2e64e 100644
--- a/osm/opensm/osm_sa_path_record.c
+++ b/osm/opensm/osm_sa_path_record.c
@@ -528,6 +528,7 @@ __osm_pr_rcv_get_path_parms(
 
   /*
     Determine if these values meet the user criteria
+     and adjust appropriatly
   */
 
   /* we silently ignore cases where only the MTU selector is defined */
@@ -543,13 +544,22 @@ __osm_pr_rcv_get_path_parms(
       break;
 
     case 1:    /* must be less than */
-      if( mtu >= required_mtu )
-        status = IB_NOT_FOUND;
+       if( mtu >= required_mtu )
+       {
+          /* adjust to use the highest mtu
+             lower then the required one */
+          if (required_mtu > 1)
+             mtu = required_mtu - 1;
+          else
+             status = IB_NOT_FOUND;
+       }
       break;
 
     case 2:    /* exact match */
-      if( mtu != required_mtu )
-        status = IB_NOT_FOUND;
+      if( mtu < required_mtu )
+         status = IB_NOT_FOUND;
+      else
+         mtu = required_mtu;
       break;
 
     case 3:    /* largest available */
@@ -578,12 +588,21 @@ __osm_pr_rcv_get_path_parms(
 
     case 1:    /* must be less than */
       if( rate >= required_rate )
-        status = IB_NOT_FOUND;
+      {
+         /* adjust the rate to use the highest rate
+            lower then the required one */
+         if (required_rate > 2)
+            rate = required_rate - 1;
+         else
+            status = IB_NOT_FOUND;
+      }
       break;
 
     case 2:    /* exact match */
-      if( rate != required_rate )
-        status = IB_NOT_FOUND;
+      if( rate < required_rate )
+         status = IB_NOT_FOUND;
+      else
+         rate = required_rate;
       break;
 
     case 3:    /* largest available */
@@ -620,12 +639,21 @@ __osm_pr_rcv_get_path_parms(
 
     case 1:    /* must be less than */
       if( pkt_life >= required_pkt_life )
-        status = IB_NOT_FOUND;
+      {
+         /* adjust the lifetime to use the highest possible
+            lower then the required one */
+         if (required_pkt_life > 1)
+            pkt_life = required_pkt_life - 1;
+         else
+            status = IB_NOT_FOUND;
+      }
       break;
 
     case 2:    /* exact match */
-      if( pkt_life != required_pkt_life )
-        status = IB_NOT_FOUND;
+      if( pkt_life < required_pkt_life )
+         status = IB_NOT_FOUND;
+      else
+         pkt_life = required_pkt_life;
       break;
 
     case 3:    /* smallest available */


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ibisTestPathRec.tcl
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20061224/56740f91/attachment.ksh>


More information about the general mailing list