IB/ehca: Fix static rate if path faster than link
[sfrench/cifs-2.6.git] / drivers / infiniband / hw / ehca / ehca_av.c
index 453eb995c1d47b59255e46d4fcad70147d83c9e5..f7782c882ab4c9cfb9c6c49ee116efb1107f639d 100644 (file)
@@ -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;
 }