[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>
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 76a31af..7ca30d7 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -3911,7 +3911,7 @@
else {
struct iphdr *iph = ip_hdr(skb);
- tcp_opt_len = ((skb->h.th->doff - 5) * 4);
+ tcp_opt_len = tcp_optlen(skb);
ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr);
iph->check = 0;
@@ -4065,7 +4065,7 @@
goto out_unlock;
}
- tcp_opt_len = ((skb->h.th->doff - 5) * 4);
+ tcp_opt_len = tcp_optlen(skb);
ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr);
hdr_len = ip_tcp_len + tcp_opt_len;