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/netxen | |
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/netxen')
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 8 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 6 |
2 files changed, 8 insertions, 6 deletions
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 625e11ed6aae..b2f5032937e3 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -35,6 +35,8 @@ | |||
35 | #include "netxen_nic_hw.h" | 35 | #include "netxen_nic_hw.h" |
36 | #include "netxen_nic_phan_reg.h" | 36 | #include "netxen_nic_phan_reg.h" |
37 | 37 | ||
38 | #include <net/ip.h> | ||
39 | |||
38 | /* PCI Windowing for DDR regions. */ | 40 | /* PCI Windowing for DDR regions. */ |
39 | 41 | ||
40 | #define ADDR_IN_RANGE(addr, low, high) \ | 42 | #define ADDR_IN_RANGE(addr, low, high) \ |
@@ -371,9 +373,9 @@ void netxen_tso_check(struct netxen_adapter *adapter, | |||
371 | struct cmd_desc_type0 *desc, struct sk_buff *skb) | 373 | struct cmd_desc_type0 *desc, struct sk_buff *skb) |
372 | { | 374 | { |
373 | if (desc->mss) { | 375 | if (desc->mss) { |
374 | desc->total_hdr_length = sizeof(struct ethhdr) + | 376 | desc->total_hdr_length = (sizeof(struct ethhdr) + |
375 | ((skb->nh.iph)->ihl * sizeof(u32)) + | 377 | ip_hdrlen(skb) + |
376 | ((skb->h.th)->doff * sizeof(u32)); | 378 | skb->h.th->doff * 4); |
377 | netxen_set_cmd_desc_opcode(desc, TX_TCP_LSO); | 379 | netxen_set_cmd_desc_opcode(desc, TX_TCP_LSO); |
378 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { | 380 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { |
379 | if (skb->nh.iph->protocol == IPPROTO_TCP) { | 381 | if (skb->nh.iph->protocol == IPPROTO_TCP) { |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 7d2525e76abb..b548a30e5c8e 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -41,6 +41,7 @@ | |||
41 | 41 | ||
42 | #include <linux/dma-mapping.h> | 42 | #include <linux/dma-mapping.h> |
43 | #include <linux/vmalloc.h> | 43 | #include <linux/vmalloc.h> |
44 | #include <net/ip.h> | ||
44 | 45 | ||
45 | MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); | 46 | MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); |
46 | MODULE_LICENSE("GPL"); | 47 | MODULE_LICENSE("GPL"); |
@@ -778,9 +779,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
778 | if (skb_shinfo(skb)->gso_size > 0) { | 779 | if (skb_shinfo(skb)->gso_size > 0) { |
779 | 780 | ||
780 | no_of_desc++; | 781 | no_of_desc++; |
781 | if (((skb->nh.iph)->ihl * sizeof(u32)) + | 782 | if ((ip_hdrlen(skb) + skb->h.th->doff * 4 + |
782 | ((skb->h.th)->doff * sizeof(u32)) + | 783 | sizeof(struct ethhdr)) > |
783 | sizeof(struct ethhdr) > | ||
784 | (sizeof(struct cmd_desc_type0) - 2)) { | 784 | (sizeof(struct cmd_desc_type0) - 2)) { |
785 | no_of_desc++; | 785 | no_of_desc++; |
786 | } | 786 | } |