Skip to contentSkip to conversation

net:use help function of skb_checksum_start_offset to calculate offset

PATCH Applied Shan Wei 3 participants 6 messages Apr 22, 2011 – May 2, 2011

Subsystems (3)
lore
Share & tools
lore

Shan Wei

author
#0 lore raw

PATCH 1/3 net:use help function of skb_checksum_start_offset to calculate offset

Although these are equivalent, but the skb_checksum_start_offset() is more readable.

---
 drivers/net/tile/tilepro.c |    2 +-
 net/ipv6/udp.c             |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/tile/tilepro.c +1 -1
index 0825db6..1e980fd 100644
@@ -1930,7 +1930,7 @@ static int tile_net_tx(struct sk_buff *skb, struct net_device *dev)
 	unsigned int len = skb->len;
 	unsigned char *data = skb->data;
 
-	unsigned int csum_start = skb->csum_start - skb_headroom(skb);
+	unsigned int csum_start = skb_checksum_start_offset(skb);
 
 	lepp_frag_t frags[LEPP_MAX_FRAGS];
 
net/ipv6/udp.c +1 -1
index 15c3774..95c62a1 100644
@@ -1328,7 +1328,7 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, u32 features)
 	/* Do software UFO. Complete and fill in the UDP checksum as HW cannot
 	 * do checksum of UDP packets sent as multiple IP fragments.
 	 */
-	offset = skb->csum_start - skb_headroom(skb);
+	offset = skb_checksum_start_offset(skb);
 	csum = skb_checksum(skb, offset, skb->len- offset, 0);
 	offset += skb->csum_offset;
 	*(__sum16 *)(skb->data + offset) = csum_fold(csum);
Signature · 1 line
1.6.3.3
#2 lore raw
In reply to Shan Wei
Quoted 27 lines · Shan Wei

Although these are equivalent, but the skb_checksum_start_offset() is more readable.

---
 drivers/net/tile/tilepro.c |    2 +-
 net/ipv6/udp.c             |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/tile/tilepro.c +1 -1
index 0825db6..1e980fd 100644
@@ -1930,7 +1930,7 @@ static int tile_net_tx(struct sk_buff *skb, struct net_device *dev)
 	unsigned int len = skb->len;
 	unsigned char *data = skb->data;
 
-	unsigned int csum_start = skb->csum_start - skb_headroom(skb);
+	unsigned int csum_start = skb_checksum_start_offset(skb);
 
 	lepp_frag_t frags[LEPP_MAX_FRAGS];
 
net/ipv6/udp.c +0 -0
index 15c3774..95c62a1 100644

net/ipv6/udp.c static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, u32 features) · line 1334

Quoted 8 lines
net/ipv6/udp.c +1 -1
@@ -1328,7 +1328,7 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, u32 features)
 	/* Do software UFO. Complete and fill in the UDP checksum as HW cannot
 	 * do checksum of UDP packets sent as multiple IP fragments.
 	 */
-	offset = skb->csum_start - skb_headroom(skb);
+	offset = skb_checksum_start_offset(skb);
 	csum = skb_checksum(skb, offset, skb->len- offset, 0);
 	offset += skb->csum_offset;
 	*(__sum16 *)(skb->data + offset) = csum_fold(csum);

I took the drivers/net/tile/ change into my tree, but I'll defer to David or some other net person to take the net/ipv6/udp.c change. Thanks!

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
maintainer
#3 lore raw

From: Chris Metcalf <[email protected]>
Date: Mon, 2 May 2011 18:20:01 -0400

Quoted 2 lines

I took the drivers/net/tile/ change into my tree, but I'll defer to David or some other net person to take the net/ipv6/udp.c change. Thanks!

I took them both into my tree. Didn't you see my reply?

#4 lore raw
Quoted 6 lines · David Miller

From: Chris Metcalf <[email protected]>
Date: Mon, 2 May 2011 18:20:01 -0400

Quoted 2 lines

I took the drivers/net/tile/ change into my tree, but I'll defer to David or some other net person to take the net/ipv6/udp.c change. Thanks!

I took them both into my tree. Didn't you see my reply?

I did, but I didn't see the change yet in .39-rc5, so I figured it would be harmless to also take it into the tile tree. And, I thought you might have just taken the platform-independent part of the change. I'll revert the tile part of the change out of my tree. Thanks!

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
maintainer
#5 lore raw

From: Chris Metcalf <[email protected]>
Date: Mon, 2 May 2011 18:29:11 -0400

Quoted 10 lines · David Miller
Quoted 6 lines

From: Chris Metcalf <[email protected]>
Date: Mon, 2 May 2011 18:20:01 -0400

Quoted 2 lines

I took the drivers/net/tile/ change into my tree, but I'll defer to David or some other net person to take the net/ipv6/udp.c change. Thanks!

I took them both into my tree. Didn't you see my reply?

I did, but I didn't see the change yet in .39-rc5, so I figured it would be harmless to also take it into the tile tree.

This change will show up in net-next-2.6 and as a consequence linux-2.6-next