Skip to content

Commit

Permalink
tcp: use MAX_TCP_HEADER in tcp_stream_alloc_skb
Browse files Browse the repository at this point in the history
Both IPv4 and IPv6 uses same reserve, no need risking
cache line misses to fetch its value.

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>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Oct 26, 2021
1 parent f8dd3b8 commit 8a794df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ struct sk_buff *tcp_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp,
if (unlikely(tcp_under_memory_pressure(sk)))
sk_mem_reclaim_partial(sk);

skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp);
skb = alloc_skb_fclone(size + MAX_TCP_HEADER, gfp);
if (likely(skb)) {
bool mem_scheduled;

Expand All @@ -878,7 +878,7 @@ struct sk_buff *tcp_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp,
mem_scheduled = sk_wmem_schedule(sk, skb->truesize);
}
if (likely(mem_scheduled)) {
skb_reserve(skb, sk->sk_prot->max_header);
skb_reserve(skb, MAX_TCP_HEADER);
/*
* Make sure that we have exactly size bytes
* available to the caller, no more, no less.
Expand Down

0 comments on commit 8a794df

Please sign in to comment.