diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2011-06-21 23:33:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-06-21 23:33:34 -0400 |
commit | 56f8a75c17abb854b5907f4a815dc4c3f186ba11 (patch) | |
tree | 6ba333b7668ce7dd04cddecf4f15a0a48b335991 /drivers/net | |
parent | f470e5ae34d68880a38aa79ee5c102ebc2a1aef6 (diff) |
ip: introduce ip_is_fragment helper inline function
There are enough instances of this:
iph->frag_off & htons(IP_MF | IP_OFFSET)
that a helper function is probably warranted.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 2 | ||||
-rw-r--r-- | drivers/net/ioc3-eth.c | 2 | ||||
-rw-r--r-- | drivers/net/myri10ge/myri10ge.c | 2 | ||||
-rw-r--r-- | drivers/net/s2io.c | 2 | ||||
-rw-r--r-- | drivers/net/sfc/filter.c | 2 | ||||
-rw-r--r-- | drivers/net/vxge/vxge-main.c | 2 |
6 files changed, 6 insertions, 6 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index d117280b9cd8..ebb1d219b45c 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -3438,7 +3438,7 @@ static int bond_xmit_hash_policy_l34(struct sk_buff *skb, int count) | |||
3438 | int layer4_xor = 0; | 3438 | int layer4_xor = 0; |
3439 | 3439 | ||
3440 | if (skb->protocol == htons(ETH_P_IP)) { | 3440 | if (skb->protocol == htons(ETH_P_IP)) { |
3441 | if (!(iph->frag_off & htons(IP_MF|IP_OFFSET)) && | 3441 | if (!ip_is_fragment(iph) && |
3442 | (iph->protocol == IPPROTO_TCP || | 3442 | (iph->protocol == IPPROTO_TCP || |
3443 | iph->protocol == IPPROTO_UDP)) { | 3443 | iph->protocol == IPPROTO_UDP)) { |
3444 | layer4_xor = ntohs((*layer4hdr ^ *(layer4hdr + 1))); | 3444 | layer4_xor = ntohs((*layer4hdr ^ *(layer4hdr + 1))); |
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c index 32f07f868d89..318a25a92310 100644 --- a/drivers/net/ioc3-eth.c +++ b/drivers/net/ioc3-eth.c | |||
@@ -532,7 +532,7 @@ static void ioc3_tcpudp_checksum(struct sk_buff *skb, uint32_t hwsum, int len) | |||
532 | return; | 532 | return; |
533 | 533 | ||
534 | ih = (struct iphdr *) ((char *)eh + ETH_HLEN); | 534 | ih = (struct iphdr *) ((char *)eh + ETH_HLEN); |
535 | if (ih->frag_off & htons(IP_MF | IP_OFFSET)) | 535 | if (ip_is_fragment(ih)) |
536 | return; | 536 | return; |
537 | 537 | ||
538 | proto = ih->protocol; | 538 | proto = ih->protocol; |
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index 3e89a842fc5e..3ed5f3505cea 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -2257,7 +2257,7 @@ myri10ge_get_frag_header(struct skb_frag_struct *frag, void **mac_hdr, | |||
2257 | *ip_hdr = iph; | 2257 | *ip_hdr = iph; |
2258 | if (iph->protocol != IPPROTO_TCP) | 2258 | if (iph->protocol != IPPROTO_TCP) |
2259 | return -1; | 2259 | return -1; |
2260 | if (iph->frag_off & htons(IP_MF | IP_OFFSET)) | 2260 | if (ip_is_fragment(iph)) |
2261 | return -1; | 2261 | return -1; |
2262 | *hdr_flags |= LRO_TCP; | 2262 | *hdr_flags |= LRO_TCP; |
2263 | *tcpudp_hdr = (u8 *) (*ip_hdr) + (iph->ihl << 2); | 2263 | *tcpudp_hdr = (u8 *) (*ip_hdr) + (iph->ihl << 2); |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index f4d80f9050ef..043850b8c304 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -4109,7 +4109,7 @@ static netdev_tx_t s2io_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4109 | struct tcphdr *th; | 4109 | struct tcphdr *th; |
4110 | ip = ip_hdr(skb); | 4110 | ip = ip_hdr(skb); |
4111 | 4111 | ||
4112 | if ((ip->frag_off & htons(IP_OFFSET|IP_MF)) == 0) { | 4112 | if (!ip_is_fragment(ip)) { |
4113 | th = (struct tcphdr *)(((unsigned char *)ip) + | 4113 | th = (struct tcphdr *)(((unsigned char *)ip) + |
4114 | ip->ihl*4); | 4114 | ip->ihl*4); |
4115 | 4115 | ||
diff --git a/drivers/net/sfc/filter.c b/drivers/net/sfc/filter.c index 95a980fd63d5..f2fc2587c09d 100644 --- a/drivers/net/sfc/filter.c +++ b/drivers/net/sfc/filter.c | |||
@@ -652,7 +652,7 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, | |||
652 | /* RFS must validate the IP header length before calling us */ | 652 | /* RFS must validate the IP header length before calling us */ |
653 | EFX_BUG_ON_PARANOID(!pskb_may_pull(skb, nhoff + sizeof(*ip))); | 653 | EFX_BUG_ON_PARANOID(!pskb_may_pull(skb, nhoff + sizeof(*ip))); |
654 | ip = (const struct iphdr *)(skb->data + nhoff); | 654 | ip = (const struct iphdr *)(skb->data + nhoff); |
655 | if (ip->frag_off & htons(IP_MF | IP_OFFSET)) | 655 | if (ip_is_fragment(ip)) |
656 | return -EPROTONOSUPPORT; | 656 | return -EPROTONOSUPPORT; |
657 | EFX_BUG_ON_PARANOID(!pskb_may_pull(skb, nhoff + 4 * ip->ihl + 4)); | 657 | EFX_BUG_ON_PARANOID(!pskb_may_pull(skb, nhoff + 4 * ip->ihl + 4)); |
658 | ports = (const __be16 *)(skb->data + nhoff + 4 * ip->ihl); | 658 | ports = (const __be16 *)(skb->data + nhoff + 4 * ip->ihl); |
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c index 54ca74806bb6..1c92af392992 100644 --- a/drivers/net/vxge/vxge-main.c +++ b/drivers/net/vxge/vxge-main.c | |||
@@ -633,7 +633,7 @@ static u32 vxge_get_vpath_no(struct vxgedev *vdev, struct sk_buff *skb) | |||
633 | 633 | ||
634 | ip = ip_hdr(skb); | 634 | ip = ip_hdr(skb); |
635 | 635 | ||
636 | if ((ip->frag_off & htons(IP_OFFSET|IP_MF)) == 0) { | 636 | if (!ip_is_fragment(ip)) { |
637 | th = (struct tcphdr *)(((unsigned char *)ip) + | 637 | th = (struct tcphdr *)(((unsigned char *)ip) + |
638 | ip->ihl*4); | 638 | ip->ihl*4); |
639 | 639 | ||