]> www.infradead.org Git - users/dwmw2/linux.git/commit
mptcp: add mptcp_userspace_pm_lookup_addr helper
authorGeliang Tang <tanggeliang@kylinos.cn>
Fri, 13 Dec 2024 19:52:52 +0000 (20:52 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sun, 15 Dec 2024 22:28:33 +0000 (14:28 -0800)
commite7b4083b90b7213902124d13fd1ed808360e32b1
treed9492d4f69d219b04ee9a7473bf82e13ad14921c
parentdcacb364772eb463bde225176086bd7738b7102f
mptcp: add mptcp_userspace_pm_lookup_addr helper

Like __lookup_addr() helper in pm_netlink.c, a new helper
mptcp_userspace_pm_lookup_addr() is also defined in pm_userspace.c.
It looks up the corresponding mptcp_pm_addr_entry address in
userspace_pm_local_addr_list through the passed "addr" parameter
and returns the found address entry.

This helper can be used in mptcp_userspace_pm_delete_local_addr(),
mptcp_userspace_pm_set_flags(), mptcp_userspace_pm_get_local_id()
and mptcp_userspace_pm_is_backup() to simplify the code.

Please note that with this change now list_for_each_entry() is used in
mptcp_userspace_pm_append_new_local_addr(), not list_for_each_entry_safe(),
but that's OK to do so because mptcp_userspace_pm_lookup_addr() only
returns an entry from the list, the list hasn't been modified here.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20241213-net-next-mptcp-pm-misc-cleanup-v1-1-ddb6d00109a8@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mptcp/pm_userspace.c