All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>
Cc: Kuniyuki Iwashima <kuniyu@amazon.com>,
	Kuniyuki Iwashima <kuni1840@gmail.com>, <netdev@vger.kernel.org>
Subject: [PATCH v3 net-next 12/15] socket: Move sock_inuse_add() to sock.c.
Date: Fri, 13 Dec 2024 18:21:49 +0900	[thread overview]
Message-ID: <20241213092152.14057-13-kuniyu@amazon.com> (raw)
In-Reply-To: <20241213092152.14057-1-kuniyu@amazon.com>

sock_inuse_add() is used only in net/core/sock.c.

Let's move sock_inuse_add() there.

This is mostly revert of commit d477eb900484 ("net: make
sock_inuse_add() available").

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
 include/net/sock.h |  9 ---------
 net/core/sock.c    | 10 ++++++++++
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/include/net/sock.h b/include/net/sock.h
index 8de415fefe3b..845efc3c5568 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1433,11 +1433,6 @@ static inline void sock_prot_inuse_add(const struct net *net,
 	this_cpu_add(net->core.prot_inuse->val[prot->inuse_idx], val);
 }
 
-static inline void sock_inuse_add(const struct net *net, int val)
-{
-	this_cpu_add(net->core.prot_inuse->all, val);
-}
-
 int sock_prot_inuse_get(struct net *net, struct proto *proto);
 int sock_inuse_get(struct net *net);
 #else
@@ -1445,10 +1440,6 @@ static inline void sock_prot_inuse_add(const struct net *net,
 				       const struct proto *prot, int val)
 {
 }
-
-static inline void sock_inuse_add(const struct net *net, int val)
-{
-}
 #endif
 
 
diff --git a/net/core/sock.c b/net/core/sock.c
index 9fb57afe6848..78c812205e35 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -153,6 +153,7 @@
 static DEFINE_MUTEX(proto_list_mutex);
 static LIST_HEAD(proto_list);
 
+static void sock_inuse_add(const struct net *net, int val);
 static void sock_def_write_space_wfree(struct sock *sk);
 static void sock_def_write_space(struct sock *sk);
 
@@ -3885,6 +3886,11 @@ int sock_prot_inuse_get(struct net *net, struct proto *prot)
 }
 EXPORT_SYMBOL_GPL(sock_prot_inuse_get);
 
+static void sock_inuse_add(const struct net *net, int val)
+{
+	this_cpu_add(net->core.prot_inuse->all, val);
+}
+
 int sock_inuse_get(struct net *net)
 {
 	int cpu, res = 0;
@@ -3944,6 +3950,10 @@ static void release_proto_idx(struct proto *prot)
 		clear_bit(prot->inuse_idx, proto_inuse_idx);
 }
 #else
+static void sock_inuse_add(const struct net *net, int val)
+{
+}
+
 static inline int assign_proto_idx(struct proto *prot)
 {
 	return 0;
-- 
2.39.5 (Apple Git-154)


  parent reply	other threads:[~2024-12-13  9:26 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-13  9:21 [PATCH v3 net-next 00/15] treewide: socket: Clean up sock_create() and friends Kuniyuki Iwashima
2024-12-13  9:21 ` [PATCH v3 net-next 01/15] socket: Un-export __sock_create() Kuniyuki Iwashima
2024-12-13  9:21 ` [PATCH v3 net-next 02/15] socket: Pass hold_net flag to __sock_create() Kuniyuki Iwashima
2024-12-13  9:21 ` [PATCH v3 net-next 03/15] smc: Pass kern to smc_sock_alloc() Kuniyuki Iwashima
2024-12-13 13:46   ` Wenjia Zhang
2024-12-13  9:21 ` [PATCH v3 net-next 04/15] socket: Pass hold_net to struct net_proto_family.create() Kuniyuki Iwashima
2024-12-13 13:46   ` Wenjia Zhang
2024-12-17 10:24   ` Paolo Abeni
2024-12-13  9:21 ` [PATCH v3 net-next 05/15] ppp: Pass hold_net to struct pppox_proto.create() Kuniyuki Iwashima
2024-12-13  9:21 ` [PATCH v3 net-next 06/15] nfc: Pass hold_net to struct nfc_protocol.create() Kuniyuki Iwashima
2024-12-13  9:21 ` [PATCH v3 net-next 07/15] socket: Add hold_net flag to struct proto_accept_arg Kuniyuki Iwashima
2024-12-13  9:21 ` [PATCH v3 net-next 08/15] socket: Pass hold_net to sk_alloc() Kuniyuki Iwashima
2024-12-13 13:45   ` Wenjia Zhang
2024-12-13  9:21 ` [PATCH v3 net-next 09/15] socket: Respect hold_net in sk_alloc() Kuniyuki Iwashima
2024-12-13  9:21 ` [PATCH v3 net-next 10/15] socket: Introduce sock_create_net() Kuniyuki Iwashima
2024-12-13  9:21 ` [PATCH v3 net-next 11/15] socket: Remove kernel socket conversion Kuniyuki Iwashima
2024-12-13 13:45   ` Wenjia Zhang
2024-12-13 13:54     ` Kuniyuki Iwashima
2024-12-13 15:15       ` Wenjia Zhang
2024-12-13 14:15   ` Chuck Lever
2024-12-13 23:29   ` Allison Henderson
2024-12-13  9:21 ` Kuniyuki Iwashima [this message]
2024-12-13  9:21 ` [PATCH v3 net-next 13/15] socket: Use sock_create_net() instead of sock_create() Kuniyuki Iwashima
2024-12-13  9:21 ` [PATCH v3 net-next 14/15] socket: Rename sock_create() to sock_create_user() Kuniyuki Iwashima
2024-12-13  9:21 ` [PATCH v3 net-next 15/15] socket: Rename sock_create_kern() to sock_create_net_noref() Kuniyuki Iwashima
2024-12-13 13:46   ` Wenjia Zhang
2024-12-17 10:32   ` Paolo Abeni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241213092152.14057-13-kuniyu@amazon.com \
    --to=kuniyu@amazon.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuni1840@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.