From nobody Sat Dec 21 18:57:14 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 AC6441A3A9C for ; Tue, 24 Sep 2024 12:27: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=1727180852; cv=none; b=W7/ZLsJsHikyV+828Z51XewehLIbOFRDiQ3DTnOFHSFXjIhXOic8YvkoTi6Hm3axpf+JDRR54oVB41wbBAI79yMtMM4/LQ6MSQMxZVf7EU9lR4B7Ym4UuThwmzZwi5J7ssQj5WXav+Hn0dEQfmTvquN8CDdnSipb9+KuSKxg0wc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727180852; c=relaxed/simple; bh=eU2O0PTPjdrEynHN04weD+DBX49Cn5DZK4/RNN2Ehw4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Rxrc2clvRsSnw+T+rxXXEYzYrq7cQ1nqsUmAEYur38C3Antm30n0uP00woHbXTpUuNru/hu/84X6StYcWtci2PM1cTwrZRCMi5uM8jBiEbz4Sw1K+DVoVWOMSsl7Bs46iOWq3O11v83GIVxfWt8ALhVhWhgMBu+YUypCCM/rFls= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rIyd8sLf; 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="rIyd8sLf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FF8AC4CEC6; Tue, 24 Sep 2024 12:27:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727180852; bh=eU2O0PTPjdrEynHN04weD+DBX49Cn5DZK4/RNN2Ehw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rIyd8sLfJLaArDYlAqfhFHzQSdMRz1wCfU33rblE8MO0sLssETPjgrplTDpbbILEL HJNPl7Vq6OoCAi39xzoJbxX36Xfb8ZWGw7w6eT96mxDgs0FfZOKODcgf8oBFomlZlH odSCNHzL9oKulLLvxLsBnf4ljQGGnF8r8cAKV/6u5j3HMcoWEttc05OGSjXsCib0mN bvv+1KPnUYp/SLsQYnZN+BG7XTHb0HM4mOwczZ+sBs2EAg/VqiaCSqL9NGuiBvifMH 1UGeiLc00DQ3E37y8jeEnP3cTWvgoaLdndLfyI+fn8fS9GzSEn+QSvV2RyoAURQRur MzfdTadlpUP1g== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 1/2] mptcp: drop skb parameters in get_addr interfaces Date: Tue, 24 Sep 2024 20:27:24 +0800 Message-ID: <7d29c0e225ef4bd00a5820130a1125f165631c1b.1727180731.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 parameter "skb" in mptcp_userspace_pm_get_addr() is only used to obtained the network namespace, which can also be obtained through the second parameter "info" by using genl_info_net() helper. This patch drop this useless parameter in all three get_addr() interfaces: mptcp_pm_get_addr() mptcp_pm_nl_get_addr() mptcp_userspace_pm_get_addr(). Signed-off-by: Geliang Tang --- net/mptcp/pm.c | 6 +++--- net/mptcp/pm_netlink.c | 4 ++-- net/mptcp/pm_userspace.c | 5 ++--- net/mptcp/protocol.h | 7 +++---- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index fe7e5ca38dfd..58181e846cec 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -440,11 +440,11 @@ 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) +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_dump_addr(struct sk_buff *msg, struct netlink_callback *cb) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index fe34297ea6dc..ed236522a30e 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1796,7 +1796,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) +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); @@ -1848,7 +1848,7 @@ int mptcp_pm_nl_get_addr(struct sk_buff *skb, struct = genl_info *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 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 2cceded3a83a..a68df40a62d3 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -669,13 +669,12 @@ 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 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 net *net =3D genl_info_net(info); struct mptcp_sock *msk; struct sk_buff *msg; int ret =3D -EINVAL; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 6d7a66ce77b3..ef66cc8c4d9a 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1126,10 +1126,9 @@ 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); +int mptcp_pm_get_addr(struct genl_info *info); +int mptcp_pm_nl_get_addr(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 18:57:14 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 F3BF93F9D5 for ; Tue, 24 Sep 2024 12:27:33 +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=1727180854; cv=none; b=uXwQPgCTVRR5H0CtEgEQhG0iiuGdNWBOdlcwqV1WceqMCKhGCxJXnYmTIdTMh+GMl2Zk3yGR8KlCcU/Evw028YlR3GS3lEtTd5szD28DnY/ZSkIZHFlyHeaGu6hebXsPLB9QLllqEBRTw9uEToMq9T58S3k7mMlMskz64hiZoM0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727180854; c=relaxed/simple; bh=Oi0rQIj+GQhZRLvZBEhGdLxDTlssXekAKlkSIpot/eU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SpfZu/thRscLdDnwWVRvq/ZGlx8C/QvU1vmFXaXYOetQUAW6EM9p75zxASBVEBc1FY8Kn+aiXto6S3GTKVkw/wPt7JaSlLEc4Wd4hQDIh8pi/ZO5+DXMGz1IcKhhsUlkDNop8KiTuFMVVyUYcBpC50mDIlEqrkGXQ0xQ1Y71x44= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YphEljs7; 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="YphEljs7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7AA4C4CEC7; Tue, 24 Sep 2024 12:27:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727180853; bh=Oi0rQIj+GQhZRLvZBEhGdLxDTlssXekAKlkSIpot/eU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YphEljs7FrR7OBmYV2DAualgkgKFk06G6lGlmFOQ9cYchUogRTCi1XdpZiRE9UCgP oEG2gMoBdIzFVBp1DxTr1q/GUTkLhBwB9m8GP57J7tQcVu2o7V70VAGEo2fQZhlJ33 mKzF0yN7WURpx693cHQCsJQKlHIzjTpSbQ4D5XCDqV596GbsBOOx+mpmU0g0XXi63S TaBAN+Ubg3Bwr3dmMUsHvxHBOOwJd8/Rjo8TFPzPbJgerlFEg6t1yLEUK6v6xL+nEM 9zzzIYU3TxIi3OBlCWl37ElO4O/xFICmh2xQb/KEeCklNkMD2ASxofzG2BngDNfF5B 6vv/ndrEPojbw== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 2/2] mptcp: drop skb parameters in set_flags interfaces Date: Tue, 24 Sep 2024 20:27:25 +0800 Message-ID: <2d05ad2de44965015a89fa04217d9cf7df6816d5.1727180731.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 parameter "skb" in mptcp_pm_nl_set_flags() or mptcp_userspace_pm_set_flags() is only used to obtained the network namespace, which can also be obtained through the second parameter "info" by using genl_info_net() helper. This patch drop this useless parameter in all three set_flags() interfaces: mptcp_pm_set_flags() mptcp_pm_nl_set_flags() mptcp_userspace_pm_set_flags(). Signed-off-by: Geliang Tang --- net/mptcp/pm.c | 6 +++--- net/mptcp/pm_netlink.c | 6 +++--- net/mptcp/pm_userspace.c | 4 ++-- net/mptcp/protocol.h | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 58181e846cec..4b9f7077db64 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -456,11 +456,11 @@ 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_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 void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock = *ssk) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index ed236522a30e..9e2a866db1ad 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -2015,13 +2015,13 @@ 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) +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; @@ -2071,7 +2071,7 @@ int mptcp_pm_nl_set_flags(struct sk_buff *skb, struct= genl_info *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 a68df40a62d3..0afbca4f7362 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -551,14 +551,14 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *= skb, 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 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 net *net =3D genl_info_net(info); struct mptcp_sock *msk; int ret =3D -EINVAL; struct sock *sk; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index ef66cc8c4d9a..d54ca66d1029 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1029,9 +1029,9 @@ 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_set_flags(struct genl_info *info); +int mptcp_pm_nl_set_flags(struct genl_info *info); +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