Skip to content

Commit

Permalink
tcp: use tcp_flags in tcp_data_queue()
Browse files Browse the repository at this point in the history
This patch is a cleanup which follows the idea in commit e11ecdd (tcp: use
TCP_SKB_CB(skb)->tcp_flags in input path),
and it may reduce register pressure since skb->cb[] access is fast,
bacause skb is probably in a register.

v2: remove variable th
v3: reword the changelog

Signed-off-by: Weiping Pan <panweiping3@gmail.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Peter Pan(潘卫平) authored and David S. Miller committed Sep 28, 2014
1 parent cd7d849 commit 155c6e1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions net/ipv4/tcp_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -4344,7 +4344,6 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size)

static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
{
const struct tcphdr *th = tcp_hdr(skb);
struct tcp_sock *tp = tcp_sk(sk);
int eaten = -1;
bool fragstolen = false;
Expand All @@ -4353,7 +4352,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
goto drop;

skb_dst_drop(skb);
__skb_pull(skb, th->doff * 4);
__skb_pull(skb, tcp_hdr(skb)->doff * 4);

TCP_ECN_accept_cwr(tp, skb);

Expand Down Expand Up @@ -4397,7 +4396,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq;
if (skb->len)
tcp_event_data_recv(sk, skb);
if (th->fin)
if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)
tcp_fin(sk);

if (!skb_queue_empty(&tp->out_of_order_queue)) {
Expand Down

0 comments on commit 155c6e1

Please sign in to comment.