summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband')
-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,
.sl = pathrec->sl,
.port_num = priv->port
};
+ int path_rate = ib_sa_rate_enum_to_int(pathrec->rate);
- if (ib_sa_rate_enum_to_int(pathrec->rate) > 0)
- av.static_rate = (2 * priv->local_rate -
- ib_sa_rate_enum_to_int(pathrec->rate) - 1) /
- (priv->local_rate ? priv->local_rate : 1);
+ 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,
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,
.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 (ib_sa_rate_enum_to_int(mcast->mcmember.rate) > 0)
- av.static_rate = (2 * priv->local_rate -
- ib_sa_rate_enum_to_int(mcast->mcmember.rate) - 1) /
- (priv->local_rate ? priv->local_rate : 1);
+ 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,
OpenPOWER on IntegriCloud