Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3414171imm; Tue, 29 May 2018 06:55:27 -0700 (PDT) X-Google-Smtp-Source: AB8JxZplprr3IAx8M8FAe03l/Z1Vw3wpqeAWKnduacej0EjbKWitITHUrHpNo2j8YDjkt3l+yRtn X-Received: by 2002:a62:404f:: with SMTP id n76-v6mr17551579pfa.185.1527602127545; Tue, 29 May 2018 06:55:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527602127; cv=none; d=google.com; s=arc-20160816; b=ghGlxQWz0K+smOsXYXyMWzDYKOR/x419or7noYuJyetDT7G1bALZjFdIpflMzf3TXj m08YtTOEdh5XAJ2w0ShcXe0l+btMiv5Gev7+Bq5FY3hBl5AISTme9KZceLllRynC+6nt DIEwQMDZa3RArT/QRRkHpizoCYRXI9e2CY+n6tk6H4w8E6MRIrXo0fa1FsFz5FNxk8oq ZkLeC3y0hV4KeRZP+JXLZ6KdEJJvj2mGLNC/gBugOO0eCKJNZMS7lvMIiMTMxklBDy7i ykj2Af3aNoj19OdIG2CT7INFCJ/KGfqiAutinzuZFY2BtgYbjj9kjnJg0pXPLXTlEDkc zDlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=a2W4GSrZfGSuAINtmnvDpHbfhk7cIHuPsPuE65MqPjY=; b=Znz/6M9Cu4J4PPzFmIiKK5jR9z++/0asPeiMAAJvbZQvalbmbgJg4JRK3sMy08lE0A IM+qkTOq0jTXvrZrsLCxwQ8RD51EHdFlLzYnF9TAAw+gNCI0tR/ryw5pHO0AyJ16WHXh Pb5EFCQO5pYSuiAv35RPGfmb33Pu3fE+ItZ2oIZpQbNA8XWta04UvqnLqweVJtkGgaRX AaFmV02513Jkxa44vBPcQ6G3WEFg+/Gj0XbUOVIVln2hWbKLYfzxJ1Ja8yrqcwZPxYBw CIIfzr1kpFAvhvxRUmo4xpJMYufR+mlwc5/mDz/a66MD0qGK8wsJKjeXwQVlO4rqwCq1 8HOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tuP0sme3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h62-v6si8622842pge.184.2018.05.29.06.55.13; Tue, 29 May 2018 06:55:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tuP0sme3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934201AbeE2Nye (ORCPT + 99 others); Tue, 29 May 2018 09:54:34 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:35997 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934204AbeE2Nya (ORCPT ); Tue, 29 May 2018 09:54:30 -0400 Received: by mail-pg0-f67.google.com with SMTP id m5-v6so2254294pgd.3; Tue, 29 May 2018 06:54:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=a2W4GSrZfGSuAINtmnvDpHbfhk7cIHuPsPuE65MqPjY=; b=tuP0sme3/Jh2zcVuPqJXmlDjiauR5ULs2FIbJdiawZMUKZ+Br+GOnvRe+eI5YbVtne 9DcYZaBNzYjUpy7Q5P7psoz5T0Fk+NBv8Dm9YBGDxh0UUdMQk3lU/ZiFh2YZ9+05y90G U6kXaop1fGvhUq8cNIQ+u1scyuSmlVqYa3BEFm1x0q8SBabYNi/5CG4xHPZvAT49bElu K3H2cTep6OLrEBEtXXOp16EJH2Xr+m3JeoXzRIHJ+SXiSTO24za2kSfBRVtjk003bK9J eIotzgRy+1M/5l7Azbev/iwLxrwrYCVpeUElW94uuFRbEaUis6Oat5R8N7QFx9mTzMvS +w1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=a2W4GSrZfGSuAINtmnvDpHbfhk7cIHuPsPuE65MqPjY=; b=d9lymerkAK1G7nNW2jKKOemBOEpfM703LJV9+vr8de3ffWmK05b2E9CwQujJ6CmHe6 GFzdy8gAWKkipN7nrqT91yG6b21Yi37TpwzL51mla74tVnyd5saoyqL9LKK1Lkm3uaO+ JNdp5QK62n7h8+i8+p++x52sr6S+MERjiaXP8c+va/YTLTWnHvZ1soOwHi2Jigga0z7R nCMrKkJ3I+XeNmDX/uLs1u3h5ml5B07UAsY6ORz1xUyhVIv41PEyZQaJqFRZc8q8WjhJ q/muK63Luv1kIA4LEgJwpX8Vjw00/7GErcMZJrI/lmtzZSUfTM9GiQcn9T90+sMVjLMl CPSQ== X-Gm-Message-State: ALKqPwdu4JlFBFUWd0QoqVmE9Rwyjc4LKEh5u8PnGfrfBd32rroleUDz 0y4OXhxO5phKlN1K3MwZMfmaLB4O X-Received: by 2002:a63:6e8b:: with SMTP id j133-v6mr13740066pgc.91.1527602069711; Tue, 29 May 2018 06:54:29 -0700 (PDT) Received: from [192.168.86.235] (c-67-180-167-114.hsd1.ca.comcast.net. [67.180.167.114]) by smtp.gmail.com with ESMTPSA id v16-v6sm99031256pfk.164.2018.05.29.06.54.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 06:54:28 -0700 (PDT) Subject: Re: [PATCH v4 net-next 2/2] tcp: minor optimization around tcp_hdr() usage in tcp receive path To: Yafang Shao , songliubraving@fb.com, edumazet@google.com, davem@davemloft.net Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <1527600915-10955-1-git-send-email-laoar.shao@gmail.com> <1527600915-10955-2-git-send-email-laoar.shao@gmail.com> From: Eric Dumazet Message-ID: Date: Tue, 29 May 2018 06:54:27 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1527600915-10955-2-git-send-email-laoar.shao@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/29/2018 06:35 AM, Yafang Shao wrote: > This is additional to the commit ea1627c20c34 ("tcp: minor optimizations around tcp_hdr() usage"). > At this point, skb->data is same with tcp_hdr() as tcp header has not > been pulled yet. > Remove the third parameter of tcp_rcv_established() and put it into > the function body. > > Cc: Eric Dumazet > Signed-off-by: Yafang Shao > > --- > v4: remove the third parameter of tcp_rcv_established() > --- > include/net/tcp.h | 3 +-- > net/ipv4/tcp_input.c | 4 ++-- > net/ipv4/tcp_ipv4.c | 2 +- > net/ipv6/tcp_ipv6.c | 2 +- > 4 files changed, 5 insertions(+), 6 deletions(-) > > diff --git a/include/net/tcp.h b/include/net/tcp.h > index 952d842..029a51b 100644 > --- a/include/net/tcp.h > +++ b/include/net/tcp.h > @@ -334,8 +334,7 @@ ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset, > void tcp_delack_timer_handler(struct sock *sk); > int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); > int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb); > -void tcp_rcv_established(struct sock *sk, struct sk_buff *skb, > - const struct tcphdr *th); > +void tcp_rcv_established(struct sock *sk, struct sk_buff *skb); > void tcp_rcv_space_adjust(struct sock *sk); > int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp); > void tcp_twsk_destructor(struct sock *sk); > diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c > index 1191cac..1d70dab 100644 > --- a/net/ipv4/tcp_input.c > +++ b/net/ipv4/tcp_input.c > @@ -5390,11 +5390,11 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb, > * the rest is checked inline. Fast processing is turned on in > * tcp_data_queue when everything is OK. > */ > -void tcp_rcv_established(struct sock *sk, struct sk_buff *skb, > - const struct tcphdr *th) > +void tcp_rcv_established(struct sock *sk, struct sk_buff *skb) > { > unsigned int len = skb->len; > struct tcp_sock *tp = tcp_sk(sk); > + const struct tcphdr *th = (const struct tcphdr *)skb->data; > > Please reorder list to get a reverse christmas tree. const struct tcphdr *th = (const struct tcphdr *)skb->data; struct tcp_sock *tp = tcp_sk(sk); unsigned int len = skb->len;