aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp/ipoib
diff options
context:
space:
mode:
authorRoland Dreier <roland@topspin.com>2005-04-16 18:26:06 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:26:06 -0400
commite6ded99cbbbfef2cef537d717ad61d2f77f4dfd6 (patch)
tree44ef73e8f9ac7bdfc71ff3286e6b2715aafbbd9d /drivers/infiniband/ulp/ipoib
parent62241eb497721be7640e5d9330e60f4a88a4db46 (diff)
[PATCH] IPoIB: fix static rate calculation
Correct and simplify calculation of static rate. We need to round up the quotient of (local_rate - path_rate) / path_rate. To round up we add (path_rate - 1) to the numerator, so the quotient simplifies to (local_rate - 1) / path_rate. No idea how I came up with the old formula. Signed-off-by: Roland Dreier <roland@topspin.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/infiniband/ulp/ipoib')
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c7
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_multicast.c7
2 files changed, 6 insertions, 8 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 5a3b5c6a4494..8d35475a1d56 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -302,11 +302,10 @@ static void path_rec_completion(int status,
302 .sl = pathrec->sl, 302 .sl = pathrec->sl,
303 .port_num = priv->port 303 .port_num = priv->port
304 }; 304 };
305 int path_rate = ib_sa_rate_enum_to_int(pathrec->rate);
305 306
306 if (ib_sa_rate_enum_to_int(pathrec->rate) > 0) 307 if (path_rate > 0 && priv->local_rate > path_rate)
307 av.static_rate = (2 * priv->local_rate - 308 av.static_rate = (priv->local_rate - 1) / path_rate;
308 ib_sa_rate_enum_to_int(pathrec->rate) - 1) /
309 (priv->local_rate ? priv->local_rate : 1);
310 309
311 ipoib_dbg(priv, "static_rate %d for local port %dX, path %dX\n", 310 ipoib_dbg(priv, "static_rate %d for local port %dX, path %dX\n",
312 av.static_rate, priv->local_rate, 311 av.static_rate, priv->local_rate,
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index f46932dc81c9..70208c3d21e2 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -258,13 +258,12 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast,
258 .traffic_class = mcast->mcmember.traffic_class 258 .traffic_class = mcast->mcmember.traffic_class
259 } 259 }
260 }; 260 };
261 int path_rate = ib_sa_rate_enum_to_int(mcast->mcmember.rate);
261 262
262 av.grh.dgid = mcast->mcmember.mgid; 263 av.grh.dgid = mcast->mcmember.mgid;
263 264
264 if (ib_sa_rate_enum_to_int(mcast->mcmember.rate) > 0) 265 if (path_rate > 0 && priv->local_rate > path_rate)
265 av.static_rate = (2 * priv->local_rate - 266 av.static_rate = (priv->local_rate - 1) / path_rate;
266 ib_sa_rate_enum_to_int(mcast->mcmember.rate) - 1) /
267 (priv->local_rate ? priv->local_rate : 1);
268 267
269 ipoib_dbg_mcast(priv, "static_rate %d for local port %dX, mcmember %dX\n", 268 ipoib_dbg_mcast(priv, "static_rate %d for local port %dX, mcmember %dX\n",
270 av.static_rate, priv->local_rate, 269 av.static_rate, priv->local_rate,