From: t_jeang Date: Tue, 6 Jan 2009 12:05:21 +0000 (+0000) Subject: commit ab6a5bb6b28a970104a34f0f6959b73cf61bdc72 X-Git-Tag: git-427c2196b92697a4a8ee87959ebc16bfac024f6b X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=b8a645e80a14de8f27e1724cea9f3a1f4d1aaaf7;p=xenclient%2Fkernel.git commit ab6a5bb6b28a970104a34f0f6959b73cf61bdc72 Author: Arnaldo Carvalho de Melo Date: Sun Mar 18 17:43:48 2007 -0700 [TCP]: Introduce tcp_hdrlen() and tcp_optlen() The ip_hdrlen() buddy, created to reduce the number of skb->h.th-> uses and to avoid the longer, open coded equivalent. Ditched a no-op in bnx2 in the process. I wonder if we should have a BUG_ON(skb->h.th->doff < 5) in tcp_optlen()... Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: David S. Miller Edited: Ian Campbell -- just definition. --- diff --git a/include/linux/tcp.h b/include/linux/tcp.h index cd641f8e..7524faf6 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -170,6 +170,16 @@ static inline struct tcphdr *tcp_hdr(const struct sk_buff *skb) return skb->h.th; } +static inline unsigned int tcp_hdrlen(const struct sk_buff *skb) +{ + return skb->h.th->doff * 4; +} + +static inline unsigned int tcp_optlen(const struct sk_buff *skb) +{ + return (skb->h.th->doff - 5) * 4; +} + /* This defines a selective acknowledgement block. */ struct tcp_sack_block { __u32 start_seq;