Skip to contentSkip to conversation

forcedeth skb_gso_segment warning

DISCUSSION Applied Herbert Xu 2 participants 4 messages Jun 29, 2009 – Jun 30, 2009 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Herbert Xu

author
#1 lore raw
Quoted 6 lines · Johannes Berg

Happened a number of times:

Jun  8 18:56:25 johannes kernel: [33987.849090] ------------[ cut here ]------------
Jun  8 18:56:25 johannes kernel: [33987.849106] WARNING: at /home/johannes/sys/wireless-testing/net/core/dev.c:1560 skb_gso_segment+0x233/0x2e0()
Jun  8 18:56:25 johannes kernel: [33987.849110] Hardware name: MacBook5,1
Jun  8 18:56:25 johannes kernel: [33987.849114] forcedeth: caps=(0x10823, 0x19082b) len=65212 data_len=63712 ip_summed=0

Thank you!

This was the clue I needed. The fact that the packet is TSO and not completely non-linear.

tcp: Stop non-TSO packets morphing into TSO

If a socket starts out on a non-TSO route, and then switches to a TSO route, then the tail on the tx queue can morph into a TSO packet, causing mischief because the rest of the stack does not expect a partially linear TSO packet.

This patch fixes this by ensuring that skb->ip_summed is set to CHECKSUM_PARTIAL before declaring a packet as TSO.

net/ipv4/tcp_output.c +2 -1
index 416fc4c..5bdf08d 100644
@@ -725,7 +725,8 @@ static void tcp_queue_skb(struct sock *sk, struct sk_buff *skb)
 static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb,
 				 unsigned int mss_now)
 {
-	if (skb->len <= mss_now || !sk_can_gso(sk)) {
+	if (skb->len <= mss_now || !sk_can_gso(sk) ||
+	    skb->ip_summed == CHECKSUM_NONE) {
 		/* Avoid the costly divide in the normal
 		 * non-TSO case.
 		 */

Thanks,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
author
#2 lore raw
Quoted 2 lines · Herbert Xu

tcp: Stop non-TSO packets morphing into TSO

Here's a follow-up patch to optimise this boundary case.

tcp: Do not tack on TSO data to non-TSO packet

If a socket starts out on a non-TSO route, and then switches to a TSO route, then we will tack on data to the tail of the tx queue even if it started out life as non-TSO. This is suboptimal because all of it will then be copied and checksummed unnecessarily.

This patch fixes this by ensuring that skb->ip_summed is set to CHECKSUM_PARTIAL before appending extra data beyond the MSS.

net/ipv4/tcp.c +10 -5
index 17b89c5..7870a53 100644
@@ -903,13 +903,17 @@ int tcp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
 		iov++;
 
 		while (seglen > 0) {
-			int copy;
+			int copy = 0;
+			int max = size_goal;
 
 			skb = tcp_write_queue_tail(sk);
+			if (tcp_send_head(sk)) {
+				if (skb->ip_summed == CHECKSUM_NONE)
+					max = mss_now;
+				copy = max - skb->len;
+			}
 
-			if (!tcp_send_head(sk) ||
-			    (copy = size_goal - skb->len) <= 0) {
-
+			if (copy <= 0) {
 new_segment:
 				/* Allocate new segment. If the interface is SG,
 				 * allocate skb fitting to single page.
@@ -930,6 +934,7 @@ new_segment:
 
 				skb_entail(sk, skb);
 				copy = size_goal;
+				max = size_goal;
 			}
 
 			/* Try to append data to the end of skb. */
@@ -1028,7 +1033,7 @@ new_segment:
 			if ((seglen -= copy) == 0 && iovlen == 0)
 				goto out;
 
-			if (skb->len < size_goal || (flags & MSG_OOB))
+			if (skb->len < max || (flags & MSG_OOB))
 				continue;
 
 			if (forced_push(tp)) {

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
maintainer Applied
#3 lore raw

From: Herbert Xu <[email protected]>
Date: Mon, 29 Jun 2009 12:06:41 +0800

Quoted 13 lines · Herbert Xu
Quoted 2 lines

tcp: Stop non-TSO packets morphing into TSO

Here's a follow-up patch to optimise this boundary case.

tcp: Do not tack on TSO data to non-TSO packet

If a socket starts out on a non-TSO route, and then switches to a TSO route, then we will tack on data to the tail of the tx queue even if it started out life as non-TSO. This is suboptimal because all of it will then be copied and checksummed unnecessarily.

Quoted 4 lines

This patch fixes this by ensuring that skb->ip_summed is set to CHECKSUM_PARTIAL before appending extra data beyond the MSS.

Applied.

maintainer Applied
#4 lore raw
In reply to Herbert Xu

From: Herbert Xu <[email protected]>
Date: Mon, 29 Jun 2009 12:03:30 +0800

Quoted 11 lines

tcp: Stop non-TSO packets morphing into TSO

If a socket starts out on a non-TSO route, and then switches to a TSO route, then the tail on the tx queue can morph into a TSO packet, causing mischief because the rest of the stack does not expect a partially linear TSO packet.

This patch fixes this by ensuring that skb->ip_summed is set to CHECKSUM_PARTIAL before declaring a packet as TSO.

Applied.