Commit 155c6e1a authored by Peter Pan(潘卫平)'s avatar Peter Pan(潘卫平) Committed by David S. Miller

tcp: use tcp_flags in tcp_data_queue()

This patch is a cleanup which follows the idea in commit e11ecddf (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: default avatarWeiping Pan <panweiping3@gmail.com>
Acked-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cd7d8498
...@@ -4344,7 +4344,6 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size) ...@@ -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) 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); struct tcp_sock *tp = tcp_sk(sk);
int eaten = -1; int eaten = -1;
bool fragstolen = false; bool fragstolen = false;
...@@ -4353,7 +4352,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb) ...@@ -4353,7 +4352,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
goto drop; goto drop;
skb_dst_drop(skb); skb_dst_drop(skb);
__skb_pull(skb, th->doff * 4); __skb_pull(skb, tcp_hdr(skb)->doff * 4);
TCP_ECN_accept_cwr(tp, skb); TCP_ECN_accept_cwr(tp, skb);
...@@ -4397,7 +4396,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb) ...@@ -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; tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq;
if (skb->len) if (skb->len)
tcp_event_data_recv(sk, skb); tcp_event_data_recv(sk, skb);
if (th->fin) if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)
tcp_fin(sk); tcp_fin(sk);
if (!skb_queue_empty(&tp->out_of_order_queue)) { if (!skb_queue_empty(&tp->out_of_order_queue)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment