mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Geliang Tang <geliangtang@gmail.com>
To: Mat Martineau <mathew.j.martineau@linux.intel.com>,
	Matthieu Baerts <matthieu.baerts@tessares.net>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: Geliang Tang <geliangtang@gmail.com>,
	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	[thread overview]
Message-ID: <aa4ffb8cb7f8c135e5704eb11cfce7cb0bf7ecd4.1600853093.git.geliangtang@gmail.com> (raw)
In-Reply-To: <cover.1600853093.git.geliangtang@gmail.com>
In-Reply-To: <fcebccadfa3127e0f55103cc7ee4cd00841e2ea0.1600853093.git.geliangtang@gmail.com>

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 <matthieu.baerts@tessares.net>
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Suggested-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 .../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;
-- 
2.17.1


  reply	other threads:[~2020-09-24  0:59 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-24  0:29 [MPTCP][PATCH net-next 00/16] mptcp: RM_ADDR/ADD_ADDR enhancements Geliang Tang
2020-09-24  0:29 ` [MPTCP][PATCH net-next 01/16] mptcp: rename addr_signal and the related functions Geliang Tang
2020-09-24  0:29   ` [MPTCP][PATCH net-next 02/16] mptcp: add the outgoing RM_ADDR support Geliang Tang
2020-09-24  0:29     ` [MPTCP][PATCH net-next 03/16] mptcp: add the incoming " Geliang Tang
2020-09-24  0:29       ` [MPTCP][PATCH net-next 04/16] mptcp: send out ADD_ADDR with echo flag Geliang Tang
2020-09-24  0:29         ` [MPTCP][PATCH net-next 05/16] mptcp: add ADD_ADDR related mibs Geliang Tang
2020-09-24  0:29           ` [MPTCP][PATCH net-next 06/16] selftests: mptcp: add ADD_ADDR mibs check function Geliang Tang
2020-09-24  0:29             ` [MPTCP][PATCH net-next 07/16] mptcp: add accept_subflow re-check Geliang Tang
2020-09-24  0:29               ` [MPTCP][PATCH net-next 08/16] mptcp: remove addr and subflow in PM netlink Geliang Tang
2020-09-24  0:29                 ` [MPTCP][PATCH net-next 09/16] mptcp: implement mptcp_pm_remove_subflow Geliang Tang
2020-09-24  0:29                   ` [MPTCP][PATCH net-next 10/16] mptcp: add RM_ADDR related mibs Geliang Tang
2020-09-24  0:29                     ` [MPTCP][PATCH net-next 11/16] mptcp: add mptcp_destroy_common helper Geliang Tang
2020-09-24  0:29                       ` Geliang Tang [this message]
2020-09-24  0:29                         ` [MPTCP][PATCH net-next 13/16] selftests: mptcp: add remove addr and subflow test cases Geliang Tang
2020-09-24  0:30                           ` [MPTCP][PATCH net-next 14/16] mptcp: add struct mptcp_pm_add_entry Geliang Tang
2020-09-24  0:30                             ` [MPTCP][PATCH net-next 15/16] mptcp: add sk_stop_timer_sync helper Geliang Tang
2020-09-24  0:30                               ` [MPTCP][PATCH net-next 16/16] mptcp: retransmit ADD_ADDR when timeout Geliang Tang
2020-09-25  0:26                                 ` Mat Martineau
2020-09-25  0:26                               ` [MPTCP][PATCH net-next 15/16] mptcp: add sk_stop_timer_sync helper Mat Martineau
2020-09-25  0:25                             ` [MPTCP][PATCH net-next 14/16] mptcp: add struct mptcp_pm_add_entry Mat Martineau
2020-09-25  0:25                           ` [MPTCP][PATCH net-next 13/16] selftests: mptcp: add remove addr and subflow test cases Mat Martineau
2020-09-25  0:24                         ` [MPTCP][PATCH net-next 12/16] selftests: mptcp: add remove cfg in mptcp_connect Mat Martineau
2020-09-25  0:23                       ` [MPTCP][PATCH net-next 11/16] mptcp: add mptcp_destroy_common helper Mat Martineau
2020-09-25  0:21                     ` [MPTCP][PATCH net-next 10/16] mptcp: add RM_ADDR related mibs Mat Martineau
2020-09-25  0:20                 ` [MPTCP][PATCH net-next 08/16] mptcp: remove addr and subflow in PM netlink Mat Martineau
2020-09-25  0:19       ` [MPTCP][PATCH net-next 03/16] mptcp: add the incoming RM_ADDR support Mat Martineau
2020-09-25  0:17     ` [MPTCP][PATCH net-next 02/16] mptcp: add the outgoing " Mat Martineau
2020-09-25  0:17   ` [MPTCP][PATCH net-next 01/16] mptcp: rename addr_signal and the related functions Mat Martineau
2020-09-25  2:58 ` [MPTCP][PATCH net-next 00/16] mptcp: RM_ADDR/ADD_ADDR enhancements David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aa4ffb8cb7f8c135e5704eb11cfce7cb0bf7ecd4.1600853093.git.geliangtang@gmail.com \
    --to=geliangtang@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathew.j.martineau@linux.intel.com \
    --cc=matthieu.baerts@tessares.net \
    --cc=mptcp@lists.01.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®