[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>
This commit is contained in:
committed by
David S. Miller
parent
0272ffc46f
commit
c9bdd4b525
@ -41,6 +41,7 @@
|
||||
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <net/ip.h>
|
||||
|
||||
MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
@ -778,9 +779,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
|
||||
if (skb_shinfo(skb)->gso_size > 0) {
|
||||
|
||||
no_of_desc++;
|
||||
if (((skb->nh.iph)->ihl * sizeof(u32)) +
|
||||
((skb->h.th)->doff * sizeof(u32)) +
|
||||
sizeof(struct ethhdr) >
|
||||
if ((ip_hdrlen(skb) + skb->h.th->doff * 4 +
|
||||
sizeof(struct ethhdr)) >
|
||||
(sizeof(struct cmd_desc_type0) - 2)) {
|
||||
no_of_desc++;
|
||||
}
|
||||
|
Reference in New Issue
Block a user