[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241213092152.14057-13-kuniyu@amazon.com>
Date: Fri, 13 Dec 2024 18:21:49 +0900
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>, Simon Horman <horms@...nel.org>
CC: Kuniyuki Iwashima <kuniyu@...zon.com>, Kuniyuki Iwashima
<kuni1840@...il.com>, <netdev@...r.kernel.org>
Subject: [PATCH v3 net-next 12/15] socket: Move sock_inuse_add() to sock.c.
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@...zon.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)
Powered by blists - more mailing lists