Skip to contentSkip to conversation

RDMA/cma: Fix incorrect Packet Lifetime calculation

PATCH Applied Håkon Bugge 2 participants 2 messages Jun 22, 2021 – Jun 25, 2021 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 RDMA/cma: Fix incorrect Packet Lifetime calculation

An approximation for the PacketLifeTime is half the local ACK timeout. The encoding for both timers are logarithmic.

If the local ACK timeout is set, but zero, it means the timer is disabled. In this case, we choose the CMA_IBOE_PACKET_LIFETIME value, since 50% of infinite makes no sense.

Before this commit, the PacketLifeTime became 255 if local ACK timeout was zero (not running).

Fixed by explicitly testing for timeout being zero.

Fixes e1ee1e62bec4 ("RDMA/cma: Use ACK timeout for RoCE packetLifeTime")

---

v1 -> v2:
* Rebased on tip of for-next with ("RDMA/cma: Protect RMW with qp_mutex") included
* A local ACK timeout of zero now sets PacketLifeTime to CMA_IBOE_PACKET_LIFETIME
* Added Leon's r-b

---
 drivers/infiniband/core/cma.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/infiniband/core/cma.c +4 -2
index c44a0c4..35fe300 100644
@@ -3080,8 +3080,10 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
 	 * as a reasonable approximation for RoCE networks.
 	 */
 	mutex_lock(&id_priv->qp_mutex);
-	route->path_rec->packet_life_time = id_priv->timeout_set ?
-		id_priv->timeout - 1 : CMA_IBOE_PACKET_LIFETIME;
+	if (id_priv->timeout_set && id_priv->timeout)
+		route->path_rec->packet_life_time = id_priv->timeout - 1;
+	else
+		route->path_rec->packet_life_time = CMA_IBOE_PACKET_LIFETIME;
 	mutex_unlock(&id_priv->qp_mutex);
 
 	if (!route->path_rec->mtu) {
Signature · 1 line
1.8.3.1
maintainer Applied
#1 lore raw
Quoted 23 lines · Håkon Bugge

An approximation for the PacketLifeTime is half the local ACK timeout. The encoding for both timers are logarithmic.

If the local ACK timeout is set, but zero, it means the timer is disabled. In this case, we choose the CMA_IBOE_PACKET_LIFETIME value, since 50% of infinite makes no sense.

Before this commit, the PacketLifeTime became 255 if local ACK timeout was zero (not running).

Fixed by explicitly testing for timeout being zero.

Fixes e1ee1e62bec4 ("RDMA/cma: Use ACK timeout for RoCE packetLifeTime")

---

v1 -> v2:
* Rebased on tip of for-next with ("RDMA/cma: Protect RMW with qp_mutex") included
* A local ACK timeout of zero now sets PacketLifeTime to CMA_IBOE_PACKET_LIFETIME
* Added Leon's r-b

Quoted 3 lines
---
 drivers/infiniband/core/cma.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Applied to for-next, thanks

Jason