From: Craig Gallek <kraigatgoog@gmail.com>
To: netdev@vger.kernel.org, David Miller <davem@davemloft.net>
Subject: [PATCH net-next v4 3/7] tcp: __tcp_hdrlen() helper
Date: Wed, 10 Feb 2016 11:50:37 -0500 [thread overview]
Message-ID: <1455123041-22638-4-git-send-email-kraigatgoog@gmail.com> (raw)
In-Reply-To: <1455123041-22638-1-git-send-email-kraigatgoog@gmail.com>
From: Craig Gallek <kraig@google.com>
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 <kraig@google.com>
---
include/linux/tcp.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index d909feeeaea2..bcbf51da4e1e 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -29,9 +29,14 @@ static inline struct tcphdr *tcp_hdr(const struct sk_buff *skb)
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)
--
2.7.0.rc3.207.g0ac5344
next prev parent reply other threads:[~2016-02-10 16:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-10 16:50 [PATCH net-next v4 0/7] Faster SO_REUSEPORT for TCP Craig Gallek
2016-02-10 16:50 ` [PATCH net-next v4 1/7] sock: struct proto hash function may error Craig Gallek
2016-02-10 16:50 ` [PATCH net-next v4 2/7] inet: create IPv6-equivalent inet_hash function Craig Gallek
2016-02-10 16:50 ` Craig Gallek [this message]
2016-02-10 16:50 ` [PATCH net-next v4 4/7] inet: refactor inet[6]_lookup functions to take skb Craig Gallek
2016-02-10 16:50 ` [PATCH net-next v4 5/7] soreuseport: Prep for fast reuseport TCP socket selection Craig Gallek
2016-02-10 16:50 ` [PATCH net-next v4 6/7] soreuseport: " Craig Gallek
2016-02-10 16:50 ` [PATCH net-next v4 7/7] soreuseport: BPF selection functional test for TCP Craig Gallek
2016-02-11 8:54 ` [PATCH net-next v4 0/7] Faster SO_REUSEPORT " David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1455123041-22638-4-git-send-email-kraigatgoog@gmail.com \
--to=kraigatgoog@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).