Skip to content

Commit e1ee1e6

Browse files
Dag Moxnesjgunthorpe
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]>
1 parent 72b894b commit e1ee1e6

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
@@ -2504,7 +2504,9 @@ EXPORT_SYMBOL(rdma_set_service_type);
25042504
* This function should be called before rdma_connect() on active side,
25052505
* and on passive side before rdma_accept(). It is applicable to primary
25062506
* path only. The timeout will affect the local side of the QP, it is not
2507-
* negotiated with remote side and zero disables the timer.
2507+
* negotiated with remote side and zero disables the timer. In case it is
2508+
* set before rdma_resolve_route, the value will also be used to determine
2509+
* PacketLifeTime for RoCE.
25082510
*
25092511
* Return: 0 for success
25102512
*/
@@ -2913,7 +2915,16 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
29132915
route->path_rec->rate = iboe_get_rate(ndev);
29142916
dev_put(ndev);
29152917
route->path_rec->packet_life_time_selector = IB_SA_EQ;
2916-
route->path_rec->packet_life_time = CMA_IBOE_PACKET_LIFETIME;
2918+
/* In case ACK timeout is set, use this value to calculate
2919+
* PacketLifeTime. As per IBTA 12.7.34,
2920+
* local ACK timeout = (2 * PacketLifeTime + Local CA’s ACK delay).
2921+
* Assuming a negligible local ACK delay, we can use
2922+
* PacketLifeTime = local ACK timeout/2
2923+
* as a reasonable approximation for RoCE networks.
2924+
*/
2925+
route->path_rec->packet_life_time = id_priv->timeout_set ?
2926+
id_priv->timeout - 1 : CMA_IBOE_PACKET_LIFETIME;
2927+
29172928
if (!route->path_rec->mtu) {
29182929
ret = -EINVAL;
29192930
goto err2;

0 commit comments

Comments
 (0)