From patchwork Mon Jan 28 13:56:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 10783709 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3628C1390 for ; Mon, 28 Jan 2019 13:57:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24BC22ADA3 for ; Mon, 28 Jan 2019 13:57:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18F9C2ADAB; Mon, 28 Jan 2019 13:57:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2CC82ADB9 for ; Mon, 28 Jan 2019 13:57:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726772AbfA1N5A (ORCPT ); Mon, 28 Jan 2019 08:57:00 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:43508 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726695AbfA1N47 (ORCPT ); Mon, 28 Jan 2019 08:56:59 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 28 Jan 2019 15:56:52 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [10.7.2.17]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x0SDuqg3028052; Mon, 28 Jan 2019 15:56:52 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [127.0.0.1]) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8) with ESMTP id x0SDuqV0018436; Mon, 28 Jan 2019 15:56:52 +0200 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id x0SDuqhZ018435; Mon, 28 Jan 2019 15:56:52 +0200 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, danitg@mellanox.com, monis@mellanox.com, jgg@mellanox.com, majd@mellanox.com Subject: [PATCH rdma-core 4/4] ucmatose: Add option to set ACK timeout Date: Mon, 28 Jan 2019 15:56:27 +0200 Message-Id: <1548683787-18270-5-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1548683787-18270-1-git-send-email-yishaih@mellanox.com> References: <1548683787-18270-1-git-send-email-yishaih@mellanox.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Danit Goldberg The option is available via "-a" flag. Signed-off-by: Danit Goldberg Reviewed-by: Moni Shoua Signed-off-by: Yishai Hadas --- librdmacm/examples/cmatose.c | 24 ++++++++++++++++++++++-- librdmacm/man/ucmatose.1 | 8 ++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/librdmacm/examples/cmatose.c b/librdmacm/examples/cmatose.c index 457e507..1f7f315 100644 --- a/librdmacm/examples/cmatose.c +++ b/librdmacm/examples/cmatose.c @@ -80,6 +80,8 @@ static uint8_t migrate = 0; static char *dst_addr; static char *src_addr; static struct rdma_addrinfo hints; +static uint8_t set_timeout; +static uint8_t timeout; static int create_message(struct cmatest_node *node) { @@ -223,7 +225,13 @@ static int addr_handler(struct cmatest_node *node) if (ret) perror("cmatose: set TOS option failed"); } - + if (set_timeout) { + ret = rdma_set_option(node->cma_id, RDMA_OPTION_ID, + RDMA_OPTION_ID_ACK_TIMEOUT, + &timeout, sizeof(timeout)); + if (ret) + perror("cmatose: set ack timeout option failed"); + } ret = rdma_resolve_route(node->cma_id, 2000); if (ret) { perror("cmatose: resolve route failed"); @@ -280,6 +288,13 @@ static int connect_handler(struct rdma_cm_id *cma_id) if (ret) goto err2; + if (set_timeout) { + ret = rdma_set_option(node->cma_id, RDMA_OPTION_ID, + RDMA_OPTION_ID_ACK_TIMEOUT, + &timeout, sizeof(timeout)); + if (ret) + perror("cmatose: set ack timeout option failed"); + } ret = post_recvs(node); if (ret) goto err2; @@ -635,7 +650,7 @@ int main(int argc, char **argv) int op, ret; hints.ai_port_space = RDMA_PS_TCP; - while ((op = getopt(argc, argv, "s:b:f:P:c:C:S:t:p:m")) != -1) { + while ((op = getopt(argc, argv, "s:b:f:P:c:C:S:t:p:a:m")) != -1) { switch (op) { case 's': dst_addr = optarg; @@ -679,6 +694,10 @@ int main(int argc, char **argv) case 'm': migrate = 1; break; + case 'a': + set_timeout = 1; + timeout = (uint8_t) strtoul(optarg, NULL, 0); + break; default: printf("usage: %s\n", argv[0]); printf("\t[-s server_address]\n"); @@ -693,6 +712,7 @@ int main(int argc, char **argv) printf("\t[-t type_of_service]\n"); printf("\t[-p port_number]\n"); printf("\t[-m(igrate)]\n"); + printf("\t[-a ack_timeout]\n"); exit(1); } } diff --git a/librdmacm/man/ucmatose.1 b/librdmacm/man/ucmatose.1 index 56e0702..d672e9d 100644 --- a/librdmacm/man/ucmatose.1 +++ b/librdmacm/man/ucmatose.1 @@ -7,10 +7,10 @@ ucmatose \- RDMA CM connection and simple ping-pong test. .nf \fIucmatose\fR [-s server_address] [-b bind_address] [-f address_format] [-P port_space] - [-c connections] [-C message_count] [-S message_size] + [-c connections] [-C message_count] [-S message_size] [-a ack_timeout] \fIucmatose\fR -s server_address [-b bind_address] [-f address_format] [-P port_space] - [-c connections] [-C message_count] [-S message_size] [-t tos] + [-c connections] [-C message_count] [-S message_size] [-t tos] [-a ack_timeout] .fi .SH "DESCRIPTION" Establishes a set of reliable RDMA connections between two nodes using the @@ -52,6 +52,10 @@ The size of each message transferred, in bytes. (default 100) Indicates the type of service used for the communication. Type of service is implementation dependent based on subnet configuration. .TP +\-a ack_timeout +Indicates the QP ACK timeout value that should be used. +The value calculated according to the formula 4.096 * 2^(ack_timeout) usec. +.TP \-m Tests event channel migration. Migrates all communication identifiers to a different event channel for disconnect events.