* [MPTCP][PATCH v7 mptcp-next 0/6] fullmesh path manager support @ 2021-07-29 7:20 Geliang Tang 2021-07-29 7:20 ` [MPTCP][PATCH v7 mptcp-next 1/6] mptcp: drop flags and ifindex arguments Geliang Tang ` (2 more replies) 0 siblings, 3 replies; 11+ messages in thread From: Geliang Tang @ 2021-07-29 7:20 UTC (permalink / raw) To: mptcp, geliangtang; +Cc: Geliang Tang From: Geliang Tang <geliangtang@xiaomi.com> v7: - add a new patch to drop flags and ifindex arguments of __mptcp_subflow_connect(). - add more comments for the testcase. v6: - drop lookup_subflow_by_addrs() - pass three arrays instead of 'entries' in fill_local_adresses_vec() - drop the 'remote' argument of fill_local_addresses_vec - drop the 'local' argument of fill_remote_addresses_vec - fix the pm.subflows. - add limit testcase. v5: - patch 1, add a new helper lookup_address_in_vec. - patch 2, update pm.subflows in the non-fullmesh case. - patch 4, add more tests. - tag: export/20210727T054640 v4: - add new helpers, fill_local/remote_addresses_vec - add max_subflows checks - add 'local' into the local addresses array only when no fullmesh entry found. - add signal,fullmesh check v3: - the in-kernel fullmesh path manager has been dropped from this patchset, only keep the fullmesh flag support code. v2: - Implement the fullmesh mode as an extension to the netlink PM, not a standalone PM as Paolo suggested. - drop duplicate code. - add a new per endpoint flag MPTCP_PM_ADDR_FLAG_FULLMESH. Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/193 Geliang Tang (6): mptcp: drop flags and ifindex arguments mptcp: remote addresses fullmesh mptcp: local addresses fullmesh selftests: mptcp: set and print the fullmesh flag selftests: mptcp: add fullmesh testcases selftests: mptcp: delete uncontinuous removing ids include/uapi/linux/mptcp.h | 1 + net/mptcp/pm_netlink.c | 155 ++++++++++++++++-- net/mptcp/protocol.h | 5 +- net/mptcp/subflow.c | 7 +- .../testing/selftests/net/mptcp/mptcp_join.sh | 76 ++++++++- tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 16 +- 6 files changed, 233 insertions(+), 27 deletions(-) -- 2.31.1 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [MPTCP][PATCH v7 mptcp-next 1/6] mptcp: drop flags and ifindex arguments 2021-07-29 7:20 [MPTCP][PATCH v7 mptcp-next 0/6] fullmesh path manager support Geliang Tang @ 2021-07-29 7:20 ` Geliang Tang 2021-07-29 7:20 ` [MPTCP][PATCH v7 mptcp-next 2/6] mptcp: remote addresses fullmesh Geliang Tang 2021-07-29 11:12 ` [MPTCP][PATCH v7 mptcp-next 1/6] mptcp: drop flags and ifindex arguments Paolo Abeni 2021-07-30 18:14 ` [MPTCP][PATCH v7 mptcp-next 0/6] fullmesh path manager support Mat Martineau 2021-08-03 15:59 ` Matthieu Baerts 2 siblings, 2 replies; 11+ messages in thread From: Geliang Tang @ 2021-07-29 7:20 UTC (permalink / raw) To: mptcp, geliangtang; +Cc: Geliang Tang From: Geliang Tang <geliangtang@xiaomi.com> This patch added a new helper mptcp_pm_get_flags_and_ifindex_by_id(), and used it in __mptcp_subflow_connect() to get the flags and ifindex values. Then the two arguments flags and ifindex of __mptcp_subflow_connect() can be dropped. Signed-off-by: Geliang Tang <geliangtang@xiaomi.com> --- net/mptcp/pm_netlink.c | 25 ++++++++++++++++++++++--- net/mptcp/protocol.h | 5 +++-- net/mptcp/subflow.c | 7 +++++-- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index ba0e1d71504d..94c68d6093de 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -462,8 +462,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) check_work_pending(msk); remote_address((struct sock_common *)sk, &remote); spin_unlock_bh(&msk->pm.lock); - __mptcp_subflow_connect(sk, &local->addr, &remote, - local->flags, local->ifindex); + __mptcp_subflow_connect(sk, &local->addr, &remote); spin_lock_bh(&msk->pm.lock); return; } @@ -518,7 +517,7 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) local.family = remote.family; spin_unlock_bh(&msk->pm.lock); - __mptcp_subflow_connect(sk, &local, &remote, 0, 0); + __mptcp_subflow_connect(sk, &local, &remote); spin_lock_bh(&msk->pm.lock); add_addr_echo: @@ -1103,6 +1102,26 @@ __lookup_addr_by_id(struct pm_nl_pernet *pernet, unsigned int id) return NULL; } +int mptcp_pm_get_flags_and_ifindex_by_id(struct net *net, unsigned int id, + u8 *flags, int *ifindex) +{ + struct mptcp_pm_addr_entry *entry; + + rcu_read_lock(); + entry = __lookup_addr_by_id(net_generic(net, pm_nl_pernet_id), id); + rcu_read_unlock(); + + if (entry) { + *flags = entry->flags; + *ifindex = entry->ifindex; + } else { + *flags = 0; + *ifindex = 0; + } + + return 0; +} + static bool remove_anno_list_by_saddr(struct mptcp_sock *msk, struct mptcp_addr_info *addr) { diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index e8a36ff52af6..d276ce16f126 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -576,8 +576,7 @@ struct socket *__mptcp_nmpc_socket(const struct mptcp_sock *msk); /* called with sk socket lock held */ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, - const struct mptcp_addr_info *remote, - u8 flags, int ifindex); + const struct mptcp_addr_info *remote); int mptcp_subflow_create_socket(struct sock *sk, struct socket **new_sock); void mptcp_info2sockaddr(const struct mptcp_addr_info *info, struct sockaddr_storage *addr, @@ -732,6 +731,8 @@ mptcp_pm_del_add_timer(struct mptcp_sock *msk, struct mptcp_pm_add_entry * mptcp_lookup_anno_list_by_saddr(struct mptcp_sock *msk, struct mptcp_addr_info *addr); +int mptcp_pm_get_flags_and_ifindex_by_id(struct net *net, unsigned int id, + u8 *flags, int *ifindex); int mptcp_pm_announce_addr(struct mptcp_sock *msk, const struct mptcp_addr_info *addr, diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 1151926d335b..8c43aa14897a 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1355,8 +1355,7 @@ void mptcp_info2sockaddr(const struct mptcp_addr_info *info, } int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, - const struct mptcp_addr_info *remote, - u8 flags, int ifindex) + const struct mptcp_addr_info *remote) { struct mptcp_sock *msk = mptcp_sk(sk); struct mptcp_subflow_context *subflow; @@ -1367,6 +1366,8 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, struct sock *ssk; u32 remote_token; int addrlen; + int ifindex; + u8 flags; int err; if (!mptcp_is_fully_established(sk)) @@ -1390,6 +1391,8 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, local_id = err; } + mptcp_pm_get_flags_and_ifindex_by_id(sock_net(sk), local_id, + &flags, &ifindex); subflow->remote_key = msk->remote_key; subflow->local_key = msk->local_key; subflow->token = msk->token; -- 2.31.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [MPTCP][PATCH v7 mptcp-next 2/6] mptcp: remote addresses fullmesh 2021-07-29 7:20 ` [MPTCP][PATCH v7 mptcp-next 1/6] mptcp: drop flags and ifindex arguments Geliang Tang @ 2021-07-29 7:20 ` Geliang Tang 2021-07-29 7:20 ` [MPTCP][PATCH v7 mptcp-next 3/6] mptcp: local " Geliang Tang 2021-07-29 11:12 ` [MPTCP][PATCH v7 mptcp-next 1/6] mptcp: drop flags and ifindex arguments Paolo Abeni 1 sibling, 1 reply; 11+ messages in thread From: Geliang Tang @ 2021-07-29 7:20 UTC (permalink / raw) To: mptcp, geliangtang; +Cc: Geliang Tang, Paolo Abeni From: Geliang Tang <geliangtang@xiaomi.com> This patch added and managed a new per endpoint flag, named MPTCP_PM_ADDR_FLAG_FULLMESH. In mptcp_pm_create_subflow_or_signal_addr(), if such flag is set, instead of: remote_address((struct sock_common *)sk, &remote); fill a temporary allocated array of all known remote address. After releaseing the pm lock loop on such array and create a subflow for each remote address from the given local. Note that the we could still use an array even for non 'fullmesh' endpoint: with a single entry corresponding to the primary MPC subflow remote address. Suggested-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Geliang Tang <geliangtang@xiaomi.com> --- include/uapi/linux/mptcp.h | 1 + net/mptcp/pm_netlink.c | 61 +++++++++++++++++++++++++++++++++++--- 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/include/uapi/linux/mptcp.h b/include/uapi/linux/mptcp.h index 7b05f7102321..f66038b9551f 100644 --- a/include/uapi/linux/mptcp.h +++ b/include/uapi/linux/mptcp.h @@ -73,6 +73,7 @@ enum { #define MPTCP_PM_ADDR_FLAG_SIGNAL (1 << 0) #define MPTCP_PM_ADDR_FLAG_SUBFLOW (1 << 1) #define MPTCP_PM_ADDR_FLAG_BACKUP (1 << 2) +#define MPTCP_PM_ADDR_FLAG_FULLMESH (1 << 3) enum { MPTCP_PM_CMD_UNSPEC, diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 94c68d6093de..77cab67e732d 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -410,6 +410,57 @@ void mptcp_pm_free_anno_list(struct mptcp_sock *msk) } } +static bool lookup_address_in_vec(struct mptcp_addr_info *addrs, unsigned int nr, + struct mptcp_addr_info *addr) +{ + int i; + + for (i = 0; i < nr; i++) { + if (addresses_equal(&addrs[i], addr, addr->port)) + return true; + } + + return false; +} + +/* Fill all the remote addresses into the array addrs[], + * and return the array size. + */ +static unsigned int fill_remote_addresses_vec(struct mptcp_sock *msk, bool fullmesh, + struct mptcp_addr_info *addrs) +{ + struct sock *sk = (struct sock *)msk, *ssk; + struct mptcp_subflow_context *subflow; + struct mptcp_addr_info remote = { 0 }; + struct pm_nl_pernet *pernet; + unsigned int subflows_max; + int i = 0; + + pernet = net_generic(sock_net(sk), pm_nl_pernet_id); + subflows_max = mptcp_pm_get_subflows_max(msk); + + /* Non-fullmesh endpoint, fill in the single entry + * corresponding to the primary MPC subflow remote address + */ + if (!fullmesh) { + remote_address((struct sock_common *)sk, &remote); + msk->pm.subflows++; + addrs[i++] = remote; + } else { + mptcp_for_each_subflow(msk, subflow) { + ssk = mptcp_subflow_tcp_sock(subflow); + remote_address((struct sock_common *)ssk, &remote); + if (!lookup_address_in_vec(addrs, i, &remote) && + msk->pm.subflows < subflows_max) { + msk->pm.subflows++; + addrs[i++] = remote; + } + } + } + + return i; +} + static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) { struct sock *sk = (struct sock *)msk; @@ -455,14 +506,16 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) !READ_ONCE(msk->pm.remote_deny_join_id0)) { local = select_local_address(pernet, msk); if (local) { - struct mptcp_addr_info remote = { 0 }; + bool fullmesh = !!(local->flags & MPTCP_PM_ADDR_FLAG_FULLMESH); + struct mptcp_addr_info addrs[MPTCP_PM_ADDR_MAX]; + int i, nr; msk->pm.local_addr_used++; - msk->pm.subflows++; check_work_pending(msk); - remote_address((struct sock_common *)sk, &remote); + nr = fill_remote_addresses_vec(msk, fullmesh, addrs); spin_unlock_bh(&msk->pm.lock); - __mptcp_subflow_connect(sk, &local->addr, &remote); + for (i = 0; i < nr; i++) + __mptcp_subflow_connect(sk, &local->addr, &addrs[i]); spin_lock_bh(&msk->pm.lock); return; } -- 2.31.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [MPTCP][PATCH v7 mptcp-next 3/6] mptcp: local addresses fullmesh 2021-07-29 7:20 ` [MPTCP][PATCH v7 mptcp-next 2/6] mptcp: remote addresses fullmesh Geliang Tang @ 2021-07-29 7:20 ` Geliang Tang 2021-07-29 7:20 ` [MPTCP][PATCH v7 mptcp-next 4/6] selftests: mptcp: set and print the fullmesh flag Geliang Tang 0 siblings, 1 reply; 11+ messages in thread From: Geliang Tang @ 2021-07-29 7:20 UTC (permalink / raw) To: mptcp, geliangtang; +Cc: Geliang Tang, Paolo Abeni From: Geliang Tang <geliangtang@xiaomi.com> In mptcp_pm_nl_add_addr_received(), fill a temporary allocate array of all local address corresponding to the fullmesh endpoint. If such array is empty, keep the current behavior. Elsewhere loop on such array and create a subflow for each local address towards the given remote address Suggested-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Geliang Tang <geliangtang@xiaomi.com> --- net/mptcp/pm_netlink.c | 73 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 63 insertions(+), 10 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 77cab67e732d..b0be7c9477d7 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -536,13 +536,67 @@ static void mptcp_pm_nl_subflow_established(struct mptcp_sock *msk) mptcp_pm_create_subflow_or_signal_addr(msk); } +/* Fill all the local addresses into the array addrs[], + * and return the array size. + */ +static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk, + struct mptcp_addr_info *addrs) +{ + struct sock *sk = (struct sock *)msk; + struct mptcp_pm_addr_entry *entry; + struct mptcp_addr_info local; + struct pm_nl_pernet *pernet; + unsigned int subflows_max; + int i = 0; + + pernet = net_generic(sock_net(sk), pm_nl_pernet_id); + subflows_max = mptcp_pm_get_subflows_max(msk); + + rcu_read_lock(); + __mptcp_flush_join_list(msk); + list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { + if (!(entry->flags & MPTCP_PM_ADDR_FLAG_FULLMESH)) + continue; + + if (entry->addr.family != sk->sk_family) { +#if IS_ENABLED(CONFIG_MPTCP_IPV6) + if ((entry->addr.family == AF_INET && + !ipv6_addr_v4mapped(&sk->sk_v6_daddr)) || + (sk->sk_family == AF_INET && + !ipv6_addr_v4mapped(&entry->addr.addr6))) +#endif + continue; + } + + if (msk->pm.subflows < subflows_max) { + msk->pm.subflows++; + addrs[i++] = entry->addr; + } + } + rcu_read_unlock(); + + /* If the array is empty, fill in the single + * 'IPADDRANY' local address + */ + if (!i) { + memset(&local, 0, sizeof(local)); + local.family = msk->pm.remote.family; + + msk->pm.subflows++; + addrs[i++] = local; + } + + return i; +} + static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) { + struct mptcp_addr_info addrs[MPTCP_PM_ADDR_MAX]; struct sock *sk = (struct sock *)msk; unsigned int add_addr_accept_max; struct mptcp_addr_info remote; - struct mptcp_addr_info local; unsigned int subflows_max; + int i, nr; add_addr_accept_max = mptcp_pm_get_add_addr_accept_max(msk); subflows_max = mptcp_pm_get_subflows_max(msk); @@ -554,23 +608,22 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) if (lookup_subflow_by_daddr(&msk->conn_list, &msk->pm.remote)) goto add_addr_echo; - msk->pm.add_addr_accepted++; - msk->pm.subflows++; - if (msk->pm.add_addr_accepted >= add_addr_accept_max || - msk->pm.subflows >= subflows_max) - WRITE_ONCE(msk->pm.accept_addr, false); - /* connect to the specified remote address, using whatever * local address the routing configuration will pick. */ remote = msk->pm.remote; if (!remote.port) remote.port = sk->sk_dport; - memset(&local, 0, sizeof(local)); - local.family = remote.family; + nr = fill_local_addresses_vec(msk, addrs); + + msk->pm.add_addr_accepted++; + if (msk->pm.add_addr_accepted >= add_addr_accept_max || + msk->pm.subflows >= subflows_max) + WRITE_ONCE(msk->pm.accept_addr, false); spin_unlock_bh(&msk->pm.lock); - __mptcp_subflow_connect(sk, &local, &remote); + for (i = 0; i < nr; i++) + __mptcp_subflow_connect(sk, &addrs[i], &remote); spin_lock_bh(&msk->pm.lock); add_addr_echo: -- 2.31.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [MPTCP][PATCH v7 mptcp-next 4/6] selftests: mptcp: set and print the fullmesh flag 2021-07-29 7:20 ` [MPTCP][PATCH v7 mptcp-next 3/6] mptcp: local " Geliang Tang @ 2021-07-29 7:20 ` Geliang Tang 2021-07-29 7:20 ` [MPTCP][PATCH v7 mptcp-next 5/6] selftests: mptcp: add fullmesh testcases Geliang Tang 0 siblings, 1 reply; 11+ messages in thread From: Geliang Tang @ 2021-07-29 7:20 UTC (permalink / raw) To: mptcp, geliangtang; +Cc: Geliang Tang From: Geliang Tang <geliangtang@xiaomi.com> This patch dealt with the MPTCP_PM_ADDR_FLAG_FULLMESH flag in add_addr() and print_addr(), to set and print out the fullmesh flag. Signed-off-by: Geliang Tang <geliangtang@xiaomi.com> --- tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c index 115decfdc1ef..354784512748 100644 --- a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c +++ b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c @@ -25,7 +25,7 @@ static void syntax(char *argv[]) { fprintf(stderr, "%s add|get|set|del|flush|dump|accept [<args>]\n", argv[0]); - fprintf(stderr, "\tadd [flags signal|subflow|backup] [id <nr>] [dev <name>] <ip>\n"); + fprintf(stderr, "\tadd [flags signal|subflow|backup|fullmesh] [id <nr>] [dev <name>] <ip>\n"); fprintf(stderr, "\tdel <id> [<ip>]\n"); fprintf(stderr, "\tget <id>\n"); fprintf(stderr, "\tset <ip> [flags backup|nobackup]\n"); @@ -236,11 +236,18 @@ int add_addr(int fd, int pm_family, int argc, char *argv[]) flags |= MPTCP_PM_ADDR_FLAG_SIGNAL; else if (!strcmp(tok, "backup")) flags |= MPTCP_PM_ADDR_FLAG_BACKUP; + else if (!strcmp(tok, "fullmesh")) + flags |= MPTCP_PM_ADDR_FLAG_FULLMESH; else error(1, errno, "unknown flag %s", argv[arg]); } + if (flags & MPTCP_PM_ADDR_FLAG_SIGNAL && + flags & MPTCP_PM_ADDR_FLAG_FULLMESH) { + error(1, errno, "error flag fullmesh"); + } + rta = (void *)(data + off); rta->rta_type = MPTCP_PM_ADDR_ATTR_FLAGS; rta->rta_len = RTA_LENGTH(4); @@ -422,6 +429,13 @@ static void print_addr(struct rtattr *attrs, int len) printf(","); } + if (flags & MPTCP_PM_ADDR_FLAG_FULLMESH) { + printf("fullmesh"); + flags &= ~MPTCP_PM_ADDR_FLAG_FULLMESH; + if (flags) + printf(","); + } + /* bump unknown flags, if any */ if (flags) printf("0x%x", flags); -- 2.31.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [MPTCP][PATCH v7 mptcp-next 5/6] selftests: mptcp: add fullmesh testcases 2021-07-29 7:20 ` [MPTCP][PATCH v7 mptcp-next 4/6] selftests: mptcp: set and print the fullmesh flag Geliang Tang @ 2021-07-29 7:20 ` Geliang Tang 2021-07-29 7:20 ` [MPTCP][PATCH v7 mptcp-next 6/6] selftests: mptcp: delete uncontinuous removing ids Geliang Tang 0 siblings, 1 reply; 11+ messages in thread From: Geliang Tang @ 2021-07-29 7:20 UTC (permalink / raw) To: mptcp, geliangtang; +Cc: Geliang Tang From: Geliang Tang <geliangtang@xiaomi.com> This patch added the testcases for the fullmesh address flag of the path manager. Reuse the above 10 address numbers for the fullmesh test. Signed-off-by: Geliang Tang <geliangtang@xiaomi.com> --- .../testing/selftests/net/mptcp/mptcp_join.sh | 66 ++++++++++++++++++- 1 file changed, 63 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 937e861e9490..cb5f9a43baa1 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -367,7 +367,13 @@ do_transfer() fi if [ $addr_nr_ns2 -gt 0 ]; then - let add_nr_ns2=addr_nr_ns2 + if [ $addr_nr_ns2 -gt 10 ]; then + let add_nr_ns2=addr_nr_ns2-10 + flags=subflow,fullmesh + else + let add_nr_ns2=addr_nr_ns2 + flags=subflow + fi counter=3 sleep 1 while [ $add_nr_ns2 -gt 0 ]; do @@ -377,7 +383,7 @@ do_transfer() else addr="10.0.$counter.2" fi - ip netns exec $ns2 ./pm_nl_ctl add $addr flags subflow + ip netns exec $ns2 ./pm_nl_ctl add $addr flags $flags let counter+=1 let add_nr_ns2-=1 done @@ -1697,6 +1703,55 @@ deny_join_id0_tests() chk_join_nr "subflow and address allow join id0 2" 1 1 1 } +fullmesh_tests() +{ + # fullmesh 1 + # 2 fullmesh addrs in ns2, added before the connection, + # 1 non-fullmesh addr in ns1, added during the connection. + reset + ip netns exec $ns1 ./pm_nl_ctl limits 0 4 + ip netns exec $ns2 ./pm_nl_ctl limits 1 4 + ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow,fullmesh + ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow,fullmesh + run_tests $ns1 $ns2 10.0.1.1 0 1 0 slow + chk_join_nr "fullmesh test 2x1" 4 4 4 + chk_add_nr 1 1 + + # fullmesh 2 + # 1 non-fullmesh addr in ns1, added before the connection, + # 1 fullmesh addr in ns2, added during the connection. + reset + ip netns exec $ns1 ./pm_nl_ctl limits 1 3 + ip netns exec $ns2 ./pm_nl_ctl limits 1 3 + ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal + run_tests $ns1 $ns2 10.0.1.1 0 0 11 slow # 11 here meams creating 1 fullmesh subflow + chk_join_nr "fullmesh test 1x1" 3 3 3 + chk_add_nr 1 1 + + # fullmesh 3 + # 1 non-fullmesh addr in ns1, added before the connection, + # 2 fullmesh addrs in ns2, added during the connection. + reset + ip netns exec $ns1 ./pm_nl_ctl limits 2 5 + ip netns exec $ns2 ./pm_nl_ctl limits 1 5 + ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal + run_tests $ns1 $ns2 10.0.1.1 0 0 12 slow # 12 here meams creating 2 fullmesh subflows + chk_join_nr "fullmesh test 1x2" 5 5 5 + chk_add_nr 1 1 + + # fullmesh 4 + # 1 non-fullmesh addr in ns1, added before the connection, + # 2 fullmesh addrs in ns2, added during the connection, + # limit max_subflows to 4. + reset + ip netns exec $ns1 ./pm_nl_ctl limits 2 4 + ip netns exec $ns2 ./pm_nl_ctl limits 1 4 + ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal + run_tests $ns1 $ns2 10.0.1.1 0 0 12 slow + chk_join_nr "fullmesh test 1x2, limited" 4 4 4 + chk_add_nr 1 1 +} + all_tests() { subflows_tests @@ -1712,6 +1767,7 @@ all_tests() syncookies_tests checksum_tests deny_join_id0_tests + fullmesh_tests } usage() @@ -1730,6 +1786,7 @@ usage() echo " -k syncookies_tests" echo " -S checksum_tests" echo " -d deny_join_id0_tests" + echo " -m fullmesh_tests" echo " -c capture pcap files" echo " -C enable data checksum" echo " -h help" @@ -1765,7 +1822,7 @@ if [ $do_all_tests -eq 1 ]; then exit $ret fi -while getopts 'fsltra64bpkdchCS' opt; do +while getopts 'fsltra64bpkdmchCS' opt; do case $opt in f) subflows_tests @@ -1806,6 +1863,9 @@ while getopts 'fsltra64bpkdchCS' opt; do d) deny_join_id0_tests ;; + m) + fullmesh_tests + ;; c) ;; C) -- 2.31.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [MPTCP][PATCH v7 mptcp-next 6/6] selftests: mptcp: delete uncontinuous removing ids 2021-07-29 7:20 ` [MPTCP][PATCH v7 mptcp-next 5/6] selftests: mptcp: add fullmesh testcases Geliang Tang @ 2021-07-29 7:20 ` Geliang Tang 0 siblings, 0 replies; 11+ messages in thread From: Geliang Tang @ 2021-07-29 7:20 UTC (permalink / raw) To: mptcp, geliangtang; +Cc: Geliang Tang From: Geliang Tang <geliangtang@xiaomi.com> The removing addresses testcases can only deal with the continuous ids. This patch added the uncontinuous removing ids support. Fixes: f87744ad42446 ("selftests: mptcp: set addr id for removing testcases") Signed-off-by: Geliang Tang <geliangtang@xiaomi.com> --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index cb5f9a43baa1..dab7fbd6813a 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -344,17 +344,18 @@ do_transfer() let rm_nr_ns1=-addr_nr_ns1 if [ $rm_nr_ns1 -lt 8 ]; then counter=1 + pos=1 dump=(`ip netns exec ${listener_ns} ./pm_nl_ctl dump`) if [ ${#dump[@]} -gt 0 ]; then - id=${dump[1]} sleep 1 while [ $counter -le $rm_nr_ns1 ] do + id=${dump[$pos]} ip netns exec ${listener_ns} ./pm_nl_ctl del $id sleep 1 let counter+=1 - let id+=1 + let pos+=5 done fi elif [ $rm_nr_ns1 -eq 8 ]; then @@ -392,17 +393,18 @@ do_transfer() let rm_nr_ns2=-addr_nr_ns2 if [ $rm_nr_ns2 -lt 8 ]; then counter=1 + pos=1 dump=(`ip netns exec ${connector_ns} ./pm_nl_ctl dump`) if [ ${#dump[@]} -gt 0 ]; then - id=${dump[1]} sleep 1 while [ $counter -le $rm_nr_ns2 ] do + id=${dump[$pos]} ip netns exec ${connector_ns} ./pm_nl_ctl del $id sleep 1 let counter+=1 - let id+=1 + let pos+=5 done fi elif [ $rm_nr_ns2 -eq 8 ]; then -- 2.31.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [MPTCP][PATCH v7 mptcp-next 1/6] mptcp: drop flags and ifindex arguments 2021-07-29 7:20 ` [MPTCP][PATCH v7 mptcp-next 1/6] mptcp: drop flags and ifindex arguments Geliang Tang 2021-07-29 7:20 ` [MPTCP][PATCH v7 mptcp-next 2/6] mptcp: remote addresses fullmesh Geliang Tang @ 2021-07-29 11:12 ` Paolo Abeni 2021-07-29 11:37 ` Geliang Tang 1 sibling, 1 reply; 11+ messages in thread From: Paolo Abeni @ 2021-07-29 11:12 UTC (permalink / raw) To: Geliang Tang, mptcp; +Cc: Geliang Tang On Thu, 2021-07-29 at 15:20 +0800, Geliang Tang wrote: > From: Geliang Tang <geliangtang@xiaomi.com> > > This patch added a new helper mptcp_pm_get_flags_and_ifindex_by_id(), > and used it in __mptcp_subflow_connect() to get the flags and ifindex > values. > > Then the two arguments flags and ifindex of __mptcp_subflow_connect() > can be dropped. > > Signed-off-by: Geliang Tang <geliangtang@xiaomi.com> > --- > net/mptcp/pm_netlink.c | 25 ++++++++++++++++++++++--- > net/mptcp/protocol.h | 5 +++-- > net/mptcp/subflow.c | 7 +++++-- > 3 files changed, 30 insertions(+), 7 deletions(-) > > diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c > index ba0e1d71504d..94c68d6093de 100644 > --- a/net/mptcp/pm_netlink.c > +++ b/net/mptcp/pm_netlink.c > @@ -462,8 +462,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) > check_work_pending(msk); > remote_address((struct sock_common *)sk, &remote); > spin_unlock_bh(&msk->pm.lock); > - __mptcp_subflow_connect(sk, &local->addr, &remote, > - local->flags, local->ifindex); > + __mptcp_subflow_connect(sk, &local->addr, &remote); > spin_lock_bh(&msk->pm.lock); > return; > } > @@ -518,7 +517,7 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) > local.family = remote.family; > > spin_unlock_bh(&msk->pm.lock); > - __mptcp_subflow_connect(sk, &local, &remote, 0, 0); > + __mptcp_subflow_connect(sk, &local, &remote); > spin_lock_bh(&msk->pm.lock); > > add_addr_echo: > @@ -1103,6 +1102,26 @@ __lookup_addr_by_id(struct pm_nl_pernet *pernet, unsigned int id) > return NULL; > } > > +int mptcp_pm_get_flags_and_ifindex_by_id(struct net *net, unsigned int id, > + u8 *flags, int *ifindex) > +{ > + struct mptcp_pm_addr_entry *entry; > + > + rcu_read_lock(); > + entry = __lookup_addr_by_id(net_generic(net, pm_nl_pernet_id), id); > + rcu_read_unlock(); > + > + if (entry) { > + *flags = entry->flags; > + *ifindex = entry->ifindex; > + } else { > + *flags = 0; > + *ifindex = 0; > + } You need to extend the RCU section after the entry reference above, or on preempt-enabled build, the entry could be deleted in between the rcu unlock and the later access. I'm wondering if there are issues with the 0 id ?!? /P ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [MPTCP][PATCH v7 mptcp-next 1/6] mptcp: drop flags and ifindex arguments 2021-07-29 11:12 ` [MPTCP][PATCH v7 mptcp-next 1/6] mptcp: drop flags and ifindex arguments Paolo Abeni @ 2021-07-29 11:37 ` Geliang Tang 0 siblings, 0 replies; 11+ messages in thread From: Geliang Tang @ 2021-07-29 11:37 UTC (permalink / raw) To: Paolo Abeni; +Cc: mptcp, Geliang Tang Paolo Abeni <pabeni@redhat.com> 于2021年7月29日周四 下午7:12写道: > > On Thu, 2021-07-29 at 15:20 +0800, Geliang Tang wrote: > > From: Geliang Tang <geliangtang@xiaomi.com> > > > > This patch added a new helper mptcp_pm_get_flags_and_ifindex_by_id(), > > and used it in __mptcp_subflow_connect() to get the flags and ifindex > > values. > > > > Then the two arguments flags and ifindex of __mptcp_subflow_connect() > > can be dropped. > > > > Signed-off-by: Geliang Tang <geliangtang@xiaomi.com> > > --- > > net/mptcp/pm_netlink.c | 25 ++++++++++++++++++++++--- > > net/mptcp/protocol.h | 5 +++-- > > net/mptcp/subflow.c | 7 +++++-- > > 3 files changed, 30 insertions(+), 7 deletions(-) > > > > diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c > > index ba0e1d71504d..94c68d6093de 100644 > > --- a/net/mptcp/pm_netlink.c > > +++ b/net/mptcp/pm_netlink.c > > @@ -462,8 +462,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) > > check_work_pending(msk); > > remote_address((struct sock_common *)sk, &remote); > > spin_unlock_bh(&msk->pm.lock); > > - __mptcp_subflow_connect(sk, &local->addr, &remote, > > - local->flags, local->ifindex); > > + __mptcp_subflow_connect(sk, &local->addr, &remote); > > spin_lock_bh(&msk->pm.lock); > > return; > > } > > @@ -518,7 +517,7 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) > > local.family = remote.family; > > > > spin_unlock_bh(&msk->pm.lock); > > - __mptcp_subflow_connect(sk, &local, &remote, 0, 0); > > + __mptcp_subflow_connect(sk, &local, &remote); > > spin_lock_bh(&msk->pm.lock); > > > > add_addr_echo: > > @@ -1103,6 +1102,26 @@ __lookup_addr_by_id(struct pm_nl_pernet *pernet, unsigned int id) > > return NULL; > > } > > > > +int mptcp_pm_get_flags_and_ifindex_by_id(struct net *net, unsigned int id, > > + u8 *flags, int *ifindex) > > +{ > > + struct mptcp_pm_addr_entry *entry; > > + > > + rcu_read_lock(); > > + entry = __lookup_addr_by_id(net_generic(net, pm_nl_pernet_id), id); > > + rcu_read_unlock(); > > + > > + if (entry) { > > + *flags = entry->flags; > > + *ifindex = entry->ifindex; > > + } else { > > + *flags = 0; > > + *ifindex = 0; > > + } > > You need to extend the RCU section after the entry reference above, or > on preempt-enabled build, the entry could be deleted in between the rcu > unlock and the later access. Thanks Paolo, I'll send a squash-to patch to fix this. > > I'm wondering if there are issues with the 0 id ?!? The 0 id address isn't on the local_addr_list, we should set it's flags and ifindex all to 0. I'll add a non-zero check in the squash-to patch too. Thanks, -Geliang > > /P > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [MPTCP][PATCH v7 mptcp-next 0/6] fullmesh path manager support 2021-07-29 7:20 [MPTCP][PATCH v7 mptcp-next 0/6] fullmesh path manager support Geliang Tang 2021-07-29 7:20 ` [MPTCP][PATCH v7 mptcp-next 1/6] mptcp: drop flags and ifindex arguments Geliang Tang @ 2021-07-30 18:14 ` Mat Martineau 2021-08-03 15:59 ` Matthieu Baerts 2 siblings, 0 replies; 11+ messages in thread From: Mat Martineau @ 2021-07-30 18:14 UTC (permalink / raw) To: Geliang Tang; +Cc: mptcp, Geliang Tang On Thu, 29 Jul 2021, Geliang Tang wrote: > From: Geliang Tang <geliangtang@xiaomi.com> > > v7: > - add a new patch to drop flags and ifindex arguments of > __mptcp_subflow_connect(). > - add more comments for the testcase. > Ok, in addition to the review I did for v6 I've also looked at the subflow topologies generated by the test cases. Those look good to me. I think this is good for the export branch (with the squash-to patch). Thanks Geliang. Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com> > v6: > - drop lookup_subflow_by_addrs() > - pass three arrays instead of 'entries' in fill_local_adresses_vec() > - drop the 'remote' argument of fill_local_addresses_vec > - drop the 'local' argument of fill_remote_addresses_vec > - fix the pm.subflows. > - add limit testcase. > > v5: > - patch 1, add a new helper lookup_address_in_vec. > - patch 2, update pm.subflows in the non-fullmesh case. > - patch 4, add more tests. > - tag: export/20210727T054640 > > v4: > - add new helpers, fill_local/remote_addresses_vec > - add max_subflows checks > - add 'local' into the local addresses array only when no fullmesh > entry found. > - add signal,fullmesh check > > v3: > - the in-kernel fullmesh path manager has been dropped from this > patchset, only keep the fullmesh flag support code. > > v2: > - Implement the fullmesh mode as an extension to the netlink PM, not a > standalone PM as Paolo suggested. > - drop duplicate code. > - add a new per endpoint flag MPTCP_PM_ADDR_FLAG_FULLMESH. > > Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/193 > > Geliang Tang (6): > mptcp: drop flags and ifindex arguments > mptcp: remote addresses fullmesh > mptcp: local addresses fullmesh > selftests: mptcp: set and print the fullmesh flag > selftests: mptcp: add fullmesh testcases > selftests: mptcp: delete uncontinuous removing ids > > include/uapi/linux/mptcp.h | 1 + > net/mptcp/pm_netlink.c | 155 ++++++++++++++++-- > net/mptcp/protocol.h | 5 +- > net/mptcp/subflow.c | 7 +- > .../testing/selftests/net/mptcp/mptcp_join.sh | 76 ++++++++- > tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 16 +- > 6 files changed, 233 insertions(+), 27 deletions(-) > > -- > 2.31.1 > > > -- Mat Martineau Intel ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [MPTCP][PATCH v7 mptcp-next 0/6] fullmesh path manager support 2021-07-29 7:20 [MPTCP][PATCH v7 mptcp-next 0/6] fullmesh path manager support Geliang Tang 2021-07-29 7:20 ` [MPTCP][PATCH v7 mptcp-next 1/6] mptcp: drop flags and ifindex arguments Geliang Tang 2021-07-30 18:14 ` [MPTCP][PATCH v7 mptcp-next 0/6] fullmesh path manager support Mat Martineau @ 2021-08-03 15:59 ` Matthieu Baerts 2 siblings, 0 replies; 11+ messages in thread From: Matthieu Baerts @ 2021-08-03 15:59 UTC (permalink / raw) To: Geliang Tang, mptcp; +Cc: Geliang Tang Hi Geliang, Mat, Paolo, On 29/07/2021 09:20, Geliang Tang wrote: > From: Geliang Tang <geliangtang@xiaomi.com> > > v7: > - add a new patch to drop flags and ifindex arguments of > __mptcp_subflow_connect(). > - add more comments for the testcase. (...) > > Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/193 > > Geliang Tang (6): > mptcp: drop flags and ifindex arguments > mptcp: remote addresses fullmesh > mptcp: local addresses fullmesh > selftests: mptcp: set and print the fullmesh flag > selftests: mptcp: add fullmesh testcases > selftests: mptcp: delete uncontinuous removing ids Thank you for the patches and the reviews! Now in our tree with Mat's RvB tag: - 8235745392a1: mptcp: drop flags and ifindex arguments - 31e4fdaf9c0b: mptcp: remote addresses fullmesh - 6ad65bd12896: mptcp: local addresses fullmesh - 3faae7f56182: selftests: mptcp: set and print the fullmesh flag - ee6f6d4a5b48: selftests: mptcp: add fullmesh testcases - 68e72848611e: selftests: mptcp: delete uncontinuous removing ids - Results: d5c73e4f859d..dcbca66e0658 And the squash-to patch: - 22876224b527: "squashed" in "mptcp: drop flags and ifindex arguments" - Results: dcbca66e0658..b1d5eb590503 Builds and tests are now in progress: https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20210803T155939 https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export/20210803T155939 Cheers, Matt -- Tessares | Belgium | Hybrid Access Solutions www.tessares.net ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-08-03 16:00 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-07-29 7:20 [MPTCP][PATCH v7 mptcp-next 0/6] fullmesh path manager support Geliang Tang 2021-07-29 7:20 ` [MPTCP][PATCH v7 mptcp-next 1/6] mptcp: drop flags and ifindex arguments Geliang Tang 2021-07-29 7:20 ` [MPTCP][PATCH v7 mptcp-next 2/6] mptcp: remote addresses fullmesh Geliang Tang 2021-07-29 7:20 ` [MPTCP][PATCH v7 mptcp-next 3/6] mptcp: local " Geliang Tang 2021-07-29 7:20 ` [MPTCP][PATCH v7 mptcp-next 4/6] selftests: mptcp: set and print the fullmesh flag Geliang Tang 2021-07-29 7:20 ` [MPTCP][PATCH v7 mptcp-next 5/6] selftests: mptcp: add fullmesh testcases Geliang Tang 2021-07-29 7:20 ` [MPTCP][PATCH v7 mptcp-next 6/6] selftests: mptcp: delete uncontinuous removing ids Geliang Tang 2021-07-29 11:12 ` [MPTCP][PATCH v7 mptcp-next 1/6] mptcp: drop flags and ifindex arguments Paolo Abeni 2021-07-29 11:37 ` Geliang Tang 2021-07-30 18:14 ` [MPTCP][PATCH v7 mptcp-next 0/6] fullmesh path manager support Mat Martineau 2021-08-03 15:59 ` Matthieu Baerts
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.