diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-03-12 19:09:15 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:25:07 -0400 |
commit | c9bdd4b5257406b0608385d19c40b5511decf4f6 (patch) | |
tree | fe5319c322a11c0b00e7ef0473762a8d1961da83 /drivers/net/sky2.c | |
parent | 0272ffc46f81a4bbbf302ba093c737e969c5bb55 (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/sky2.c')
-rw-r--r-- | drivers/net/sky2.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index ac36152c68bf..51e994f26a84 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/ethtool.h> | 32 | #include <linux/ethtool.h> |
33 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
34 | #include <linux/ip.h> | 34 | #include <linux/ip.h> |
35 | #include <net/ip.h> | ||
35 | #include <linux/tcp.h> | 36 | #include <linux/tcp.h> |
36 | #include <linux/in.h> | 37 | #include <linux/in.h> |
37 | #include <linux/delay.h> | 38 | #include <linux/delay.h> |
@@ -1392,7 +1393,7 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev) | |||
1392 | mss = skb_shinfo(skb)->gso_size; | 1393 | mss = skb_shinfo(skb)->gso_size; |
1393 | if (mss != 0) { | 1394 | if (mss != 0) { |
1394 | mss += ((skb->h.th->doff - 5) * 4); /* TCP options */ | 1395 | mss += ((skb->h.th->doff - 5) * 4); /* TCP options */ |
1395 | mss += (skb->nh.iph->ihl * 4) + sizeof(struct tcphdr); | 1396 | mss += ip_hdrlen(skb) + sizeof(struct tcphdr); |
1396 | mss += ETH_HLEN; | 1397 | mss += ETH_HLEN; |
1397 | 1398 | ||
1398 | if (mss != sky2->tx_last_mss) { | 1399 | if (mss != sky2->tx_last_mss) { |