aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-03-12 19:09:15 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:25:07 -0400
commitc9bdd4b5257406b0608385d19c40b5511decf4f6 (patch)
treefe5319c322a11c0b00e7ef0473762a8d1961da83 /drivers/net/tg3.c
parent0272ffc46f81a4bbbf302ba093c737e969c5bb55 (diff)
[IP]: Introduce ip_hdrlen()
For the common sequence "skb->nh.iph->ihl * 4", removing a good number of open coded skb->nh.iph uses, now to go after the rest... Just out of curiosity, here are the idioms found to get the same result: skb->nh.iph->ihl << 2 skb->nh.iph->ihl<<2 skb->nh.iph->ihl * 4 skb->nh.iph->ihl*4 (skb->nh.iph)->ihl * sizeof(u32) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 256969e1300c..62a3bba0097d 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -40,6 +40,7 @@
40#include <linux/dma-mapping.h> 40#include <linux/dma-mapping.h>
41 41
42#include <net/checksum.h> 42#include <net/checksum.h>
43#include <net/ip.h>
43 44
44#include <asm/system.h> 45#include <asm/system.h>
45#include <asm/io.h> 46#include <asm/io.h>
@@ -3909,8 +3910,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
3909 mss |= (skb_headlen(skb) - ETH_HLEN) << 9; 3910 mss |= (skb_headlen(skb) - ETH_HLEN) << 9;
3910 else { 3911 else {
3911 tcp_opt_len = ((skb->h.th->doff - 5) * 4); 3912 tcp_opt_len = ((skb->h.th->doff - 5) * 4);
3912 ip_tcp_len = (skb->nh.iph->ihl * 4) + 3913 ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr);
3913 sizeof(struct tcphdr);
3914 3914
3915 skb->nh.iph->check = 0; 3915 skb->nh.iph->check = 0;
3916 skb->nh.iph->tot_len = htons(mss + ip_tcp_len + 3916 skb->nh.iph->tot_len = htons(mss + ip_tcp_len +
@@ -4064,7 +4064,7 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev)
4064 } 4064 }
4065 4065
4066 tcp_opt_len = ((skb->h.th->doff - 5) * 4); 4066 tcp_opt_len = ((skb->h.th->doff - 5) * 4);
4067 ip_tcp_len = (skb->nh.iph->ihl * 4) + sizeof(struct tcphdr); 4067 ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr);
4068 4068
4069 hdr_len = ip_tcp_len + tcp_opt_len; 4069 hdr_len = ip_tcp_len + tcp_opt_len;
4070 if (unlikely((ETH_HLEN + hdr_len) > 80) && 4070 if (unlikely((ETH_HLEN + hdr_len) > 80) &&