Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3461533imm; Tue, 29 May 2018 07:39:36 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqDnt5x8IOzdV0fvKY/xoXxXMLDfJkyiUw7s2C5rkJAu6xUj44Ys1y5PXrRP/ji3dfpP2D3 X-Received: by 2002:a65:6648:: with SMTP id z8-v6mr13656694pgv.397.1527604776932; Tue, 29 May 2018 07:39:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527604776; cv=none; d=google.com; s=arc-20160816; b=t2LhUhTe7hogEwMaeG040ZnGrh71/JjJYpbsBeh1SoD7xWsexEbxJ+d29PX9OJj0Wn dds8BmCxvkWu01c+wD4vIgN5R3w8bqHNPvJXU2EueXvC1LI+JZ0cVwGbaRvsHidUMZ++ m0dnIYn1gGCdzfNC0yk0oAYqgp8VY8/mm36QnrkPay/OyAP3FNTWaK+Lmto6VQIV318O Wet4U70QTTIS0wiDP2bqvmD8AqHO09hXsDPwxOZsPkZ9V2v7xAtHQTfF2vF8Kx1UrKRc //+PpQ7H7BhlopmYbo+FjJLmWgxzW5BE7Y5ecvlSt1t/nuDZL9xQesdtGDhj52RNKQ5F 0uQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=0EQeLSBggRYgPw35CS6anzJSSR4B3s+cqKGK+z9t38M=; b=rELkUFyAu/3qGMt60dQOWQF9Vn+jhohoy+H4sZKTk4TMXsQ5WZW1nYqLNQWA4zOCED Qx/CXkcSBAJDuttxbY7gtjlCHn/GRZqsPXmlHdxMFZLFqluQKIJaXg6Bqj79gd77lIN9 LlQVnCAkikYn+wzdelkQG3P9DvCepsGhRXPI6MfNPxsh1/TcMEARPYvEStfA+8b2YhkQ 77wO6Euu784Z2D3ObJYUffxvlnVNqwt5MCJrU4EQ+EJAFPmpTZCrumS/WlHElS/6Ik9j ZmER/nq1pnRSv75fWCyNMvNglZ9wFUxN+/VsCmTIwVyBVfWO9YbYTQ0JMFvdK2uHHoor ZVBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kEQGqspU; 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 l64-v6si5328105pgd.174.2018.05.29.07.39.23; Tue, 29 May 2018 07:39:36 -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=kEQGqspU; 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 S935090AbeE2Oi0 (ORCPT + 99 others); Tue, 29 May 2018 10:38:26 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:51750 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934608AbeE2OiV (ORCPT ); Tue, 29 May 2018 10:38:21 -0400 Received: by mail-it0-f67.google.com with SMTP id d10-v6so18688845itj.1; Tue, 29 May 2018 07:38:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=0EQeLSBggRYgPw35CS6anzJSSR4B3s+cqKGK+z9t38M=; b=kEQGqspUdFXpxukYZpbZDeWEdCZpCG0NbuBn5zWFcefUJ9bimUoDzX2jFii48qN8YL HgJw05UmSV0hYe/Hx7+/Er1lImNZX4YQGWwSnbqsr+ekrXCbnyjU7TFqpkm/3QWclbGQ eC90mBNOZCE0n/2Xu07usXP0YWf/GG8ndUvkJzLVRhDB7WUIjTaBcOABCZDom9Pxey9c c7thydDxRet1HamggAxxIDTfLkXcNtVf3e2FCqDp1Kw60nWF/EM7cwYadBhvUyL4fKrq Lsu02DQYEwlik45XRSjpi8wvyFXARmId/vWfQD2tNGMFLJrpYQehW2bsCcr6o8MwzwyL pE+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=0EQeLSBggRYgPw35CS6anzJSSR4B3s+cqKGK+z9t38M=; b=AW2bqTD0C+U+B9EMx4sYqdrPbbhp7KK+jC6PNMjCUIQSEytI5iENLnd68SjfFtBd6r z+Jsxxms3SCerCZoAMLXJsYha3n/Nky4U/QW06mX9UPeAdJiTrxwXkmubi8dB0rvHlWA Sxl/VZZ1MTeoMihlqe6JxMrd2Vg47zv0xouy+FextE2zjOWRrXXAnwN5rqWDlDR1AAwp 77WG0GETnqjYQdzQCgQZ71wlAL+AlDa0gciVehbYhIpI3hm11rXFy1ArmZuQSgx/9sh4 aTPXrX9DYaYf8DvZHjCYGJ396CAOvLGIlZDcmbrdayJMj0SrhYcUG0i1sbdTnEafkhGo I1Uw== X-Gm-Message-State: ALKqPwc1aCHhAgE1jr3MKfSNQKkH0OH/YkKWqRgqlDbX5MpoN7Pic8Ga uWDaBioNgCs9YIEIoSuqvML80ZGmZqVMt2UBKy0= X-Received: by 2002:a24:9149:: with SMTP id i70-v6mr14594870ite.142.1527604700692; Tue, 29 May 2018 07:38:20 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:ef03:0:0:0:0:0 with HTTP; Tue, 29 May 2018 07:37:40 -0700 (PDT) In-Reply-To: References: <1527600915-10955-1-git-send-email-laoar.shao@gmail.com> <1527600915-10955-2-git-send-email-laoar.shao@gmail.com> From: Yafang Shao Date: Tue, 29 May 2018 22:37:40 +0800 Message-ID: Subject: Re: [PATCH v4 net-next 2/2] tcp: minor optimization around tcp_hdr() usage in tcp receive path To: Eric Dumazet Cc: Song Liu , Eric Dumazet , David Miller , netdev , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 29, 2018 at 9:54 PM, Eric Dumazet wrote: > > > 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. > Got it :) > const struct tcphdr *th = (const struct tcphdr *)skb->data; > struct tcp_sock *tp = tcp_sk(sk); > unsigned int len = skb->len; > >