mptcp.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH mptcp-net v2 0/2] mptcp: support MP_PRIO signals with userspace PMs
@ 2022-06-23  0:59 Kishen Maloor
  2022-06-23  0:59 ` [PATCH mptcp-net v2 1/2] mptcp: netlink: issue MP_PRIO signals from " Kishen Maloor
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Kishen Maloor @ 2022-06-23  0:59 UTC (permalink / raw)
  To: kishen.maloor, mptcp

This patch series updates MPTCP_PM_CMD_SET_FLAGS to allow userspace PMs
to issue MP_PRIO signals for a specified address ID over a chosen
MPTCP connection. It also adds self testing support for this change.

v2:
-userspace_pm.sh: added a sleep after issuing the MP_PRIO signal.

Kishen Maloor (2):
  mptcp: netlink: issue MP_PRIO signals from userspace PMs
  selftests: mptcp: userspace PM support for MP_PRIO signals

 net/mptcp/pm_netlink.c                        | 23 +++++++++----
 net/mptcp/pm_userspace.c                      | 30 +++++++++++++++++
 net/mptcp/protocol.h                          |  6 +++-
 tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 19 +++++++++--
 .../selftests/net/mptcp/userspace_pm.sh       | 32 +++++++++++++++++++
 5 files changed, 101 insertions(+), 9 deletions(-)


base-commit: 68fec8b7f640037e4bf224ca4e924574098f5911
--
2.31.1

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH mptcp-net 2/2] selftests: mptcp: userspace PM support for MP_PRIO signals
@ 2022-06-22 17:55 Kishen Maloor
  2022-06-22 20:03 ` selftests: mptcp: userspace PM support for MP_PRIO signals: Tests Results MPTCP CI
  0 siblings, 1 reply; 7+ messages in thread
From: Kishen Maloor @ 2022-06-22 17:55 UTC (permalink / raw)
  To: kishen.maloor, mptcp

This change updates the testing sample (pm_nl_ctl) to take a
connection token as an optional param for the MPTCP_PM_CMD_SET_FLAGS
command. This is used to test the userspace PM code path for issuing
MP_PRIO signals over a connection for the specified address ID.

E.g. ./pm_nl_ctl set id 0 flags backup token 823274047

userspace_pm.sh has new selftests which exercise this command.

Fixes: 259a834fadda ("selftests: mptcp: functional tests for the userspace PM type")
Signed-off-by: Kishen Maloor <kishen.maloor@intel.com>
---
 tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 19 ++++++++++--
 .../selftests/net/mptcp/userspace_pm.sh       | 31 +++++++++++++++++++
 2 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c
index 4dd87bb9ee91..0512d64b1d11 100644
--- a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c
+++ b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c
@@ -39,7 +39,7 @@ static void syntax(char *argv[])
 	fprintf(stderr, "\tdsf lip <local-ip> lport <local-port> rip <remote-ip> rport <remote-port> token <token>\n");
 	fprintf(stderr, "\tdel <id> [<ip>]\n");
 	fprintf(stderr, "\tget <id>\n");
-	fprintf(stderr, "\tset [<ip>] [id <nr>] flags [no]backup|[no]fullmesh [port <nr>]\n");
+	fprintf(stderr, "\tset [<ip>] [id <nr>] flags [no]backup|[no]fullmesh [port <nr>] [token <token>]\n");
 	fprintf(stderr, "\tflush\n");
 	fprintf(stderr, "\tdump\n");
 	fprintf(stderr, "\tlimits [<rcv addr max> <subflow max>]\n");
@@ -1279,6 +1279,7 @@ int set_flags(int fd, int pm_family, int argc, char *argv[])
 	struct rtattr *rta, *nest;
 	struct nlmsghdr *nh;
 	u_int32_t flags = 0;
+	u_int32_t token = 0;
 	u_int16_t family;
 	int nest_start;
 	int use_id = 0;
