From nobody Sun Dec 22 03:22:34 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