[openib-general] [PATCH 1 of 2] static rate encoding change (kernel)

Jack Morgenstein jackm at mellanox.co.il
Thu Mar 2 08:57:41 PST 2006


For static rate encoding, use encoding rate field from PathRecord,
with addition of value 0, for backwards compatibility with
current usage.

Push translation of static rate to IPD value down to provider layer.

Thus, this translation is done in only one place.

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

Index: src/drivers/infiniband/include/rdma/ib_verbs.h
===================================================================
--- src.orig/drivers/infiniband/include/rdma/ib_verbs.h	2006-03-02 
16:44:22.598040000 +0200
+++ src/drivers/infiniband/include/rdma/ib_verbs.h	2006-03-02 
18:29:38.077359000 +0200
@@ -337,6 +337,36 @@ enum ib_ah_flags {
 	IB_AH_GRH	= 1
 };
 
+enum ib_max_static_rate {
+	IB_MAX_STATIC_RATE_PORT_CURRENT_MAX = 0,
+	IB_MAX_STATIC_RATE_2_5_GBPS = 2,
+	IB_MAX_STATIC_RATE_5_GBPS   = 5,
+	IB_MAX_STATIC_RATE_10_GBPS  = 3,
+	IB_MAX_STATIC_RATE_20_GBPS  = 6,
+	IB_MAX_STATIC_RATE_30_GBPS  = 4,
+	IB_MAX_STATIC_RATE_40_GBPS  = 7,
+	IB_MAX_STATIC_RATE_60_GBPS  = 8,
+	IB_MAX_STATIC_RATE_80_GBPS  = 9,
+	IB_MAX_STATIC_RATE_120_GBPS = 10
+};
+
+static inline int ib_static_rate_enum_to_int(enum ib_max_static_rate rate)
+{
+	switch (rate) {
+	case IB_MAX_STATIC_RATE_2_5_GBPS: return  1;
+	case IB_MAX_STATIC_RATE_5_GBPS:   return  2;
+	case IB_MAX_STATIC_RATE_10_GBPS:  return  4;
+	case IB_MAX_STATIC_RATE_20_GBPS:  return  8;
+	case IB_MAX_STATIC_RATE_30_GBPS:  return 12;
+	case IB_MAX_STATIC_RATE_40_GBPS:  return 16;
+	case IB_MAX_STATIC_RATE_60_GBPS:  return 24;
+	case IB_MAX_STATIC_RATE_80_GBPS:  return 32;
+	case IB_MAX_STATIC_RATE_120_GBPS: return 48;
+	default: 	          	  return -1;
+	}
+}
+
+
 struct ib_ah_attr {
 	struct ib_global_route	grh;
 	u16			dlid;
Index: src/drivers/infiniband/ulp/ipoib/ipoib_main.c
===================================================================
--- src.orig/drivers/infiniband/ulp/ipoib/ipoib_main.c	2006-03-02 
16:44:22.907008000 +0200
+++ src/drivers/infiniband/ulp/ipoib/ipoib_main.c	2006-03-02 
17:48:53.601733000 +0200
@@ -368,16 +368,9 @@ static void path_rec_completion(int stat
 		struct ib_ah_attr av = {
 			.dlid 	       = be16_to_cpu(pathrec->dlid),
 			.sl 	       = pathrec->sl,
-			.port_num      = priv->port
+			.port_num      = priv->port,
+			.static_rate   = pathrec->rate
 		};
-		int path_rate = ib_sa_rate_enum_to_int(pathrec->rate);
-
-		if (path_rate > 0 && priv->local_rate > path_rate)
-			av.static_rate = (priv->local_rate - 1) / path_rate;
-
-		ipoib_dbg(priv, "static_rate %d for local port %dX, path %dX\n",
-			  av.static_rate, priv->local_rate,
-			  ib_sa_rate_enum_to_int(pathrec->rate));
 
 		ah = ipoib_create_ah(dev, priv->pd, &av);
 	}
Index: src/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
===================================================================
--- src.orig/drivers/infiniband/ulp/ipoib/ipoib_multicast.c	2006-03-02 
16:44:22.919011000 +0200
+++ src/drivers/infiniband/ulp/ipoib/ipoib_multicast.c	2006-03-02 
17:48:53.621735000 +0200
@@ -252,6 +252,7 @@ static int ipoib_mcast_join_finish(struc
 			.port_num      = priv->port,
 			.sl	       = mcast->mcmember.sl,
 			.ah_flags      = IB_AH_GRH,
+			.static_rate   = mcast->mcmember.rate,
 			.grh	       = {
 				.flow_label    = be32_to_cpu(mcast->mcmember.flow_label),
 				.hop_limit     = mcast->mcmember.hop_limit,
@@ -259,17 +260,8 @@ static int ipoib_mcast_join_finish(struc
 				.traffic_class = mcast->mcmember.traffic_class
 			}
 		};
-		int path_rate = ib_sa_rate_enum_to_int(mcast->mcmember.rate);
-
 		av.grh.dgid = mcast->mcmember.mgid;
 
-		if (path_rate > 0 && priv->local_rate > path_rate)
-			av.static_rate = (priv->local_rate - 1) / path_rate;
-
-		ipoib_dbg_mcast(priv, "static_rate %d for local port %dX, mcmember %dX\n",
-				av.static_rate, priv->local_rate,
-				ib_sa_rate_enum_to_int(mcast->mcmember.rate));
-
 		ah = ipoib_create_ah(dev, priv->pd, &av);
 		if (!ah) {
 			ipoib_warn(priv, "ib_address_create failed\n");
Index: src/drivers/infiniband/include/rdma/ib_sa.h
===================================================================
--- src.orig/drivers/infiniband/include/rdma/ib_sa.h	2006-01-29 
09:48:55.796263000 +0200
+++ src/drivers/infiniband/include/rdma/ib_sa.h	2006-03-02 18:28:46.291819000 
+0200
@@ -91,34 +91,6 @@ enum ib_sa_selector {
 	IB_SA_BEST = 3
 };
 
-enum ib_sa_rate {
-	IB_SA_RATE_2_5_GBPS = 2,
-	IB_SA_RATE_5_GBPS   = 5,
-	IB_SA_RATE_10_GBPS  = 3,
-	IB_SA_RATE_20_GBPS  = 6,
-	IB_SA_RATE_30_GBPS  = 4,
-	IB_SA_RATE_40_GBPS  = 7,
-	IB_SA_RATE_60_GBPS  = 8,
-	IB_SA_RATE_80_GBPS  = 9,
-	IB_SA_RATE_120_GBPS = 10
-};
-
-static inline int ib_sa_rate_enum_to_int(enum ib_sa_rate rate)
-{
-	switch (rate) {
-	case IB_SA_RATE_2_5_GBPS: return  1;
-	case IB_SA_RATE_5_GBPS:   return  2;
-	case IB_SA_RATE_10_GBPS:  return  4;
-	case IB_SA_RATE_20_GBPS:  return  8;
-	case IB_SA_RATE_30_GBPS:  return 12;
-	case IB_SA_RATE_40_GBPS:  return 16;
-	case IB_SA_RATE_60_GBPS:  return 24;
-	case IB_SA_RATE_80_GBPS:  return 32;
-	case IB_SA_RATE_120_GBPS: return 48;
-	default: 	          return -1;
-	}
-}
-
 /*
  * Structures for SA records are named "struct ib_sa_xxx_rec."  No
  * attempt is made to pack structures to match the physical layout of
Index: src/drivers/infiniband/ulp/ipoib/ipoib_fs.c
===================================================================
--- src.orig/drivers/infiniband/ulp/ipoib/ipoib_fs.c	2005-11-08 
10:07:11.320536000 +0200
+++ src/drivers/infiniband/ulp/ipoib/ipoib_fs.c	2006-03-02 18:30:04.429630000 
+0200
@@ -213,7 +213,7 @@ static int ipoib_path_seq_show(struct se
 		   gid_buf, path.pathrec.dlid ? "yes" : "no");
 
 	if (path.pathrec.dlid) {
-		rate = ib_sa_rate_enum_to_int(path.pathrec.rate) * 25;
+		rate = ib_static_rate_enum_to_int(path.pathrec.rate) * 25;
 
 		seq_printf(file,
 			   "  DLID:     0x%04x\n"



More information about the general mailing list