From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x227R28xOsXoGHUIA5+btLD0zCNI2f7TvnVo64mtLgVep40cg+5QP0zSES6j2UAtOSs/YqmNy ARC-Seal: i=1; a=rsa-sha256; t=1517256870; cv=none; d=google.com; s=arc-20160816; b=lmP/C3KabmoIeTP27vWVDLuHSwkwtWrx2Wu6zVoLhsk1nSweTEdZyKGyJKS2oUYWbZ CIZie9G12tGKyRvlK3wNkPaLZl+qWW8+fDkZCHcRT6dlnZ03dstYV0h5vFe4hhTcA6qq 5RJZvu1Cw/qbj+V2wA93o42Pfpz0+sV7sg4AIqDBFtJ4LxBIGbszs9KONS2d39HacjZQ SxCUlmAAt7IOYpOB9ZY9FORurgfEqskOh68cWe8xHKQsnzcc60LVxmQYzfW9S5BIWz0Y 7IgIhKHFK2dxNaht2e7gFqa7FUXbyvImO/Vvyvj49R6iLQTu8/1SFiTqYncmrJR7Dd/0 rOcw== 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=9u10Ed+JB8xJjFAimc1kR+Z25EueQhi0v07dTZZj5A0=; b=GFVZV4i9XOOyhoP6YHohNgfw274Id/7YkCSGOMrWv37dBsClgrQ3YrVKN9SCgwt9H9 nj23JpUSZWAUX6sH+apLGIWeSM0eIx9EHoJP2+iBHY0E89myBOpfO2+ohxPCnYCyHP0+ gDRDLq40rJ5jlH3m6/NddbdA0r4dqCCcD7RzBvOP87qcTjx9mc7d0WQGn+R+n1/ST55z Ya5WAlRPYctbiw3sJI6jy/GKUiAfTegrViFLGEdW0Srb8QTtwdhgBSdN7P7+eHPnG3VN fDIQ2QkkmGOWm2qGP2ghbZdSlEGzmnX70KSOBXCacX8GHI8Em+T2MvhsQk5VXXAefoY7 zOTg== 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 3.18 44/52] tcp: __tcp_hdrlen() helper Date: Mon, 29 Jan 2018 13:57:02 +0100 Message-Id: <20180129123630.109290716@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123628.168904217@linuxfoundation.org> References: <20180129123628.168904217@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?1590959141046868753?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 3.18-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)