[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>
This commit is contained in:
committed by
David S. Miller
parent
8584d6df39
commit
84fa7933a3
@ -1166,12 +1166,12 @@ EXPORT_SYMBOL(netif_device_attach);
|
||||
* Invalidate hardware checksum when packet is to be mangled, and
|
||||
* complete checksum manually on outgoing path.
|
||||
*/
|
||||
int skb_checksum_help(struct sk_buff *skb, int inward)
|
||||
int skb_checksum_help(struct sk_buff *skb)
|
||||
{
|
||||
unsigned int csum;
|
||||
int ret = 0, offset = skb->h.raw - skb->data;
|
||||
|
||||
if (inward)
|
||||
if (skb->ip_summed == CHECKSUM_COMPLETE)
|
||||
goto out_set_summed;
|
||||
|
||||
if (unlikely(skb_shinfo(skb)->gso_size)) {
|
||||
@ -1223,7 +1223,7 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features)
|
||||
skb->mac_len = skb->nh.raw - skb->data;
|
||||
__skb_pull(skb, skb->mac_len);
|
||||
|
||||
if (unlikely(skb->ip_summed != CHECKSUM_HW)) {
|
||||
if (unlikely(skb->ip_summed != CHECKSUM_PARTIAL)) {
|
||||
if (skb_header_cloned(skb) &&
|
||||
(err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
|
||||
return ERR_PTR(err);
|
||||
@ -1232,7 +1232,7 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features)
|
||||
rcu_read_lock();
|
||||
list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type) & 15], list) {
|
||||
if (ptype->type == type && !ptype->dev && ptype->gso_segment) {
|
||||
if (unlikely(skb->ip_summed != CHECKSUM_HW)) {
|
||||
if (unlikely(skb->ip_summed != CHECKSUM_PARTIAL)) {
|
||||
err = ptype->gso_send_check(skb);
|
||||
segs = ERR_PTR(err);
|
||||
if (err || skb_gso_ok(skb, features))
|
||||
@ -1444,11 +1444,11 @@ int dev_queue_xmit(struct sk_buff *skb)
|
||||
/* If packet is not checksummed and device does not support
|
||||
* checksumming for this protocol, complete checksumming here.
|
||||
*/
|
||||
if (skb->ip_summed == CHECKSUM_HW &&
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL &&
|
||||
(!(dev->features & NETIF_F_GEN_CSUM) &&
|
||||
(!(dev->features & NETIF_F_IP_CSUM) ||
|
||||
skb->protocol != htons(ETH_P_IP))))
|
||||
if (skb_checksum_help(skb, 0))
|
||||
if (skb_checksum_help(skb))
|
||||
goto out_kfree_skb;
|
||||
|
||||
gso:
|
||||
|
Reference in New Issue
Block a user