From: Anil Kaushik <anilkaushikwireless@gmail.com>
To: mptcp@lists.linux.dev
Cc: anilkaushikwireless@gmail.com
Subject: [PATCH mptcp-next v16 6/7] selftests: mptcp: pm_nl_ctl: support the subflow-retries limit
Date: Sun, 22 Nov 2026 00:47:53 +0000 [thread overview]
Message-ID: <20261122004754.2276802-7-anilkaushikwireless@gmail.com> (raw)
In-Reply-To: <20261122004754.2276802-1-anilkaushikwireless@gmail.com>
'pm_nl_ctl limits' can now set the subflow-retries limit with a third
value, and shows it when the kernel supports it. The shared
mptcp_lib_pm_nl_set_limits() helper takes it as an optional value too,
for both ip and pm_nl_ctl: the existing callers are not changed.
pm_netlink.sh checks its default value, that a value above the maximum
is refused, that it can be set, and that it is kept when only the other
limits are set. With "-i", this is done with "ip mptcp" when it supports
this limit, and the expected "ip mptcp limits" output includes it then.
With an older kernel or an older ip, these checks are skipped.
Signed-off-by: Anil Kaushik <anilkaushikwireless@gmail.com>
---
.../testing/selftests/net/mptcp/mptcp_lib.sh | 8 ++-
.../testing/selftests/net/mptcp/pm_netlink.sh | 59 +++++++++++++++++--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 34 ++++++++---
3 files changed, 88 insertions(+), 13 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
index e1c8c6fd8820..7039ee7356ce 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
@@ -689,15 +689,19 @@ mptcp_lib_pm_nl_get_endpoint() {
fi
}
+# $1: ns, $2: rcv addrs, $3: subflows, [ $4: subflow retries ]
mptcp_lib_pm_nl_set_limits() {
local ns=${1}
local addrs=${2}
local subflows=${3}
+ local retries=${4}
if mptcp_lib_is_ip_mptcp; then
- ip -n "${ns}" mptcp limits set add_addr_accepted "${addrs}" subflows "${subflows}"
+ ip -n "${ns}" mptcp limits set add_addr_accepted "${addrs}" subflows "${subflows}" \
+ ${retries:+subflow_retries "${retries}"}
else
- ip netns exec "${ns}" ./pm_nl_ctl limits "${addrs}" "${subflows}"
+ ip netns exec "${ns}" ./pm_nl_ctl limits "${addrs}" "${subflows}" \
+ ${retries:+"${retries}"}
fi
}
diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testing/selftests/net/mptcp/pm_netlink.sh
index 21bfe1311f11..ca8c5db00ea4 100755
--- a/tools/testing/selftests/net/mptcp/pm_netlink.sh
+++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh
@@ -46,15 +46,24 @@ trap cleanup EXIT
mptcp_lib_ns_init ns1
+# $3: subflow retries, if supported
format_limits() {
local accept="${1}"
local subflows="${2}"
+ local retries="${3}"
if mptcp_lib_is_ip_mptcp; then
# with a space at the end
- printf "add_addr_accepted %d subflows %d \n" "${accept}" "${subflows}"
+ printf "add_addr_accepted %d subflows %d " "${accept}" "${subflows}"
+ if [ -n "${retries}" ]; then
+ printf "subflow_retries %d " "${retries}"
+ fi
+ printf "\n"
else
printf "accept %d\nsubflows %d\n" "${accept}" "${subflows}"
+ if [ -n "${retries}" ]; then
+ printf "subflow_retries %d\n" "${retries}"
+ fi
fi
}
@@ -71,7 +80,24 @@ get_limits_nb() {
ip -n "${ns1}" mptcp limits | awk '{ print $2" "$4 }'
else
ip netns exec "${ns1}" ./pm_nl_ctl limits | \
- awk '{ printf "%s ", $2 }'
+ awk 'NR <= 2 { printf "%s ", $2 }'
+ fi
+}
+
+# Prints the default value of the subflow retries limit if it is supported.
+# With ip mptcp, it also needs an iproute2 version supporting it.
+get_default_retries() {
+ if mptcp_lib_is_ip_mptcp; then
+ if ! ip mptcp help 2>&1 | grep -q "subflow_retries"; then
+ return
+ fi
+ fi
+
+ if get_limits | grep -q "subflow_retries"; then
+ echo 127
+ elif mptcp_lib_expect_all_features; then
+ # missing feature: the defaults limits check will fail
+ echo 127
fi
}
@@ -154,8 +180,10 @@ mptcp_lib_subtests_last_ts_reset
check "show_endpoints" "" "defaults addr list"
default_limits="$(get_limits)"
+default_retries="$(get_default_retries)"
if mptcp_lib_expect_all_features; then
- check "get_limits" "$(format_limits 0 2)" "defaults limits"
+ check "get_limits" "$(format_limits 0 2 "${default_retries}")" \
+ "defaults limits"
fi
add_endpoint 10.0.1.1
@@ -224,7 +252,30 @@ check "get_limits" "${default_limits}" "subflows above hard limit"
set_limits ${max_limits} ${max_limits}
flush_endpoint ## to make sure it doesn't affect the limits
-check "get_limits" "$(format_limits ${max_limits} ${max_limits})" "set limits"
+max_limits_out="$(format_limits ${max_limits} ${max_limits} \
+ "${default_retries}")"
+check "get_limits" "${max_limits_out}" "set limits"
+
+if [ -n "${default_retries}" ]; then
+ set_limits ${max_limits} ${max_limits} 0
+ check "get_limits" "$(format_limits ${max_limits} ${max_limits} 0)" \
+ "set subflow retries"
+
+ # not given: unchanged
+ set_limits ${max_limits} ${max_limits}
+ check "get_limits" "$(format_limits ${max_limits} ${max_limits} 0)" \
+ "subflow retries kept"
+
+ # not from the default: a refused value differs from a clamped one
+ set_limits ${max_limits} ${max_limits} 128 2>/dev/null
+ check "get_limits" "$(format_limits ${max_limits} ${max_limits} 0)" \
+ "subflow retries above hard limit"
+
+ set_limits ${max_limits} ${max_limits} 127
+ check "get_limits" "$(format_limits ${max_limits} ${max_limits} 127)" \
+ "set max subflow retries"
+ set_limits ${max_limits} ${max_limits} "${default_retries}"
+fi
flush_endpoint
add_endpoint 10.0.1.1
diff --git a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c
index 36a6d39b31bb..b8413246d3ad 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, "\tset [<ip>] [id <nr>] flags [no]backup|[no]fullmesh [port <nr>] [token <token>] [rip <ip>] [rport <port>]\n");
fprintf(stderr, "\tflush\n");
fprintf(stderr, "\tdump\n");
- fprintf(stderr, "\tlimits [<rcv addr max> <subflow max>]\n");
+ fprintf(stderr, "\tlimits [<rcv addr max> <subflow max> [<retry>]]\n");
fprintf(stderr, "\tevents\n");
fprintf(stderr, "\tlisten <local-ip> <local-port>\n");
exit(0);
@@ -1217,6 +1217,7 @@ int flush_addrs(int fd, int pm_family, int argc, char *argv[])
static void print_limits(struct nlmsghdr *nh, int pm_family, int total_len)
{
struct rtattr *attrs;
+ const char *name;
uint32_t max;
for (; NLMSG_OK(nh, total_len); nh = NLMSG_NEXT(nh, total_len)) {
@@ -1235,13 +1236,22 @@ static void print_limits(struct nlmsghdr *nh, int pm_family, int total_len)
while (RTA_OK(attrs, len)) {
int type = attrs->rta_type;
- if (type != MPTCP_PM_ATTR_RCV_ADD_ADDRS &&
- type != MPTCP_PM_ATTR_SUBFLOWS)
+ switch (type) {
+ case MPTCP_PM_ATTR_RCV_ADD_ADDRS:
+ name = "accept";
+ break;
+ case MPTCP_PM_ATTR_SUBFLOWS:
+ name = "subflows";
+ break;
+ case MPTCP_PM_ATTR_SUBFLOW_RETRIES:
+ name = "subflow_retries";
+ break;
+ default:
goto next;
+ }
memcpy(&max, RTA_DATA(attrs), 4);
- printf("%s %u\n", type == MPTCP_PM_ATTR_SUBFLOWS ?
- "subflows" : "accept", max);
+ printf("%s %u\n", name, max);
next:
attrs = RTA_NEXT(attrs, len);
@@ -1254,15 +1264,17 @@ int get_set_limits(int fd, int pm_family, int argc, char *argv[])
char data[NLMSG_ALIGN(sizeof(struct nlmsghdr)) +
NLMSG_ALIGN(sizeof(struct genlmsghdr)) +
1024];
- uint32_t rcv_addr = 0, subflows = 0;
+ uint32_t rcv_addr = 0, subflows = 0, retries = 0;
int cmd, len = sizeof(data);
struct nlmsghdr *nh;
int off = 0;
/* limit */
- if (argc == 4) {
+ if (argc == 4 || argc == 5) {
rcv_addr = atoi(argv[2]);
subflows = atoi(argv[3]);
+ if (argc == 5)
+ retries = atoi(argv[4]);
cmd = MPTCP_PM_CMD_SET_LIMITS;
} else {
cmd = MPTCP_PM_CMD_GET_LIMITS;
@@ -1287,6 +1299,14 @@ int get_set_limits(int fd, int pm_family, int argc, char *argv[])
memcpy(RTA_DATA(rta), &subflows, 4);
off += NLMSG_ALIGN(rta->rta_len);
+ if (argc == 5) {
+ rta = (void *)(data + off);
+ rta->rta_type = MPTCP_PM_ATTR_SUBFLOW_RETRIES;
+ rta->rta_len = RTA_LENGTH(4);
+ memcpy(RTA_DATA(rta), &retries, 4);
+ off += NLMSG_ALIGN(rta->rta_len);
+ }
+
/* do not expect a reply */
len = 0;
}
--
2.25.1
next prev parent reply other threads:[~2026-11-22 0:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 0:47 [PATCH mptcp-next v16 0/7] mptcp: pm: in-kernel: retry subflows closed after an error Anil Kaushik
2026-11-22 0:47 ` [PATCH mptcp-next v16 1/7] selftests: mptcp: connect: retry write() on EAGAIN Anil Kaushik
2026-11-22 0:47 ` [PATCH mptcp-next v16 2/7] mptcp: pm: in-kernel: check the limits with the netlink policy Anil Kaushik
2026-11-22 0:47 ` [PATCH mptcp-next v16 3/7] netlink: specs: mptcp: add the subflow-retries attribute Anil Kaushik
2026-11-22 0:47 ` [PATCH mptcp-next v16 4/7] mptcp: pm: in-kernel: add the subflow-retries limit Anil Kaushik
2026-11-22 0:47 ` [PATCH mptcp-next v16 5/7] mptcp: pm: in-kernel: retry subflows closed after an error Anil Kaushik
2026-11-22 0:47 ` Anil Kaushik [this message]
2026-11-22 0:47 ` [PATCH mptcp-next v16 7/7] selftests: mptcp: join: validate subflow retry after link failure Anil Kaushik
2026-11-22 3:28 ` [PATCH mptcp-next v16 0/7] mptcp: pm: in-kernel: retry subflows closed after an error MPTCP CI
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=20261122004754.2276802-7-anilkaushikwireless@gmail.com \
--to=anilkaushikwireless@gmail.com \
--cc=mptcp@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.