From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x2259uAzked4HORlmWO8FTsqSezO1DudFXOC5UTI0pTB9k0et7MBbMp/ctUfJ6H1DzuPM9mRr ARC-Seal: i=1; a=rsa-sha256; t=1517256284; cv=none; d=google.com; s=arc-20160816; b=Aur2vclXkz7sCSBadZ9z55KUKBEKRd8ahZOt2V9rIWfXxL1PRGj18FYHtnVrGAFi08 3DhPwjoL1PW1OHcmWNiDva5Qo3GDW4sDWVPyo1+drO2cOZSABUbfIq5d6nSu0259x0ij Aeybk4DNGCCK/QvsfTk3SPWZqa1eVvTCuNkKKlYNislOu6Q7wO2YUbyfEdBXCQ56qq96 utB7cVa9ilqquGorQyUriq4ysUkVYcUkP7WjwLwmN9Nn4k8UbYjyOaKDG1LUosHIvIGw C5FRKlQ07cLvUBE2NjHeFQnGCA+/pHhKGPpzi/Eakldj1/t1Ske9qyEWuM+j+XNxnvxt eVhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=W/kzJ6kFr7lbVDAt+r4NgcbUtHOkL2GlgOWLBfAXRuQ=; b=jBua+a039es8ZUdlzv3gXE844sUgTJG3qANNBW8TLn1oMPl8f5JGLa4zbQF151gcEK pJvqHJLPQ19RHN1nBdZxP5F8JS8YJVNpNuumGA2ngdeI0+ConhQSYUCHNusS/OFiy4uh iZ9FqeR0Oi5SGbFY2f8bAgtLuGiPPbrrdsaR3ph7TWoDl9fIltc3cQiNDaWeTCUE3kjL uJN0QI7wtTQg4cpA7Atk6hrXZQ7PyQYkWfsmGXbB6L4oFj3bsHSZ/YG2QlSBJMhy4bBb 8Ly42CnN/VIrEIm1GhCI8bBRS9IndKWl5Sy5RMCyiF4d9dtK4YOiomzyRHqwimLZlLnp kWkw== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Craig Gallek , "David S. Miller" Subject: [PATCH 4.4 64/74] tcp: __tcp_hdrlen() helper Date: Mon, 29 Jan 2018 13:57:09 +0100 Message-Id: <20180129123850.428107956@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123847.507563674@linuxfoundation.org> References: <20180129123847.507563674@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1590958525631118084?= X-GMAIL-MSGID: =?utf-8?q?1590958525631118084?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Craig Gallek commit d9b3fca27385eafe61c3ca6feab6cb1e7dc77482 upstream. tcp_hdrlen is wasteful if you already have a pointer to struct tcphdr. This splits the size calculation into a helper function that can be used if a struct tcphdr is already available. Signed-off-by: Craig Gallek Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- include/linux/tcp.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -29,9 +29,14 @@ static inline struct tcphdr *tcp_hdr(con return (struct tcphdr *)skb_transport_header(skb); } +static inline unsigned int __tcp_hdrlen(const struct tcphdr *th) +{ + return th->doff * 4; +} + static inline unsigned int tcp_hdrlen(const struct sk_buff *skb) { - return tcp_hdr(skb)->doff * 4; + return __tcp_hdrlen(tcp_hdr(skb)); } static inline struct tcphdr *inner_tcp_hdr(const struct sk_buff *skb)