From: Joachim Fenkes Date: Sat, 1 Dec 2007 00:19:41 +0000 (-0800) Subject: IB/ehca: Fix static rate if path faster than link X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b1812582ba94b5f377d5d3cec7646cc17d84e733;p=openwrt%2Fstaging%2Fblogic.git IB/ehca: Fix static rate if path faster than link 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 Signed-off-by: Roland Dreier --- diff --git a/drivers/infiniband/hw/ehca/ehca_av.c b/drivers/infiniband/hw/ehca/ehca_av.c index 453eb995c1d4..f7782c882ab4 100644 --- a/drivers/infiniband/hw/ehca/ehca_av.c +++ b/drivers/infiniband/hw/ehca/ehca_av.c @@ -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; }