]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
tcp: move reqsk_alloc() to inet_connection_sock.c
authorEric Dumazet <edumazet@google.com>
Wed, 5 Jun 2024 07:15:53 +0000 (07:15 +0000)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 6 Jun 2024 13:18:04 +0000 (15:18 +0200)
reqsk_alloc() has a single caller, no need to expose it
in include/net/request_sock.h.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
include/net/request_sock.h
net/ipv4/inet_connection_sock.c

index a8f82216c628734f84d25dd4e798bde1de42a589..b07b1cd14e9f4d41d2b4fbad6015bbfae4190636 100644 (file)
@@ -128,39 +128,6 @@ static inline struct sock *skb_steal_sock(struct sk_buff *skb,
        return sk;
 }
 
-static inline struct request_sock *
-reqsk_alloc_noprof(const struct request_sock_ops *ops, struct sock *sk_listener,
-           bool attach_listener)
-{
-       struct request_sock *req;
-
-       req = kmem_cache_alloc_noprof(ops->slab, GFP_ATOMIC | __GFP_NOWARN);
-       if (!req)
-               return NULL;
-       req->rsk_listener = NULL;
-       if (attach_listener) {
-               if (unlikely(!refcount_inc_not_zero(&sk_listener->sk_refcnt))) {
-                       kmem_cache_free(ops->slab, req);
-                       return NULL;
-               }
-               req->rsk_listener = sk_listener;
-       }
-       req->rsk_ops = ops;
-       req_to_sk(req)->sk_prot = sk_listener->sk_prot;
-       sk_node_init(&req_to_sk(req)->sk_node);
-       sk_tx_queue_clear(req_to_sk(req));
-       req->saved_syn = NULL;
-       req->syncookie = 0;
-       req->timeout = 0;
-       req->num_timeout = 0;
-       req->num_retrans = 0;
-       req->sk = NULL;
-       refcount_set(&req->rsk_refcnt, 0);
-
-       return req;
-}
-#define reqsk_alloc(...)       alloc_hooks(reqsk_alloc_noprof(__VA_ARGS__))
-
 static inline void __reqsk_free(struct request_sock *req)
 {
        req->rsk_ops->destructor(req);
index a9d2e630891003adaf3044306619aeeab87801a8..7ced569778ab44796fe883e48c78c8cccd6a909d 100644 (file)
@@ -911,6 +911,39 @@ int inet_rtx_syn_ack(const struct sock *parent, struct request_sock *req)
 }
 EXPORT_SYMBOL(inet_rtx_syn_ack);
 
+static struct request_sock *
+reqsk_alloc_noprof(const struct request_sock_ops *ops, struct sock *sk_listener,
+                  bool attach_listener)
+{
+       struct request_sock *req;
+
+       req = kmem_cache_alloc_noprof(ops->slab, GFP_ATOMIC | __GFP_NOWARN);
+       if (!req)
+               return NULL;
+       req->rsk_listener = NULL;
+       if (attach_listener) {
+               if (unlikely(!refcount_inc_not_zero(&sk_listener->sk_refcnt))) {
+                       kmem_cache_free(ops->slab, req);
+                       return NULL;
+               }
+               req->rsk_listener = sk_listener;
+       }
+       req->rsk_ops = ops;
+       req_to_sk(req)->sk_prot = sk_listener->sk_prot;
+       sk_node_init(&req_to_sk(req)->sk_node);
+       sk_tx_queue_clear(req_to_sk(req));
+       req->saved_syn = NULL;
+       req->syncookie = 0;
+       req->timeout = 0;
+       req->num_timeout = 0;
+       req->num_retrans = 0;
+       req->sk = NULL;
+       refcount_set(&req->rsk_refcnt, 0);
+
+       return req;
+}
+#define reqsk_alloc(...)       alloc_hooks(reqsk_alloc_noprof(__VA_ARGS__))
+
 struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops,
                                      struct sock *sk_listener,
                                      bool attach_listener)