Skip to content

Commit dfcea06

Browse files
Dag MoxnesSomasundaram Krishnasamy
authored andcommitted
RDMA/cma: Use ACK timeout for RoCE packetLifeTime
The cma is currently using a hard-coded value, CMA_IBOE_PACKET_LIFETIME, for the PacketLifeTime, as it can not be determined from the network. This value might not be optimal for all networks. The cma module supports the function rdma_set_ack_timeout to set the ACK timeout for a QP associated with a connection. As per IBTA 12.7.34 local ACK timeout = (2 * PacketLifeTime + Local CA’s ACK delay). Assuming a negligible local ACK delay, we can use PacketLifeTime = local ACK timeout/2 as a reasonable approximation for RoCE networks. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dag Moxnes <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]> (cherry picked from commit e1ee1e6) cherry-pick-repo=kernel/git/rdma/rdma.git Orabug: 30556591 Signed-off-by: Dag Moxnes <[email protected]> Reviewed-by: Håkon Bugge <[email protected]> Signed-off-by: Somasundaram Krishnasamy <[email protected]>
1 parent 80e9e54 commit dfcea06

File tree

1 file changed

+13
-2
lines changed
  • drivers/infiniband/core

1 file changed

+13
-2
lines changed

drivers/infiniband/core/cma.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2468,7 +2468,9 @@ EXPORT_SYMBOL(rdma_set_service_type);
24682468
* This function should be called before rdma_connect() on active side,
24692469
* and on passive side before rdma_accept(). It is applicable to primary
24702470
* path only. The timeout will affect the local side of the QP, it is not
2471-
* negotiated with remote side and zero disables the timer.
2471+
* negotiated with remote side and zero disables the timer. In case it is
2472+
* set before rdma_resolve_route, the value will also be used to determine
2473+
* PacketLifeTime for RoCE.
24722474
*
24732475
* Return: 0 for success
24742476
*/
@@ -2860,7 +2862,16 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
28602862
route->path_rec->rate = iboe_get_rate(ndev);
28612863
dev_put(ndev);
28622864
route->path_rec->packet_life_time_selector = IB_SA_EQ;
2863-
route->path_rec->packet_life_time = CMA_IBOE_PACKET_LIFETIME;
2865+
/* In case ACK timeout is set, use this value to calculate
2866+
* PacketLifeTime. As per IBTA 12.7.34,
2867+
* local ACK timeout = (2 * PacketLifeTime + Local CA’s ACK delay).
2868+
* Assuming a negligible local ACK delay, we can use
2869+
* PacketLifeTime = local ACK timeout/2
2870+
* as a reasonable approximation for RoCE networks.
2871+
*/
2872+
route->path_rec->packet_life_time = id_priv->timeout_set ?
2873+
id_priv->timeout - 1 : CMA_IBOE_PACKET_LIFETIME;
2874+
28642875
if (!route->path_rec->mtu) {
28652876
ret = -EINVAL;
28662877
goto err2;

0 commit comments

Comments
 (0)