Skip to content

Commit

Permalink
IB/ehca: Fix static rate if path faster than link
Browse files Browse the repository at this point in the history
The formula would yield -1 if the path is faster than the link, which
is wrong in a bad way (max throttling).  Clamp to 0, which is the
correct value.

Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Joachim Fenkes authored and Roland Dreier committed Dec 1, 2007
1 parent 1401b53 commit b181258
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/infiniband/hw/ehca/ehca_av.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,12 @@ int ehca_calc_ipd(struct ehca_shca *shca, int port,

link = ib_width_enum_to_int(pa.active_width) * pa.active_speed;

/* IPD = round((link / path) - 1) */
*ipd = ((link + (path >> 1)) / path) - 1;
if (path >= link)
/* no need to throttle if path faster than link */
*ipd = 0;
else
/* IPD = round((link / path) - 1) */
*ipd = ((link + (path >> 1)) / path) - 1;

return 0;
}
Expand Down

0 comments on commit b181258

Please sign in to comment.