linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH rdma-next] RDMA/cma: Use ACK timeout for RoCE packetLifeTime
@ 2019-10-25 11:42 Dag Moxnes
  2019-10-29 19:51 ` Jason Gunthorpe
  0 siblings, 1 reply; 3+ messages in thread
From: Dag Moxnes @ 2019-10-25 11:42 UTC (permalink / raw)
  To: dledford, jgg, leon, parav; +Cc: linux-rdma, linux-kernel, dag.moxnes

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.

Signed-off-by: Dag Moxnes <dag.moxnes@oracle.com>
Change-Id: I200eda9d54829184e556c3c55d6a8869558d76b2
---
 drivers/infiniband/core/cma.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index c8566a4237..2c1b08bde2 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -2530,7 +2530,9 @@ EXPORT_SYMBOL(rdma_set_service_type);
  * This function should be called before rdma_connect() on active side,
  * and on passive side before rdma_accept(). It is applicable to primary
  * path only. The timeout will affect the local side of the QP, it is not
- * negotiated with remote side and zero disables the timer.
+ * negotiated with remote side and zero disables the timer. In case it is
+ * set before rdma_resolve_route, the value will also be used to determine
+ * PacketLifeTime for RoCE.
  *
  * Return: 0 for success
  */
@@ -2939,7 +2941,16 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
 	route->path_rec->rate = iboe_get_rate(ndev);
 	dev_put(ndev);
 	route->path_rec->packet_life_time_selector = IB_SA_EQ;
-	route->path_rec->packet_life_time = CMA_IBOE_PACKET_LIFETIME;
+	/* In case ACK timeout is set, use this value to calculate
+	 * PacketLifeTime.  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.
+	 */
+	route->path_rec->packet_life_time = id_priv->timeout_set ?
+		id_priv->timeout - 1 : CMA_IBOE_PACKET_LIFETIME;
+
 	if (!route->path_rec->mtu) {
 		ret = -EINVAL;
 		goto err2;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH rdma-next] RDMA/cma: Use ACK timeout for RoCE packetLifeTime
  2019-10-25 11:42 [PATCH rdma-next] RDMA/cma: Use ACK timeout for RoCE packetLifeTime Dag Moxnes
@ 2019-10-29 19:51 ` Jason Gunthorpe
  2019-10-29 20:58   ` Dag Moxnes
  0 siblings, 1 reply; 3+ messages in thread
From: Jason Gunthorpe @ 2019-10-29 19:51 UTC (permalink / raw)
  To: Dag Moxnes; +Cc: dledford, leon, parav, linux-rdma, linux-kernel

On Fri, Oct 25, 2019 at 01:42:01PM +0200, Dag Moxnes wrote:
> 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.
> 
> Signed-off-by: Dag Moxnes <dag.moxnes@oracle.com>
> Change-Id: I200eda9d54829184e556c3c55d6a8869558d76b2

Please don't send Change-Id to the public lists. Run checkpatch before
sending.

Otherwise this seems reasonable to me..

Jason

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH rdma-next] RDMA/cma: Use ACK timeout for RoCE packetLifeTime
  2019-10-29 19:51 ` Jason Gunthorpe
@ 2019-10-29 20:58   ` Dag Moxnes
  0 siblings, 0 replies; 3+ messages in thread
From: Dag Moxnes @ 2019-10-29 20:58 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: dledford, leon, parav, linux-rdma, linux-kernel

Hi Jason,

Den 29.10.2019 20:51, skrev Jason Gunthorpe:
> On Fri, Oct 25, 2019 at 01:42:01PM +0200, Dag Moxnes wrote:
>> 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.
>>
>> Signed-off-by: Dag Moxnes <dag.moxnes@oracle.com>
>> Change-Id: I200eda9d54829184e556c3c55d6a8869558d76b2
> Please don't send Change-Id to the public lists. Run checkpatch before
> sending.
>
> Otherwise this seems reasonable to me..
Thanks for the review. Sorry about the Change-Id. I will send a v2 patch 
without it.

Regards,
-Dag
>
> Jason


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-29 20:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-25 11:42 [PATCH rdma-next] RDMA/cma: Use ACK timeout for RoCE packetLifeTime Dag Moxnes
2019-10-29 19:51 ` Jason Gunthorpe
2019-10-29 20:58   ` Dag Moxnes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).