[openib-general] [PATCH] mthca: fix for checked-in static rate patch

Jack Morgenstein jackm at mellanox.co.il
Mon Apr 10 08:09:00 PDT 2006


rate stored for port is a multiple of 1X. Needs to be
converted to the ib_rate enumeration.

Signed-off-by: Jack Morgenstein <jackm at mellanox.co.il>

Index: drivers/infiniband/hw/mthca/mthca_av.c
===================================================================
--- drivers/infiniband/hw/mthca/mthca_av.c	(revision 6362)
+++ drivers/infiniband/hw/mthca/mthca_av.c	(working copy)
@@ -70,11 +70,20 @@ struct mthca_av {
 static enum ib_rate memfree_rate_to_ib(u8 mthca_rate, u8 port_rate)
 {
 	switch (mthca_rate) {
-	case MTHCA_RATE_MEMFREE_EIGHTH:  return port_rate / 8;
-	case MTHCA_RATE_MEMFREE_QUARTER: return port_rate / 4;
-	case MTHCA_RATE_MEMFREE_HALF:    return port_rate / 2;
-	case MTHCA_RATE_MEMFREE_FULL:    return port_rate;
-	default:                         return port_rate;
+	case MTHCA_RATE_MEMFREE_EIGHTH:
+		return mult_to_ib_rate(port_rate / 8);
+	
+	case MTHCA_RATE_MEMFREE_QUARTER:
+		return mult_to_ib_rate(port_rate / 4);
+	
+	case MTHCA_RATE_MEMFREE_HALF:
+		return mult_to_ib_rate(port_rate / 2);
+	
+	case MTHCA_RATE_MEMFREE_FULL:
+		return mult_to_ib_rate(port_rate);
+	
+	default:
+		return mult_to_ib_rate(port_rate);
 	}
 }
 
@@ -84,7 +93,7 @@ static enum ib_rate tavor_rate_to_ib(u8 
 	case MTHCA_RATE_TAVOR_1X:     return IB_RATE_2_5_GBPS;
 	case MTHCA_RATE_TAVOR_1X_DDR: return IB_RATE_5_GBPS;
 	case MTHCA_RATE_TAVOR_4X:     return IB_RATE_10_GBPS;
-	default:		      return port_rate;
+	default:		      return mult_to_ib_rate(port_rate);
 	}
 }
 



More information about the general mailing list