diff options
author | Patrick McHardy <kaber@trash.net> | 2006-08-29 19:44:56 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-22 17:53:53 -0400 |
commit | 84fa7933a33f806bbbaae6775e87459b1ec584c0 (patch) | |
tree | 5be404225d90f640997b12f631e9b496b3fd0d61 /net/core/dev.c | |
parent | 8584d6df39db5601965f9bc5e3bf2fea833ad7bb (diff) |
[NET]: Replace CHECKSUM_HW by CHECKSUM_PARTIAL/CHECKSUM_COMPLETE
Replace CHECKSUM_HW by CHECKSUM_PARTIAL (for outgoing packets, whose
checksum still needs to be completed) and CHECKSUM_COMPLETE (for
incoming packets, device supplied full checksum).
Patch originally from Herbert Xu, updated by myself for 2.6.18-rc3.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index d4a1ec3bded5..fc82f6f6e1c1 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1166,12 +1166,12 @@ EXPORT_SYMBOL(netif_device_attach); | |||
1166 | * Invalidate hardware checksum when packet is to be mangled, and | 1166 | * Invalidate hardware checksum when packet is to be mangled, and |
1167 | * complete checksum manually on outgoing path. | 1167 | * complete checksum manually on outgoing path. |
1168 | */ | 1168 | */ |
1169 | int skb_checksum_help(struct sk_buff *skb, int inward) | 1169 | int skb_checksum_help(struct sk_buff *skb) |
1170 | { | 1170 | { |
1171 | unsigned int csum; | 1171 | unsigned int csum; |
1172 | int ret = 0, offset = skb->h.raw - skb->data; | 1172 | int ret = 0, offset = skb->h.raw - skb->data; |
1173 | 1173 | ||
1174 | if (inward) | 1174 | if (skb->ip_summed == CHECKSUM_COMPLETE) |
1175 | goto out_set_summed; | 1175 | goto out_set_summed; |
1176 | 1176 | ||
1177 | if (unlikely(skb_shinfo(skb)->gso_size)) { | 1177 | if (unlikely(skb_shinfo(skb)->gso_size)) { |
@@ -1223,7 +1223,7 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features) | |||
1223 | skb->mac_len = skb->nh.raw - skb->data; | 1223 | skb->mac_len = skb->nh.raw - skb->data; |
1224 | __skb_pull(skb, skb->mac_len); | 1224 | __skb_pull(skb, skb->mac_len); |
1225 | 1225 | ||
1226 | if (unlikely(skb->ip_summed != CHECKSUM_HW)) { | 1226 | if (unlikely(skb->ip_summed != CHECKSUM_PARTIAL)) { |
1227 | if (skb_header_cloned(skb) && | 1227 | if (skb_header_cloned(skb) && |
1228 | (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC))) | 1228 | (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC))) |
1229 | return ERR_PTR(err); | 1229 | return ERR_PTR(err); |
@@ -1232,7 +1232,7 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features) | |||
1232 | rcu_read_lock(); | 1232 | rcu_read_lock(); |
1233 | list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type) & 15], list) { | 1233 | list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type) & 15], list) { |
1234 | if (ptype->type == type && !ptype->dev && ptype->gso_segment) { | 1234 | if (ptype->type == type && !ptype->dev && ptype->gso_segment) { |
1235 | if (unlikely(skb->ip_summed != CHECKSUM_HW)) { | 1235 | if (unlikely(skb->ip_summed != CHECKSUM_PARTIAL)) { |
1236 | err = ptype->gso_send_check(skb); | 1236 | err = ptype->gso_send_check(skb); |
1237 | segs = ERR_PTR(err); | 1237 | segs = ERR_PTR(err); |
1238 | if (err || skb_gso_ok(skb, features)) | 1238 | if (err || skb_gso_ok(skb, features)) |
@@ -1444,11 +1444,11 @@ int dev_queue_xmit(struct sk_buff *skb) | |||
1444 | /* If packet is not checksummed and device does not support | 1444 | /* If packet is not checksummed and device does not support |
1445 | * checksumming for this protocol, complete checksumming here. | 1445 | * checksumming for this protocol, complete checksumming here. |
1446 | */ | 1446 | */ |
1447 | if (skb->ip_summed == CHECKSUM_HW && | 1447 | if (skb->ip_summed == CHECKSUM_PARTIAL && |
1448 | (!(dev->features & NETIF_F_GEN_CSUM) && | 1448 | (!(dev->features & NETIF_F_GEN_CSUM) && |
1449 | (!(dev->features & NETIF_F_IP_CSUM) || | 1449 | (!(dev->features & NETIF_F_IP_CSUM) || |
1450 | skb->protocol != htons(ETH_P_IP)))) | 1450 | skb->protocol != htons(ETH_P_IP)))) |
1451 | if (skb_checksum_help(skb, 0)) | 1451 | if (skb_checksum_help(skb)) |
1452 | goto out_kfree_skb; | 1452 | goto out_kfree_skb; |
1453 | 1453 | ||
1454 | gso: | 1454 | gso: |