From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuchung Cheng Subject: Re: [PATCH net-next 1/3] tcp: remove hdrlen argument from tcp_queue_rcv() Date: Wed, 21 Nov 2018 14:41:14 -0800 Message-ID: References: <20181121175240.6075-1-edumazet@google.com> <20181121175240.6075-2-edumazet@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: "David S . Miller" , netdev , Jean-Louis Dupond , Neal Cardwell , Eric Dumazet To: Eric Dumazet Return-path: Received: from mail-it1-f195.google.com ([209.85.166.195]:53705 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387447AbeKVJSU (ORCPT ); Thu, 22 Nov 2018 04:18:20 -0500 Received: by mail-it1-f195.google.com with SMTP id g85so11378954ita.3 for ; Wed, 21 Nov 2018 14:41:56 -0800 (PST) In-Reply-To: <20181121175240.6075-2-edumazet@google.com> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, Nov 21, 2018 at 9:52 AM, Eric Dumazet wrote: > Only one caller needs to pull TCP headers, so lets > move __skb_pull() to the caller side. > > Signed-off-by: Eric Dumazet > --- Acked-by: Yuchung Cheng > net/ipv4/tcp_input.c | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c > index edaaebfbcd4693ef6689f3f4c71733b3888c7c2c..e0ad7d3825b5945049c099171ce36e5c8bb9ba99 100644 > --- a/net/ipv4/tcp_input.c > +++ b/net/ipv4/tcp_input.c > @@ -4602,13 +4602,12 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb) > } > } > > -static int __must_check tcp_queue_rcv(struct sock *sk, struct sk_buff *skb, int hdrlen, > - bool *fragstolen) > +static int __must_check tcp_queue_rcv(struct sock *sk, struct sk_buff *skb, > + bool *fragstolen) > { > int eaten; > struct sk_buff *tail = skb_peek_tail(&sk->sk_receive_queue); > > - __skb_pull(skb, hdrlen); > eaten = (tail && > tcp_try_coalesce(sk, tail, > skb, fragstolen)) ? 1 : 0; > @@ -4659,7 +4658,7 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size) > TCP_SKB_CB(skb)->end_seq = TCP_SKB_CB(skb)->seq + size; > TCP_SKB_CB(skb)->ack_seq = tcp_sk(sk)->snd_una - 1; > > - if (tcp_queue_rcv(sk, skb, 0, &fragstolen)) { > + if (tcp_queue_rcv(sk, skb, &fragstolen)) { > WARN_ON_ONCE(fragstolen); /* should not happen */ > __kfree_skb(skb); > } > @@ -4719,7 +4718,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb) > goto drop; > } > > - eaten = tcp_queue_rcv(sk, skb, 0, &fragstolen); > + eaten = tcp_queue_rcv(sk, skb, &fragstolen); > if (skb->len) > tcp_event_data_recv(sk, skb); > if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN) > @@ -5585,8 +5584,8 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb) > NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPHPHITS); > > /* Bulk data transfer: receiver */ > - eaten = tcp_queue_rcv(sk, skb, tcp_header_len, > - &fragstolen); > + __skb_pull(skb, tcp_header_len); > + eaten = tcp_queue_rcv(sk, skb, &fragstolen); > > tcp_event_data_recv(sk, skb); > > -- > 2.19.1.1215.g8438c0b245-goog >