From nobody Sat Dec 21 16:33:43 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9FCB41D1319 for ; Mon, 7 Oct 2024 10:53:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728298409; cv=none; b=nAvXSieaSpAL0et0C1XyRICwhi2owge+UaYly+J50As8e7Wu68V43vDh2RSlQHlUqaciWywS7IKzDnq08pxy8LSe3nDu4caaihjWBP2qZw3N9QpmrEN9OsCd1OrWR6SOp/a4BqY2neDY7EaMMZNMwtOtTuxkPrJBRb4BoU3bIx0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728298409; c=relaxed/simple; bh=eRZ+fRXE0e719NQXc0auY59zeAdA7p1VlW2/ij3npP8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XP1W6ugEFnThavOjStLg0HHPlOeWMper5BTzG4vKoO6CrBi/QztN8FGBdCitLYrRbc7X+3cN0r7AxgxqkiGx5qOP/qLG596X4yqps0cfAEbPMBmurSh1O6IPoNkILVlpjPIoGd1IpzSS19e7MO+bNSn376J+fxNma7sU1OWm2YE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WeZtcJ6v; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WeZtcJ6v" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14149C4CED2; Mon, 7 Oct 2024 10:53:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728298409; bh=eRZ+fRXE0e719NQXc0auY59zeAdA7p1VlW2/ij3npP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WeZtcJ6vpQGHhE1OKGr/ipiKj1WW8L/L++Lb0dCCby1VzG/7YYai0xZ3giDLag+cr qRvXqrnDNMBchYLm1+6vAJJ6KkrM0KQOaBg/OTGMRH4OWMwX5g62JgoTlhUfUNqE4Q hEjyXO74Y1WhxeprxH+72FLBD3PQSyMuC7VZfTWfYHZdWQvySqpRjPCJaIFUqfbM8W NVRpXdHH2wC5U1V5nC/3PuadBJGmuG8fb1g2InvOyBZL5+QGiUjP0r4wPc2/9oROQ9 HzSVI3ev8TwpjL0OY3COP38tsA56nAhxCjPMG66xw0mH0xqHD3fdUJtNq5zH75EZNe aGrSx7liSZ+Cw== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 01/10] mptcp: add struct mptcp_id_bitmap Date: Mon, 7 Oct 2024 18:53:13 +0800 Message-ID: <492eb1cf8c8717111dd9c32496d5edcfa2b49ed3.1728298100.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang A new struct mptcp_id_bitmap is defined to unify all bitmap type of address ids. This type can be used to easily define dump_addr() interface of the path managers as: int (*dump_addr)(struct mptcp_sock *msk, struct mptcp_id_bitmap *bitmap); It also allows this parameter to be modified in BPF. Signed-off-by: Geliang Tang --- net/mptcp/pm.c | 2 +- net/mptcp/pm_netlink.c | 42 ++++++++++++++++++++-------------------- net/mptcp/pm_userspace.c | 14 ++++++-------- net/mptcp/protocol.h | 6 +++++- 4 files changed, 33 insertions(+), 31 deletions(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 16c336c51940..5afc1f8e5ca7 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -536,7 +536,7 @@ void mptcp_pm_data_reset(struct mptcp_sock *msk) WRITE_ONCE(pm->addr_signal, 0); WRITE_ONCE(pm->remote_deny_join_id0, false); pm->status =3D 0; - bitmap_fill(msk->pm.id_avail_bitmap, MPTCP_PM_MAX_ADDR_ID + 1); + bitmap_fill(msk->pm.id_avail_bitmap.map, MPTCP_PM_MAX_ADDR_ID + 1); } =20 void mptcp_pm_data_init(struct mptcp_sock *msk) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index fe34297ea6dc..6fcbfcbc0edb 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -37,7 +37,7 @@ struct pm_nl_pernet { unsigned int local_addr_max; unsigned int subflows_max; unsigned int next_id; - DECLARE_BITMAP(id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1); + struct mptcp_id_bitmap id_bitmap; }; =20 #define MPTCP_PM_ADDR_MAX 8 @@ -161,7 +161,7 @@ select_local_address(const struct pm_nl_pernet *pernet, if (!(entry->flags & MPTCP_PM_ADDR_FLAG_SUBFLOW)) continue; =20 - if (!test_bit(entry->addr.id, msk->pm.id_avail_bitmap)) + if (!test_bit(entry->addr.id, msk->pm.id_avail_bitmap.map)) continue; =20 new_local->addr =3D entry->addr; @@ -189,7 +189,7 @@ select_signal_address(struct pm_nl_pernet *pernet, cons= t struct mptcp_sock *msk, * can lead to additional addresses not being announced. */ list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { - if (!test_bit(entry->addr.id, msk->pm.id_avail_bitmap)) + if (!test_bit(entry->addr.id, msk->pm.id_avail_bitmap.map)) continue; =20 if (!(entry->flags & MPTCP_PM_ADDR_FLAG_SIGNAL)) @@ -243,7 +243,7 @@ bool mptcp_pm_nl_check_work_pending(struct mptcp_sock *= msk) struct pm_nl_pernet *pernet =3D pm_nl_get_pernet_from_msk(msk); =20 if (msk->pm.subflows =3D=3D mptcp_pm_get_subflows_max(msk) || - (find_next_and_bit(pernet->id_bitmap, msk->pm.id_avail_bitmap, + (find_next_and_bit(pernet->id_bitmap.map, msk->pm.id_avail_bitmap.map, MPTCP_PM_MAX_ADDR_ID + 1, 0) =3D=3D MPTCP_PM_MAX_ADDR_ID + 1)) { WRITE_ONCE(msk->pm.work_pending, false); return false; @@ -443,15 +443,15 @@ static unsigned int fill_remote_addresses_vec(struct = mptcp_sock *msk, msk->pm.subflows++; addrs[i++] =3D remote; } else { - DECLARE_BITMAP(unavail_id, MPTCP_PM_MAX_ADDR_ID + 1); + struct mptcp_id_bitmap unavail_id; =20 /* Forbid creation of new subflows matching existing * ones, possibly already created by incoming ADD_ADDR */ - bitmap_zero(unavail_id, MPTCP_PM_MAX_ADDR_ID + 1); + bitmap_zero(unavail_id.map, MPTCP_PM_MAX_ADDR_ID + 1); mptcp_for_each_subflow(msk, subflow) if (READ_ONCE(subflow->local_id) =3D=3D local->id) - __set_bit(subflow->remote_id, unavail_id); + __set_bit(subflow->remote_id, unavail_id.map); =20 mptcp_for_each_subflow(msk, subflow) { ssk =3D mptcp_subflow_tcp_sock(subflow); @@ -460,7 +460,7 @@ static unsigned int fill_remote_addresses_vec(struct mp= tcp_sock *msk, if (deny_id0 && !addrs[i].id) continue; =20 - if (test_bit(addrs[i].id, unavail_id)) + if (test_bit(addrs[i].id, unavail_id.map)) continue; =20 if (!mptcp_pm_addr_families_match(sk, local, &addrs[i])) @@ -470,7 +470,7 @@ static unsigned int fill_remote_addresses_vec(struct mp= tcp_sock *msk, /* forbid creating multiple address towards * this id */ - __set_bit(addrs[i].id, unavail_id); + __set_bit(addrs[i].id, unavail_id.map); msk->pm.subflows++; i++; } @@ -558,7 +558,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(stru= ct mptcp_sock *msk) rcu_read_lock(); entry =3D __lookup_addr(pernet, &mpc_addr); if (entry) { - __clear_bit(entry->addr.id, msk->pm.id_avail_bitmap); + __clear_bit(entry->addr.id, msk->pm.id_avail_bitmap.map); msk->mpc_endpoint_id =3D entry->addr.id; backup =3D !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP); } @@ -596,7 +596,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(stru= ct mptcp_sock *msk) if (!mptcp_pm_alloc_anno_list(msk, &local.addr)) return; =20 - __clear_bit(local.addr.id, msk->pm.id_avail_bitmap); + __clear_bit(local.addr.id, msk->pm.id_avail_bitmap.map); msk->pm.add_addr_signaled++; =20 /* Special case for ID0: set the correct ID */ @@ -625,7 +625,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(stru= ct mptcp_sock *msk) =20 fullmesh =3D !!(local.flags & MPTCP_PM_ADDR_FLAG_FULLMESH); =20 - __clear_bit(local.addr.id, msk->pm.id_avail_bitmap); + __clear_bit(local.addr.id, msk->pm.id_avail_bitmap.map); =20 /* Special case for ID0: set the correct ID */ if (local.addr.id =3D=3D msk->mpc_endpoint_id) @@ -990,7 +990,7 @@ static int mptcp_pm_nl_append_new_local_addr(struct pm_= nl_pernet *pernet, ret =3D -ERANGE; goto out; } - if (test_bit(entry->addr.id, pernet->id_bitmap)) { + if (test_bit(entry->addr.id, pernet->id_bitmap.map)) { ret =3D -EBUSY; goto out; } @@ -1024,7 +1024,7 @@ static int mptcp_pm_nl_append_new_local_addr(struct p= m_nl_pernet *pernet, =20 if (!entry->addr.id && needs_id) { find_next: - entry->addr.id =3D find_next_zero_bit(pernet->id_bitmap, + entry->addr.id =3D find_next_zero_bit(pernet->id_bitmap.map, MPTCP_PM_MAX_ADDR_ID + 1, pernet->next_id); if (!entry->addr.id && pernet->next_id !=3D 1) { @@ -1036,7 +1036,7 @@ static int mptcp_pm_nl_append_new_local_addr(struct p= m_nl_pernet *pernet, if (!entry->addr.id && needs_id) goto out; =20 - __set_bit(entry->addr.id, pernet->id_bitmap); + __set_bit(entry->addr.id, pernet->id_bitmap.map); if (entry->addr.id > pernet->next_id) pernet->next_id =3D entry->addr.id; =20 @@ -1484,7 +1484,7 @@ static bool mptcp_pm_remove_anno_addr(struct mptcp_so= ck *msk, if (ret || force) { spin_lock_bh(&msk->pm.lock); if (ret) { - __set_bit(addr->id, msk->pm.id_avail_bitmap); + __set_bit(addr->id, msk->pm.id_avail_bitmap.map); msk->pm.add_addr_signaled--; } mptcp_pm_remove_addr(msk, &list); @@ -1496,7 +1496,7 @@ static bool mptcp_pm_remove_anno_addr(struct mptcp_so= ck *msk, static void __mark_subflow_endp_available(struct mptcp_sock *msk, u8 id) { /* If it was marked as used, and not ID 0, decrement local_addr_used */ - if (!__test_and_set_bit(id ? : msk->mpc_endpoint_id, msk->pm.id_avail_bit= map) && + if (!__test_and_set_bit(id ? : msk->mpc_endpoint_id, msk->pm.id_avail_bit= map.map) && id && !WARN_ON_ONCE(msk->pm.local_addr_used =3D=3D 0)) msk->pm.local_addr_used--; } @@ -1627,7 +1627,7 @@ int mptcp_pm_nl_del_addr_doit(struct sk_buff *skb, st= ruct genl_info *info) =20 pernet->addrs--; list_del_rcu(&entry->list); - __clear_bit(entry->addr.id, pernet->id_bitmap); + __clear_bit(entry->addr.id, pernet->id_bitmap.map); spin_unlock_bh(&pernet->lock); =20 mptcp_nl_remove_subflow_and_signal_addr(sock_net(skb->sk), entry); @@ -1691,7 +1691,7 @@ static void mptcp_pm_flush_addrs_and_subflows(struct = mptcp_sock *msk, if (slist.nr) mptcp_pm_nl_rm_subflow_received(msk, &slist); /* Reset counters: maybe some subflows have been removed before */ - bitmap_fill(msk->pm.id_avail_bitmap, MPTCP_PM_MAX_ADDR_ID + 1); + bitmap_fill(msk->pm.id_avail_bitmap.map, MPTCP_PM_MAX_ADDR_ID + 1); msk->pm.local_addr_used =3D 0; spin_unlock_bh(&msk->pm.lock); } @@ -1749,7 +1749,7 @@ int mptcp_pm_nl_flush_addrs_doit(struct sk_buff *skb,= struct genl_info *info) list_splice_init(&pernet->local_addr_list, &free_list); __reset_counters(pernet); pernet->next_id =3D 1; - bitmap_zero(pernet->id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1); + bitmap_zero(pernet->id_bitmap.map, MPTCP_PM_MAX_ADDR_ID + 1); spin_unlock_bh(&pernet->lock); mptcp_nl_flush_addrs_list(sock_net(skb->sk), &free_list); synchronize_rcu(); @@ -1865,7 +1865,7 @@ int mptcp_pm_nl_dump_addr(struct sk_buff *msg, =20 spin_lock_bh(&pernet->lock); for (i =3D id; i < MPTCP_PM_MAX_ADDR_ID + 1; i++) { - if (test_bit(i, pernet->id_bitmap)) { + if (test_bit(i, pernet->id_bitmap.map)) { entry =3D __lookup_addr_by_id(pernet, i); if (!entry) break; diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 2cceded3a83a..e3f29d8865f4 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -30,15 +30,15 @@ static int mptcp_userspace_pm_append_new_local_addr(str= uct mptcp_sock *msk, struct mptcp_pm_addr_entry *entry, bool needs_id) { - DECLARE_BITMAP(id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1); struct mptcp_pm_addr_entry *match =3D NULL; struct sock *sk =3D (struct sock *)msk; + struct mptcp_id_bitmap id_bitmap; struct mptcp_pm_addr_entry *e; bool addr_match =3D false; bool id_match =3D false; int ret =3D -EINVAL; =20 - bitmap_zero(id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1); + bitmap_zero(id_bitmap.map, MPTCP_PM_MAX_ADDR_ID + 1); =20 spin_lock_bh(&msk->pm.lock); list_for_each_entry(e, &msk->pm.userspace_pm_local_addr_list, list) { @@ -52,7 +52,7 @@ static int mptcp_userspace_pm_append_new_local_addr(struc= t mptcp_sock *msk, } else if (addr_match || id_match) { break; } - __set_bit(e->addr.id, id_bitmap); + __set_bit(e->addr.id, id_bitmap.map); } =20 if (!match && !addr_match && !id_match) { @@ -67,7 +67,7 @@ static int mptcp_userspace_pm_append_new_local_addr(struc= t mptcp_sock *msk, =20 *e =3D *entry; if (!e->addr.id && needs_id) - e->addr.id =3D find_next_zero_bit(id_bitmap, + e->addr.id =3D find_next_zero_bit(id_bitmap.map, MPTCP_PM_MAX_ADDR_ID + 1, 1); list_add_tail_rcu(&e->list, &msk->pm.userspace_pm_local_addr_list); @@ -612,19 +612,17 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb,= struct genl_info *info) int mptcp_userspace_pm_dump_addr(struct sk_buff *msg, struct netlink_callback *cb) { - struct id_bitmap { - DECLARE_BITMAP(map, MPTCP_PM_MAX_ADDR_ID + 1); - } *bitmap; const struct genl_info *info =3D genl_info_dump(cb); struct net *net =3D sock_net(msg->sk); struct mptcp_pm_addr_entry *entry; + struct mptcp_id_bitmap *bitmap; struct mptcp_sock *msk; struct nlattr *token; int ret =3D -EINVAL; struct sock *sk; void *hdr; =20 - bitmap =3D (struct id_bitmap *)cb->ctx; + bitmap =3D (struct mptcp_id_bitmap *)cb->ctx; token =3D info->attrs[MPTCP_PM_ATTR_TOKEN]; =20 msk =3D mptcp_token_get_sock(net, nla_get_u32(token)); diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index c3942416fa3a..ef50ef0c0829 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -211,6 +211,10 @@ enum mptcp_addr_signal_status { /* max value of mptcp_addr_info.id */ #define MPTCP_PM_MAX_ADDR_ID U8_MAX =20 +struct mptcp_id_bitmap { + DECLARE_BITMAP(map, MPTCP_PM_MAX_ADDR_ID + 1); +}; + struct mptcp_pm_data { struct mptcp_addr_info local; struct mptcp_addr_info remote; @@ -231,7 +235,7 @@ struct mptcp_pm_data { u8 pm_type; u8 subflows; u8 status; - DECLARE_BITMAP(id_avail_bitmap, MPTCP_PM_MAX_ADDR_ID + 1); + struct mptcp_id_bitmap id_avail_bitmap; struct mptcp_rm_list rm_list_tx; struct mptcp_rm_list rm_list_rx; }; --=20 2.43.0 From nobody Sat Dec 21 16:33:43 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CFCB115D5C1 for ; Mon, 7 Oct 2024 10:53:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728298410; cv=none; b=fHs6AEyl7SEoJgjra4jVcTYoooVNSrrbxb3h7Ss8qumz6WZsg3nLG4QNwWzufDJjfFEdcFfGcu+24iqU2Jb4y4wXd+tn5t58P3XeGDKqpu/+L82GkNMa+x5XOVwnR3fe63aaTfBkoArqpsLiKFSob/6RZjDhLWZhhguudZxNXBA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728298410; c=relaxed/simple; bh=/u3gCX8BHNF2cTPDn+WFIzR7nDhtLd1k4baWkqqlp8g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Nmt+/y+eBD6MqibwYzAsj45s72ddIGznu7jTxJ6lQbYjVH2lMArj2BXyFZk1zFhoYfgXlNZC9a9Dj8TvsZTk5figlJVY7HA9V76LyB5SG1NS2Vd4WV1nToDSHwYv2AUWRG2zEGXPBp8l6bFIegNDU4J/p0G0XQOH9Op5uliQ9h4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KMrBhU7Z; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KMrBhU7Z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1082C4CECC; Mon, 7 Oct 2024 10:53:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728298410; bh=/u3gCX8BHNF2cTPDn+WFIzR7nDhtLd1k4baWkqqlp8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KMrBhU7Za10sB2ZYXg5KSgZ5ALGbDNhtFqPUnQS+nJg4PJcC1ZMNOmHy4b2aTsLdW +kD7XiVsfvknj7CNJYsJrNVj87QJqp1qOw0OLlOea5RYBCi8rNk9nyvHmV8tsnkkk3 xpF4dZdzt4M77CrA5tw17LwcKL28+sf2XcYfQQbzSxSKFynXz+1sRCB1ug0susd60Q UiefXpr05649q49+qhBMuSV4XaM5uEJSK675ij5pgrN5OwLMxE/DhyXSSevY5K86pH uDNVp+ZGrPLrgP3ue2P6ToPesLeC1Q60T6jtbjRJkyDNRJ/ruULdUITFPrX6i471nu haocl6477M8cA== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 02/10] mptcp: add mptcp_userspace_pm_get_sock helper Date: Mon, 7 Oct 2024 18:53:14 +0800 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang Each userspace pm netlink function uses nla_get_u32() to get the msk token value, then pass it to mptcp_token_get_sock() to get the msk. Finally check whether userspace pm is selected on this msk. It makes sense to wrap them into a helper, named mptcp_userspace_pm_get_sock(), to do this. Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 137 +++++++++++++-------------------------- 1 file changed, 44 insertions(+), 93 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index e3f29d8865f4..6aaf10b8ddd1 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -166,36 +166,51 @@ bool mptcp_userspace_pm_is_backup(struct mptcp_sock *= msk, return backup; } =20 -int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info) +static struct mptcp_sock *mptcp_userspace_pm_get_sock(const struct genl_in= fo *info) { struct nlattr *token =3D info->attrs[MPTCP_PM_ATTR_TOKEN]; + struct mptcp_sock *msk =3D NULL; + + if (!token) { + GENL_SET_ERR_MSG(info, "missing required inputs"); + goto out; + } + + msk =3D mptcp_token_get_sock(genl_info_net(info), nla_get_u32(token)); + if (!msk) { + NL_SET_ERR_MSG_ATTR(info->extack, token, "invalid token"); + goto out; + } + + if (!mptcp_pm_is_userspace(msk)) { + GENL_SET_ERR_MSG(info, "invalid request; userspace PM not selected"); + sock_put((struct sock *)msk); + msk =3D NULL; + } + +out: + return msk; +} + +int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info) +{ struct nlattr *addr =3D info->attrs[MPTCP_PM_ATTR_ADDR]; struct mptcp_pm_addr_entry addr_val; struct mptcp_sock *msk; int err =3D -EINVAL; struct sock *sk; - u32 token_val; =20 - if (!addr || !token) { + if (!addr) { GENL_SET_ERR_MSG(info, "missing required inputs"); return err; } =20 - token_val =3D nla_get_u32(token); - - msk =3D mptcp_token_get_sock(sock_net(skb->sk), token_val); - if (!msk) { - NL_SET_ERR_MSG_ATTR(info->extack, token, "invalid token"); + msk =3D mptcp_userspace_pm_get_sock(info); + if (!msk) return err; - } =20 sk =3D (struct sock *)msk; =20 - if (!mptcp_pm_is_userspace(msk)) { - GENL_SET_ERR_MSG(info, "invalid request; userspace PM not selected"); - goto announce_err; - } - err =3D mptcp_pm_parse_entry(addr, info, true, &addr_val); if (err < 0) { GENL_SET_ERR_MSG(info, "error parsing local address"); @@ -268,7 +283,6 @@ static int mptcp_userspace_pm_remove_id_zero_address(st= ruct mptcp_sock *msk, =20 int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info) { - struct nlattr *token =3D info->attrs[MPTCP_PM_ATTR_TOKEN]; struct nlattr *id =3D info->attrs[MPTCP_PM_ATTR_LOC_ID]; struct mptcp_pm_addr_entry *match; struct mptcp_pm_addr_entry *entry; @@ -276,30 +290,21 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, stru= ct genl_info *info) LIST_HEAD(free_list); int err =3D -EINVAL; struct sock *sk; - u32 token_val; u8 id_val; =20 - if (!id || !token) { + if (!id) { GENL_SET_ERR_MSG(info, "missing required inputs"); return err; } =20 id_val =3D nla_get_u8(id); - token_val =3D nla_get_u32(token); =20 - msk =3D mptcp_token_get_sock(sock_net(skb->sk), token_val); - if (!msk) { - NL_SET_ERR_MSG_ATTR(info->extack, token, "invalid token"); + msk =3D mptcp_userspace_pm_get_sock(info); + if (!msk) return err; - } =20 sk =3D (struct sock *)msk; =20 - if (!mptcp_pm_is_userspace(msk)) { - GENL_SET_ERR_MSG(info, "invalid request; userspace PM not selected"); - goto out; - } - if (id_val =3D=3D 0) { err =3D mptcp_userspace_pm_remove_id_zero_address(msk, info); goto out; @@ -333,7 +338,6 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct= genl_info *info) int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info = *info) { struct nlattr *raddr =3D info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE]; - struct nlattr *token =3D info->attrs[MPTCP_PM_ATTR_TOKEN]; struct nlattr *laddr =3D info->attrs[MPTCP_PM_ATTR_ADDR]; struct mptcp_pm_addr_entry entry =3D { 0 }; struct mptcp_addr_info addr_r; @@ -341,28 +345,18 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *s= kb, struct genl_info *info) struct mptcp_sock *msk; int err =3D -EINVAL; struct sock *sk; - u32 token_val; =20 - if (!laddr || !raddr || !token) { + if (!laddr || !raddr) { GENL_SET_ERR_MSG(info, "missing required inputs"); return err; } =20 - token_val =3D nla_get_u32(token); - - msk =3D mptcp_token_get_sock(genl_info_net(info), token_val); - if (!msk) { - NL_SET_ERR_MSG_ATTR(info->extack, token, "invalid token"); + msk =3D mptcp_userspace_pm_get_sock(info); + if (!msk) return err; - } =20 sk =3D (struct sock *)msk; =20 - if (!mptcp_pm_is_userspace(msk)) { - GENL_SET_ERR_MSG(info, "invalid request; userspace PM not selected"); - goto create_err; - } - err =3D mptcp_pm_parse_entry(laddr, info, true, &entry); if (err < 0) { NL_SET_ERR_MSG_ATTR(info->extack, laddr, "error parsing local addr"); @@ -465,35 +459,24 @@ static struct sock *mptcp_nl_find_ssk(struct mptcp_so= ck *msk, int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *skb, struct genl_info= *info) { struct nlattr *raddr =3D info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE]; - struct nlattr *token =3D info->attrs[MPTCP_PM_ATTR_TOKEN]; struct nlattr *laddr =3D info->attrs[MPTCP_PM_ATTR_ADDR]; struct mptcp_addr_info addr_l; struct mptcp_addr_info addr_r; struct mptcp_sock *msk; struct sock *sk, *ssk; int err =3D -EINVAL; - u32 token_val; =20 - if (!laddr || !raddr || !token) { + if (!laddr || !raddr) { GENL_SET_ERR_MSG(info, "missing required inputs"); return err; } =20 - token_val =3D nla_get_u32(token); - - msk =3D mptcp_token_get_sock(genl_info_net(info), token_val); - if (!msk) { - NL_SET_ERR_MSG_ATTR(info->extack, token, "invalid token"); + msk =3D mptcp_userspace_pm_get_sock(info); + if (!msk) return err; - } =20 sk =3D (struct sock *)msk; =20 - if (!mptcp_pm_is_userspace(msk)) { - GENL_SET_ERR_MSG(info, "invalid request; userspace PM not selected"); - goto destroy_err; - } - err =3D mptcp_pm_parse_addr(laddr, info, &addr_l); if (err < 0) { NL_SET_ERR_MSG_ATTR(info->extack, laddr, "error parsing local addr"); @@ -556,30 +539,18 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb,= struct genl_info *info) struct mptcp_pm_addr_entry loc =3D { .addr =3D { .family =3D AF_UNSPEC },= }; struct mptcp_pm_addr_entry rem =3D { .addr =3D { .family =3D AF_UNSPEC },= }; struct nlattr *attr_rem =3D info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE]; - struct nlattr *token =3D info->attrs[MPTCP_PM_ATTR_TOKEN]; struct nlattr *attr =3D info->attrs[MPTCP_PM_ATTR_ADDR]; - struct net *net =3D sock_net(skb->sk); struct mptcp_sock *msk; int ret =3D -EINVAL; struct sock *sk; - u32 token_val; u8 bkup =3D 0; =20 - token_val =3D nla_get_u32(token); - - msk =3D mptcp_token_get_sock(net, token_val); - if (!msk) { - NL_SET_ERR_MSG_ATTR(info->extack, token, "invalid token"); + msk =3D mptcp_userspace_pm_get_sock(info); + if (!msk) return ret; - } =20 sk =3D (struct sock *)msk; =20 - if (!mptcp_pm_is_userspace(msk)) { - GENL_SET_ERR_MSG(info, "userspace PM not selected"); - goto set_flags_err; - } - ret =3D mptcp_pm_parse_entry(attr, info, false, &loc); if (ret < 0) goto set_flags_err; @@ -613,31 +584,21 @@ int mptcp_userspace_pm_dump_addr(struct sk_buff *msg, struct netlink_callback *cb) { const struct genl_info *info =3D genl_info_dump(cb); - struct net *net =3D sock_net(msg->sk); struct mptcp_pm_addr_entry *entry; struct mptcp_id_bitmap *bitmap; struct mptcp_sock *msk; - struct nlattr *token; int ret =3D -EINVAL; struct sock *sk; void *hdr; =20 bitmap =3D (struct mptcp_id_bitmap *)cb->ctx; - token =3D info->attrs[MPTCP_PM_ATTR_TOKEN]; =20 - msk =3D mptcp_token_get_sock(net, nla_get_u32(token)); - if (!msk) { - NL_SET_ERR_MSG_ATTR(info->extack, token, "invalid token"); + msk =3D mptcp_userspace_pm_get_sock(info); + if (!msk) return ret; - } =20 sk =3D (struct sock *)msk; =20 - if (!mptcp_pm_is_userspace(msk)) { - GENL_SET_ERR_MSG(info, "invalid request; userspace PM not selected"); - goto out; - } - lock_sock(sk); spin_lock_bh(&msk->pm.lock); list_for_each_entry(entry, &msk->pm.userspace_pm_local_addr_list, list) { @@ -662,7 +623,6 @@ int mptcp_userspace_pm_dump_addr(struct sk_buff *msg, release_sock(sk); ret =3D msg->len; =20 -out: sock_put(sk); return ret; } @@ -671,28 +631,19 @@ int mptcp_userspace_pm_get_addr(struct sk_buff *skb, struct genl_info *info) { struct nlattr *attr =3D info->attrs[MPTCP_PM_ENDPOINT_ADDR]; - struct nlattr *token =3D info->attrs[MPTCP_PM_ATTR_TOKEN]; struct mptcp_pm_addr_entry addr, *entry; - struct net *net =3D sock_net(skb->sk); struct mptcp_sock *msk; struct sk_buff *msg; int ret =3D -EINVAL; struct sock *sk; void *reply; =20 - msk =3D mptcp_token_get_sock(net, nla_get_u32(token)); - if (!msk) { - NL_SET_ERR_MSG_ATTR(info->extack, token, "invalid token"); + msk =3D mptcp_userspace_pm_get_sock(info); + if (!msk) return ret; - } =20 sk =3D (struct sock *)msk; =20 - if (!mptcp_pm_is_userspace(msk)) { - GENL_SET_ERR_MSG(info, "invalid request; userspace PM not selected"); - goto out; - } - ret =3D mptcp_pm_parse_entry(attr, info, false, &addr); if (ret < 0) goto out; --=20 2.43.0 From nobody Sat Dec 21 16:33:43 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 956B9199956 for ; Mon, 7 Oct 2024 10:53:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728298412; cv=none; b=slzGUn1xR+Msjz1+NU1bb6lJjSp249ma1WYfTprDPaZRl8SQM0BAg323LMkd2abZ6AQrlta9tqgyKNgS0cAmJK5qIFZjTzIM31KPE0usCbtdpJDE3lz+Cdq9ewk48wJhewHzNIGSZ/3GnHLAfzyoSRFcF85os54Y0pP0yLwQvKU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728298412; c=relaxed/simple; bh=G/L/qe+cBFfXmT3vO7fZ9m3E8qsGSV8Hh3uQMPlRCag=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cYGjZh9FimpfcV57+82hQkWluAeHYCnTiX+4kjd1mSMk5PSIH3lDU5zKEykvd6x9U0KgjX0OUcEU2MPhcMww2GVyZ8xdLJQC+AtalrF9ql8YSQHZM9dSRlqIzgXJLHAF8sNiKAZDe9dIJO/4a0JGD6jYYO5YoORPEny+gFX8l5g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YZREibZC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YZREibZC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56D27C4CECD; Mon, 7 Oct 2024 10:53:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728298412; bh=G/L/qe+cBFfXmT3vO7fZ9m3E8qsGSV8Hh3uQMPlRCag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YZREibZC6L+n89TyEO7b0RjmACO4F9EAFXbKHiKcCkU0EqqgHfKfso16uBwwNwfnp q9OwVxdC3+fUaLVeoF9xE6fyts1iO1RF/L4ONK30bd8Xq+Lz7u8hIdHf8ACq55VZqk 6v0kUiaqSJcVwDy74FtbP8u54pYtKkNFZNaExoYRollj+JXIBq5vIl10sRyPfTuog4 CwqWBYevsbYG+ZbfG4StMNdvjKesSW6kJ0mQRMmJW0nWy5/LqRvYTPYlSF6XYDI6jS s7Rd1+4NRw4Ji9pIoAo8YMKRjmrIJjNZA2ORzdx6fHIu3PsX8ZcFunP7Njhd1bGDty jduCFfjJiEFYw== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 03/10] mptcp: use __lookup_addr in pm_netlink Date: Mon, 7 Oct 2024 18:53:15 +0800 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang The helper __lookup_addr() can be used in mptcp_pm_nl_get_local_id() and mptcp_pm_nl_is_backup() to simplify the code if using list_for_each_entry_rcu instead of list_for_each_entry in it. Signed-off-by: Geliang Tang --- net/mptcp/pm_netlink.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 6fcbfcbc0edb..e1907dad3bc4 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -524,7 +524,7 @@ __lookup_addr(struct pm_nl_pernet *pernet, const struct= mptcp_addr_info *info) { struct mptcp_pm_addr_entry *entry; =20 - list_for_each_entry(entry, &pernet->local_addr_list, list) { + list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { if (mptcp_addresses_equal(&entry->addr, info, entry->addr.port)) return entry; } @@ -1144,12 +1144,9 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk,= struct mptcp_addr_info *skc pernet =3D pm_nl_get_pernet_from_msk(msk); =20 rcu_read_lock(); - list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { - if (mptcp_addresses_equal(&entry->addr, skc, entry->addr.port)) { - ret =3D entry->addr.id; - break; - } - } + entry =3D __lookup_addr(pernet, skc); + if (entry) + ret =3D entry->addr.id; rcu_read_unlock(); if (ret >=3D 0) return ret; @@ -1179,12 +1176,9 @@ bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, s= truct mptcp_addr_info *skc) bool backup =3D false; =20 rcu_read_lock(); - list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { - if (mptcp_addresses_equal(&entry->addr, skc, entry->addr.port)) { - backup =3D !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP); - break; - } - } + entry =3D __lookup_addr(pernet, skc); + if (entry) + backup =3D !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP); rcu_read_unlock(); =20 return backup; --=20 2.43.0 From nobody Sat Dec 21 16:33:43 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 312EB199956 for ; Mon, 7 Oct 2024 10:53:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728298415; cv=none; b=ijFoeGAXa4t7pOPaRv0rOnUR060E67U8Zt77j7uEheXlYh5WQTPSBeIdWOuk+yWCST556fmGJ3d6K94eXhsXo72JaGVB7KDWc5EKntN3PTYv4xOvf3XwgdpxKGlUloOMhLuM9Bvd6aSAepEcFTB7jdcE73L3Nnc67Zc4wlhNPn4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728298415; c=relaxed/simple; bh=vqOcOg8dsGwhak4/lx17NFlGIdPz8M3KC4JMpErX4cE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nRlTc0lVB6H9ZRGQ2grtqcnzj1Ly5xrxSgczf7D0kGeMbFxPqKrw5pSRj7iajLxY2X5ytowgNiu0tbtZEN8k/MTBJvUcScVWCOpaTP2kxGSw6ntfjkgO19QSQLqz+DHZtLtTRdCZnk/rv2cs7jdhmmx93JYLxGWx4H3QnrUeaJA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tmsYphFH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tmsYphFH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17A1DC4CEC6; Mon, 7 Oct 2024 10:53:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728298414; bh=vqOcOg8dsGwhak4/lx17NFlGIdPz8M3KC4JMpErX4cE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tmsYphFHTmnVLhkgbBeDsl9aqnUU8ukzxGB+lpMYvvzGzAaN/ZAt89ZhOHZfLl+hy 0u6lhwSuBvjbvBwX9IgcsZK/cfVLt4VkwQyX5FS6Jds2bTYBLzMOsas2Rv77CrQFC+ ywDJJA1kxQ9V3tNdEZLiCOquX91zQ2MnbuyCVLRrcck481oYj53ub3Bw3wZxJgmzbD wZKcl/4iLmxr8bnpY7duJx0/Og1DzkmP+1bSoh/Ua7MVGMz/99DkoTd90kll04iwok GweFsHtp6l7qPScYwNuhmoPSWmQ2uWheAeIpx+MkqR6/KHXmUPyymZMzgXTX1sN+8y oGucI6Pwc/64g== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 04/10] mptcp: use sock_kfree_s instead of kfree Date: Mon, 7 Oct 2024 18:53:16 +0800 Message-ID: <47ee37e871195c5235c2d76cbe1f50c3be4a1f58.1728298100.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang The local address entries on the userspace_pm_local_addr_list are allocated by sock_kmalloc(). It's better to use sock_kfree_s() to free them, instead of using kfree(). Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 6aaf10b8ddd1..b7272289d4c1 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -91,6 +91,7 @@ static int mptcp_userspace_pm_delete_local_addr(struct mp= tcp_sock *msk, struct mptcp_pm_addr_entry *addr) { struct mptcp_pm_addr_entry *entry, *tmp; + struct sock *sk =3D (struct sock *)msk; =20 list_for_each_entry_safe(entry, tmp, &msk->pm.userspace_pm_local_addr_lis= t, list) { if (mptcp_addresses_equal(&entry->addr, &addr->addr, false)) { @@ -98,7 +99,7 @@ static int mptcp_userspace_pm_delete_local_addr(struct mp= tcp_sock *msk, * be used multiple times (e.g. fullmesh mode). */ list_del_rcu(&entry->list); - kfree(entry); + sock_kfree_s(sk, entry, sizeof(*entry)); msk->pm.local_addr_used--; return 0; } --=20 2.43.0 From nobody Sat Dec 21 16:33:43 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CF811D131D for ; Mon, 7 Oct 2024 10:53:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728298416; cv=none; b=h909w335NNoOF4rzUF5gWQKiXNpadN954yl4bEI3N/x8oToRtI/tk+WujCKzZktfTGxXH/s1Bc1JF/1oDwAGjE/4SDWk9u/k+C0BfPqdufpF2PmrkOkQdBuEk2y8KZEgRSUQMxggm8JSc7wwQKYDQfDwZE+w29Bx/xbG2jcCxgw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728298416; c=relaxed/simple; bh=aMpeyZ6/+/H/lGVoFPiGJQnezrT5elltKFPsGt3J5II=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P2J3w5NLr2nylCfV4+x9fTiWdtmdDAre62mICRlccQurnrMpd/aRnlFiBfbHp+0VSBsX5GN3+JgzzSZPL2prVccwT02s+b1v63kdAElxyaZmBBwZlqfws/bdDGzvKJyeT1evhUsfi7uR+jSQCzfq065sOX2HI7H0s3/mBlwqSzg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Vg8KoaLd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Vg8KoaLd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D896C4CECC; Mon, 7 Oct 2024 10:53:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728298416; bh=aMpeyZ6/+/H/lGVoFPiGJQnezrT5elltKFPsGt3J5II=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vg8KoaLd9Ue84hgo+g3pVMLfx0CRlJp1FnyK+RsW1VXGvuc1MksZnkTnCPxZixPCE rOPMXM8mvCvfS/WDAqkMU88KwafxuJA6AH3bPkI6O7Yj8UcYq3xqETG71tGZ5Ks1ef 056QjniUPY3vn0DfCwZBhnyjtgMkAAm1ax0wKbsbmo7pMXqi4vCHTRKU4vzD6qQKkN qubIAU14COFrEgS8QuupO0rhZ3wIYTmWycRkDEdD0yg5zTSL9WVhXjHAPCnCcWNS5x AnUabDuS6pW1zAhAnj0l9YavyoOZr+ICoIbUOTpWxIxyx7PIT9tif+w5Mh/ZYNI1wa rvPuSzEdD0tjw== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 05/10] mptcp: add lookup_addr for userspace pm Date: Mon, 7 Oct 2024 18:53:17 +0800 Message-ID: <25c49a66e1228a26a285f3a678200800f5498204.1728298100.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang 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 it. This helper can be used in mptcp_userspace_pm_delete_local_addr(), mptcp_userspace_pm_get_local_id() and mptcp_userspace_pm_is_backup() to simplify the code. Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 56 +++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index b7272289d4c1..58599f32b279 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -26,6 +26,18 @@ void mptcp_free_local_addr_list(struct mptcp_sock *msk) } } =20 +static struct mptcp_pm_addr_entry * +mptcp_userspace_pm_lookup_addr(struct mptcp_sock *msk, const struct mptcp_= addr_info *addr) +{ + struct mptcp_pm_addr_entry *entry, *tmp; + + list_for_each_entry_safe(entry, tmp, &msk->pm.userspace_pm_local_addr_lis= t, list) { + if (mptcp_addresses_equal(&entry->addr, addr, false)) + return entry; + } + return NULL; +} + static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, struct mptcp_pm_addr_entry *entry, bool needs_id) @@ -90,22 +102,20 @@ static int mptcp_userspace_pm_append_new_local_addr(st= ruct 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 sock *sk =3D (struct sock *)msk; + struct mptcp_pm_addr_entry *entry; =20 - list_for_each_entry_safe(entry, tmp, &msk->pm.userspace_pm_local_addr_lis= t, list) { - if (mptcp_addresses_equal(&entry->addr, &addr->addr, false)) { - /* TODO: a refcount is needed because the entry can - * be used multiple times (e.g. fullmesh mode). - */ - list_del_rcu(&entry->list); - sock_kfree_s(sk, entry, sizeof(*entry)); - msk->pm.local_addr_used--; - return 0; - } - } - - return -EINVAL; + entry =3D mptcp_userspace_pm_lookup_addr(msk, &addr->addr); + if (!entry) + return -EINVAL; + + /* TODO: a refcount is needed because the entry can + * be used multiple times (e.g. fullmesh mode). + */ + list_del_rcu(&entry->list); + sock_kfree_s(sk, entry, sizeof(*entry)); + msk->pm.local_addr_used--; + return 0; } =20 static struct mptcp_pm_addr_entry * @@ -123,17 +133,12 @@ mptcp_userspace_pm_lookup_addr_by_id(struct mptcp_soc= k *msk, unsigned int id) int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc) { - struct mptcp_pm_addr_entry *entry =3D NULL, *e, new_entry; + struct mptcp_pm_addr_entry *entry =3D NULL, new_entry; __be16 msk_sport =3D ((struct inet_sock *) inet_sk((struct sock *)msk))->inet_sport; =20 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 =3D e; - break; - } - } + entry =3D mptcp_userspace_pm_lookup_addr(msk, skc); spin_unlock_bh(&msk->pm.lock); if (entry) return entry->addr.id; @@ -156,12 +161,9 @@ bool mptcp_userspace_pm_is_backup(struct mptcp_sock *m= sk, bool backup =3D false; =20 spin_lock_bh(&msk->pm.lock); - list_for_each_entry(entry, &msk->pm.userspace_pm_local_addr_list, list) { - if (mptcp_addresses_equal(&entry->addr, skc, false)) { - backup =3D !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP); - break; - } - } + entry =3D mptcp_userspace_pm_lookup_addr(msk, skc); + if (entry) + backup =3D !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP); spin_unlock_bh(&msk->pm.lock); =20 return backup; --=20 2.43.0 From nobody Sat Dec 21 16:33:43 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E347615D5C1 for ; Mon, 7 Oct 2024 10:53:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728298418; cv=none; b=fOSMXAVX51X9KBK1wrdLD8odhzYpBNshXElvZ2WUU1PXV/Iib/V6MiU1TfHIb4E0sbwDtEK5QoupuNOeOL5muoymJ63F3saD11N5oQy1P4wamrQdX13zfMn/w/+1e6oDg0ZGEfawgd/stCCGzvMg8yB1yaGkkLBDpFa5BoOBqvM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728298418; c=relaxed/simple; bh=kEMmc02kMK6FOx1V+tinbaU1Ku0mDwmcrqsRmCrdqOc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OVzIJKsrAlCLr6yTUXaMRw7zEdlzqLb2Yg3oJTjP0nR3r3XmMq4ozdHPJ2wTAxxVcjJTIS7JxGfMFhmRmH+KY+jhhsVcol7ikkjfd0vwLu7Sw/PKlOQYxNvZ1VM+1djWMm0vjJ+GMP/jRgS9YRK59xX/zizgbeSGrR9UB0Lg8tY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DM9pBq9A; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DM9pBq9A" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B87F8C4CEC6; Mon, 7 Oct 2024 10:53:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728298417; bh=kEMmc02kMK6FOx1V+tinbaU1Ku0mDwmcrqsRmCrdqOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DM9pBq9A8dHr9KrSXhLgMndN9j2WpUxZNRqe1LUL7eNqzLtOLFj4Nfvhlj8RRFQwm 3f/cTAw5oeJvtbaGj+C75Y+w43jSTOyDSdJ5HHCPswgwBdHdCzgf6AsuziP1f4LvCP r0tHRcyG+vzn6tqCZvo3rg8GlAqE7lmpWdbMcitF1Y12/Z0rNxm8ULHgJwmZDGrY3u BbZcLzkOOTIZqa6mmg2OTJQ+tp897oHjaEFsuH9Yz2bVjIB+D/TjnfdDOCn/ahmGYS 4ON5XMtf1oH5VLD85TiJqlVpqu1ZaSHQlUD2lTTpcgAi0BIvcspw9UpJM7t/kapqEc zkr3oVDV3CG+w== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 06/10] mptcp: change remote as mptcp_addr_info Date: Mon, 7 Oct 2024 18:53:18 +0800 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang Generally, in the path manager interfaces, the local address is defined as an mptcp_pm_addr_entry type address, while the remote address is defined as an mptcp_addr_info one: (struct mptcp_pm_addr_entry *local, struct mptcp_addr_info *remote) But the set_flags() interface uses two mptcp_pm_addr_entry type parameters. This patch changes the second one to mptcp_addr_info type and use helper mptcp_pm_parse_addr() to parse it instead of using mptcp_pm_parse_entry(). Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 58599f32b279..3c5591af0a80 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -540,9 +540,9 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *sk= b, struct genl_info *info int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *in= fo) { struct mptcp_pm_addr_entry loc =3D { .addr =3D { .family =3D AF_UNSPEC },= }; - struct mptcp_pm_addr_entry rem =3D { .addr =3D { .family =3D AF_UNSPEC },= }; struct nlattr *attr_rem =3D info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE]; struct nlattr *attr =3D info->attrs[MPTCP_PM_ATTR_ADDR]; + struct mptcp_addr_info rem =3D { .family =3D AF_UNSPEC, }; struct mptcp_sock *msk; int ret =3D -EINVAL; struct sock *sk; @@ -559,13 +559,13 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb,= struct genl_info *info) goto set_flags_err; =20 if (attr_rem) { - ret =3D mptcp_pm_parse_entry(attr_rem, info, false, &rem); + ret =3D mptcp_pm_parse_addr(attr_rem, info, &rem); if (ret < 0) goto set_flags_err; } =20 if (loc.addr.family =3D=3D AF_UNSPEC || - rem.addr.family =3D=3D AF_UNSPEC) { + rem.family =3D=3D AF_UNSPEC) { GENL_SET_ERR_MSG(info, "invalid address families"); ret =3D -EINVAL; goto set_flags_err; @@ -575,7 +575,7 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb, s= truct genl_info *info) bkup =3D 1; =20 lock_sock(sk); - ret =3D mptcp_pm_nl_mp_prio_send_ack(msk, &loc.addr, &rem.addr, bkup); + ret =3D mptcp_pm_nl_mp_prio_send_ack(msk, &loc.addr, &rem, bkup); release_sock(sk); =20 set_flags_err: --=20 2.43.0 From nobody Sat Dec 21 16:33:43 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5E7D18BC1C for ; Mon, 7 Oct 2024 10:53:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728298419; cv=none; b=KAz/XU5W3I9NfNXiC8YmlsqpNjaKefsaehquu+ZEfaWzY1DqPzZSBD7n2MIwkUf3Qv3IBC/oMhr/IPp1SJn/lOx88v30H0nstrMxvg3bxkG/Lz5mQkXq2uEXcj+EeNVVOPcD92Ocoo/7EdKdQFDcV7RDym49eqbx5CLQ1Qf//JY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728298419; c=relaxed/simple; bh=VCj8skfMlHHGk08KV+De8lYpKM477DBc/su6MnYOkL0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TXrtSFOR7BuZvLrV5OSwzJLz2AY8rkAT7EgF2Kd7wtg1KY4QhFQeMr906WUh8w8wW2wb/9uLWRxt94xatR3/F/VUQAtJfaEoTDkAyzeUIRiCD7IW1zQlyb5uesUw7QVkJ5sGCd7hKGJfqXF1WgwPL0HmTy48/lEulAV6pi4QNyY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fvYdbNEa; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fvYdbNEa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DF39C4CEC6; Mon, 7 Oct 2024 10:53:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728298419; bh=VCj8skfMlHHGk08KV+De8lYpKM477DBc/su6MnYOkL0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fvYdbNEapQsQbGPh7kCl7NXcTShIFEAvkzt3HaStQWtOk2KNfa3+JdMqsan6qy3EL 6WB0aW/D/j56u7p8V5d5qj1mzz9HK4aP1r3iAL9zA56yCD95G+9BeaRGvG2QD0/iqJ ZN2RzxEKwE0uFjPwqvo6IWAt7Iih0ZHSdYoP37N3HfQDIjjj/dZlOlLZMtv9wDPVJQ N1dBFkVrVyfGz4jW2RvAFO6bjdUL9FQs6y2kGYqse6W5FzP+UjVQmsZgbzzd446rVK tk/TePdg2C/9a7G9NY9yp50TBhBsSlPoCkjCxG8FRl8oAMYE4eyUki/oFs8OZUbfVX A/03AIvkkV6gg== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 07/10] mptcp: change local as mptcp_pm_addr_entry Date: Mon, 7 Oct 2024 18:53:19 +0800 Message-ID: <9e69cd9e599a65f6f0b69d56e65197bd15f4ebdc.1728298100.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang Generally, in the path manager interfaces, the local address is defined as an mptcp_pm_addr_entry type address, while the remote address is defined as an mptcp_addr_info one: (struct mptcp_pm_addr_entry *local, struct mptcp_addr_info *remote) But subflow_destroy() interface uses two mptcp_addr_info type parameters. This patch changes the first one to mptcp_pm_addr_entry type and use helper mptcp_pm_parse_entry() to parse it instead of using mptcp_pm_parse_addr(). Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 3c5591af0a80..5d6801ff48ca 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -463,7 +463,7 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *sk= b, struct genl_info *info { struct nlattr *raddr =3D info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE]; struct nlattr *laddr =3D info->attrs[MPTCP_PM_ATTR_ADDR]; - struct mptcp_addr_info addr_l; + struct mptcp_pm_addr_entry local; struct mptcp_addr_info addr_r; struct mptcp_sock *msk; struct sock *sk, *ssk; @@ -480,7 +480,7 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *sk= b, struct genl_info *info =20 sk =3D (struct sock *)msk; =20 - err =3D mptcp_pm_parse_addr(laddr, info, &addr_l); + err =3D mptcp_pm_parse_entry(laddr, info, true, &local); if (err < 0) { NL_SET_ERR_MSG_ATTR(info->extack, laddr, "error parsing local addr"); goto destroy_err; @@ -493,35 +493,34 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *= skb, struct genl_info *info } =20 #if IS_ENABLED(CONFIG_MPTCP_IPV6) - if (addr_l.family =3D=3D AF_INET && ipv6_addr_v4mapped(&addr_r.addr6)) { - ipv6_addr_set_v4mapped(addr_l.addr.s_addr, &addr_l.addr6); - addr_l.family =3D AF_INET6; + if (local.addr.family =3D=3D AF_INET && ipv6_addr_v4mapped(&addr_r.addr6)= ) { + ipv6_addr_set_v4mapped(local.addr.addr.s_addr, &local.addr.addr6); + local.addr.family =3D AF_INET6; } - if (addr_r.family =3D=3D AF_INET && ipv6_addr_v4mapped(&addr_l.addr6)) { - ipv6_addr_set_v4mapped(addr_r.addr.s_addr, &addr_r.addr6); + if (addr_r.family =3D=3D AF_INET && ipv6_addr_v4mapped(&local.addr.addr6)= ) { + ipv6_addr_set_v4mapped(addr_r.addr.s_addr, &local.addr.addr6); addr_r.family =3D AF_INET6; } #endif - if (addr_l.family !=3D addr_r.family) { + if (local.addr.family !=3D addr_r.family) { GENL_SET_ERR_MSG(info, "address families do not match"); err =3D -EINVAL; goto destroy_err; } =20 - if (!addr_l.port || !addr_r.port) { + if (!local.addr.port || !addr_r.port) { GENL_SET_ERR_MSG(info, "missing local or remote port"); err =3D -EINVAL; goto destroy_err; } =20 lock_sock(sk); - ssk =3D mptcp_nl_find_ssk(msk, &addr_l, &addr_r); + ssk =3D mptcp_nl_find_ssk(msk, &local.addr, &addr_r); if (ssk) { struct mptcp_subflow_context *subflow =3D mptcp_subflow_ctx(ssk); - struct mptcp_pm_addr_entry entry =3D { .addr =3D addr_l }; =20 spin_lock_bh(&msk->pm.lock); - mptcp_userspace_pm_delete_local_addr(msk, &entry); + mptcp_userspace_pm_delete_local_addr(msk, &local); spin_unlock_bh(&msk->pm.lock); mptcp_subflow_shutdown(sk, ssk, RCV_SHUTDOWN | SEND_SHUTDOWN); mptcp_close_ssk(sk, ssk, subflow); --=20 2.43.0 From nobody Sat Dec 21 16:33:43 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4AB871D0E26 for ; Mon, 7 Oct 2024 10:53:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728298421; cv=none; b=ER3DDNrRIqbtr0DzO25kMvzUdRAcJfUXfyLoIp0Hjbmjqi5q9U1WZkntt4EHkJiOBG1U+G2RQgSPMPfkqBsDvlwNul1zofkyF48LK8TJJjQ+5U6AumfN6ck+Hd7/ctdT1Dq1Ac3Mgz2Qe2lGAPTOQq/ENlJAzGW2wpuvwmT88Uk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728298421; c=relaxed/simple; bh=mmzc7mLX/pp+4/834DqQqofFdcapSC05ny0izEtmmpM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BkfV9FYTf8nKsnZZKRUCPFIOBf9gXCCVafhjtRxMRgwZWyHwE9bRte/xhidadEOJZOLho3K+P7e/CNsTc/L+ILhp+X920mh8v9qtU3Gm0tvXTOq3R9MIqtIcxaN23u7IiCL7+JDVo1rdep0jstlRpIZYnZP61/E0Kzc91xj5mQ0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hjVn9wfb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hjVn9wfb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 284F8C4CECC; Mon, 7 Oct 2024 10:53:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728298421; bh=mmzc7mLX/pp+4/834DqQqofFdcapSC05ny0izEtmmpM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hjVn9wfbykrTnpzFVDWqsigOxJl4SE9j7IhJXqFgVQCKZUgKLleHkXVArg2Uo69V2 oPAwBBXKfsd0I4UkXoZuQESE2NgCyBnNX7rd7LXbFWp26i1Dy9eL/aM86cbOk1PRfV /NWfthYp2fh2GuzFWJmF6e5ofqltxxtFoL7s70O78kQ0p3MOG83LJf1uFLyxoA6aaE /7QLEThiR4Y/7ci9e39VjRAXDtjE/fyLPmON/6OOo3MpW1RrKPxDWFGCCZejfMYdUZ tqUn93kfWgwUuQY9fxcLQAnSntJ2JCIkjU1h3KNtpOhm8rqkyRr9G1912mqs00u7JA D34ltwi1P7Gyw== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 08/10] mptcp: make pm wrappers static Date: Mon, 7 Oct 2024 18:53:20 +0800 Message-ID: <6ed0c2a566bc9e997cce1531d2b6923ed2e82f2c.1728298100.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang The path manager wrappers, mptcp_pm_get_addr(), mptcp_pm_dump_addr() and mptcp_pm_set_flags() are used to switch the interfaces between in-kernel PM and userspace PM. These wrappers are defined in pm.c but only used in pm_netlink.c. It makes more sense to move them to pm_netlink.c and make them all static. Signed-off-by: Geliang Tang --- net/mptcp/pm.c | 23 ----------------------- net/mptcp/pm_netlink.c | 31 +++++++++++++++++++++++++++---- net/mptcp/protocol.h | 7 ------- 3 files changed, 27 insertions(+), 34 deletions(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 5afc1f8e5ca7..c051c1ec4de4 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -433,29 +433,6 @@ bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct= sock_common *skc) return mptcp_pm_nl_is_backup(msk, &skc_local); } =20 -int mptcp_pm_get_addr(struct sk_buff *skb, struct genl_info *info) -{ - if (info->attrs[MPTCP_PM_ATTR_TOKEN]) - return mptcp_userspace_pm_get_addr(skb, info); - return mptcp_pm_nl_get_addr(skb, info); -} - -int mptcp_pm_dump_addr(struct sk_buff *msg, struct netlink_callback *cb) -{ - const struct genl_info *info =3D genl_info_dump(cb); - - if (info->attrs[MPTCP_PM_ATTR_TOKEN]) - return mptcp_userspace_pm_dump_addr(msg, cb); - return mptcp_pm_nl_dump_addr(msg, cb); -} - -int mptcp_pm_set_flags(struct sk_buff *skb, struct genl_info *info) -{ - if (info->attrs[MPTCP_PM_ATTR_TOKEN]) - return mptcp_userspace_pm_set_flags(skb, info); - return mptcp_pm_nl_set_flags(skb, info); -} - void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock = *ssk) { struct mptcp_subflow_context *subflow =3D mptcp_subflow_ctx(ssk); diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index e1907dad3bc4..d7a4199b142e 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1790,7 +1790,7 @@ int mptcp_nl_fill_addr(struct sk_buff *skb, return -EMSGSIZE; } =20 -int mptcp_pm_nl_get_addr(struct sk_buff *skb, struct genl_info *info) +static int mptcp_pm_nl_get_addr(struct sk_buff *skb, struct genl_info *inf= o) { struct nlattr *attr =3D info->attrs[MPTCP_PM_ENDPOINT_ADDR]; struct pm_nl_pernet *pernet =3D genl_info_pm_nl(info); @@ -1840,13 +1840,20 @@ int mptcp_pm_nl_get_addr(struct sk_buff *skb, struc= t genl_info *info) return ret; } =20 +static int mptcp_pm_get_addr(struct sk_buff *skb, struct genl_info *info) +{ + if (info->attrs[MPTCP_PM_ATTR_TOKEN]) + return mptcp_userspace_pm_get_addr(skb, info); + return mptcp_pm_nl_get_addr(skb, info); +} + int mptcp_pm_nl_get_addr_doit(struct sk_buff *skb, struct genl_info *info) { return mptcp_pm_get_addr(skb, info); } =20 -int mptcp_pm_nl_dump_addr(struct sk_buff *msg, - struct netlink_callback *cb) +static int mptcp_pm_nl_dump_addr(struct sk_buff *msg, + struct netlink_callback *cb) { struct net *net =3D sock_net(msg->sk); struct mptcp_pm_addr_entry *entry; @@ -1888,6 +1895,15 @@ int mptcp_pm_nl_dump_addr(struct sk_buff *msg, return msg->len; } =20 +static int mptcp_pm_dump_addr(struct sk_buff *msg, struct netlink_callback= *cb) +{ + const struct genl_info *info =3D genl_info_dump(cb); + + if (info->attrs[MPTCP_PM_ATTR_TOKEN]) + return mptcp_userspace_pm_dump_addr(msg, cb); + return mptcp_pm_nl_dump_addr(msg, cb); +} + int mptcp_pm_nl_get_addr_dumpit(struct sk_buff *msg, struct netlink_callback *cb) { @@ -2009,7 +2025,7 @@ static int mptcp_nl_set_flags(struct net *net, return ret; } =20 -int mptcp_pm_nl_set_flags(struct sk_buff *skb, struct genl_info *info) +static int mptcp_pm_nl_set_flags(struct sk_buff *skb, struct genl_info *in= fo) { struct mptcp_pm_addr_entry addr =3D { .addr =3D { .family =3D AF_UNSPEC }= , }; struct nlattr *attr =3D info->attrs[MPTCP_PM_ATTR_ADDR]; @@ -2063,6 +2079,13 @@ int mptcp_pm_nl_set_flags(struct sk_buff *skb, struc= t genl_info *info) return 0; } =20 +static int mptcp_pm_set_flags(struct sk_buff *skb, struct genl_info *info) +{ + if (info->attrs[MPTCP_PM_ATTR_TOKEN]) + return mptcp_userspace_pm_set_flags(skb, info); + return mptcp_pm_nl_set_flags(skb, info); +} + int mptcp_pm_nl_set_flags_doit(struct sk_buff *skb, struct genl_info *info) { return mptcp_pm_set_flags(skb, info); diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index ef50ef0c0829..95533d5b82c4 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1035,8 +1035,6 @@ mptcp_pm_del_add_timer(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); -int mptcp_pm_set_flags(struct sk_buff *skb, struct genl_info *info); -int mptcp_pm_nl_set_flags(struct sk_buff *skb, struct genl_info *info); int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *in= fo); int mptcp_pm_announce_addr(struct mptcp_sock *msk, const struct mptcp_addr_info *addr, @@ -1127,13 +1125,8 @@ int mptcp_userspace_pm_get_local_id(struct mptcp_soc= k *msk, struct mptcp_addr_in bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc); bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info = *skc); bool mptcp_userspace_pm_is_backup(struct mptcp_sock *msk, struct mptcp_add= r_info *skc); -int mptcp_pm_dump_addr(struct sk_buff *msg, struct netlink_callback *cb); -int mptcp_pm_nl_dump_addr(struct sk_buff *msg, - struct netlink_callback *cb); int mptcp_userspace_pm_dump_addr(struct sk_buff *msg, struct netlink_callback *cb); -int mptcp_pm_get_addr(struct sk_buff *skb, struct genl_info *info); -int mptcp_pm_nl_get_addr(struct sk_buff *skb, struct genl_info *info); int mptcp_userspace_pm_get_addr(struct sk_buff *skb, struct genl_info *info); =20 --=20 2.43.0 From nobody Sat Dec 21 16:33:43 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68F9018BC1C for ; Mon, 7 Oct 2024 10:53:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728298423; cv=none; b=nF6iUf7tw93sM3IdiaewW96MZvMuLFf5skZTg2YvN0CDDJZbnr7nUZWgvAfOg1+eKGOTRkr7vY4Gnl7nj0YrxTCkDtyUyldYAgLbDZgXCbPajMCXMWhF1DcSSFLQQY227ggwJb5qzYp5y8h+ODSajA1uJRBsr/f8wteA0Zo+79g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728298423; c=relaxed/simple; bh=rfoqoFvML2u+ErY2Y+MLv96V9ZZDcbPgf9yAnZ+7uW0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fvyInkQlBvh8p8T+iDO1mcQT7e+rjUGETu9LK24BhkcuDDflChyAh6x9r+o1pzPCIGX0y12Zochf67fKZHMSfTE5VJAQS2M4MQqXrh/fvxIXrtYIA0nw0w53Wkvs+brz2s0JPDwMmvYk3c3coTLsLcE1eEKSq8osw6slgmonhK8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lnh2FQOU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lnh2FQOU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C35BCC4CEC6; Mon, 7 Oct 2024 10:53:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728298422; bh=rfoqoFvML2u+ErY2Y+MLv96V9ZZDcbPgf9yAnZ+7uW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lnh2FQOUsmny5U/LFlh7+nAbze+ERayvjThwhUP0ssDAbvLEjxc3HAJLL38i0HOOQ UqJLQzmTXvdeJU9u5uCa0FDbAZxP8ZhmwazzSq60g8PqOB7/KQu1TFhQgjfHY6B0sl mqxGJ/+ROWXo+Un6FhR2Hy6UyDGFUBivFMu6ilAw54ofm3N2Ycp9jZNmxih0DAlmJM ad1UIyD+6g6nLQJQKIE68xN/GpWgncTmShXxDUWw5z1Y1RKl4VLQfvKJG9z5uUQ5ED plqXVCjkvqQaGOTdh8UedA36bwuRSxiZRl/kekUodnUBUs03UGdtqzFxqKkWPJ43Uc eKXUWEVlhvGzg== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 09/10] mptcp: drop skb parameter of get_addr Date: Mon, 7 Oct 2024 18:53:21 +0800 Message-ID: <316169717f06be08a2892c121adb07c67525813c.1728298100.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang The first parameters "skb" of all three get_addr() interfaces are now useless. This patch drops them. Signed-off-by: Geliang Tang --- net/mptcp/pm_netlink.c | 10 +++++----- net/mptcp/pm_userspace.c | 3 +-- net/mptcp/protocol.h | 3 +-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index d7a4199b142e..f02378e9a9c8 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1790,7 +1790,7 @@ int mptcp_nl_fill_addr(struct sk_buff *skb, return -EMSGSIZE; } =20 -static int mptcp_pm_nl_get_addr(struct sk_buff *skb, struct genl_info *inf= o) +static int mptcp_pm_nl_get_addr(struct genl_info *info) { struct nlattr *attr =3D info->attrs[MPTCP_PM_ENDPOINT_ADDR]; struct pm_nl_pernet *pernet =3D genl_info_pm_nl(info); @@ -1840,16 +1840,16 @@ static int mptcp_pm_nl_get_addr(struct sk_buff *skb= , struct genl_info *info) return ret; } =20 -static int mptcp_pm_get_addr(struct sk_buff *skb, struct genl_info *info) +static int mptcp_pm_get_addr(struct genl_info *info) { if (info->attrs[MPTCP_PM_ATTR_TOKEN]) - return mptcp_userspace_pm_get_addr(skb, info); - return mptcp_pm_nl_get_addr(skb, info); + return mptcp_userspace_pm_get_addr(info); + return mptcp_pm_nl_get_addr(info); } =20 int mptcp_pm_nl_get_addr_doit(struct sk_buff *skb, struct genl_info *info) { - return mptcp_pm_get_addr(skb, info); + return mptcp_pm_get_addr(info); } =20 static int mptcp_pm_nl_dump_addr(struct sk_buff *msg, diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 5d6801ff48ca..e9977eddd1d3 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -629,8 +629,7 @@ int mptcp_userspace_pm_dump_addr(struct sk_buff *msg, return ret; } =20 -int mptcp_userspace_pm_get_addr(struct sk_buff *skb, - struct genl_info *info) +int mptcp_userspace_pm_get_addr(struct genl_info *info) { struct nlattr *attr =3D info->attrs[MPTCP_PM_ENDPOINT_ADDR]; struct mptcp_pm_addr_entry addr, *entry; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 95533d5b82c4..238fb2ddb68a 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1127,8 +1127,7 @@ bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, st= ruct mptcp_addr_info *skc); bool mptcp_userspace_pm_is_backup(struct mptcp_sock *msk, struct mptcp_add= r_info *skc); int mptcp_userspace_pm_dump_addr(struct sk_buff *msg, struct netlink_callback *cb); -int mptcp_userspace_pm_get_addr(struct sk_buff *skb, - struct genl_info *info); +int mptcp_userspace_pm_get_addr(struct genl_info *info); =20 static inline u8 subflow_get_local_id(const struct mptcp_subflow_context *= subflow) { --=20 2.43.0 From nobody Sat Dec 21 16:33:43 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1A5715D5C1 for ; Mon, 7 Oct 2024 10:53:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728298425; cv=none; b=MZryYr3S1tgk+XtxNoi1i7xgxTRj68MB39Xsxd117EjLt2IcDxbBpHHySpP/w1YpMqgqLrptoYWJ8s+Ph0TMbnmyOZg1zKBo9c7EI/viREQ6oeAebRuRIQXnj4Ok53YBAw6DcjHDeEwwcPylMGk35RhnysTQPpUtox9wqv9kmJ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728298425; c=relaxed/simple; bh=rdUifMuXEBUI1GLxjTIkp2/5JSVtp7u8BDcoHWINhwY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Zst9SWVtUHnyQRM/IzC7p+Oraoq15x2DS4BrnXjs+gHeCBqbhTR9Twf7wpK7GpGCBrdDCngC/hkFaO7DneD6p67fpaeyxSMoKSSuHCz26dB+GRFz10HWzHW+ctOdpGgMrPT4jv4APXSUHEJqDPgh9FLIqHkNZgFoinlnJwy/KNE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mlcb3sbM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mlcb3sbM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 858E0C4CECD; Mon, 7 Oct 2024 10:53:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728298424; bh=rdUifMuXEBUI1GLxjTIkp2/5JSVtp7u8BDcoHWINhwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mlcb3sbM0POaAjBAb+6Xa09DIHV8ERm6niSWW89+PXN8db0QUSkydMTF/2ZvbaZXT QjboCBkPtizs5rxkf1jJ9I9gqTuFRBo4DjN/4Zd/7M8bkoZhPpXt+1/g1lCMDtrJGf G3u2KCJmBV/tMGFWqTOu3hXoTEDLzCMSnZcJxLOg69HdJ3CHSEXdUC8Z5EEKiMNkgQ NsFTqo0PYqOWdUqIGsPHQhyrx+XEMHJKUU6N1wIY/qo+Y69CZ80cXit8L64AxB52Yh IMOUpnhnnrdbZ31DOkJiUyfDAdhXVy4g+9J2b2kaoilMr1Q+yNjEuFBHCwo3shTBVH MZtMgSfAcSgeA== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 10/10] mptcp: drop skb parameter of set_flags Date: Mon, 7 Oct 2024 18:53:22 +0800 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang The first parameter "skb" in mptcp_pm_nl_set_flags() is only used to obtained the network namespace, which can also be obtained through the second parameters "info" by using genl_info_net() helper. This patch drops these useless parameters "skb" in all three set_flags() interfaces. Signed-off-by: Geliang Tang --- net/mptcp/pm_netlink.c | 12 ++++++------ net/mptcp/pm_userspace.c | 2 +- net/mptcp/protocol.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index f02378e9a9c8..0f2fe64fd568 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -2025,13 +2025,13 @@ static int mptcp_nl_set_flags(struct net *net, return ret; } =20 -static int mptcp_pm_nl_set_flags(struct sk_buff *skb, struct genl_info *in= fo) +static int mptcp_pm_nl_set_flags(struct genl_info *info) { struct mptcp_pm_addr_entry addr =3D { .addr =3D { .family =3D AF_UNSPEC }= , }; struct nlattr *attr =3D info->attrs[MPTCP_PM_ATTR_ADDR]; u8 changed, mask =3D MPTCP_PM_ADDR_FLAG_BACKUP | MPTCP_PM_ADDR_FLAG_FULLMESH; - struct net *net =3D sock_net(skb->sk); + struct net *net =3D genl_info_net(info); struct mptcp_pm_addr_entry *entry; struct pm_nl_pernet *pernet; u8 lookup_by_id =3D 0; @@ -2079,16 +2079,16 @@ static int mptcp_pm_nl_set_flags(struct sk_buff *sk= b, struct genl_info *info) return 0; } =20 -static int mptcp_pm_set_flags(struct sk_buff *skb, struct genl_info *info) +static int mptcp_pm_set_flags(struct genl_info *info) { if (info->attrs[MPTCP_PM_ATTR_TOKEN]) - return mptcp_userspace_pm_set_flags(skb, info); - return mptcp_pm_nl_set_flags(skb, info); + return mptcp_userspace_pm_set_flags(info); + return mptcp_pm_nl_set_flags(info); } =20 int mptcp_pm_nl_set_flags_doit(struct sk_buff *skb, struct genl_info *info) { - return mptcp_pm_set_flags(skb, info); + return mptcp_pm_set_flags(info); } =20 static void mptcp_nl_mcast_send(struct net *net, struct sk_buff *nlskb, gf= p_t gfp) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index e9977eddd1d3..512260e4afb2 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -536,7 +536,7 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *sk= b, struct genl_info *info return err; } =20 -int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *in= fo) +int mptcp_userspace_pm_set_flags(struct genl_info *info) { struct mptcp_pm_addr_entry loc =3D { .addr =3D { .family =3D AF_UNSPEC },= }; struct nlattr *attr_rem =3D info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE]; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 238fb2ddb68a..41d01a046e27 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1035,7 +1035,7 @@ mptcp_pm_del_add_timer(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); -int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *in= fo); +int mptcp_userspace_pm_set_flags(struct genl_info *info); int mptcp_pm_announce_addr(struct mptcp_sock *msk, const struct mptcp_addr_info *addr, bool echo); --=20 2.43.0