Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2520573imm; Mon, 28 May 2018 09:38:36 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIuhK3rFER1XHiC4KzfqRcG0zqiYVaNyZOyYvIJHbpuP+FKZPUDHvjUs21dCVOcwGJDIicy X-Received: by 2002:a62:3bd2:: with SMTP id w79-v6mr10195068pfj.129.1527525516510; Mon, 28 May 2018 09:38:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527525516; cv=none; d=google.com; s=arc-20160816; b=N4Dq7nGzKKjQSlcdWsjEg1fIEqWXur4XTgh8jWP9mbFSxlwx6y9UcpFUXlyD1X6A/D sxiFHpd4X5uKVSYD25U0cOn8S+011BourIK5hdPWNcovsFT/uteSCIL0qq8qTwfIWRa3 Dz2PJ+8tPohlK+TUAZjcDJodCZVBg09Umov0DXyrJ+3b9Ngh9V3ckSnRcLdsF8YZ33F8 5IOSCr0keZiCWRSSnTnaSGkWnte9ix0UAmXLVyHuaA1tYtjx1JXOFcw6tuxWILEQWr4s dTBFng9E8jWjbg5OT5EVvgjAjlh1+yqdAA7YTwcy4yjnVg2RI4ZQJB0x8yHFyqVUUOrc gcaQ== 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 :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=M3F3OJaLRHOWALKwoaVZpvE6TZHJv9s/q5QyI8vOsOQ=; b=AMPTOpApa/zMkM8KMhyTTvDGFOz3AbxRrZIQJQe6zmLRhAAlMo5ieNWUq4QrW3Ah24 MloCEj7FU9GMQGg/L828kBszsNQ4MOzda4C5OK/my1BEXlXbHNJKesCxz8iy7o6j4Gsd zGVuJldkcBB28xwPOMj2UDZjbStHa3LU9oXxjwPNrtevEpy8P9UPzQK9XdAmNIx9qhDO yyLjT5V8ma94yEAOHWd8Wgj0hOnuHtdDGWyjaqyqAJ4JvN4S9aIkEkilo2EeUQK9fylM EgM1HRbbQfMCw3rXlEEzhRlXQZKj6ZQFAQ8GIXkH0s121Cn/W34GQB4IEUnPpoYozBWQ 9B5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=SNxXy0L4; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b65-v6si8932144pgc.139.2018.05.28.09.38.21; Mon, 28 May 2018 09:38: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=@google.com header.s=20161025 header.b=SNxXy0L4; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S940258AbeE1Qgj (ORCPT + 99 others); Mon, 28 May 2018 12:36:39 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:37333 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934609AbeE1Qgg (ORCPT ); Mon, 28 May 2018 12:36:36 -0400 Received: by mail-io0-f195.google.com with SMTP id e20-v6so14626393iof.4 for ; Mon, 28 May 2018 09:36:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=M3F3OJaLRHOWALKwoaVZpvE6TZHJv9s/q5QyI8vOsOQ=; b=SNxXy0L4e7hvgNIQYau7vQYZvJ/GmTpAcu5mYG1T7Ek8tBtCjyyKVevnq+yqBgWpYf Dl+4ZBEHiVyB0D8rT4PnLQr1+jtnlMNpJZ/VAyVRwkhOJhCyQsWxxWgC5ShezYay8myM M1LOgXBC5igF9GN/tvtwofabgPvXEWokInEmFsPrGVbZ1D4gEPhxlNdOoU9qc7d7tu28 LXZnsrvueK+S8sC9KLEzClltEGrXQJ6elNISg61eej0MBh9y4ejSXWXAOrykvhXb3Pkq Ry8qt8WYM6kloXm1P1UShk3bt8/i62c+V2/zqYXi//9E7YVfkEZ+NJ0jOIu4aJbXhZBn T+ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=M3F3OJaLRHOWALKwoaVZpvE6TZHJv9s/q5QyI8vOsOQ=; b=Ws6I3SYM9+WlzPrI+3bAxL+hsvOatVxPIW09brSwWkpZ10H4wOQ4zXQxeN9x0zWv67 MV3pvr0GxUeTvKvN3SW9jlhHbBYD9ZCe4sjsZDwIxVwn157p6zK02k0NkYql+75psZLe e5JGekyVRqxx8XnCGZqWBDF9P0iE7iuRyrcv+TD+GOHN5tXDAs+f90jxImJd2bHBj7vL gOdl5SMDKgdZv2HVXTq85Y4CxTbDuMqiHihzytbJFPdLJ7DoaKeBZDM2dx4cJf8YaJBO BRAE3Vx8Fag+Iulb02qHjpJofkcwNpQhZWTKT9bTHghkOICB/xA0IoCtyR7FS6TO719t TLLw== X-Gm-Message-State: ALKqPwf3VZeh1UVArDMmNZ7J6Ej+OMY9J23RKPw9WzJtysmWenZMcE0w S6HtY3PmRdX703Vq1JJw4SUmQ2S9ZyE/5dN5J65PkY9CeLY= X-Received: by 2002:a6b:5301:: with SMTP id h1-v6mr12244790iob.73.1527525395293; Mon, 28 May 2018 09:36:35 -0700 (PDT) MIME-Version: 1.0 References: <1527521753-17963-1-git-send-email-laoar.shao@gmail.com> <1527521753-17963-2-git-send-email-laoar.shao@gmail.com> In-Reply-To: <1527521753-17963-2-git-send-email-laoar.shao@gmail.com> From: Eric Dumazet Date: Mon, 28 May 2018 09:36:23 -0700 Message-ID: Subject: Re: [PATCH v3 net-next 2/2] tcp: minor optimization around tcp_hdr() usage in tcp receive path To: laoar.shao@gmail.com Cc: songliubraving@fb.com, 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 Mon, May 28, 2018 at 8:36 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. > Cc: Eric Dumazet > Signed-off-by: Yafang Shao > --- > net/ipv4/tcp_ipv4.c | 2 +- > net/ipv6/tcp_ipv6.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c > index adbdb50..d179386 100644 > --- a/net/ipv4/tcp_ipv4.c > +++ b/net/ipv4/tcp_ipv4.c > @@ -1486,7 +1486,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb) > sk->sk_rx_dst = NULL; > } > } > - tcp_rcv_established(sk, skb, tcp_hdr(skb)); > + tcp_rcv_established(sk, skb, (const struct tcphdr *)skb->data); > return 0; > } > diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c > index 7d47c2b..1c633ff 100644 > --- a/net/ipv6/tcp_ipv6.c > +++ b/net/ipv6/tcp_ipv6.c > @@ -1322,7 +1322,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) > } > } > - tcp_rcv_established(sk, skb, tcp_hdr(skb)); > + tcp_rcv_established(sk, skb, (const struct tcphdr *)skb->data); > if (opt_skb) > goto ipv6_pktoptions; > return 0; > -- > 1.8.3.1 I would rather remove the third parameter of tcp_rcv_established() instead of duplicating the cast.