From c4f8e22a6d078fa914cd4102d65fa854587e1248 Mon Sep 17 00:00:00 2001 From: Sean Hefty Date: Mon, 7 Jul 2014 08:40:44 -0700 Subject: [PATCH] Revert "Revert "rsocket: Change keepalive to 0-byte RDMA write"" This reverts commit a34703c53259845dd20450a87eb6747030e23e8b. 0-byte RDMA writes appears to be working correctly with HCAs from 2 different vendors. The original problem that was reported turned out to be a user error. Signed-off-by: Sean Hefty --- src/rsocket.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/rsocket.c b/src/rsocket.c index b869d889..c7a0cb2a 100644 --- a/src/rsocket.c +++ b/src/rsocket.c @@ -156,6 +156,7 @@ enum { enum { RS_CTRL_DISCONNECT, + RS_CTRL_KEEPALIVE, RS_CTRL_SHUTDOWN }; @@ -4243,18 +4244,17 @@ static void tcp_svc_process_sock(struct rs_svc *svc) } /* - * Send a credit update as the keep-alive message. We may or may not have - * any credits, but if we do, then we require a minimum of 2 control credits - * for protocols that do not support RDMA write with immediate data. There's - * no need to send a keep-alive message if we have any messages outstanding, - * and we start with a minimum of 2 credits. For simplicity, we just check - * that both credits are available before sending the keep-alive. + * Send a 0 byte RDMA write with immediate as keep-alive message. + * This avoids the need for the receive side to do any acknowledgment. */ static void tcp_svc_send_keepalive(struct rsocket *rs) { fastlock_acquire(&rs->cq_lock); - if (rs_2ctrl_avail(rs) && (rs->state & rs_connected)) - rs_send_credits(rs); + if (rs_ctrl_avail(rs) && (rs->state & rs_connected)) { + rs->ctrl_seqno++; + rs_post_write(rs, NULL, 0, rs_msg_set(RS_OP_CTRL, RS_CTRL_KEEPALIVE), + 0, (uint64_t) NULL, (uint64_t) NULL); + } fastlock_release(&rs->cq_lock); } -- 2.41.0