mptcp: limits: add subflow_retries
cover mptcp: limits: add subflow_retries
This adds the new subflow-retries limit of the in-kernel path manager to "ip mptcp limits", as Matt suggested on the kernel series:
https://lore.kernel.org/mptcp/[email protected]/
Patch 1 adds the new attribute to the copied uapi header. It is only needed until the iproute2 maintainers update the headers, once the kernel part is merged.
Patch 2 adds "subflow_retries" to "ip mptcp limits set" and "show", and to the man page.
Tested in a VM with the kernel series applied: show, set, a partial set keeping the other limits, JSON output, and the maximum (127 accepted, 128 refused by the kernel).
With this ip, "pm_netlink.sh -i" from the v15 kernel series fails the "set limits" check, because ip now shows the new limit. I have a fix for the selftest, which also runs the subflow-retries checks with ip. I can squash it in the pm_netlink.sh patch of the next version of the series.
I used an LLM to help write and review these patches. I checked and tested every change myself.
Anil Kaushik (2):
uapi: mptcp: add MPTCP_PM_ATTR_SUBFLOW_RETRIES
mptcp: limits: add subflow_retries
include/uapi/linux/mptcp_pm.h | 1 + ip/ipmptcp.c | 21 ++++++++++++++++++++- man/man8/ip-mptcp.8 | 10 ++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-)
base-commit: 87cb3f4198507331b9308689d4a726d17db63dd3
Signature · 1 line
2.25.1
PATCH 1/2 uapi: mptcp: add MPTCP_PM_ATTR_SUBFLOW_RETRIES
Add the new attribute from the kernel series adding the subflow-retries limit to the in-kernel path manager. It is used by the next patch.
This should be replaced by the usual header update from the iproute2 maintainers once the kernel part is merged.
--- include/uapi/linux/mptcp_pm.h | 1 + 1 file changed, 1 insertion(+)
include/uapi/linux/mptcp_pm.h +1 -0
@@ -102,6 +102,7 @@ enum {MPTCP_PM_ATTR_TOKEN ,MPTCP_PM_ATTR_LOC_ID ,MPTCP_PM_ATTR_ADDR_REMOTE , +MPTCP_PM_ATTR_SUBFLOW_RETRIES , __MPTCP_ATTR_AFTER_LAST };
base-commit: 87cb3f4198507331b9308689d4a726d17db63dd3
Signature · 1 line
2.25.1
PATCH 2/2 mptcp: limits: add subflow_retries
In reply to Anil KaushikThe in-kernel path manager can create again a subflow closed after a retransmission or keepalive timeout. The new subflow-retries limit sets the number of SYN retries of such subflow, like the TCP_SYNCNT socket
option: 127 by default, also the maximum, and 0 to not re-create it.
Add it to "ip mptcp limits set" and show it in "ip mptcp limits show" when the kernel reports it:
# ip mptcp limits set subflow_retries 5 # ip mptcp limits show add_addr_accepted 0 subflows 2 subflow_retries 5
--- ip/ipmptcp.c | 21 ++++++++++++++++++++- man/man8/ip-mptcp.8 | 10 ++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-)
ip/ipmptcp.c +20 -1
@@ -30,6 +30,7 @@ static void usage(void)" ip mptcp endpoint show [ id ID ]\n" " ip mptcp endpoint flush\n" " ip mptcp limits set [ subflows NR ] [ add_addr_accepted NR ]\n" +" [ subflow_retries NR ]\n" " ip mptcp limits show\n" " ip mptcp monitor\n" "FLAG-LIST := [ FLAG-LIST ] FLAG\n"
@@ -362,9 +363,11 @@ static int mptcp_addr_flush(int argc, char **argv)static int mptcp_parse_limit (int argc,char **argv,struct nlmsghdr *n) {bool set_rcv_add_addrs = false; +bool set_retries = false;bool set_subflows = false;__u32 rcv_add_addrs =0 ;__u32 subflows =0 ; +__u32 retries =0 ;while (argc >0 ) {if (matches (*argv,"subflows" ) ==0 ) {
@@ -379,6 +382,12 @@ static int mptcp_parse_limit(int argc, char **argv, struct nlmsghdr *n)if (get_u32 (&rcv_add_addrs, *argv,0 ))invarg ("invalid add_addr_accepted\n" , *argv); set_rcv_add_addrs = true; + }else if (matches (*argv,"subflow_retries" ) ==0 ) { +NEXT_ARG (); + +if (get_u32 (&retries, *argv,0 )) +invarg ("invalid subflow_retries\n" , *argv); + set_retries = true; }else {invarg ("unknown limit" , *argv); }
@@ -390,7 +399,10 @@ static int mptcp_parse_limit(int argc, char **argv, struct nlmsghdr *n) rcv_add_addrs);if (set_subflows)addattr32 (n,MPTCP_BUFLEN ,MPTCP_PM_ATTR_SUBFLOWS , subflows); -return set_rcv_add_addrs || set_subflows; +if (set_retries) +addattr32 (n,MPTCP_BUFLEN ,MPTCP_PM_ATTR_SUBFLOW_RETRIES , + retries); +return set_rcv_add_addrs || set_subflows || set_retries; }static int print_mptcp_limit (struct nlmsghdr *n,void *arg)
@@ -424,6 +436,13 @@ static int print_mptcp_limit(struct nlmsghdr *n, void *arg)print_uint (PRINT_ANY ,"subflows" ,"subflows %d " , val); } +if (tb[MPTCP_PM_ATTR_SUBFLOW_RETRIES ]) { + val =rta_getattr_u32 (tb[MPTCP_PM_ATTR_SUBFLOW_RETRIES ]); + +print_uint (PRINT_ANY ,"subflow_retries" ,"subflow_retries %d " , + val); + } +print_nl ();close_json_object ();
man/man8/ip-mptcp.8 +10 -0
@@ -92,6 +92,9 @@ ip-mptcp \- MPTCP path manager configuration .RB "[ " .B add_addr_accepted .IR ADD_ADDR_ACCEPTED_NR " ]" +.RB "[ " +.B subflow_retries +.IR SUBFLOW_RETRIES_NR " ]" .ti -8 .BR "ip mptcp limits show"
@@ -268,6 +271,13 @@ In both cases the .IR SUBFLOW_NR limit is enforced. +.TP +.IR SUBFLOW_RETRIES_NR +specifies the number of SYN retries used when the in-kernel path manager +creates again a subflow closed after a retransmission or keepalive timeout, +like the TCP_SYNCNT socket option. The default and maximum value is 127, +about 4 hours with the default RTO settings. 0 disables the re-creation. + .sp .PP .B monitor
Signature · 1 line
2.25.1
Matthieu Baerts
maintainerHi Anil,
Quoted 11 lines · Anil Kaushik
This adds the new subflow-retries limit of the in-kernel path manager to "ip mptcp limits", as Matt suggested on the kernel series:
https://lore.kernel.org/mptcp/[email protected]/
Patch 1 adds the new attribute to the copied uapi header. It is only needed until the iproute2 maintainers update the headers, once the kernel part is merged.
Patch 2 adds "
subflow_retries" to "ip mptcp limits set" and "show", and to the man page.
I didn't review this in details, but I'm just thinking that you might also want to expose the new limit_subflow_retries counter in ss.
Just note that ss.c is probably going to be split, see:
https://lore.kernel.org/[email protected]
(if you send a v2, please use [iproute2-mptcp] prefix, just not to confuse with the ones that will be sent upstream)
Quoted 4 lines
With this ip, "
pm_netlink.sh-i" from the v15 kernel series fails the "set limits" check, because ip now shows the new limit. I have a fix for the selftest, which also runs the subflow-retries checks with ip. I can squash it in thepm_netlink.shpatch of the next version of the series.
Ah yes, good point. Yes, we will need it. I didn't review v15 yet, it can wait or feel free to send a v16 if you already have it.
Note that the selftests ideally need to support older kernel version (so without recent features) and older tools, e.g. IPRoute2 without your patch. (except if thing get unreadable)
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.