Skip to content

Commit a0b8486

Browse files
edumazetdavem330
authored andcommitted
tcp: tcp_make_synack() minor changes
There is no need to allocate 15 bytes in excess for a SYNACK packet, as it contains no data, only headers. SYNACK are always generated in softirq context, and contain a single segment, we can use TCP_INC_STATS_BH() Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e5fd387 commit a0b8486

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎net/ipv4/tcp_output.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2741,7 +2741,7 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,
27412741
int tcp_header_size;
27422742
int mss;
27432743

2744-
skb = sock_wmalloc(sk, MAX_TCP_HEADER + 15, 1, GFP_ATOMIC);
2744+
skb = sock_wmalloc(sk, MAX_TCP_HEADER, 1, GFP_ATOMIC);
27452745
if (unlikely(!skb)) {
27462746
dst_release(dst);
27472747
return NULL;
@@ -2811,7 +2811,7 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,
28112811
th->window = htons(min(req->rcv_wnd, 65535U));
28122812
tcp_options_write((__be32 *)(th + 1), tp, &opts);
28132813
th->doff = (tcp_header_size >> 2);
2814-
TCP_ADD_STATS(sock_net(sk), TCP_MIB_OUTSEGS, tcp_skb_pcount(skb));
2814+
TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_OUTSEGS);
28152815

28162816
#ifdef CONFIG_TCP_MD5SIG
28172817
/* Okay, we have all we need - do the md5 hash if needed */

0 commit comments

Comments
 (0)