diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2010-12-14 10:24:08 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-12-16 17:43:14 -0500 |
commit | 55508d601dab7df5cbcc7a63f4be8620eface204 (patch) | |
tree | 346f30fae9c726d2e73aba2e37ce1e4a31dcea8c /net | |
parent | 04fb451eff978ca059399eab83d5594b073caf6f (diff) |
net: Use skb_checksum_start_offset()
Replace skb->csum_start - skb_headroom(skb) with skb_checksum_start_offset().
Note for usb/smsc95xx: skb->data - skb->head == skb_headroom(skb).
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/dev.c | 6 | ||||
-rw-r--r-- | net/core/skbuff.c | 2 | ||||
-rw-r--r-- | net/ipv4/udp.c | 2 | ||||
-rw-r--r-- | net/packet/af_packet.c | 3 |
4 files changed, 6 insertions, 7 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 794b20de5d44..92d414ac0e30 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1793,7 +1793,7 @@ int skb_checksum_help(struct sk_buff *skb) | |||
1793 | goto out_set_summed; | 1793 | goto out_set_summed; |
1794 | } | 1794 | } |
1795 | 1795 | ||
1796 | offset = skb->csum_start - skb_headroom(skb); | 1796 | offset = skb_checksum_start_offset(skb); |
1797 | BUG_ON(offset >= skb_headlen(skb)); | 1797 | BUG_ON(offset >= skb_headlen(skb)); |
1798 | csum = skb_checksum(skb, offset, skb->len - offset, 0); | 1798 | csum = skb_checksum(skb, offset, skb->len - offset, 0); |
1799 | 1799 | ||
@@ -2090,8 +2090,8 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, | |||
2090 | * checksumming here. | 2090 | * checksumming here. |
2091 | */ | 2091 | */ |
2092 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 2092 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
2093 | skb_set_transport_header(skb, skb->csum_start - | 2093 | skb_set_transport_header(skb, |
2094 | skb_headroom(skb)); | 2094 | skb_checksum_start_offset(skb)); |
2095 | if (!dev_can_checksum(dev, skb) && | 2095 | if (!dev_can_checksum(dev, skb) && |
2096 | skb_checksum_help(skb)) | 2096 | skb_checksum_help(skb)) |
2097 | goto out_kfree_skb; | 2097 | goto out_kfree_skb; |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 8814a9a52f47..19d6c21220fd 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -1824,7 +1824,7 @@ void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to) | |||
1824 | long csstart; | 1824 | long csstart; |
1825 | 1825 | ||
1826 | if (skb->ip_summed == CHECKSUM_PARTIAL) | 1826 | if (skb->ip_summed == CHECKSUM_PARTIAL) |
1827 | csstart = skb->csum_start - skb_headroom(skb); | 1827 | csstart = skb_checksum_start_offset(skb); |
1828 | else | 1828 | else |
1829 | csstart = skb_headlen(skb); | 1829 | csstart = skb_headlen(skb); |
1830 | 1830 | ||
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index b37181da487c..1198adf45102 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -2226,7 +2226,7 @@ struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, int features) | |||
2226 | /* Do software UFO. Complete and fill in the UDP checksum as HW cannot | 2226 | /* Do software UFO. Complete and fill in the UDP checksum as HW cannot |
2227 | * do checksum of UDP packets sent as multiple IP fragments. | 2227 | * do checksum of UDP packets sent as multiple IP fragments. |
2228 | */ | 2228 | */ |
2229 | offset = skb->csum_start - skb_headroom(skb); | 2229 | offset = skb_checksum_start_offset(skb); |
2230 | csum = skb_checksum(skb, offset, skb->len - offset, 0); | 2230 | csum = skb_checksum(skb, offset, skb->len - offset, 0); |
2231 | offset += skb->csum_offset; | 2231 | offset += skb->csum_offset; |
2232 | *(__sum16 *)(skb->data + offset) = csum_fold(csum); | 2232 | *(__sum16 *)(skb->data + offset) = csum_fold(csum); |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index e79efaf06389..91cb1d71f018 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -1650,8 +1650,7 @@ static int packet_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1650 | 1650 | ||
1651 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 1651 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
1652 | vnet_hdr.flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; | 1652 | vnet_hdr.flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; |
1653 | vnet_hdr.csum_start = skb->csum_start - | 1653 | vnet_hdr.csum_start = skb_checksum_start_offset(skb); |
1654 | skb_headroom(skb); | ||
1655 | vnet_hdr.csum_offset = skb->csum_offset; | 1654 | vnet_hdr.csum_offset = skb->csum_offset; |
1656 | } /* else everything is zero */ | 1655 | } /* else everything is zero */ |
1657 | 1656 | ||