Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3396538imm; Tue, 29 May 2018 06:37:09 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp1lp/Is2GUePruDJVaq2qYkl5Z9aM2ibGjFygGn4zkVj6wxpAMwRwLnisLbU2Y+UJjigct X-Received: by 2002:a63:7c04:: with SMTP id x4-v6mr13734866pgc.67.1527601029508; Tue, 29 May 2018 06:37:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527601029; cv=none; d=google.com; s=arc-20160816; b=iGcAnerIBjZxy2pNRu9bCcnvQB1ZdAQt0E2rwcHmWLHeh2OYK0Favnu6KEEmghVV0k lMztuqPtYbXv+W6xPjzR61QaSDpRpC5MlCJXZDXkUQWqbVwj/qYpoF05e1lL+6XzxqWv iP3gTbKWHORoWKRRnTCHM+u/Ba9vVNOQA0uh4RF8OS0LeGsojjUURm5uhhmhvJoLch2z LPkwiPgBbKvOYxOZiBK8JKeo4BGMR8v6LksRA1MMaHHsw1XyraH0munWn6tzsLaEUuFB fps4DuA922mbGERnWfemaYHIepTAUNAP4KalnogtdMH7indRBPPJsq2ZWIBrnJE6oV5m xkSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=vk4QaNdNO9IwGdC6wcyZRKRrVCyhUt89ubVmTYSe+ag=; b=qyWRdmuEl3a1e2nlb4P4FW4DkDKKw4TEUr+FIAvauUwug20AOrKIRLUzqLZeuCeVWg 1Du9iu/i1HwDF/9yXl+NzM0QUb4nnqm6oPZmKR9mvRQJ9L6NQDYYS0tCtYL1P4Irjiim sVu986imzTPogqUViS3HbRaHrlZcq8D233u5r36Ey6/ij7R+Z852wKd4N7MxHjSSDcbe xz3noKehVm7dBnTIuuNqX0vmU64pVBqAKi6NJ62BxvtU0QLZ0Xs/dEaVrW+6lOq2u6Ma UCcUta3lBRWruZV48rEBw8m5mXbBw0BnPoB9Xi5pAFlAyqQmH5p90Do5VBklQWDKFEyZ 0gZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XuQ2mnFg; 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 u189-v6si9849983pgd.260.2018.05.29.06.36.55; Tue, 29 May 2018 06:37:09 -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=XuQ2mnFg; 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 S934682AbeE2Nfl (ORCPT + 99 others); Tue, 29 May 2018 09:35:41 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:43289 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934136AbeE2Nfc (ORCPT ); Tue, 29 May 2018 09:35:32 -0400 Received: by mail-pl0-f66.google.com with SMTP id c41-v6so8955638plj.10; Tue, 29 May 2018 06:35:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vk4QaNdNO9IwGdC6wcyZRKRrVCyhUt89ubVmTYSe+ag=; b=XuQ2mnFgIfCfGLtZIALHXqUj92e8YoI0F13NuTtvsS4SKPw6XEGNf29vHqyqc4ZTwg Hye/Mh3FUgd7Ierpj6BcJ1MXqOadDLmqwjNJYEo+aNJj3apCso3w+v7pvMI0KKLnMZJ8 bDJZgyR6Lol1JOEnaGUfwlrtpVjhSKtbWIag18qf7Dvntjxly6TFGFxsYQ+7fZC/CBgt gtL0kAZLqTCiJJuM3XKILATO0Jj080uFcEEOv4RCU6sj1St8mgdkkvMeT2VJx/i/XPCq tQV/4OV6/63c1QMyAjAQGDWBGDfSLd3qJYt6ahisCsZJJU5DSj1hAZjEDUSRvqW90caC QdjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vk4QaNdNO9IwGdC6wcyZRKRrVCyhUt89ubVmTYSe+ag=; b=agGd5Zp2qkONwRo/doIYTAB+xvktQFFkjIPFoHALiAwy7uA4u6WijHkwvw9jRplG8R eG5OUfC7M1bYSHn+AZxQXNBa1zVp4bGeOhlwNtITXdz/4EURw3tWS6sPCmfFJzAjy12s tmhJlS5KatAKIIm/3Dm4PXHeFAq2jcxNu+IuYJrK1azKw9D4LrzAfGlkGyIku4QeC/Bd X29tisYaedrxlSFCvqhDbB+TMXmIwg2pvrAl4W+K+S4LUAK0KUXOGqdvvmrM+u4ZfhSs fc6W6VCbhrI5Z2HiH50ubXc0k48XxZ6ff4rE/f13XICe5A3sEXUVmxWfvP5hKBZHCy2F 4VIg== X-Gm-Message-State: ALKqPwdIhkMEraLxDixvA6zHs0228x3SnFizOjUzjXZqOhINzMD/J0OW 1SpTQ5gsqnthcfJPN8k5n8U= X-Received: by 2002:a17:902:8604:: with SMTP id f4-v6mr9221076plo.4.1527600931772; Tue, 29 May 2018 06:35:31 -0700 (PDT) Received: from li1588-6.members.linode.com (li1588-6.members.linode.com. [139.162.104.6]) by smtp.gmail.com with ESMTPSA id q82-v6sm16459605pfg.170.2018.05.29.06.35.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 06:35:31 -0700 (PDT) From: Yafang Shao To: songliubraving@fb.com, edumazet@google.com, davem@davemloft.net Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Yafang Shao Subject: [PATCH v4 net-next 2/2] tcp: minor optimization around tcp_hdr() usage in tcp receive path Date: Tue, 29 May 2018 21:35:15 +0800 Message-Id: <1527600915-10955-2-git-send-email-laoar.shao@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1527600915-10955-1-git-send-email-laoar.shao@gmail.com> References: <1527600915-10955-1-git-send-email-laoar.shao@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; /* TCP congestion window tracking */ trace_tcp_probe(sk, skb); diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index adbdb50..749b0ef 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); return 0; } diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 7d47c2b..8764a63 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); if (opt_skb) goto ipv6_pktoptions; return 0; -- 1.8.3.1