Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b1812582 authored by Joachim Fenkes's avatar Joachim Fenkes Committed by Roland Dreier
Browse files

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: default avatarJoachim Fenkes <fenkes@de.ibm.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 1401b53a
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -76,6 +76,10 @@ int ehca_calc_ipd(struct ehca_shca *shca, int port,

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

	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;