OSDN Git Service

tcp: rename sk_stream_alloc_skb
authorEric Dumazet <edumazet@google.com>
Mon, 25 Oct 2021 22:13:40 +0000 (15:13 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 Oct 2021 13:45:11 +0000 (14:45 +0100)
sk_stream_alloc_skb() is only used by TCP.

Rename it to make this clear, and move its declaration
to include/net/tcp.h

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sock.h
include/net/tcp.h
net/ipv4/tcp.c
net/ipv4/tcp_output.c

index b76be30..ff4e62a 100644 (file)
@@ -2422,9 +2422,6 @@ static inline void sk_stream_moderate_sndbuf(struct sock *sk)
        WRITE_ONCE(sk->sk_sndbuf, max_t(u32, val, SOCK_MIN_SNDBUF));
 }
 
-struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp,
-                                   bool force_schedule);
-
 /**
  * sk_page_frag - return an appropriate page_frag
  * @sk: socket
index d62467a..701587a 100644 (file)
@@ -337,6 +337,8 @@ void tcp_twsk_destructor(struct sock *sk);
 ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos,
                        struct pipe_inode_info *pipe, size_t len,
                        unsigned int flags);
+struct sk_buff *tcp_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp,
+                                    bool force_schedule);
 
 void tcp_enter_quickack_mode(struct sock *sk, unsigned int max_quickacks);
 static inline void tcp_dec_quickack_mode(struct sock *sk,
index 56ff7c7..9ba2317 100644 (file)
@@ -856,8 +856,8 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos,
 }
 EXPORT_SYMBOL(tcp_splice_read);
 
-struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp,
-                                   bool force_schedule)
+struct sk_buff *tcp_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp,
+                                    bool force_schedule)
 {
        struct sk_buff *skb;
 
@@ -960,8 +960,8 @@ new_segment:
                if (!sk_stream_memory_free(sk))
                        return NULL;
 
-               skb = sk_stream_alloc_skb(sk, 0, sk->sk_allocation,
-                                         tcp_rtx_and_write_queues_empty(sk));
+               skb = tcp_stream_alloc_skb(sk, 0, sk->sk_allocation,
+                                          tcp_rtx_and_write_queues_empty(sk));
                if (!skb)
                        return NULL;
 
@@ -1289,8 +1289,8 @@ new_segment:
                                        goto restart;
                        }
                        first_skb = tcp_rtx_and_write_queues_empty(sk);
-                       skb = sk_stream_alloc_skb(sk, 0, sk->sk_allocation,
-                                                 first_skb);
+                       skb = tcp_stream_alloc_skb(sk, 0, sk->sk_allocation,
+                                                  first_skb);
                        if (!skb)
                                goto wait_for_space;
 
index 3a01e55..c0c55a8 100644 (file)
@@ -1564,7 +1564,7 @@ int tcp_fragment(struct sock *sk, enum tcp_queue tcp_queue,
                return -ENOMEM;
 
        /* Get a new skb... force flag on. */
-       buff = sk_stream_alloc_skb(sk, nsize, gfp, true);
+       buff = tcp_stream_alloc_skb(sk, nsize, gfp, true);
        if (!buff)
                return -ENOMEM; /* We'll just try again later. */
        skb_copy_decrypted(buff, skb);
@@ -2121,7 +2121,7 @@ static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len,
                return tcp_fragment(sk, TCP_FRAG_IN_WRITE_QUEUE,
                                    skb, len, mss_now, gfp);
 
-       buff = sk_stream_alloc_skb(sk, 0, gfp, true);
+       buff = tcp_stream_alloc_skb(sk, 0, gfp, true);
        if (unlikely(!buff))
                return -ENOMEM;
        skb_copy_decrypted(buff, skb);
@@ -2388,7 +2388,7 @@ static int tcp_mtu_probe(struct sock *sk)
                return -1;
 
        /* We're allowed to probe.  Build it now. */
-       nskb = sk_stream_alloc_skb(sk, probe_size, GFP_ATOMIC, false);
+       nskb = tcp_stream_alloc_skb(sk, probe_size, GFP_ATOMIC, false);
        if (!nskb)
                return -1;
        sk_wmem_queued_add(sk, nskb->truesize);
@@ -3754,7 +3754,7 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn)
        /* limit to order-0 allocations */
        space = min_t(size_t, space, SKB_MAX_HEAD(MAX_TCP_HEADER));
 
-       syn_data = sk_stream_alloc_skb(sk, space, sk->sk_allocation, false);
+       syn_data = tcp_stream_alloc_skb(sk, space, sk->sk_allocation, false);
        if (!syn_data)
                goto fallback;
        syn_data->ip_summed = CHECKSUM_PARTIAL;
@@ -3835,7 +3835,7 @@ int tcp_connect(struct sock *sk)
                return 0;
        }
 
-       buff = sk_stream_alloc_skb(sk, 0, sk->sk_allocation, true);
+       buff = tcp_stream_alloc_skb(sk, 0, sk->sk_allocation, true);
        if (unlikely(!buff))
                return -ENOBUFS;