userspace pm enhancements
Subsystems (3)
v14 cover userspace pm enhancements
v14:
- implement flush operation in user space as Mat suggested.
- update selftests.
- Now this series includes five parts:
Part 1: dump for userspace pm (patches 1-9)
Part 2: fixes for creating id 0 subflow (patches 10-13) Part 3: v4-mapped addr support (patches 14-15)
Part 4: flush for userspace pm (patches 16-18)
Part 5: address entry refcount for userspace pm (patches 19-25)
v13:
- add 4 patches: 10, 11, 31, 32.
- update selftests.
v12:
- add pm_remove_subflows, instead of changing pm_remove_addrs_and_subflows.
v11:
- add a patch "mptcp: userspace pm send RM_ADDR for conn_list addr" to fix selftests failures reported by CI.
v10:
- add "fixes for creating id 0 subflow" part.
v9:
- Fix typos reported by CI.
- Squash two patches
"selftests: mptcp: pm_netlink: print colored output" "selftests: mptcp: add mptcp_lib_check helper"
into one:
"selftests: mptcp: add mptcp_lib_check helper"
v8:
- add mptcp_lib_check helper
v7:
- merge 'Squash to "mptcp: add use_id parameter for addresses_equal v6"', fix packetdrill_add_addr error.
- fix memleak error in "mptcp: add netlink pm addr entry refcount".
- split "selftests: mptcp: flush and dump userspace addrs list" into two patches.
v6:
- fix kmemleak errors reported by CI.
- drop a patch "mptcp: add netlink pm addr entry refcount".
v5:
- Put the two series "add flush and dump for userspace" and "add refcount for address entry" together for better CI testing.
Patches 1-12: add flush and dump for userspace
v4:
- fix the deadlock issue in v3 reported by CI.
v3:
- fix warnings reported by CI.
- get id_bitmap using pm_nl_get_pernet_from_msk.
v2:
- add two patches: "mptcp: check userspace pm subflow flag" "selftests: mptcp: add userspace pm subflow flag"
This series adds flush and dump commands support for userspace pm.
Patches 13-21: add refcount for address entry
v4:
- move two patches here from "add flush and dump for userspace pm":
mptcp: add userspace_pm_get_entry helper
mptcp: drop addr_match and id_match
v3:
- add four selftests patches:
selftests: mptcp: export event macros in mptcp_lib
selftests: mptcp: extract mptcp_lib_check_expected
selftests: mptcp: add mptcp_lib_verify_listener_events
selftests: mptcp: add mptcp_lib_init_ns
v2:
- rebased with "add flush and dump for userspace pm" series.
Add refcount for address entry.
Geliang Tang (25):
mptcp: export pm_nl_get_pernet_from_msk
mptcp: drop mptcp_pm_get_* helpers
mptcp: use pernet id_bitmap in userspace pm
mptcp: add userspace_pm_lookup_addr_by_id helper
mptcp: drop lookup_by_id parameter in lookup_addr
mptcp: dump addrs in userspace pm list
mptcp: check userspace pm subflow flag
selftests: mptcp: add userspace pm subflow flag
selftests: mptcp: dump userspace addrs list
mptcp: set set_id flag when parsing addr
mptcp: use set_id flag when appending addr
mptcp: check addrs list in userspace_pm_get_local_id
selftests: mptcp: dump after creating id 0 subflow
mptcp: map v4 address to v6 when destroying subflow
selftests: mptcp: rm subflow with v4/v4mapped addr
mptcp: make pm_remove_addrs_and_subflows static
mptcp: add a prefix for free_local_addr_list
selftests: mptcp: flush userspace addrs list
mptcp: add use_id parameter for addresses_equal
mptcp: add check_id for lookup_anno_list_by_saddr
mptcp: add userspace_pm_get_entry helper
mptcp: drop addr_match and id_match
mptcp: dup an entry when removing it
mptcp: add userspace pm addr entry refcount
selftests: mptcp: rm userspace addr with random order
net/mptcp/pm.c | 16 +- net/mptcp/pm_netlink.c | 170 +++++++--------- net/mptcp/pm_userspace.c | 189 ++++++++++++------ net/mptcp/protocol.c | 2 +- net/mptcp/protocol.h | 42 +++- net/mptcp/sockopt.c | 9 +- .../testing/selftests/net/mptcp/mptcp_join.sh | 128 +++++++++++- tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 8 + 8 files changed, 381 insertions(+), 183 deletions(-)
Signature · 1 line
2.35.3
PATCH v14 1/25 mptcp: export pm_nl_get_pernet_from_msk
This patch moves struct pm_nl_pernet from pm_netlink.c to protocol.h, and export pm_nl_get_pernet_from_msk() helper.
Then every fields of struct pm_nl_pernet can be accessed everywhere, not only being limited in pm_netlink.c.
--- net/mptcp/pm_netlink.c | 17 ++--------------- net/mptcp/protocol.h | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 15 deletions(-)
net/mptcp/pm_netlink.c +2 -15
@@ -31,20 +31,6 @@ struct mptcp_pm_add_entry {struct mptcp_sock *sock; }; -struct pm_nl_pernet { -/* protects pernet updates */ -spinlock_t lock; -struct list_head local_addr_list; -unsigned int addrs; -unsigned int stale_loss_cnt; -unsigned int add_addr_signal_max; -unsigned int add_addr_accept_max; -unsigned int local_addr_max; -unsigned int subflows_max; -unsigned int next_id; - DECLARE_BITMAP(id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1); -}; -#define MPTCP_PM_ADDR_MAX 8#define ADD_ADDR_RETRANS_MAX 3
@@ -53,11 +39,12 @@ static struct pm_nl_pernet *pm_nl_get_pernet(const struct net *net)return net_generic (net, pm_nl_pernet_id); } -static struct pm_nl_pernet * +struct pm_nl_pernet *pm_nl_get_pernet_from_msk (const struct mptcp_sock *msk) {return pm_nl_get_pernet (sock_net ((struct sock *)msk)); } +EXPORT_SYMBOL_GPL (pm_nl_get_pernet_from_msk);bool mptcp_addresses_equal (const struct mptcp_addr_info *a,const struct mptcp_addr_info *b,bool use_port)
net/mptcp/protocol.h +17 -0
@@ -1030,6 +1030,23 @@ void __init mptcp_pm_nl_init(void);void mptcp_pm_nl_work (struct mptcp_sock *msk);void mptcp_pm_nl_rm_subflow_received (struct mptcp_sock *msk,const struct mptcp_rm_list *rm_list); + +struct pm_nl_pernet { +/* protects pernet updates */ +spinlock_t lock; +struct list_head local_addr_list; +unsigned int addrs; +unsigned int stale_loss_cnt; +unsigned int add_addr_signal_max; +unsigned int add_addr_accept_max; +unsigned int local_addr_max; +unsigned int subflows_max; +unsigned int next_id; + DECLARE_BITMAP(id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1); +}; + +struct pm_nl_pernet * +pm_nl_get_pernet_from_msk (const struct mptcp_sock *msk);unsigned int mptcp_pm_get_add_addr_signal_max (const struct mptcp_sock *msk);unsigned int mptcp_pm_get_add_addr_accept_max (const struct mptcp_sock *msk);unsigned int mptcp_pm_get_subflows_max (const struct mptcp_sock *msk);
Signature · 1 line
2.35.3
PATCH v14 2/25 mptcp: drop mptcp_pm_get_* helpers
In reply to Geliang TangDrop four mptcp_pm_get_* helpers:
mptcp_pm_get_add_addr_signal_max(); mptcp_pm_get_add_addr_accept_max(); mptcp_pm_get_subflows_max(); mptcp_pm_get_local_addr_max();
The helper pm_nl_get_pernet_from_msk() now can be used to replace each of them.
--- net/mptcp/pm.c | 12 +++++----- net/mptcp/pm_netlink.c | 50 +++++++++--------------------------------- net/mptcp/protocol.h | 8 +++---- net/mptcp/sockopt.c | 9 ++++---- 4 files changed, 25 insertions(+), 54 deletions(-)
net/mptcp/pm.c +7 -5
@@ -85,6 +85,7 @@ void mptcp_pm_new_connection(struct mptcp_sock *msk, const struct sock *ssk, intbool mptcp_pm_allow_new_subflow (struct mptcp_sock *msk) { +struct pm_nl_pernet *pernet =pm_nl_get_pernet_from_msk (msk);struct mptcp_pm_data *pm = &msk->pm;unsigned int subflows_max;int ret =0 ;
@@ -99,7 +100,7 @@ bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk)return false; } - subflows_max =mptcp_pm_get_subflows_max (msk); + subflows_max =READ_ONCE (pernet->subflows_max);pr_debug ("msk=%p subflows=%d max=%d allow=%d" , msk, pm->subflows, subflows_max,READ_ONCE (pm->accept_subflow));
@@ -496,6 +497,7 @@ bool mptcp_pm_addr_families_match(const struct sock *sk,void mptcp_pm_data_reset (struct mptcp_sock *msk) { +struct pm_nl_pernet *pernet =pm_nl_get_pernet_from_msk (msk);u8 pm_type =mptcp_get_pm_type (sock_net ((struct sock *)msk));struct mptcp_pm_data *pm = &msk->pm;
@@ -508,17 +510,17 @@ void mptcp_pm_data_reset(struct mptcp_sock *msk)WRITE_ONCE (pm->pm_type, pm_type);if (pm_type ==MPTCP_PM_TYPE_KERNEL ) { -bool subflows_allowed = !!mptcp_pm_get_subflows_max (msk); +bool subflows_allowed = !!READ_ONCE (pernet->subflows_max);/* pm->work_pending must be only be set to 'true' when * pm->pm_type is set to MPTCP_PM_TYPE_KERNEL */ WRITE_ONCE (pm->work_pending, - (!!mptcp_pm_get_local_addr_max (msk) && + (!!READ_ONCE (pernet->local_addr_max) && subflows_allowed) || - !!mptcp_pm_get_add_addr_signal_max (msk)); + !!READ_ONCE (pernet->add_addr_signal_max));WRITE_ONCE (pm->accept_addr, - !!mptcp_pm_get_add_addr_accept_max (msk) && + !!READ_ONCE (pernet->add_addr_accept_max) && subflows_allowed);WRITE_ONCE (pm->accept_subflow, subflows_allowed); }else {
net/mptcp/pm_netlink.c +10 -40
96 lines not on this page · raw message
net/mptcp/protocol.h +3 -5
@@ -1047,15 +1047,13 @@ struct pm_nl_pernet {struct pm_nl_pernet *pm_nl_get_pernet_from_msk (const struct mptcp_sock *msk); -unsigned int mptcp_pm_get_add_addr_signal_max (const struct mptcp_sock *msk); -unsigned int mptcp_pm_get_add_addr_accept_max (const struct mptcp_sock *msk); -unsigned int mptcp_pm_get_subflows_max (const struct mptcp_sock *msk); -unsigned int mptcp_pm_get_local_addr_max (const struct mptcp_sock *msk);/* called under PM lock */ static inline void __mptcp_pm_close_subflow (struct mptcp_sock *msk) { -if (--msk->pm.subflows <mptcp_pm_get_subflows_max (msk)) +struct pm_nl_pernet *pernet =pm_nl_get_pernet_from_msk (msk); + +if (--msk->pm.subflows <READ_ONCE (pernet->subflows_max))WRITE_ONCE (msk->pm.accept_subflow, true); }
net/mptcp/sockopt.c +5 -4
@@ -893,6 +893,7 @@ static int mptcp_getsockopt_first_sf_only(struct mptcp_sock *msk, int level, intvoid mptcp_diag_fill_info (struct mptcp_sock *msk,struct mptcp_info *info) { +struct pm_nl_pernet *pernet =pm_nl_get_pernet_from_msk (msk);struct sock *sk = (struct sock *)msk;u32 flags =0 ;bool slow;
@@ -910,13 +911,13 @@ void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info)/* The following limits only make sense for the in-kernel PM */ if (mptcp_pm_is_kernel (msk)) { info->mptcpi_subflows_max = -mptcp_pm_get_subflows_max (msk); +READ_ONCE (pernet->subflows_max); info->mptcpi_add_addr_signal_max = -mptcp_pm_get_add_addr_signal_max (msk); +READ_ONCE (pernet->add_addr_signal_max); info->mptcpi_add_addr_accepted_max = -mptcp_pm_get_add_addr_accept_max (msk); +READ_ONCE (pernet->add_addr_accept_max); info->mptcpi_local_addr_max = -mptcp_pm_get_local_addr_max (msk); +READ_ONCE (pernet->local_addr_max); }if (__mptcp_check_fallback (msk))
Signature · 1 line
2.35.3
PATCH v14 3/25 mptcp: use pernet id_bitmap in userspace pm
In reply to Geliang TangThis patch uses pm_nl_get_pernet_from_msk() to get the pernet id_bitmap instead of using a local bitmap when appending a new local address into the userspace PM local address list.
--- net/mptcp/pm_userspace.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
net/mptcp/pm_userspace.c +3 -5
@@ -28,7 +28,7 @@ void mptcp_free_local_addr_list(struct mptcp_sock *msk)static int mptcp_userspace_pm_append_new_local_addr (struct mptcp_sock *msk,struct mptcp_pm_addr_entry *entry) { -DECLARE_BITMAP (id_bitmap,MPTCP_PM_MAX_ADDR_ID +1 ); +struct pm_nl_pernet *pernet =pm_nl_get_pernet_from_msk (msk);struct mptcp_pm_addr_entry *match =NULL ;struct sock *sk = (struct sock *)msk;struct mptcp_pm_addr_entry *e;
@@ -36,8 +36,6 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk,bool id_match = false;int ret = -EINVAL ; -bitmap_zero (id_bitmap,MPTCP_PM_MAX_ADDR_ID +1 ); -spin_lock_bh (&msk->pm.lock);list_for_each_entry (e, &msk->pm.userspace_pm_local_addr_list, list) { addr_match =mptcp_addresses_equal (&e->addr, &entry->addr, true);
@@ -50,7 +48,6 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, }else if (addr_match || id_match) {break ; } -__set_bit (e->addr.id, id_bitmap); }if (!match && !addr_match && !id_match) {
@@ -65,9 +62,10 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, *e = *entry;if (!e->addr.id) - e->addr.id =find_next_zero_bit (id_bitmap, + e->addr.id =find_next_zero_bit (pernet->id_bitmap,MPTCP_PM_MAX_ADDR_ID +1 ,1 ); +__set_bit (e->addr.id, pernet->id_bitmap);list_add_tail_rcu (&e->list, &msk->pm.userspace_pm_local_addr_list); msk->pm.local_addr_used++; ret = e->addr.id;
Signature · 1 line
2.35.3
Mat Martineau
maintainerRe: [PATCH mptcp-next v14 03/25] mptcp: use pernet id_bitmap in userspace pm
Quoted 4 lines · Geliang Tang
This patch uses
pm_nl_get_pernet_from_msk()to get the pernetid_bitmapinstead of using a local bitmap when appending a new local address into the userspace PM local address list.
Please drop this patch.
The pernet bitmap is relevant for the netlink PM, as it shares address IDs across the namespace. Userspace PMs may have different local address IDs for each MPTCP connection.
- Mat
Quoted 52 lines
Signed-off-by Geliang Tang <[email protected]>---
net/mptcp/pm_userspace.c| 8 +++-----1 file changed, 3 insertions(+), 5 deletions(-)net/mptcp/pm_userspace.c +3
-5@@ -28,7 +28,7 @@ void mptcp_free_local_addr_list(struct mptcp_sock *msk)static int mptcp_userspace_pm_append_new_local_addr (struct mptcp_sock *msk,struct mptcp_pm_addr_entry *entry) { -DECLARE_BITMAP (id_bitmap,MPTCP_PM_MAX_ADDR_ID +1 ); +struct pm_nl_pernet *pernet =pm_nl_get_pernet_from_msk (msk);struct mptcp_pm_addr_entry *match =NULL ;struct sock *sk = (struct sock *)msk;struct mptcp_pm_addr_entry *e;@@ -36,8 +36,6 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk,bool id_match = false;int ret = -EINVAL ; -bitmap_zero (id_bitmap,MPTCP_PM_MAX_ADDR_ID +1 ); -spin_lock_bh (&msk->pm.lock);list_for_each_entry (e, &msk->pm.userspace_pm_local_addr_list, list) { addr_match =mptcp_addresses_equal (&e->addr, &entry->addr, true);@@ -50,7 +48,6 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, }else if (addr_match || id_match) {break ; } -__set_bit (e->addr.id, id_bitmap); }if (!match && !addr_match && !id_match) {@@ -65,9 +62,10 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, *e = *entry;if (!e->addr.id) - e->addr.id =find_next_zero_bit (id_bitmap, + e->addr.id =find_next_zero_bit (pernet->id_bitmap,MPTCP_PM_MAX_ADDR_ID +1 ,1 ); +__set_bit (e->addr.id, pernet->id_bitmap);list_add_tail_rcu (&e->list, &msk->pm.userspace_pm_local_addr_list); msk->pm.local_addr_used++; ret = e->addr.id;Signature · 1 line
2.35.3
PATCH v14 4/25 mptcp: add userspace_pm_lookup_addr_by_id helper
In reply to Geliang TangCorresponding __lookup_addr_by_id() helper in the in-kernel netlink PM, this patch adds a new helper mptcp_userspace_pm_lookup_addr_by_id() to lookup the address entry with the given id on the userspace pm local address list.
--- net/mptcp/pm_userspace.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)
net/mptcp/pm_userspace.c +16 -15
@@ -25,6 +25,18 @@ void mptcp_free_local_addr_list(struct mptcp_sock *msk) } } +static struct mptcp_pm_addr_entry * +mptcp_userspace_pm_lookup_addr_by_id (struct mptcp_sock *msk,unsigned int id) +{ +struct mptcp_pm_addr_entry *entry; + +list_for_each_entry (entry, &msk->pm.userspace_pm_local_addr_list, list) { +if (entry->addr.id == id) +return entry; + } +return NULL ; +} +static int mptcp_userspace_pm_append_new_local_addr (struct mptcp_sock *msk,struct mptcp_pm_addr_entry *entry) {
@@ -107,15 +119,10 @@ int mptcp_userspace_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk,unsigned int id, u8 *flags, int *ifindex) { - struct mptcp_pm_addr_entry *entry, *match = NULL; + struct mptcp_pm_addr_entry *match;spin_lock_bh (&msk->pm.lock); -list_for_each_entry (entry, &msk->pm.userspace_pm_local_addr_list, list) { -if (id == entry->addr.id) { - match = entry; -break ; - } - } + match =mptcp_userspace_pm_lookup_addr_by_id (msk, id);spin_unlock_bh (&msk->pm.lock);if (match) { *flags = match->flags;
@@ -247,7 +254,7 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info) {struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN ];struct nlattr *id = info->attrs[MPTCP_PM_ATTR_LOC_ID ]; -struct mptcp_pm_addr_entry *match =NULL ; +struct mptcp_pm_addr_entry *match;struct mptcp_pm_addr_entry *entry;struct mptcp_sock *msk;LIST_HEAD (free_list);
@@ -284,13 +291,7 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info)lock_sock (sk); -list_for_each_entry (entry, &msk->pm.userspace_pm_local_addr_list, list) { -if (entry->addr.id == id_val) { - match = entry; -break ; - } - } - + match =mptcp_userspace_pm_lookup_addr_by_id (msk, id_val);if (!match) {GENL_SET_ERR_MSG (info,"address with specified id not found" );release_sock (sk);
Signature · 1 line
2.35.3
PATCH v14 5/25 mptcp: drop lookup_by_id parameter in lookup_addr
In reply to Geliang TangWhen the lookup_by_id parameter of __lookup_addr() is true, it's the same as __lookup_addr_by_id(), it can be replaced by __lookup_addr_by_id() directly. So drop this parameter, let __lookup_addr() only looks up address on the local address list by comparing addresses in it, not address ids.
--- net/mptcp/pm_netlink.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
net/mptcp/pm_netlink.c +5 -7
@@ -458,15 +458,12 @@ __lookup_addr_by_id(struct pm_nl_pernet *pernet, unsigned int id) }static struct mptcp_pm_addr_entry * -__lookup_addr (struct pm_nl_pernet *pernet,const struct mptcp_addr_info *info, -bool lookup_by_id) +__lookup_addr (struct pm_nl_pernet *pernet,const struct mptcp_addr_info *info) {struct mptcp_pm_addr_entry *entry;list_for_each_entry (entry, &pernet->local_addr_list, list) { -if ((!lookup_by_id && -mptcp_addresses_equal (&entry->addr, info, entry->addr.port)) || - (lookup_by_id && entry->addr.id == info->id)) +if (mptcp_addresses_equal (&entry->addr, info, entry->addr.port))return entry; }return NULL ;
@@ -496,7 +493,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)mptcp_local_address ((struct sock_common *)msk->first, &mpc_addr);rcu_read_lock (); - entry =__lookup_addr (pernet, &mpc_addr, false); + entry =__lookup_addr (pernet, &mpc_addr);if (entry) {__clear_bit (entry->addr.id, msk->pm.id_avail_bitmap); msk->mpc_endpoint_id = entry->addr.id;
@@ -1835,7 +1832,8 @@ int mptcp_pm_nl_set_flags(struct net *net, struct mptcp_pm_addr_entry *addr, u8 }spin_lock_bh (&pernet->lock); - entry =__lookup_addr (pernet, &addr->addr, lookup_by_id); + entry = lookup_by_id ?__lookup_addr_by_id (pernet, addr->addr.id) : +__lookup_addr (pernet, &addr->addr);if (!entry) {spin_unlock_bh (&pernet->lock);return -EINVAL ;
Signature · 1 line
2.35.3
PATCH v14 6/25 mptcp: dump addrs in userspace pm list
In reply to Geliang TangThis patch adds a new function __userspace_pm_lookup_addr_by_id() to lookup the address entry by the given id in the userspace local addresses list. Invoke it when dumping addresses from netlink commands.
--- net/mptcp/pm_netlink.c | 9 +++++++-- net/mptcp/pm_userspace.c | 25 +++++++++++++++++++++++++ net/mptcp/protocol.h | 2 ++ 3 files changed, 34 insertions(+), 2 deletions(-)
net/mptcp/pm_netlink.c +7 -2
@@ -1676,8 +1676,13 @@ int mptcp_pm_nl_get_addr_dumpit(struct sk_buff *msg,for (i = id; i <MPTCP_PM_MAX_ADDR_ID +1 ; i++) {if (test_bit (i, pernet->id_bitmap)) { entry =__lookup_addr_by_id (pernet, i); -if (!entry) -break ; +if (!entry) { +spin_unlock_bh (&pernet->lock); + entry =__userspace_pm_lookup_addr_by_id (net, i); +spin_lock_bh (&pernet->lock); +if (!entry) +break ; + }if (entry->addr.id <= id)continue ;
net/mptcp/pm_userspace.c +25 -0
@@ -549,3 +549,28 @@ int mptcp_userspace_pm_set_flags(struct net *net, struct nlattr *token,sock_put (sk);return ret; } + +struct mptcp_pm_addr_entry * +__userspace_pm_lookup_addr_by_id (struct net *net,unsigned int id) +{ +struct mptcp_pm_addr_entry *entry =NULL ; +long s_slot =0 , s_num =0 ; +struct mptcp_sock *msk; + +while ((msk =mptcp_token_iter_next (net, &s_slot, &s_num)) !=NULL ) { +struct sock *sk = (struct sock *)msk; + +if (mptcp_pm_is_userspace (msk)) { +lock_sock (sk); +spin_lock_bh (&msk->pm.lock); + entry =mptcp_userspace_pm_lookup_addr_by_id (msk, id); +spin_unlock_bh (&msk->pm.lock); +release_sock (sk); + } + +sock_put (sk); +cond_resched (); + } + +return entry; +}
net/mptcp/protocol.h +2 -0
@@ -1025,6 +1025,8 @@ bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining,int mptcp_pm_get_local_id (struct mptcp_sock *msk,struct sock_common *skc);int mptcp_pm_nl_get_local_id (struct mptcp_sock *msk,struct mptcp_addr_info *skc);int mptcp_userspace_pm_get_local_id (struct mptcp_sock *msk,struct mptcp_addr_info *skc); +struct mptcp_pm_addr_entry * +__userspace_pm_lookup_addr_by_id (struct net *net,unsigned int id);void __init mptcp_pm_nl_init (void );void mptcp_pm_nl_work (struct mptcp_sock *msk);
Signature · 1 line
2.35.3
Mat Martineau
maintainerRe: [PATCH mptcp-next v14 06/25] mptcp: dump addrs in userspace pm list
Quoted 4 lines · Geliang Tang
This patch adds a new function
__userspace_pm_lookup_addr_by_id()to lookup the address entry by the given id in the userspace local addresses list. Invoke it when dumping addresses from netlink commands.
Hi Geliang -
The existing per-net dump command won't work for the userspace PM, since each connection can have separate local address lists. So, the get-addr dump command needs an optional 'token' parameter that will dump the local addr list for one userspace PM connection.
- Mat
Quoted 78 lines
Signed-off-by Geliang Tang <[email protected]>---
net/mptcp/pm_netlink.c | 9 +++++++-- net/mptcp/pm_userspace.c | 25 +++++++++++++++++++++++++ net/mptcp/protocol.h | 2 ++ 3 files changed, 34 insertions(+), 2 deletions(-)net/mptcp/pm_netlink.c +7
-2@@ -1676,8 +1676,13 @@ int mptcp_pm_nl_get_addr_dumpit(struct sk_buff *msg,for (i = id; i <MPTCP_PM_MAX_ADDR_ID +1 ; i++) {if (test_bit (i, pernet->id_bitmap)) { entry =__lookup_addr_by_id (pernet, i); -if (!entry) -break ; +if (!entry) { +spin_unlock_bh (&pernet->lock); + entry =__userspace_pm_lookup_addr_by_id (net, i); +spin_lock_bh (&pernet->lock); +if (!entry) +break ; + }if (entry->addr.id <= id)continue ;net/mptcp/pm_userspace.c +25
-0@@ -549,3 +549,28 @@ int mptcp_userspace_pm_set_flags(struct net *net, struct nlattr *token,sock_put (sk);return ret; } + +struct mptcp_pm_addr_entry * +__userspace_pm_lookup_addr_by_id (struct net *net,unsigned int id) +{ +struct mptcp_pm_addr_entry *entry =NULL ; +long s_slot =0 , s_num =0 ; +struct mptcp_sock *msk; + +while ((msk =mptcp_token_iter_next (net, &s_slot, &s_num)) !=NULL ) { +struct sock *sk = (struct sock *)msk; + +if (mptcp_pm_is_userspace (msk)) { +lock_sock (sk); +spin_lock_bh (&msk->pm.lock); + entry =mptcp_userspace_pm_lookup_addr_by_id (msk, id); +spin_unlock_bh (&msk->pm.lock); +release_sock (sk); + } + +sock_put (sk); +cond_resched (); + } + +return entry; +}net/mptcp/protocol.h +2
-0@@ -1025,6 +1025,8 @@ bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining,int mptcp_pm_get_local_id (struct mptcp_sock *msk,struct sock_common *skc);int mptcp_pm_nl_get_local_id (struct mptcp_sock *msk,struct mptcp_addr_info *skc);int mptcp_userspace_pm_get_local_id (struct mptcp_sock *msk,struct mptcp_addr_info *skc); +struct mptcp_pm_addr_entry * +__userspace_pm_lookup_addr_by_id (struct net *net,unsigned int id);void __init mptcp_pm_nl_init (void );void mptcp_pm_nl_work (struct mptcp_sock *msk);Signature · 1 line
2.35.3
PATCH v14 7/25 mptcp: check userspace pm subflow flag
In reply to Geliang TangThis patch uses mptcp_pm_parse_entry() instead of mptcp_pm_parse_addr() to get the flags of the entry. Add MPTCP_PM_ADDR_FLAG_SUBFLOW flag check in mptcp_pm_nl_subflow_create_doit().
--- net/mptcp/pm_userspace.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
net/mptcp/pm_userspace.c +8 -2
@@ -347,12 +347,19 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) goto create_err; } - err =mptcp_pm_parse_addr (laddr, info, &addr_l); + err =mptcp_pm_parse_entry (laddr, info, true, &local);if (err <0 ) {NL_SET_ERR_MSG_ATTR (info->extack, laddr,"error parsing local addr" ); goto create_err; } +if (!(local.flags &MPTCP_PM_ADDR_FLAG_SUBFLOW )) { +GENL_SET_ERR_MSG (info,"invalid addr flags" ); + err = -EINVAL ; + goto create_err; + } + addr_l = local.addr; + err =mptcp_pm_parse_addr (raddr, info, &addr_r);if (err <0 ) {NL_SET_ERR_MSG_ATTR (info->extack, raddr,"error parsing remote addr" );
@@ -365,7 +372,6 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) goto create_err; } - local.addr = addr_l; err =mptcp_userspace_pm_append_new_local_addr (msk, &local);if (err <0 ) {GENL_SET_ERR_MSG (info,"did not match address and id" );
Signature · 1 line
2.35.3
PATCH v14 8/25 selftests: mptcp: add userspace pm subflow flag
In reply to Geliang TangThis patch adds the address flag MPTCP_PM_ADDR_FLAG_SUBFLOW in csf() in pm_nl_ctl.c when subflow is created by a userspace PM.
--- tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 8 ++++++++ 1 file changed, 8 insertions(+)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c +8 -0
@@ -453,6 +453,7 @@ int csf(int fd, int pm_family, int argc, char *argv[])char data[NLMSG_ALIGN (sizeof (struct nlmsghdr )) +NLMSG_ALIGN (sizeof (struct genlmsghdr )) +1024 ]; +u_int32_t flags =MPTCP_PM_ADDR_FLAG_SUBFLOW ;const char *params[5 ];struct nlmsghdr *nh;struct rtattr *addr;
@@ -558,6 +559,13 @@ int csf(int fd, int pm_family, int argc, char *argv[]) off +=NLMSG_ALIGN (rta->rta_len); } +/* addr flags */ + rta = (void *)(data + off); + rta->rta_type =MPTCP_PM_ADDR_ATTR_FLAGS ; + rta->rta_len =RTA_LENGTH (4 ); +memcpy (RTA_DATA (rta), &flags,4 ); + off +=NLMSG_ALIGN (rta->rta_len); + addr->rta_len = off - addr_start; }
Signature · 1 line
2.35.3
PATCH v14 9/25 selftests: mptcp: dump userspace addrs list
In reply to Geliang TangThis patch tests newly added dump command for the userspace PM. Add two new tests for userspace pm dump address and subflow. Use the helpers userspace_pm_add_addr() and userspace_pm_add_sf() to add an address and a suflow.
Similar to check() in pm_netlink.sh, add a new helper check_output() in mptcp_join.sh to check the output of the given commands. Use it to check the outputs of dump commands.
--- .../testing/selftests/net/mptcp/mptcp_join.sh | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +75 -0
@@ -21,6 +21,7 @@ cinfail="" cinsent="" tmpfile="" cout="" +check_output_err="" capout="" ns1="" ns2=""
@@ -186,6 +187,7 @@ init() { cout=$(mktemp) evts_ns1=$(mktemp) evts_ns2=$(mktemp) + check_output_err=$(mktemp) trap cleanup EXIT
@@ -199,6 +201,7 @@ cleanup() rm -f "$sin" "$sout" "$cinsent" "$cinfail" rm -f "$tmpfile" rm -rf $evts_ns1 $evts_ns2 + rm -f $check_output_err cleanup_partial }
@@ -3356,6 +3359,32 @@ userspace_pm_rm_sf() wait_rm_sf $1 "${cnt}" } +check_output() { + : "${check_output_err:?}" + : "${ret:?}" + + local cmd="$1" + local expected="$2" + local msg="$3" + local out=`$cmd 2>$check_output_err` + local cmd_ret=$? + + printf "%-42s" "$msg" + if [ $cmd_ret -ne 0 ]; then + mptcp_lib_print_err "[ FAIL ] command execution '$cmd' stderr " + cat $check_output_err + ret=${KSFT_FAIL} + return $cmd_ret + elif [ "$out" = "$expected" ]; then + mptcp_lib_print_ok "[ OK ]" + return 0 + else + mptcp_lib_print_err "[ FAIL ] expected '$expected' got '$out'" + ret=${KSFT_FAIL} + return 1 + fi +} + userspace_tests() { # userspace pm type prevents add_addr
@@ -3545,6 +3574,52 @@ userspace_tests() kill_events_pids wait $tests_pid fi + + # userspace pm dump address + if reset_with_events "userspace pm dump address" && + continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then + set_userspace_pm $ns1 + pm_nl_set_limits $ns2 1 1 + speed=5 \ + run_tests $ns1 $ns2 10.0.1.1 & + local tests_pid=$! + wait_mpj $ns1 + userspace_pm_add_addr $ns1 10.0.2.1 10 + chk_join_nr 1 1 1 + chk_add_nr 1 1 + chk_mptcp_info subflows 1 subflows 1 + chk_subflows_total 2 2 + chk_mptcp_info add_addr_signal 1 add_addr_accepted 1 + local dump="id 10 flags signal 10.0.2.1" + [ $ip_mptcp -eq 1 ] && dump="10.0.2.1 id 10 signal " + check_output "pm_nl_show_endpoints $ns1" \ + "$dump" " dump addrs signal" + kill_events_pids + wait $tests_pid + fi + + # userspace pm dump subflow + if reset_with_events "userspace pm dump subflow" && + continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then + set_userspace_pm $ns2 + pm_nl_set_limits $ns1 0 1 + speed=5 \ + run_tests $ns1 $ns2 10.0.1.1 & + local tests_pid=$! + wait_mpj $ns2 + chk_mptcp_info subflows 0 subflows 0 + chk_subflows_total 1 1 + userspace_pm_add_sf $ns2 10.0.3.2 20 + chk_join_nr 1 1 1 + chk_mptcp_info subflows 1 subflows 1 + chk_subflows_total 2 2 + local dump="id 20 flags subflow 10.0.3.2" + [ $ip_mptcp -eq 1 ] && dump="10.0.3.2 id 20 subflow " + check_output "pm_nl_show_endpoints $ns2" \ + "$dump" " dump addrs subflow" + kill_events_pids + wait $tests_pid + fi } endpoint_tests()
Signature · 1 line
2.35.3
PATCH v14 10/25 mptcp: set set_id flag when parsing addr
In reply to Geliang TangWhen userspace PM requires to create an ID 0 subflow in "userspace pm create id 0 subflow" test like this:
userspace_pm_add_sf $ns2 10.0.3.2 0
An Id 1 subflow, in fact, is created.
Since in mptcp_pm_nl_append_new_local_addr(), 'id 0' will be treated as no ID is set by userspace, and will allocate a new ID immediately:
if (!e->addr.id)
e->addr.id = find_next_zero_bit(pernet->id_bitmap,
MPTCP_PM_MAX_ADDR_ID + 1,
1);To solve this issue, a 'set_id' flag is needed to distinguish between whether userspace has set an ID 0 or whether userspace has not set any address.
This patch adds a new parameter 'set_id' for mptcp_pm_parse_entry() and mptcp_pm_parse_pm_addr_attr(), and pass a 'set_id' flag to them. If an address id is set from userspace, this flag will be set as true.
--- net/mptcp/pm_netlink.c | 26 ++++++++++++++++---------- net/mptcp/pm_userspace.c | 6 ++++-- net/mptcp/protocol.h | 3 ++- 3 files changed, 22 insertions(+), 13 deletions(-)
net/mptcp/pm_netlink.c +16 -10
@@ -1111,7 +1111,8 @@ static int mptcp_pm_parse_pm_addr_attr(struct nlattr *tb[],const struct nlattr *attr, struct genl_info *info, struct mptcp_addr_info *addr, - bool require_family) + bool require_family, + bool *set_id) { int err, addr_addr;
@@ -1126,8 +1127,11 @@ static int mptcp_pm_parse_pm_addr_attr(struct nlattr *tb[],if (err)return err; -if (tb[MPTCP_PM_ADDR_ATTR_ID ]) +if (tb[MPTCP_PM_ADDR_ATTR_ID ]) { addr->id =nla_get_u8 (tb[MPTCP_PM_ADDR_ATTR_ID ]); +if (set_id) + *set_id = true; + }if (!tb[MPTCP_PM_ADDR_ATTR_FAMILY ]) {if (!require_family)
@@ -1175,19 +1179,20 @@ int mptcp_pm_parse_addr(struct nlattr *attr, struct genl_info *info,memset (addr,0 ,sizeof (*addr)); -return mptcp_pm_parse_pm_addr_attr (tb, attr, info, addr, true); +return mptcp_pm_parse_pm_addr_attr (tb, attr, info, addr, true,NULL ); }int mptcp_pm_parse_entry (struct nlattr *attr,struct genl_info *info,bool require_family, -struct mptcp_pm_addr_entry *entry) +struct mptcp_pm_addr_entry *entry, +bool *set_id) {struct nlattr *tb[MPTCP_PM_ADDR_ATTR_MAX +1 ];int err;memset (entry,0 ,sizeof (*entry)); - err =mptcp_pm_parse_pm_addr_attr (tb, attr, info, &entry->addr, require_family); + err =mptcp_pm_parse_pm_addr_attr (tb, attr, info, &entry->addr, require_family, set_id);if (err)return err;
@@ -1242,9 +1247,10 @@ int mptcp_pm_nl_add_addr_doit(struct sk_buff *skb, struct genl_info *info)struct nlattr *attr = info->attrs[MPTCP_PM_ENDPOINT_ADDR ];struct pm_nl_pernet *pernet =genl_info_pm_nl (info);struct mptcp_pm_addr_entry addr, *entry; +bool set_id = false;int ret; - ret =mptcp_pm_parse_entry (attr, info, true, &addr); + ret =mptcp_pm_parse_entry (attr, info, true, &addr, &set_id);if (ret <0 )return ret;
@@ -1426,7 +1432,7 @@ int mptcp_pm_nl_del_addr_doit(struct sk_buff *skb, struct genl_info *info)unsigned int addr_max;int ret; - ret =mptcp_pm_parse_entry (attr, info, false, &addr); + ret =mptcp_pm_parse_entry (attr, info, false, &addr,NULL );if (ret <0 )return ret;
@@ -1619,7 +1625,7 @@ int mptcp_pm_nl_get_addr_doit(struct sk_buff *skb, struct genl_info *info)void *reply;int ret; - ret =mptcp_pm_parse_entry (attr, info, false, &addr); + ret =mptcp_pm_parse_entry (attr, info, false, &addr,NULL );if (ret <0 )return ret;
@@ -1869,12 +1875,12 @@ int mptcp_pm_nl_set_flags_doit(struct sk_buff *skb, struct genl_info *info)u8 bkup =0 ;int ret; - ret =mptcp_pm_parse_entry (attr, info, false, &addr); + ret =mptcp_pm_parse_entry (attr, info, false, &addr,NULL );if (ret <0 )return ret;if (attr_rem) { - ret =mptcp_pm_parse_entry (attr_rem, info, false, &remote); + ret =mptcp_pm_parse_entry (attr_rem, info, false, &remote,NULL );if (ret <0 )return ret; }
net/mptcp/pm_userspace.c +4 -2
@@ -156,6 +156,7 @@ int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info)struct nlattr *addr = info->attrs[MPTCP_PM_ATTR_ADDR ];struct mptcp_pm_addr_entry addr_val;struct mptcp_sock *msk; +bool set_id = false;int err = -EINVAL ;struct sock *sk;u32 token_val;
@@ -180,7 +181,7 @@ int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info) goto announce_err; } - err =mptcp_pm_parse_entry (addr, info, true, &addr_val); + err =mptcp_pm_parse_entry (addr, info, true, &addr_val, &set_id);if (err <0 ) {GENL_SET_ERR_MSG (info,"error parsing local address" ); goto announce_err;
@@ -323,6 +324,7 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info)struct mptcp_addr_info addr_r;struct mptcp_addr_info addr_l;struct mptcp_sock *msk; +bool set_id = false;int err = -EINVAL ;struct sock *sk;u32 token_val;
@@ -347,7 +349,7 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) goto create_err; } - err =mptcp_pm_parse_entry (laddr, info, true, &local); + err =mptcp_pm_parse_entry (laddr, info, true, &local, &set_id);if (err <0 ) {NL_SET_ERR_MSG_ATTR (info->extack, laddr,"error parsing local addr" ); goto create_err;
net/mptcp/protocol.h +2 -1
@@ -885,7 +885,8 @@ int mptcp_pm_parse_addr(struct nlattr *attr, struct genl_info *info, struct mptcp_addr_info *addr);int mptcp_pm_parse_entry (struct nlattr *attr,struct genl_info *info,bool require_family, -struct mptcp_pm_addr_entry *entry); +struct mptcp_pm_addr_entry *entry, +bool *set_id);bool mptcp_pm_addr_families_match (const struct sock *sk,const struct mptcp_addr_info *loc,const struct mptcp_addr_info *rem);
Signature · 1 line
2.35.3
PATCH v14 11/25 mptcp: use set_id flag when appending addr
In reply to Geliang TangThis patch uses 'set_id' flag when appending new addr, adds a new parameter 'set_id' for mptcp_pm_nl_append_new_local_addr() in pm_netlink and mptcp_userspace_pm_append_new_local_addr() in pm_userspace. Pass the flag 'set_id', which was set when parsing the address, into these append new local address functions. If this flag is set, do not alloc new address ID from id_bitmap, just keep the userspace set address ID.
--- net/mptcp/pm_netlink.c | 11 ++++++----- net/mptcp/pm_userspace.c | 13 +++++++------ 2 files changed, 13 insertions(+), 11 deletions(-)
net/mptcp/pm_netlink.c +6 -5
@@ -855,7 +855,8 @@ static void __mptcp_pm_release_addr_entry(struct mptcp_pm_addr_entry *entry) }static int mptcp_pm_nl_append_new_local_addr (struct pm_nl_pernet *pernet, -struct mptcp_pm_addr_entry *entry) +struct mptcp_pm_addr_entry *entry, +bool set_id) {struct mptcp_pm_addr_entry *cur, *del_entry =NULL ;unsigned int addr_max;
@@ -903,7 +904,7 @@ static int mptcp_pm_nl_append_new_local_addr(struct pm_nl_pernet *pernet, } } -if (!entry->addr.id) { +if (!entry->addr.id && !set_id) { find_next: entry->addr.id = find_next_zero_bit(pernet->id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1,
@@ -914,7 +915,7 @@ static int mptcp_pm_nl_append_new_local_addr(struct pm_nl_pernet *pernet, } } -if (!entry->addr.id) +if (!entry->addr.id && !set_id) goto out;__set_bit (entry->addr.id, pernet->id_bitmap);
@@ -1044,7 +1045,7 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc entry->ifindex =0 ; entry->flags =MPTCP_PM_ADDR_FLAG_IMPLICIT ; entry->lsk =NULL ; - ret =mptcp_pm_nl_append_new_local_addr (pernet, entry); + ret =mptcp_pm_nl_append_new_local_addr (pernet, entry, false);if (ret <0 )kfree (entry);
@@ -1284,7 +1285,7 @@ int mptcp_pm_nl_add_addr_doit(struct sk_buff *skb, struct genl_info *info) goto out_free; } } - ret =mptcp_pm_nl_append_new_local_addr (pernet, entry); + ret =mptcp_pm_nl_append_new_local_addr (pernet, entry, set_id);if (ret <0 ) {GENL_SET_ERR_MSG_FMT (info,"too many addresses or duplicate one: %d" , ret); goto out_free;
net/mptcp/pm_userspace.c +7 -6
@@ -38,7 +38,8 @@ mptcp_userspace_pm_lookup_addr_by_id(struct mptcp_sock *msk, unsigned int id) }static int mptcp_userspace_pm_append_new_local_addr (struct mptcp_sock *msk, -struct mptcp_pm_addr_entry *entry) +struct mptcp_pm_addr_entry *entry, +bool set_id) {struct pm_nl_pernet *pernet =pm_nl_get_pernet_from_msk (msk);struct mptcp_pm_addr_entry *match =NULL ;
@@ -51,7 +52,7 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk,spin_lock_bh (&msk->pm.lock);list_for_each_entry (e, &msk->pm.userspace_pm_local_addr_list, list) { addr_match =mptcp_addresses_equal (&e->addr, &entry->addr, true); -if (addr_match && entry->addr.id ==0 ) +if (addr_match && entry->addr.id ==0 && !set_id) entry->addr.id = e->addr.id; id_match = (e->addr.id == entry->addr.id);if (addr_match && id_match) {
@@ -73,7 +74,7 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, } *e = *entry; -if (!e->addr.id) +if (!e->addr.id && !set_id) e->addr.id =find_next_zero_bit (pernet->id_bitmap,MPTCP_PM_MAX_ADDR_ID +1 ,1 );
@@ -147,7 +148,7 @@ int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk,if (new_entry.addr.port == msk_sport) new_entry.addr.port =0 ; -return mptcp_userspace_pm_append_new_local_addr (msk, &new_entry); +return mptcp_userspace_pm_append_new_local_addr (msk, &new_entry, false); }int mptcp_pm_nl_announce_doit (struct sk_buff *skb,struct genl_info *info)
@@ -193,7 +194,7 @@ int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info) goto announce_err; } - err =mptcp_userspace_pm_append_new_local_addr (msk, &addr_val); + err =mptcp_userspace_pm_append_new_local_addr (msk, &addr_val, set_id);if (err <0 ) {GENL_SET_ERR_MSG (info,"did not match address and id" ); goto announce_err;
@@ -374,7 +375,7 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) goto create_err; } - err =mptcp_userspace_pm_append_new_local_addr (msk, &local); + err =mptcp_userspace_pm_append_new_local_addr (msk, &local, set_id);if (err <0 ) {GENL_SET_ERR_MSG (info,"did not match address and id" ); goto create_err;
Signature · 1 line
2.35.3
PATCH v14 12/25 mptcp: check addrs list in userspace_pm_get_local_id
In reply to Geliang TangBefore adding a new entry in mptcp_userspace_pm_get_local_id(), it's better to check whether this address is already in userspace pm local address list. If it's in the list, no need to add a new entry, just return it's address ID and use this address.
--- net/mptcp/pm_userspace.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
net/mptcp/pm_userspace.c +12 -1
@@ -136,10 +136,21 @@ int mptcp_userspace_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk,int mptcp_userspace_pm_get_local_id (struct mptcp_sock *msk,struct mptcp_addr_info *skc) { -struct mptcp_pm_addr_entry new_entry; +struct mptcp_pm_addr_entry *entry =NULL , *e, new_entry;__be16 msk_sport = ((struct inet_sock *)inet_sk ((struct sock *)msk))->inet_sport; +spin_lock_bh (&msk->pm.lock); +list_for_each_entry (e, &msk->pm.userspace_pm_local_addr_list, list) { +if (mptcp_addresses_equal (&e->addr, skc, false)) { + entry = e; +break ; + } + } +spin_unlock_bh (&msk->pm.lock); +if (entry) +return entry->addr.id; +memset (&new_entry,0 ,sizeof (struct mptcp_pm_addr_entry )); new_entry.addr = *skc; new_entry.addr.id =0 ;
Signature · 1 line
2.35.3
PATCH v14 13/25 selftests: mptcp: dump after creating id 0 subflow
In reply to Geliang TangThe output of dump command after creating a ID 0 subflow should be empty. Since ID 0 address doesn't list by dump command. This patch uses check_output() helper to check whether the output is empty in "userspace pm create id 0 subflow" test.
--- tools/testing/selftests/net/mptcp/mptcp_join.sh | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +2 -0
@@ -3518,6 +3518,8 @@ userspace_tests() chk_mptcp_info subflows 0 subflows 0 chk_subflows_total 1 1 userspace_pm_add_sf $ns2 10.0.3.2 0 + check_output "pm_nl_show_endpoints $ns2" \ + "" " dump addrs id 0 subflow" chk_join_nr 1 1 1 chk_mptcp_info subflows 1 subflows 1 chk_subflows_total 2 2
Signature · 1 line
2.35.3
PATCH v14 14/25 mptcp: map v4 address to v6 when destroying subflow
In reply to Geliang TangIn mptcp_pm_nl_subflow_destroy_doit(), before checking local address family with remote address family, map an IPv4 address to an IPv6 address if the pair is a v4-mapped address.
--- net/mptcp/pm_userspace.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/mptcp/pm_userspace.c +10 -0
@@ -502,6 +502,16 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *skb, struct genl_info *info goto destroy_err; } +#if IS_ENABLED (CONFIG_MPTCP_IPV6 ) +if (addr_l.family ==AF_INET &&ipv6_addr_v4mapped (&addr_r.addr6)) { +ipv6_addr_set_v4mapped (addr_l.addr.s_addr, &addr_l.addr6); + addr_l.family =AF_INET6 ; + } +if (addr_r.family ==AF_INET &&ipv6_addr_v4mapped (&addr_l.addr6)) { +ipv6_addr_set_v4mapped (addr_r.addr.s_addr, &addr_r.addr6); + addr_r.family =AF_INET6 ; + } +#endif if (addr_l.family != addr_r.family) {GENL_SET_ERR_MSG (info,"address families do not match" ); err = -EINVAL ;
Signature · 1 line
2.35.3
PATCH v14 15/25 selftests: mptcp: rm subflow with v4/v4mapped addr
In reply to Geliang TangNow both a v4 address and a v4-mapped address are supported when destroying a userspace pm subflow, this patch adds random tests for both addresses.
--- tools/testing/selftests/net/mptcp/mptcp_join.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_join.sh +8 -3
@@ -3342,12 +3342,13 @@ userspace_pm_rm_sf() { local evts=$evts_ns1 local t=${3:-1} - local ip=4 + local ip local tk da dp sp local cnt [ "$1" == "$ns2" ] && evts=$evts_ns2 - if mptcp_lib_is_v6 $2; then ip=6; fi + [ -n "$(mptcp_lib_evts_get_info "saddr4" "$evts" $t)" ] && ip=4 + [ -n "$(mptcp_lib_evts_get_info "saddr6" "$evts" $t)" ] && ip=6 tk=$(mptcp_lib_evts_get_info token "$evts") da=$(mptcp_lib_evts_get_info "daddr$ip" "$evts" $t) dp=$(mptcp_lib_evts_get_info dport "$evts" $t)
@@ -3476,7 +3477,11 @@ userspace_tests() chk_subflows_total 2 2 chk_mptcp_info add_addr_signal 1 add_addr_accepted 1 userspace_pm_rm_addr $ns1 10 - userspace_pm_rm_sf $ns1 "::ffff:10.0.2.1" $SUB_ESTABLISHED + if [ $((RANDOM%2)) -eq 0 ]; then + userspace_pm_rm_sf $ns1 ::ffff:10.0.2.1 $SUB_ESTABLISHED + else + userspace_pm_rm_sf $ns1 10.0.2.1 $SUB_ESTABLISHED + fi chk_rm_nr 1 1 invert chk_mptcp_info subflows 0 subflows 0 chk_subflows_total 1 1
Signature · 1 line
2.35.3
PATCH v14 16/25 mptcp: make pm_remove_addrs_and_subflows static
In reply to Geliang Tangmptcp_pm_remove_addrs_and_subflows() is only used in pm_netlink.c, it's no longer used in pm_userspace.c any more since the commit 8b1c94da1e48 ("mptcp: only send RM_ADDR in nl_cmd_remove"). So this patch changes it to a static function.
--- net/mptcp/pm_netlink.c | 4 ++-- net/mptcp/protocol.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-)
net/mptcp/pm_netlink.c +2 -2
@@ -1492,8 +1492,8 @@ void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list) } } -void mptcp_pm_remove_addrs_and_subflows (struct mptcp_sock *msk, -struct list_head *rm_list) +static void mptcp_pm_remove_addrs_and_subflows (struct mptcp_sock *msk, +struct list_head *rm_list) {struct mptcp_rm_list alist = { .nr =0 }, slist = { .nr =0 };struct mptcp_pm_addr_entry *entry;
net/mptcp/protocol.h +0 -2
@@ -945,8 +945,6 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk,int mptcp_pm_remove_addr (struct mptcp_sock *msk,const struct mptcp_rm_list *rm_list);int mptcp_pm_remove_subflow (struct mptcp_sock *msk,const struct mptcp_rm_list *rm_list);void mptcp_pm_remove_addrs (struct mptcp_sock *msk,struct list_head *rm_list); -void mptcp_pm_remove_addrs_and_subflows (struct mptcp_sock *msk, -struct list_head *rm_list);void mptcp_free_local_addr_list (struct mptcp_sock *msk);
Signature · 1 line
2.35.3
PATCH v14 17/25 mptcp: add a prefix for free_local_addr_list
In reply to Geliang TangSame as other functions in pm_userspace.c, this patch renames mptcp_free_local_addr_list() with the userspace pm prefix as mptcp_userspace_pm_free_local_addr_list().
--- net/mptcp/pm_userspace.c | 2 +- net/mptcp/protocol.c | 2 +- net/mptcp/protocol.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
net/mptcp/pm_userspace.c +1 -1
@@ -7,7 +7,7 @@#include "protocol.h" #include "mib.h" -void mptcp_free_local_addr_list (struct mptcp_sock *msk) +void mptcp_userspace_pm_free_local_addr_list (struct mptcp_sock *msk) {struct mptcp_pm_addr_entry *entry, *tmp;struct sock *sk = (struct sock *)msk;
net/mptcp/protocol.c +1 -1
@@ -3340,7 +3340,7 @@ void mptcp_destroy_common(struct mptcp_sock *msk, unsigned int flags)WRITE_ONCE (msk->rmem_fwd_alloc,0 );mptcp_token_destroy (msk);mptcp_pm_free_anno_list (msk); -mptcp_free_local_addr_list (msk); +mptcp_userspace_pm_free_local_addr_list (msk); }static void mptcp_destroy (struct sock *sk)
net/mptcp/protocol.h +1 -1
@@ -946,7 +946,7 @@ int mptcp_pm_remove_addr(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_int mptcp_pm_remove_subflow (struct mptcp_sock *msk,const struct mptcp_rm_list *rm_list);void mptcp_pm_remove_addrs (struct mptcp_sock *msk,struct list_head *rm_list); -void mptcp_free_local_addr_list (struct mptcp_sock *msk); +void mptcp_userspace_pm_free_local_addr_list (struct mptcp_sock *msk);void mptcp_event (enum mptcp_event_type type,const struct mptcp_sock *msk,const struct sock *ssk,gfp_t gfp);
Signature · 1 line
2.35.3
PATCH v14 18/25 selftests: mptcp: flush userspace addrs list
In reply to Geliang TangThis patch adds a new helper userspace_pm_flush() to flush all addresses for the userspace PM. Invoke it in userspace pm dump address and subflow tests. And use dump commands to check if the userspace pm local address list is empty after addresses flushing.
--- .../testing/selftests/net/mptcp/mptcp_join.sh | 45 +++++++++++++++++-- 1 file changed, 41 insertions(+), 4 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_join.sh +41 -4
@@ -3360,6 +3360,31 @@ userspace_pm_rm_sf() wait_rm_sf $1 "${cnt}" } +# $1: ns ; $2: addr +userspace_pm_flush() +{ + local ns=$1 + local line + + pm_nl_show_endpoints $ns | while read -r line; do + local arr=($line) + local nr=0 + local id + local addr + local i + for i in "${arr[@]}"; do + if [ $i = "id" ]; then + id=${arr[$nr+1]} + fi + nr=$((nr + 1)) + done + addr=${arr[$nr-1]} + [ $ip_mptcp -eq 1 ] && addr=${arr[0]} + userspace_pm_rm_addr $ns $id + userspace_pm_rm_sf $ns "$addr" $SUB_ESTABLISHED + done +} + check_output() { : "${check_output_err:?}" : "${ret:?}"
@@ -3582,8 +3607,8 @@ userspace_tests() wait $tests_pid fi - # userspace pm dump address - if reset_with_events "userspace pm dump address" && + # userspace pm dump & flush address + if reset_with_events "userspace pm dump & flush address" && continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then set_userspace_pm $ns1 pm_nl_set_limits $ns2 1 1
@@ -3601,12 +3626,18 @@ userspace_tests() [ $ip_mptcp -eq 1 ] && dump="10.0.2.1 id 10 signal " check_output "pm_nl_show_endpoints $ns1" \ "$dump" " dump addrs signal" + userspace_pm_flush $ns1 + check_output "pm_nl_show_endpoints $ns1" \ + "" " dump addrs after flush" + chk_rm_nr 1 1 invert + chk_mptcp_info subflows 0 subflows 0 + chk_subflows_total 1 1 kill_events_pids wait $tests_pid fi - # userspace pm dump subflow - if reset_with_events "userspace pm dump subflow" && + # userspace pm dump & flush subflow + if reset_with_events "userspace pm dump & flush subflow" && continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then set_userspace_pm $ns2 pm_nl_set_limits $ns1 0 1
@@ -3624,6 +3655,12 @@ userspace_tests() [ $ip_mptcp -eq 1 ] && dump="10.0.3.2 id 20 subflow " check_output "pm_nl_show_endpoints $ns2" \ "$dump" " dump addrs subflow" + userspace_pm_flush $ns2 + check_output "pm_nl_show_endpoints $ns2" \ + "" " dump addrs after flush" + chk_rm_nr 1 1 + chk_mptcp_info subflows 0 subflows 0 + chk_subflows_total 1 1 kill_events_pids wait $tests_pid fi
Signature · 1 line
2.35.3
PATCH v14 19/25 mptcp: add use_id parameter for addresses_equal
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
This patch adds a new parameter use_id for mptcp_addresses_equal() to test the address ids, as well as the address. This can be used to test if the two given addresses are identically equal, they have both the same address and the same address id.
--- net/mptcp/pm.c | 2 +- net/mptcp/pm_netlink.c | 32 +++++++++++++++++++------------- net/mptcp/pm_userspace.c | 6 +++--- net/mptcp/protocol.h | 3 ++- 4 files changed, 25 insertions(+), 18 deletions(-)
net/mptcp/pm.c +1 -1
@@ -420,7 +420,7 @@ int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc)*/ mptcp_local_address ((struct sock_common *)msk, &msk_local);mptcp_local_address ((struct sock_common *)skc, &skc_local); -if (mptcp_addresses_equal (&msk_local, &skc_local, false)) +if (mptcp_addresses_equal (&msk_local, &skc_local, false, false))return 0 ;if (mptcp_pm_is_userspace (msk))
net/mptcp/pm_netlink.c +19 -13
@@ -47,7 +47,8 @@ pm_nl_get_pernet_from_msk(const struct mptcp_sock *msk)EXPORT_SYMBOL_GPL (pm_nl_get_pernet_from_msk);bool mptcp_addresses_equal (const struct mptcp_addr_info *a, -const struct mptcp_addr_info *b,bool use_port) +const struct mptcp_addr_info *b, +bool use_port,bool use_id) {bool addr_equals = false;
@@ -68,10 +69,14 @@ bool mptcp_addresses_equal(const struct mptcp_addr_info *a,if (!addr_equals)return false; -if (!use_port) +if (!use_port && !use_id)return true; -return a->port == b->port; +if (use_port && use_id) +return (a->port == b->port) && (a->id == b->id); +if (use_port) +return a->port == b->port; +return a->id == b->id; }void mptcp_local_address (const struct sock_common *skc,struct mptcp_addr_info *addr)
@@ -110,7 +115,7 @@ static bool lookup_subflow_by_saddr(const struct list_head *list, skc = (struct sock_common *)mptcp_subflow_tcp_sock (subflow);mptcp_local_address (skc, &cur); -if (mptcp_addresses_equal (&cur, saddr, saddr->port)) +if (mptcp_addresses_equal (&cur, saddr, saddr->port, false))return true; }
@@ -128,7 +133,7 @@ static bool lookup_subflow_by_daddr(const struct list_head *list, skc = (struct sock_common *)mptcp_subflow_tcp_sock (subflow);remote_address (skc, &cur); -if (mptcp_addresses_equal (&cur, daddr, daddr->port)) +if (mptcp_addresses_equal (&cur, daddr, daddr->port, false))return true; }
@@ -205,7 +210,7 @@ mptcp_lookup_anno_list_by_saddr(const struct mptcp_sock *msk,lockdep_assert_held (&msk->pm.lock);list_for_each_entry (entry, &msk->pm.anno_list, list) { -if (mptcp_addresses_equal (&entry->addr, addr, true)) +if (mptcp_addresses_equal (&entry->addr, addr, true, false))return entry; }
@@ -222,7 +227,7 @@ bool mptcp_pm_sport_in_anno_list(struct mptcp_sock *msk, const struct sock *sk)spin_lock_bh (&msk->pm.lock);list_for_each_entry (entry, &msk->pm.anno_list, list) { -if (mptcp_addresses_equal (&entry->addr, &saddr, true)) { +if (mptcp_addresses_equal (&entry->addr, &saddr, true, false)) { ret = true; goto out; }
@@ -463,7 +468,7 @@ __lookup_addr(struct pm_nl_pernet *pernet, const struct mptcp_addr_info *info)struct mptcp_pm_addr_entry *entry;list_for_each_entry (entry, &pernet->local_addr_list, list) { -if (mptcp_addresses_equal (&entry->addr, info, entry->addr.port)) +if (mptcp_addresses_equal (&entry->addr, info, entry->addr.port, false))return entry; }return NULL ;
@@ -704,12 +709,12 @@ int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk,struct mptcp_addr_info local, remote;mptcp_local_address ((struct sock_common *)ssk, &local); -if (!mptcp_addresses_equal (&local, addr, addr->port)) +if (!mptcp_addresses_equal (&local, addr, addr->port, false))continue ;if (rem && rem->family !=AF_UNSPEC ) {remote_address ((struct sock_common *)ssk, &remote); -if (!mptcp_addresses_equal (&remote, rem, rem->port)) +if (!mptcp_addresses_equal (&remote, rem, rem->port, false))continue ; }
@@ -884,7 +889,8 @@ static int mptcp_pm_nl_append_new_local_addr(struct pm_nl_pernet *pernet, entry->addr.port =0 ;list_for_each_entry (cur, &pernet->local_addr_list, list) {if (mptcp_addresses_equal (&cur->addr, &entry->addr, - cur->addr.port || entry->addr.port)) { + cur->addr.port || entry->addr.port, + false)) {/* allow replacing the exiting endpoint only if such * endpoint is an implicit one and the user-space * did not provide an endpoint id
@@ -1025,7 +1031,7 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skcrcu_read_lock ();list_for_each_entry_rcu (entry, &pernet->local_addr_list, list) { -if (mptcp_addresses_equal (&entry->addr, skc, entry->addr.port)) { +if (mptcp_addresses_equal (&entry->addr, skc, entry->addr.port, false)) { ret = entry->addr.id;break ; }
@@ -1407,7 +1413,7 @@ static int mptcp_nl_remove_id_zero_address(struct net *net, goto next;mptcp_local_address ((struct sock_common *)msk, &msk_local); -if (!mptcp_addresses_equal (&msk_local, addr, addr->port)) +if (!mptcp_addresses_equal (&msk_local, addr, addr->port, false)) goto next;lock_sock (sk);
net/mptcp/pm_userspace.c +3 -3
@@ -51,7 +51,7 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk,spin_lock_bh (&msk->pm.lock);list_for_each_entry (e, &msk->pm.userspace_pm_local_addr_list, list) { - addr_match =mptcp_addresses_equal (&e->addr, &entry->addr, true); + addr_match =mptcp_addresses_equal (&e->addr, &entry->addr, true, false);if (addr_match && entry->addr.id ==0 && !set_id) entry->addr.id = e->addr.id; id_match = (e->addr.id == entry->addr.id);
@@ -102,7 +102,7 @@ static int mptcp_userspace_pm_delete_local_addr(struct mptcp_sock *msk,struct mptcp_pm_addr_entry *entry, *tmp;list_for_each_entry_safe (entry, tmp, &msk->pm.userspace_pm_local_addr_list, list) { -if (mptcp_addresses_equal (&entry->addr, &addr->addr, false)) { +if (mptcp_addresses_equal (&entry->addr, &addr->addr, false, false)) {/* TODO: a refcount is needed because the entry can * be used multiple times (e.g. fullmesh mode). */
@@ -142,7 +142,7 @@ int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk,spin_lock_bh (&msk->pm.lock);list_for_each_entry (e, &msk->pm.userspace_pm_local_addr_list, list) { -if (mptcp_addresses_equal (&e->addr, skc, false)) { +if (mptcp_addresses_equal (&e->addr, skc, false, false)) { entry = e;break ; }
net/mptcp/protocol.h +2 -1
@@ -649,7 +649,8 @@ void mptcp_set_owner_r(struct sk_buff *skb, struct sock *sk);void mptcp_set_state (struct sock *sk,int state);bool mptcp_addresses_equal (const struct mptcp_addr_info *a, -const struct mptcp_addr_info *b,bool use_port); +const struct mptcp_addr_info *b, +bool use_port,bool use_id);void mptcp_local_address (const struct sock_common *skc,struct mptcp_addr_info *addr);/* called with sk socket lock held */
Signature · 1 line
2.35.3
PATCH v14 20/25 mptcp: add check_id for lookup_anno_list_by_saddr
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
Add a new parameter check_id for mptcp_lookup_anno_list_by_saddr(), and pass it to mptcp_addresses_equal(). Then in mptcp_pm_del_add_timer(), the input parameter check_id can be passed as the new parameter into mptcp_lookup_anno_list_by_saddr(). After this, this condition:
(!check_id || entry->addr.id == addr->id)
can be dropped, only test if 'entry' is NULL is enough.
--- net/mptcp/pm.c | 2 +- net/mptcp/pm_netlink.c | 13 +++++++------ net/mptcp/protocol.h | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-)
net/mptcp/pm.c +1 -1
@@ -259,7 +259,7 @@ void mptcp_pm_add_addr_echoed(struct mptcp_sock *msk,spin_lock_bh (&pm->lock); -if (mptcp_lookup_anno_list_by_saddr (msk, addr) &&READ_ONCE (pm->work_pending)) +if (mptcp_lookup_anno_list_by_saddr (msk, addr, false) &&READ_ONCE (pm->work_pending))mptcp_pm_schedule_work (msk,MPTCP_PM_SUBFLOW_ESTABLISHED );spin_unlock_bh (&pm->lock);
net/mptcp/pm_netlink.c +7 -6
@@ -203,14 +203,15 @@ bool mptcp_pm_nl_check_work_pending(struct mptcp_sock *msk)struct mptcp_pm_add_entry *mptcp_lookup_anno_list_by_saddr (const struct mptcp_sock *msk, -const struct mptcp_addr_info *addr) +const struct mptcp_addr_info *addr, +bool check_id) {struct mptcp_pm_add_entry *entry;lockdep_assert_held (&msk->pm.lock);list_for_each_entry (entry, &msk->pm.anno_list, list) { -if (mptcp_addresses_equal (&entry->addr, addr, true, false)) +if (mptcp_addresses_equal (&entry->addr, addr, true, check_id))return entry; }
@@ -290,12 +291,12 @@ mptcp_pm_del_add_timer(struct mptcp_sock *msk,struct sock *sk = (struct sock *)msk;spin_lock_bh (&msk->pm.lock); - entry =mptcp_lookup_anno_list_by_saddr (msk, addr); -if (entry && (!check_id || entry->addr.id == addr->id)) + entry =mptcp_lookup_anno_list_by_saddr (msk, addr, check_id); +if (entry) entry->retrans_times =ADD_ADDR_RETRANS_MAX ;spin_unlock_bh (&msk->pm.lock); -if (entry && (!check_id || entry->addr.id == addr->id)) +if (entry)sk_stop_timer_sync (sk, &entry->add_timer);return entry;
@@ -310,7 +311,7 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,lockdep_assert_held (&msk->pm.lock); - add_entry =mptcp_lookup_anno_list_by_saddr (msk, addr); + add_entry =mptcp_lookup_anno_list_by_saddr (msk, addr, false);if (add_entry) {if (mptcp_pm_is_kernel (msk))
net/mptcp/protocol.h +2 -1
@@ -924,7 +924,8 @@ mptcp_pm_del_add_timer(struct mptcp_sock *msk, const struct mptcp_addr_info *addr, bool check_id);struct mptcp_pm_add_entry *mptcp_lookup_anno_list_by_saddr (const struct mptcp_sock *msk, -const struct mptcp_addr_info *addr); +const struct mptcp_addr_info *addr, +bool check_id);int mptcp_pm_get_flags_and_ifindex_by_id (struct mptcp_sock *msk,unsigned int id,u8 *flags,int *ifindex);
Signature · 1 line
2.35.3
PATCH v14 21/25 mptcp: add userspace_pm_get_entry helper
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
This patch adds a new helper mptcp_userspace_pm_get_entry() to find out the address entry on the userspace_pm_local_addr_list through the given address. Use this helper in mptcp_userspace_pm_delete_local_addr().
--- net/mptcp/pm_userspace.c | 44 ++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 18 deletions(-)
net/mptcp/pm_userspace.c +26 -18
@@ -37,6 +37,20 @@ mptcp_userspace_pm_lookup_addr_by_id(struct mptcp_sock *msk, unsigned int id)return NULL ; } +static struct mptcp_pm_addr_entry *mptcp_userspace_pm_get_entry (struct mptcp_sock *msk, +struct mptcp_addr_info *addr, +bool use_port,bool use_id) +{ +struct mptcp_pm_addr_entry *entry; + +list_for_each_entry (entry, &msk->pm.userspace_pm_local_addr_list, list) { +if (mptcp_addresses_equal (&entry->addr, addr, use_port, use_id)) +return entry; + } + +return NULL ; +} +static int mptcp_userspace_pm_append_new_local_addr (struct mptcp_sock *msk,struct mptcp_pm_addr_entry *entry,bool set_id)
@@ -99,18 +113,17 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk,static int mptcp_userspace_pm_delete_local_addr (struct mptcp_sock *msk,struct mptcp_pm_addr_entry *addr) { -struct mptcp_pm_addr_entry *entry, *tmp; +struct mptcp_pm_addr_entry *entry; -list_for_each_entry_safe (entry, tmp, &msk->pm.userspace_pm_local_addr_list, list) { -if (mptcp_addresses_equal (&entry->addr, &addr->addr, false, false)) { -/* TODO: a refcount is needed because the entry can -* be used multiple times (e.g. fullmesh mode). -*/ -list_del_rcu (&entry->list); -kfree (entry); - msk->pm.local_addr_used--; -return 0 ; - } + entry =mptcp_userspace_pm_get_entry (msk, &addr->addr, false, false); +if (entry) { +/* TODO: a refcount is needed because the entry can +* be used multiple times (e.g. fullmesh mode). +*/ +list_del_rcu (&entry->list); +kfree (entry); + msk->pm.local_addr_used--; +return 0 ; }return -EINVAL ;
@@ -136,17 +149,12 @@ int mptcp_userspace_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk,int mptcp_userspace_pm_get_local_id (struct mptcp_sock *msk,struct mptcp_addr_info *skc) { -struct mptcp_pm_addr_entry *entry =NULL , *e, new_entry; +struct mptcp_pm_addr_entry *entry, new_entry;__be16 msk_sport = ((struct inet_sock *)inet_sk ((struct sock *)msk))->inet_sport;spin_lock_bh (&msk->pm.lock); -list_for_each_entry (e, &msk->pm.userspace_pm_local_addr_list, list) { -if (mptcp_addresses_equal (&e->addr, skc, false, false)) { - entry = e; -break ; - } - } + entry =mptcp_userspace_pm_get_entry (msk, skc, false, false);spin_unlock_bh (&msk->pm.lock);if (entry)return entry->addr.id;
Signature · 1 line
2.35.3
PATCH v14 22/25 mptcp: drop addr_match and id_match
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
This patch uses the newly defined helper mptcp_userspace_pm_get_entry() in mptcp_userspace_pm_append_new_local_addr(), and drop local variables addr_match and id_match to simplify the code.
--- net/mptcp/pm_userspace.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-)
net/mptcp/pm_userspace.c +8 -18
@@ -58,26 +58,13 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk,struct pm_nl_pernet *pernet =pm_nl_get_pernet_from_msk (msk);struct mptcp_pm_addr_entry *match =NULL ;struct sock *sk = (struct sock *)msk; -struct mptcp_pm_addr_entry *e; -bool addr_match = false; -bool id_match = false;int ret = -EINVAL ;spin_lock_bh (&msk->pm.lock); -list_for_each_entry (e, &msk->pm.userspace_pm_local_addr_list, list) { - addr_match =mptcp_addresses_equal (&e->addr, &entry->addr, true, false); -if (addr_match && entry->addr.id ==0 && !set_id) - entry->addr.id = e->addr.id; - id_match = (e->addr.id == entry->addr.id); -if (addr_match && id_match) { - match = e; -break ; - }else if (addr_match || id_match) { -break ; - } - } + match =mptcp_userspace_pm_get_entry (msk, &entry->addr, true, entry->addr.id); +if (!match) { +struct mptcp_pm_addr_entry *e; -if (!match && !addr_match && !id_match) {/* Memory for the entry is allocated from the * sock option buffer. */
@@ -96,10 +83,13 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk,list_add_tail_rcu (&e->list, &msk->pm.userspace_pm_local_addr_list); msk->pm.local_addr_used++; ret = e->addr.id; - }else if (match) { - ret = entry->addr.id; + goto append_err; } +if (entry->addr.id ==0 && !set_id) + entry->addr.id = match->addr.id; + ret = entry->addr.id; + append_err:spin_unlock_bh (&msk->pm.lock);return ret;
Signature · 1 line
2.35.3
PATCH v14 23/25 mptcp: dup an entry when removing it
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
In some cases, the address entry doesn't need to be freed. This patch dups an entry into the free_list to separate removing an address from freeing an entry, so that the refcount of address entry can be added later.
--- net/mptcp/pm_userspace.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
net/mptcp/pm_userspace.c +9 -1
@@ -309,10 +309,18 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info) goto out; } -list_move (&match->list, &free_list); + entry =kmemdup (match,sizeof (*match),GFP_ATOMIC ); +if (!entry) { + err = -ENOMEM ; + goto out; + } +list_add (&entry->list, &free_list);mptcp_pm_remove_addrs (msk, &free_list); +list_del_rcu (&match->list); +kfree (match); +release_sock (sk);list_for_each_entry_safe (match, entry, &free_list, list) {
Signature · 1 line
2.35.3
PATCH v14 24/25 mptcp: add userspace pm addr entry refcount
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
This patch adds the refcount of addree entry in userspace PM. Add a new counter 'refcnt' in struct mptcp_pm_addr_entry, initiated to 1.
Increase this counter when an address is announced or a subflow is created in mptcp_pm_nl_announce_doit() and mptcp_pm_nl_subflow_create_doit(). And decrease it when an address is removed or a subflow is closed in mptcp_pm_nl_remove_doit() and mptcp_userspace_pm_delete_local_addr(). If the counter reaches to 1, free this entry.
--- net/mptcp/pm_userspace.c | 33 +++++++++++++++++++++++---------- net/mptcp/protocol.h | 2 ++ 2 files changed, 25 insertions(+), 10 deletions(-)
net/mptcp/pm_userspace.c +23 -10
@@ -82,6 +82,7 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk,__set_bit (e->addr.id, pernet->id_bitmap);list_add_tail_rcu (&e->list, &msk->pm.userspace_pm_local_addr_list); msk->pm.local_addr_used++; +refcount_set (&e->refcnt,1 ); ret = e->addr.id; goto append_err; }
@@ -107,12 +108,11 @@ static int mptcp_userspace_pm_delete_local_addr(struct mptcp_sock *msk, entry =mptcp_userspace_pm_get_entry (msk, &addr->addr, false, false);if (entry) { -/* TODO: a refcount is needed because the entry can -* be used multiple times (e.g. fullmesh mode). -*/ -list_del_rcu (&entry->list); -kfree (entry); - msk->pm.local_addr_used--; +if (!refcount_dec_not_one (&entry->refcnt)) { +list_del_rcu (&entry->list); +kfree (entry); + msk->pm.local_addr_used--; + }return 0 ; }
@@ -213,6 +213,11 @@ int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info)spin_lock_bh (&msk->pm.lock);if (mptcp_pm_alloc_anno_list (msk, &addr_val.addr)) { +struct mptcp_pm_addr_entry *entry; + + entry =mptcp_userspace_pm_get_entry (msk, &addr_val.addr, false, false); +if (entry && !refcount_inc_not_zero (&entry->refcnt)) +pr_debug ("userspace pm uninitialized entry" ); msk->pm.add_addr_signaled++;mptcp_pm_announce_addr (msk, &addr_val.addr, false);mptcp_pm_nl_addr_send_ack (msk);
@@ -318,8 +323,10 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info)mptcp_pm_remove_addrs (msk, &free_list); -list_del_rcu (&match->list); -kfree (match); +if (!refcount_dec_not_one (&match->refcnt)) { +list_del_rcu (&match->list); +kfree (match); + }release_sock (sk);
@@ -405,10 +412,16 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info)release_sock (sk);spin_lock_bh (&msk->pm.lock); -if (err) +if (err) {mptcp_userspace_pm_delete_local_addr (msk, &local); -else + }else { +struct mptcp_pm_addr_entry *entry; + + entry =mptcp_userspace_pm_get_entry (msk, &addr_l, false, false); +if (entry && !refcount_inc_not_zero (&entry->refcnt)) +pr_debug ("userspace pm uninitialized entry" ); msk->pm.subflows++; + }spin_unlock_bh (&msk->pm.lock); create_err:
net/mptcp/protocol.h +2 -0
@@ -8,6 +8,7 @@#define __MPTCP_PROTOCOL_H#include <linux/random.h> +#include <linux/refcount.h> #include <net/tcp.h> #include <net/inet_connection_sock.h> #include <uapi/linux/mptcp.h>
@@ -244,6 +245,7 @@ struct mptcp_pm_addr_entry {u8 flags;int ifindex;struct socket *lsk; +refcount_t refcnt; };struct mptcp_data_frag {
Signature · 1 line
2.35.3
PATCH v14 25/25 selftests: mptcp: rm userspace addr with random order
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
Previously, when deleting a userspace address and subflow, it was necessary to follow the current order of deleting the address and then deleting the subflow. With this series of changes, addresses and subflows can be deleted in any order. This patch uses random numbers to add this type of tests.
--- tools/testing/selftests/net/mptcp/mptcp_join.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/net/mptcp/mptcp_join.sh +2 -1
@@ -3501,11 +3501,12 @@ userspace_tests() chk_mptcp_info subflows 1 subflows 1 chk_subflows_total 2 2 chk_mptcp_info add_addr_signal 1 add_addr_accepted 1 - userspace_pm_rm_addr $ns1 10 if [ $((RANDOM%2)) -eq 0 ]; then + userspace_pm_rm_addr $ns1 10 userspace_pm_rm_sf $ns1 ::ffff:10.0.2.1 $SUB_ESTABLISHED else userspace_pm_rm_sf $ns1 10.0.2.1 $SUB_ESTABLISHED + userspace_pm_rm_addr $ns1 10 fi chk_rm_nr 1 1 invert chk_mptcp_info subflows 0 subflows 0
Signature · 1 line
2.35.3
Mat Martineau
maintainerQuoted 3 lines · Geliang Tang
Part 1: dump for userspace pm (patches 1-9) Part 2: fixes for creating id 0 subflow (patches 10-13) Part 3: v4-mapped addr support (patches 14-15)
Hi Geliang -
I think we should focus on parts 1-3 for enhancing the userspace PM. If the userspace daemon has to restart, it needs to find out which local address IDs have been advertised to the peer so it can avoid attempted reuse of those IDs, and it can send REMOVE_ADDR for those IDs if needed.
Quoted 1 line
Part 4: flush for userspace pm (patches 16-18)
It looks like the flush patches were removed after v13 except for the selftest (patch 18?), and it looks like patches 16-17 are not related to the flush operation.
Quoted 1 line
Part 5: address entry refcount for userspace pm (patches 19-25)
These patches are to address https://github.com/multipath-tcp/mptcp_net-next/issues/403, correct?
I think a refcount is not necessary to make the userspace local address list work correctly.
The userspace local address list should contain:
* An entry for ID 0 (when the connection is started - it may be removed
later)
* An entry for every ID advertised with ADD_ADDR
* An entry for every ID allocated by the kernel when an outgoing MP_JOIN
uses an address that doesn't have an existing ID.
Entries should only be deleted by a "remove" netlink command from the userspace PM daemon. Closing subflows (or connection errors) should not remove entries from the local address list.
Does anyone remember why the current code deletes address ID entries when subflows are destroyed or connections fail?
If the local address list is defined as "the list of address IDs we have advertised to the peer", there is no need to manage the list as subflows are added and removed. Even when no subflows currently exist, the peer still can have cached address IDs from our device, so they must be considered valid until we send a REMOVE_ADDR.
I suggest modifying the userspace local addr code to make '0' valid. If there's a need to track whether the ID is unassigned, maybe struct mptcp_addr_info needs a separate flag for that.
Another overall note: I couldn't get the series to fully apply to recent export branch tags. Please remember to add a note to the cover letter describing what other patch series it depends on, and what order to apply them in! (Or give a link to a public git repo/branch)
Matthieu Baerts
maintainerHi Mat, Geliang,
Sorry for the delay.
Quoted 1 line · Mat Martineau
On Fri, 8 Dec 2023, Geliang Tang wrote:
(...)
Quoted 10 lines
Quoted 1 line
Part 5: address entry refcount for userspace pm (patches 19-25)
These patches are to address
https://github.com/multipath-tcp/mptcp_net-next/issues/403, correct?I think a refcount is not necessary to make the userspace local address list work correctly.
The userspace local address list should contain:
Quoted 7 lines
* An entry for ID 0 (when the connection is started - it may be removed later)
* An entry for every ID advertised with
ADD_ADDR* An entry for every ID allocated by the kernel when an outgoing
MP_JOINuses an address that doesn't have an existing ID.
Yes, I agree with that: it is required to track all explicit (ADD_ADDR) and implicit (MPC + MPJ) addresses. Technically, we don't need a single list for that, as long as there is a helper function to look at all these addresses.
Quoted 3 lines
Entries should only be deleted by a "remove" netlink command from the userspace PM daemon. Closing subflows (or connection errors) should not remove entries from the local address list.
Correct, only when sending a REMOVE_ADDR. Indeed, the PM might want to delete a subflow for some reason (e.g. saving bandwidth), but it doesn't mean the address became unavailable.
Quoted 2 lines
Does anyone remember why the current code deletes address ID entries when subflows are destroyed or connections fail?
I wonder if there were not some confusions with pm.local_addr_used counter. We might want to know the "actual" status, but it is true that it should show what has been announced, and not what is being used.
For the destroyed, that's indeed not correct: we should then not remove the entry.
For the connections fails -- not able to queue the SYN+MPJ in __mptcp_subflow_connect() from mptcp_pm_nl_subflow_create_doit() --, that's maybe different, no? Nothing has been sent on the wire, maybe the new address entry should be removed? But for this specific case, we don't need a refcount, we can add the entry after having called __mptcp_subflow_connect or we modify mptcp_userspace_pm_append_new_local_addr() to also tell us if a new entry has been created.
Quoted 5 lines
If the local address list is defined as "the list of address IDs we have advertised to the peer", there is no need to manage the list as subflows are added and removed. Even when no subflows currently exist, the peer still can have cached address IDs from our device, so they must be considered valid until we send a
REMOVE_ADDR.
Agreed.
Quoted 3 lines
I suggest modifying the userspace local addr code to make '0' valid. If there's a need to track whether the ID is unassigned, maybe struct
mptcp_addr_infoneeds a separate flag for that.
Good point, thank you for having spotted that.
So, if I'm not mistaken:
- mptcp_pm_nl_subflow_create_doit() should *not* call mptcp_userspace_pm_delete_local_addr() or *only* remove the entry if it has just been created before.
- mptcp_pm_nl_subflow_destroy_doit() should *not* call mptcp_userspace_pm_delete_local_addr()
- mptcp_pm_nl_remove_doit() should call mptcp_userspace_pm_delete_local_addr() (which might need to be modified)
- We should replace this comment abovemptcp_userspace_pm_delete_local_addr()...
/* If the subflow is closed from the other peer (not via a
* subflow destroy command then), we want to keep the entry
* not to assign the same ID to another address and to be
* able to send RM_ADDR after the removal of the subflow. */
... by something like: Only remove entries from the local addr list if the address has been explicitly removed via a REMOVE_ADDR. Removing a subflow doesn't mean the address became unavailable.
- We should remove the TODO about the refcount inmptcp_userspace_pm_delete_local_addr()
- And close https://github.com/multipath-tcp/mptcp_net-next/issues/403
@Mat / Geliang: Is this correct? WDYT?
@Geliang: is it something you were already looking at?
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Matthieu Baerts
maintainerHi Geliang,
Quoted 10 lines · Geliang Tang
v14:
- implement flush operation in user space as Mat suggested.
- update selftests.
- Now this series includes five parts:Part 1: dump for userspace pm (patches 1-9)
Part 2: fixes for creating id 0 subflow (patches 10-13) Part 3: v4-mapped addr support (patches 14-15)
Part 4: flush for userspace pm (patches 16-18)
Part 5: address entry refcount for userspace pm (patches 19-25)
For tracking purposes, which patches can we drop on Patchwork?
https://patchwork.kernel.org/project/mptcp/list/?series=808195&state=7
- Part 1: If I understood correctly, patches 1-9 are supposed to be replaced by a new series "dump for userspace pm", right? Then can we drop patches 1, 2 and 5 from Patchwork? (Patch 3 has been marked as "Rejected", I guess that's OK.)
- Part 2: does it depend on part 1, or can it be applied separatelly in -net because they are fixes? Or at least the modifications in the code, the selftests tests could go only in -next if it is difficult to get them in -net.
- Part 3: Is it also a fix? I mean: did we forget to support v4-mapped addr in one command, but others have this support? Can it be sent separately to -net?
- Part 4: it is not clear to me if they were needed? They have been marked as "Rejected", but please tell me if they are still needed and just the title here was wrong.
- Part 5: I need to re-check the code before invalidating them (and issue #403).
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Hi Matt,
Quoted 14 lines · Matthieu Baerts
Hi Geliang,
Quoted 10 lines · Geliang Tang
v14:
- implement flush operation in user space as Mat suggested.
- update selftests.
- Now this series includes five parts:Part 1: dump for userspace pm (patches 1-9)
Part 2: fixes for creating id 0 subflow (patches 10-13) Part 3: v4-mapped addr support (patches 14-15)
Part 4: flush for userspace pm (patches 16-18)
Part 5: address entry refcount for userspace pm (patches 19-25)
Quoted 8 lines
For tracking purposes, which patches can we drop on Patchwork?
https://patchwork.kernel.org/project/mptcp/list/?series=808195&state=7
- Part 1: If I understood correctly, patches 1-9 are supposed to be replaced by a new series "dump for userspace pm", right? Then can we drop patches 1, 2 and 5 from Patchwork? (Patch 3 has been marked as "Rejected", I guess that's OK.)
Patches 1, 2 and 3 can been marked as "Rejected". Patches 4-9 can been marked as "Changes Requested", they will been included in the next version.
Quoted 8 lines
- Part 2: does it depend on part 1, or can it be applied separatelly in
-net because they are fixes? Or at least the modifications in the code,
the selftests tests could go only in -next if it is difficult to get them in -net.
Quoted 4 lines
- Part 3: Is it also a fix? I mean: did we forget to support v4- mapped
addr in one command, but others have this support? Can it be sent separately to -net?
Yes, patches 10, 11, 12, 14 are fixes. They don't depend on part 1 but will conflict with part 1. I'll make them a new series for -net.
Quoted 4 lines
- Part 4: it is not clear to me if they were needed? They have been marked as "Rejected", but please tell me if they are still needed and just the title here was wrong.
Patch 18 can be marked as "Changes Requested". We can test flushing addresses in userspace in it.
Thanks,
-Geliang
Quoted 6 lines
- Part 5: I need to re-check the code before invalidating them (and issue #403).
Cheers,
Matt
Matthieu Baerts
maintainerHi Geliang,
Thank you for your reply!
Quoted 19 lines · Geliang Tang
Hi Matt,
Quoted 16 lines · Matthieu Baerts
Hi Geliang,
Quoted 10 lines · Geliang Tang
v14:
- implement flush operation in user space as Mat suggested.
- update selftests.
- Now this series includes five parts:Part 1: dump for userspace pm (patches 1-9)
Part 2: fixes for creating id 0 subflow (patches 10-13) Part 3: v4-mapped addr support (patches 14-15)
Part 4: flush for userspace pm (patches 16-18)
Part 5: address entry refcount for userspace pm (patches 19-25)For tracking purposes, which patches can we drop on Patchwork?
Quoted 8 lines
Quoted 6 lines
https://patchwork.kernel.org/project/mptcp/list/?series=808195&state=7
- Part 1: If I understood correctly, patches 1-9 are supposed to be replaced by a new series "dump for userspace pm", right? Then can we drop patches 1, 2 and 5 from Patchwork? (Patch 3 has been marked as "Rejected", I guess that's OK.)
Patches 1, 2 and 3 can been marked as "Rejected".
Done!
Quoted 2 lines
Patches 4-9 can been marked as "Changes Requested", they will been included in the next version.
I marked these patches (except patch 5) as "Superseded" because there is already a new version if I'm not mistaken: now part of "dump for userspace pm" series, right?
Or maybe patch 5 has also been replaced by another patch?
Quoted 7 lines
Quoted 7 lines
- Part 2: does it depend on part 1, or can it be applied separatelly in
-net because they are fixes? Or at least the modifications in the code,
the selftests tests could go only in -next if it is difficult to get them in -net.
Quoted 7 lines
Quoted 4 lines
- Part 3: Is it also a fix? I mean: did we forget to support v4- mapped
addr in one command, but others have this support? Can it be sent separately to -net?Yes, patches 10, 11, 12, 14 are fixes. They don't depend on part 1 but will conflict with part 1. I'll make them a new series for -net.
Thank you, so we can send them to -net and have them backported in stable versions.
Quoted 6 lines
Quoted 3 lines
- Part 4: it is not clear to me if they were needed? They have been marked as "Rejected", but please tell me if they are still needed and just the title here was wrong.
Patch 18 can be marked as "Changes Requested". We can test flushing addresses in userspace in it.
We can indeed check that it doesn't affect addresses from the userspace PM. I just marked it as "Changes Requested".
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Hi Matt,
Quoted 41 lines · Matthieu Baerts
Hi Geliang,
Thank you for your reply!
Quoted 29 lines · Geliang Tang
Hi Matt,
Quoted 18 lines · Matthieu Baerts
Hi Geliang,
Quoted 10 lines · Geliang Tang
v14:
- implement flush operation in user space as Mat suggested.
- update selftests.
- Now this series includes five parts:Part 1: dump for userspace pm (patches 1-9)
Part 2: fixes for creating id 0 subflow (patches 10-13) Part 3: v4-mapped addr support (patches 14-15)
Part 4: flush for userspace pm (patches 16-18)
Part 5: address entry refcount for userspace pm (patches 19-25)For tracking purposes, which patches can we drop on Patchwork?
https://patchwork.kernel.org/project/mptcp/list/?series=808195&state=7
Quoted 7 lines
- Part 1: If I understood correctly, patches 1-9 are supposed to be
replaced by a new series "dump for userspace pm", right? Then can we
drop patches 1, 2 and 5 from Patchwork? (Patch 3 has been marked as
"Rejected", I guess that's OK.)Quoted 1 line
Patches 1, 2 and 3 can been marked as "Rejected".
Done!
Quoted 2 lines
Patches 4-9 can been marked as "Changes Requested", they will been included in the next version.
Quoted 6 lines
I marked these patches (except patch 5) as "Superseded" because there is
already a new version if I'm not mistaken: now part of "dump for userspace pm" series, right?Or maybe patch 5 has also been replaced by another patch?
Yes, you're right. Patch 5 will be resent as a cleanup patch.
Thanks,
-Geliang
Quoted 37 lines
Quoted 10 lines
Quoted 10 lines
- Part 2: does it depend on part 1, or can it be applied separatelly
in
-net because they are fixes? Or at least the modifications in the code,
the selftests tests could go only in -next if it is difficult to get
them in -net.Quoted 8 lines
Quoted 4 lines
- Part 3: Is it also a fix? I mean: did we forget to support v4- mapped
addr in one command, but others have this support? Can it be sent separately to -net?Yes, patches 10, 11, 12, 14 are fixes. They don't depend on part 1 but
will conflict with part 1. I'll make them a new series for -net.Thank you, so we can send them to -net and have them backported in stable versions.
Quoted 8 lines
Quoted 5 lines
- Part 4: it is not clear to me if they were needed? They have been
marked as "Rejected", but please tell me if they are still needed and
just the title here was wrong.Patch 18 can be marked as "Changes Requested". We can test flushing addresses in userspace in it.
We can indeed check that it doesn't affect addresses from the userspace
PM. I just marked it as "Changes Requested".Cheers,
Matt