]> xenbits.xensource.com Git - xenclient/kernel.git/commitdiff
commit ab6a5bb6b28a970104a34f0f6959b73cf61bdc72 git-427c2196b92697a4a8ee87959ebc16bfac024f6b
authort_jeang <devnull@localhost>
Tue, 6 Jan 2009 12:05:21 +0000 (12:05 +0000)
committert_jeang <devnull@localhost>
Tue, 6 Jan 2009 12:05:21 +0000 (12:05 +0000)
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
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 <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Edited: Ian Campbell -- just definition.

include/linux/tcp.h

index cd641f8ef4c5db33be1fbb650e03f4b07bf1a528..7524faf622fa5e4e36c3f211ad56e13293e8c7f7 100644 (file)
@@ -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;