@@ -1339,7 +1340,13 @@ int set_flags(int fd, int pm_family, int argc, char *argv[])
 		error(1, 0, " missing flags keyword");
 
 	for (; arg < argc; arg++) {
-		if (!strcmp(argv[arg], "flags")) {
+		if (!strcmp(argv[arg], "token")) {
+			if (++arg >= argc)
+				error(1, 0, " missing token value");
+
+			/* token */
+			token = atoi(argv[arg]);
+		} else if (!strcmp(argv[arg], "flags")) {
 			char *tok, *str;
 
 			/* flags */
@@ -1384,6 +1391,14 @@ int set_flags(int fd, int pm_family, int argc, char *argv[])
 	}
 	nest->rta_len = off - nest_start;
 
+	if (token) {
+		rta = (void *)(data + off);
+		rta->rta_type = MPTCP_PM_ATTR_TOKEN;
+		rta->rta_len = RTA_LENGTH(4);
+		memcpy(RTA_DATA(rta), &token, 4);
+		off += NLMSG_ALIGN(rta->rta_len);
+	}
+
 	do_nl_req(fd, nh, off, 0);
 	return 0;
 }
diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh
index d586bc5ffe01..387f5774d541 100755
--- a/tools/testing/selftests/net/mptcp/userspace_pm.sh
+++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh
@@ -776,10 +776,41 @@ test_subflows()
 	rm -f "$evts"
 }
 
+test_prio()
+{
+	local count
+
+	# Send MP_PRIO signal from client to server machine
+	ip netns exec "$ns2" ./pm_nl_ctl set id 0 flags backup token "$client4_token"
+
+	# Check TX
+	stdbuf -o0 -e0 printf "MP_PRIO TX                                                 \t"
+	count=$(ip netns exec "$ns2" nstat -as | grep MPTcpExtMPPrioTx | awk '{print $2}')
+	[ -z "$count" ] && count=0
+	if [ $count != 1 ]; then
+		stdbuf -o0 -e0 printf "[FAIL]\n"
+		exit 1
+	else
+		stdbuf -o0 -e0 printf "[OK]\n"
+	fi
+
+	# Check RX
+	stdbuf -o0 -e0 printf "MP_PRIO RX                                                 \t"
+	count=$(ip netns exec "$ns1" nstat -as | grep MPTcpExtMPPrioRx | awk '{print $2}')
+	[ -z "$count" ] && count=0
+	if [ $count != 1 ]; then
+		stdbuf -o0 -e0 printf "[FAIL]\n"
+		exit 1
+	else
+		stdbuf -o0 -e0 printf "[OK]\n"
+	fi
+}
+
 make_connection
 make_connection "v6"
 test_announce
 test_remove
 test_subflows
+test_prio
 
 exit 0
-- 
2.31.1


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

end of thread, other threads:[~2022-06-23 21:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-23  0:59 [PATCH mptcp-net v2 0/2] mptcp: support MP_PRIO signals with userspace PMs Kishen Maloor
2022-06-23  0:59 ` [PATCH mptcp-net v2 1/2] mptcp: netlink: issue MP_PRIO signals from " Kishen Maloor
2022-06-23  0:59 ` [PATCH mptcp-net v2 2/2] selftests: mptcp: userspace PM support for MP_PRIO signals Kishen Maloor
2022-06-23  2:39   ` selftests: mptcp: userspace PM support for MP_PRIO signals: Tests Results MPTCP CI
2022-06-23 15:02 ` [PATCH mptcp-net v2 0/2] mptcp: support MP_PRIO signals with userspace PMs Mat Martineau
2022-06-23 21:32   ` Mat Martineau
  -- strict thread matches above, loose matches on Subject: below --
2022-06-22 17:55 [PATCH mptcp-net 2/2] selftests: mptcp: userspace PM support for MP_PRIO signals Kishen Maloor
2022-06-22 20:03 ` selftests: mptcp: userspace PM support for MP_PRIO signals: Tests Results MPTCP CI

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).