From patchwork Thu Sep 24 00:29:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 260291 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE473C4727E for ; Thu, 24 Sep 2020 00:59:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 79EB42311E for ; Thu, 24 Sep 2020 00:59:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="A+w9Rw6S" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726681AbgIXA7Q (ORCPT ); Wed, 23 Sep 2020 20:59:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726466AbgIXA7Q (ORCPT ); Wed, 23 Sep 2020 20:59:16 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BB78C0613CE; Wed, 23 Sep 2020 17:59:16 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id k133so808432pgc.7; Wed, 23 Sep 2020 17:59:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=caeOrIOiWzUnYpp7IiQWCVx7AsBLB7hgOndSGgrX5Gk=; b=A+w9Rw6SyEI43czzAmd7oHvoRqydl8clyM3C8ClOVgQCfO74S02EvNMxY3TfslPQLF YOC81YxdMeaMkgtMyP2Ulij/i5WgZxMrC4BbW9ZfkX0y4Lj2ebnXjrD5vgsH6qCcWr7L qIyiSIDEwetm3DU67z+HvVvhYmNn7AdoJEr8k0KD9tYGNzTTztl3zka86trlRf7J7Jvx 5v99NtLLnNg8lo0xFnJ733bPl1jSt+coGYWPWwMun1rO0+5OQNcJ8RUtTbK2IszZo7ft JJ3kxiBdMU5br4h+NGZyycsgGDhwYKWnnlup3bZ7mDT6G84evJfEmfsYlUeWbrT6+UHH BQAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=caeOrIOiWzUnYpp7IiQWCVx7AsBLB7hgOndSGgrX5Gk=; b=g1swsDvvCcvDdqoemT9fZVKKYAuYdzYaEJHONc93z7t3D2AX4y9pIqMrFybR9Gq9Ly JYDcJrcxqMWuJxRhJyVrP9FLV2BoGlTlq+5ViL1y5t6nsVt1EBaqoSOaN0KclaEKDIQq c+1i6eIwu76yKaIIWltySRGFoyDaajcQXnG5+qStXBbRkST9sVwUrQ3WELozOszPW/PL dsFpOIIn6Ay8J/48iBvgEd00TlpgYprbZbfLvNswQd9iE4lK2OfKtCv0m8Mo6f2/LEE+ +lwxu6o8vcQNHQY46Ni0ZKy89rQhJqgfckRJrnQV0sihHNx9czqrnXSZF8vyHfl7a0Rn 4aDg== X-Gm-Message-State: AOAM5326OoOQdN3LaxDgaHz8PivB54WylcXM0gtr9y4tCvG5jW4Ch7TS LtrouryiPyHi1xsST3IfnQU= X-Google-Smtp-Source: ABdhPJytDZ8UoWMFGkes4Q/X0vLr/CJXZP9ZSSTfzJTY62QE6UHAyGz0adcgCIEaMPTORUEY1c0lhQ== X-Received: by 2002:a63:4e0a:: with SMTP id c10mr1845032pgb.369.1600909155791; Wed, 23 Sep 2020 17:59:15 -0700 (PDT) Received: from localhost ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id 27sm889290pgy.26.2020.09.23.17.59.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Sep 2020 17:59:15 -0700 (PDT) From: Geliang Tang To: Mat Martineau , Matthieu Baerts , "David S. Miller" , Jakub Kicinski Cc: Geliang Tang , netdev@vger.kernel.org, mptcp@lists.01.org, linux-kernel@vger.kernel.org Subject: [MPTCP][PATCH net-next 12/16] selftests: mptcp: add remove cfg in mptcp_connect Date: Thu, 24 Sep 2020 08:29:58 +0800 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: <430dd4f9c241ae990a5cfa6809276b36993ce91b.1600853093.git.geliangtang@gmail.com> <7b0898eff793dde434464b5fac2629739d9546fd.1600853093.git.geliangtang@gmail.com> <98bcc56283c482c294bd6ae9ce1476821ddc6837.1600853093.git.geliangtang@gmail.com> <37f2befac450fb46367f62446a4bb2c9d0a5986a.1600853093.git.geliangtang@gmail.com> <5018fd495529e058ea866e8d8edbe0bb98ec733a.1600853093.git.geliangtang@gmail.com> <644420f22ba6f0b9f9f3509c081d8d639ff4bbf3.1600853093.git.geliangtang@gmail.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch added a new cfg, named cfg_remove in mptcp_connect. This new cfg_remove is copied from cfg_join. The only difference between them is in the do_rnd_write function. Here we slow down the transfer process of all data to let the RM_ADDR suboption can be sent and received completely. Otherwise the remove address and subflow test cases don't work. Suggested-by: Matthieu Baerts Suggested-by: Paolo Abeni Suggested-by: Mat Martineau Acked-by: Paolo Abeni Signed-off-by: Geliang Tang Reviewed-by: Mat Martineau --- .../selftests/net/mptcp/mptcp_connect.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c index a54966531a64..77bb62feb872 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c @@ -54,6 +54,7 @@ static int pf = AF_INET; static int cfg_sndbuf; static int cfg_rcvbuf; static bool cfg_join; +static bool cfg_remove; static int cfg_wait; static void die_usage(void) @@ -271,6 +272,9 @@ static size_t do_rnd_write(const int fd, char *buf, const size_t len) if (cfg_join && first && do_w > 100) do_w = 100; + if (cfg_remove && do_w > 50) + do_w = 50; + bw = write(fd, buf, do_w); if (bw < 0) perror("write"); @@ -281,6 +285,9 @@ static size_t do_rnd_write(const int fd, char *buf, const size_t len) first = false; } + if (cfg_remove) + usleep(200000); + return bw; } @@ -428,7 +435,7 @@ static int copyfd_io_poll(int infd, int peerfd, int outfd) } /* leave some time for late join/announce */ - if (cfg_join) + if (cfg_join || cfg_remove) usleep(cfg_wait); close(peerfd); @@ -686,7 +693,7 @@ static void maybe_close(int fd) { unsigned int r = rand(); - if (!cfg_join && (r & 1)) + if (!(cfg_join || cfg_remove) && (r & 1)) close(fd); } @@ -822,13 +829,18 @@ static void parse_opts(int argc, char **argv) { int c; - while ((c = getopt(argc, argv, "6jlp:s:hut:m:S:R:w:")) != -1) { + while ((c = getopt(argc, argv, "6jrlp:s:hut:m:S:R:w:")) != -1) { switch (c) { case 'j': cfg_join = true; cfg_mode = CFG_MODE_POLL; cfg_wait = 400000; break; + case 'r': + cfg_remove = true; + cfg_mode = CFG_MODE_POLL; + cfg_wait = 400000; + break; case 'l': listen_mode = true; break;