From nobody Sun Dec 22 09:36:15 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 DAD7F4C79 for ; Sat, 7 Dec 2024 01:08:12 +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=1733533692; cv=none; b=Jf1sLAh4iXT65E7RS8zy5Ph8QKwx5mF9/UFN3SX5rWCaDJTEft5xI2yVues4XurbUq+Gav7YKiYy7f1MpMbdQH1F5eqDj2L9faRvHsZBWQz09w8AWfrJtHMHKQdxd5XFEdpbt6ZWDxTE541QrS//1OIxs2r0vuwZIjEbkptafx0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733533692; c=relaxed/simple; bh=xi3n30NKy6jcAWd6CK0ffRX8YNgG4baU8O7YcFiv/VE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GUe0q3eSi/VHM2u0wlRZ6RuD+JAs4cWTo9U899FBGi4JHy/3ueFjBYDk7ImClOHvmQbf7GsdHOdWhrsGQnom7hA6oAUSUgwiuKW8rrF28m0F3bgHJATHaIW5zW9ZaNhtkMvD3cDIWW1CMY+lrPo3rY/xzyxVn9ARHLUjEI1RpY8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IwGNLp23; 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="IwGNLp23" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2FD8C4CEDF; Sat, 7 Dec 2024 01:08:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733533692; bh=xi3n30NKy6jcAWd6CK0ffRX8YNgG4baU8O7YcFiv/VE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IwGNLp23o0qHThSIAB1GUgERdKuWCvX03wawEOCojWF/26Rp8/Ao9lxRRo1qbCuXi HBQ1yXr5C8XhenVLQ1V7sE6j+eTTh0s1kjVYtzOnQobO0/lGiRK593seaKHTynAMRi PQWLBAeUHjZl53OswSCMH3gM/qJXHAZNV1m/r5n0KCAM2xTdEGiCRi1mrSH6veTr2j B4Uk0/c3c6NIDRFT2pNvXbj/TAuL5aLqatgoqJVfhEZsNTO83a4lAc7T4VQ+9CT0JE 4ABG2tXUZSE9DolQGvQ5aQf8qxhNn+uFxmzzAMmsBOZ3M77jvRFvaTL//AZPOMWFNG z2DxgrAYeNe4Q== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 1/7] mptcp: make three pm wrappers static Date: Sat, 7 Dec 2024 09:07:21 +0800 Message-ID: <846e62f86b915ad161e1750729051e1be03da56f.1733533215.git.geliang@kernel.org> X-Mailer: git-send-email 2.45.2 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 Three netlink functions: mptcp_pm_nl_get_addr_doit() mptcp_pm_nl_get_addr_dumpit() mptcp_pm_nl_set_flags_doit() are generic, implemented for each PM, in-kernel PM and userspace PM. It's clearer to move them from pm_netlink.c to pm.c. And the linked three path manager wrappers mptcp_pm_get_addr() mptcp_pm_dump_addr() mptcp_pm_set_flags() can be changed as static functions, no need to export them in protocol.h. Signed-off-by: Geliang Tang --- net/mptcp/pm.c | 23 ++++++++++++++++++++--- net/mptcp/pm_netlink.c | 16 ---------------- net/mptcp/protocol.h | 3 --- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 16c336c51940..a29be5ff73a6 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -10,6 +10,7 @@ #include "protocol.h" =20 #include "mib.h" +#include "mptcp_pm_gen.h" =20 /* path manager command handlers */ =20 @@ -433,14 +434,19 @@ bool mptcp_pm_is_backup(struct mptcp_sock *msk, struc= t 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) +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); } =20 -int mptcp_pm_dump_addr(struct sk_buff *msg, struct netlink_callback *cb) +int mptcp_pm_nl_get_addr_doit(struct sk_buff *skb, struct genl_info *info) +{ + return mptcp_pm_get_addr(skb, info); +} + +static int mptcp_pm_dump_addr(struct sk_buff *msg, struct netlink_callback= *cb) { const struct genl_info *info =3D genl_info_dump(cb); =20 @@ -449,13 +455,24 @@ int mptcp_pm_dump_addr(struct sk_buff *msg, struct ne= tlink_callback *cb) return mptcp_pm_nl_dump_addr(msg, cb); } =20 -int mptcp_pm_set_flags(struct sk_buff *skb, struct genl_info *info) +int mptcp_pm_nl_get_addr_dumpit(struct sk_buff *msg, + struct netlink_callback *cb) +{ + return mptcp_pm_dump_addr(msg, cb); +} + +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); } =20 +int mptcp_pm_nl_set_flags_doit(struct sk_buff *skb, struct genl_info *info) +{ + return mptcp_pm_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 98ac73938bd8..32367fcc728e 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1812,11 +1812,6 @@ int mptcp_pm_nl_get_addr(struct sk_buff *skb, struct= genl_info *info) return ret; } =20 -int mptcp_pm_nl_get_addr_doit(struct sk_buff *skb, struct genl_info *info) -{ - return mptcp_pm_get_addr(skb, info); -} - int mptcp_pm_nl_dump_addr(struct sk_buff *msg, struct netlink_callback *cb) { @@ -1860,12 +1855,6 @@ int mptcp_pm_nl_dump_addr(struct sk_buff *msg, return msg->len; } =20 -int mptcp_pm_nl_get_addr_dumpit(struct sk_buff *msg, - struct netlink_callback *cb) -{ - return mptcp_pm_dump_addr(msg, cb); -} - static int parse_limit(struct genl_info *info, int id, unsigned int *limit) { struct nlattr *attr =3D info->attrs[id]; @@ -2035,11 +2024,6 @@ int mptcp_pm_nl_set_flags(struct sk_buff *skb, struc= t genl_info *info) return 0; } =20 -int mptcp_pm_nl_set_flags_doit(struct sk_buff *skb, struct genl_info *info) -{ - return mptcp_pm_set_flags(skb, info); -} - static void mptcp_nl_mcast_send(struct net *net, struct sk_buff *nlskb, gf= p_t gfp) { genlmsg_multicast_netns(&mptcp_genl_family, net, diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 19a811220621..3bff78efd8ed 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1035,7 +1035,6 @@ bool mptcp_lookup_subflow_by_saddr(const struct list_= head *list, const struct mptcp_addr_info *saddr); bool mptcp_remove_anno_list_by_saddr(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, @@ -1128,12 +1127,10 @@ int mptcp_userspace_pm_get_local_id(struct mptcp_so= ck *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 2.45.2