From harry@omnisec.de  Sun Apr  8 17:31:22 2007
Return-Path: <harry@omnisec.de>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 085CE16A403
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  8 Apr 2007 17:31:22 +0000 (UTC)
	(envelope-from harry@omnisec.de)
Received: from host.omnisec.de (host.omnisec.de [62.245.232.135])
	by mx1.freebsd.org (Postfix) with ESMTP id 51C1113C4C3
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  8 Apr 2007 17:31:20 +0000 (UTC)
	(envelope-from harry@omnisec.de)
Received: from tek.flintsbach.schmalzbauer.de (tek.flintsbach.schmalzbauer.de [172.21.2.3])
	by host.omnisec.de (8.13.8/8.13.8) with ESMTP id l38HVE16065589
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 8 Apr 2007 19:31:19 +0200 (CEST)
	(envelope-from harry@titan.flintsbach.schmalzbauer.de)
Received: from titan.flintsbach.schmalzbauer.de (titan.flintsbach.schmalzbauer.de [IPv6:fec0::1:0:0:1:1])
	by tek.flintsbach.schmalzbauer.de (8.13.8/8.13.8) with ESMTP id l38HVEDT048618
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 8 Apr 2007 19:31:14 +0200 (CEST)
	(envelope-from harry@titan.flintsbach.schmalzbauer.de)
Received: (from harry@localhost)
	by titan.flintsbach.schmalzbauer.de (8.13.8/8.13.8/Submit) id l38HVEwk011353;
	Sun, 8 Apr 2007 19:31:14 +0200 (CEST)
	(envelope-from harry)
Message-Id: <200704081731.l38HVEwk011353@titan.flintsbach.schmalzbauer.de>
Date: Sun, 8 Apr 2007 19:31:14 +0200 (CEST)
From: Harald Schmalzbauer <harry@omnisec.de>
Reply-To: Harald Schmalzbauer <harry@omnisec.de>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: msk hw checksum problem
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         111384
>Category:       kern
>Synopsis:       msk: msk hw checksum problem
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    yongari
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 08 17:40:02 GMT 2007
>Closed-Date:    Sat Apr 14 02:44:17 GMT 2007
>Last-Modified:  Sat Apr 14 02:44:17 GMT 2007
>Originator:     Harald Schmalzbauer
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD titan.flintsbach.schmalzbauer.de 7.0-CURRENT FreeBSD 7.0-CURRENT #4: Sun Apr 8 16:10:26 CEST 2007 root@titan.flintsbach.schmalzbauer.de:/usr/obj/usr/src/sys/TITAN i386


	src from 5. April
>Description:
	By default msk runs with:
	options=19a<TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4>
	This leads to "TCP CHECKSUM INCORRECT" messages captured with wireshark.
	The problem was that I could not connect to some websites (www.freshports.org)
	My site sent TCP ZeroWindowProbe - I don't know why!!!
	After disabling txcsum (ifconfig msk0 -txcsum) www.freshports.org communication is ok.
>How-To-Repeat:
	Under 7.0-current use any web browser and try to connect to http://www.freshports.org
	You won't get a connection.
	Now do 'ifconfig msk0 -txcsum' and reconnect.
	You'll see what you expected.
	Here's what wireshark captured with txcsum on (failing connection):
No.     Time        Source                Destination           Protocol Info
      1 0.000000    172.21.1.0            64.147.113.42         TCP      55771 > http [SYN] Seq=0 [TCP CHECKSUM INCORRECT] Len=0 MSS=1460 WS=8 TSV=2163927 TSER=0

Frame 1 (74 bytes on wire, 74 bytes captured)
Ethernet II, Src: Giga-Byt_80:cd:51 (00:16:e6:80:cd:51), Dst: Olicom_c0:33:71 (00:00:24:c0:33:71)
Internet Protocol, Src: 172.21.1.0 (172.21.1.0), Dst: 64.147.113.42 (64.147.113.42)
Transmission Control Protocol, Src Port: 55771 (55771), Dst Port: http (80), Seq: 0, Len: 0

No.     Time        Source                Destination           Protocol Info
      2 0.099367    64.147.113.42         172.21.1.0            TCP      http > 55771 [SYN, ACK] Seq=0 Ack=1 Win=0 Len=0 MSS=1452

Frame 2 (60 bytes on wire, 60 bytes captured)
Ethernet II, Src: Olicom_c0:33:71 (00:00:24:c0:33:71), Dst: Giga-Byt_80:cd:51 (00:16:e6:80:cd:51)
Internet Protocol, Src: 64.147.113.42 (64.147.113.42), Dst: 172.21.1.0 (172.21.1.0)
Transmission Control Protocol, Src Port: http (80), Dst Port: 55771 (55771), Seq: 0, Ack: 1, Len: 0

No.     Time        Source                Destination           Protocol Info
      3 0.099431    172.21.1.0            64.147.113.42         TCP      55771 > http [ACK] Seq=1 Ack=1 Win=65535 [TCP CHECKSUM INCORRECT] Len=0

Frame 3 (54 bytes on wire, 54 bytes captured)
Ethernet II, Src: Giga-Byt_80:cd:51 (00:16:e6:80:cd:51), Dst: Olicom_c0:33:71 (00:00:24:c0:33:71)
Internet Protocol, Src: 172.21.1.0 (172.21.1.0), Dst: 64.147.113.42 (64.147.113.42)
Transmission Control Protocol, Src Port: 55771 (55771), Dst Port: http (80), Seq: 1, Ack: 1, Len: 0

No.     Time        Source                Destination           Protocol Info
      4 5.281304    172.21.1.0            64.147.113.42         TCP      [TCP ZeroWindowProbe] 55771 > http [ACK] Seq=1 Ack=1 Win=65535 [TCP CHECKSUM INCORRECT] Len=1

Frame 4 (55 bytes on wire, 55 bytes captured)
Ethernet II, Src: Giga-Byt_80:cd:51 (00:16:e6:80:cd:51), Dst: Olicom_c0:33:71 (00:00:24:c0:33:71)
Internet Protocol, Src: 172.21.1.0 (172.21.1.0), Dst: 64.147.113.42 (64.147.113.42)
Transmission Control Protocol, Src Port: 55771 (55771), Dst Port: http (80), Seq: 1, Ack: 1, Len: 1

No.     Time        Source                Destination           Protocol Info
      5 10.445927   172.21.1.0            64.147.113.42         TCP      [TCP ZeroWindowProbe] 55771 > http [ACK] Seq=1 Ack=1 Win=65535 [TCP CHECKSUM INCORRECT] Len=1

Frame 5 (55 bytes on wire, 55 bytes captured)
Ethernet II, Src: Giga-Byt_80:cd:51 (00:16:e6:80:cd:51), Dst: Olicom_c0:33:71 (00:00:24:c0:33:71)
Internet Protocol, Src: 172.21.1.0 (172.21.1.0), Dst: 64.147.113.42 (64.147.113.42)
Transmission Control Protocol, Src Port: 55771 (55771), Dst Port: http (80), Seq: 1, Ack: 1, Len: 1

No.     Time        Source                Destination           Protocol Info
      6 11.600999   172.21.1.0            64.147.113.42         HTTP     Continuation or non-HTTP traffic

Frame 6 (55 bytes on wire, 55 bytes captured)
Ethernet II, Src: Giga-Byt_80:cd:51 (00:16:e6:80:cd:51), Dst: Olicom_c0:33:71 (00:00:24:c0:33:71)
Internet Protocol, Src: 172.21.1.0 (172.21.1.0), Dst: 64.147.113.42 (64.147.113.42)
Transmission Control Protocol, Src Port: 60906 (60906), Dst Port: http (80), Seq: 0, Ack: 0, Len: 1
Hypertext Transfer Protocol

No.     Time        Source                Destination           Protocol Info
      7 15.635975   172.21.1.0            64.147.113.42         TCP      [TCP ZeroWindowProbe] 55771 > http [ACK] Seq=1 Ack=1 Win=65535 [TCP CHECKSUM INCORRECT] Len=1

Frame 7 (55 bytes on wire, 55 bytes captured)
Ethernet II, Src: Giga-Byt_80:cd:51 (00:16:e6:80:cd:51), Dst: Olicom_c0:33:71 (00:00:24:c0:33:71)
Internet Protocol, Src: 172.21.1.0 (172.21.1.0), Dst: 64.147.113.42 (64.147.113.42)
Transmission Control Protocol, Src Port: 55771 (55771), Dst Port: http (80), Seq: 1, Ack: 1, Len: 1

No.     Time        Source                Destination           Protocol Info
      8 22.410580   172.21.1.0            64.147.113.42         TCP      [TCP ZeroWindowProbe] 55771 > http [ACK] Seq=1 Ack=1 Win=65535 [TCP CHECKSUM INCORRECT] Len=1

Frame 8 (55 bytes on wire, 55 bytes captured)
Ethernet II, Src: Giga-Byt_80:cd:51 (00:16:e6:80:cd:51), Dst: Olicom_c0:33:71 (00:00:24:c0:33:71)
Internet Protocol, Src: 172.21.1.0 (172.21.1.0), Dst: 64.147.113.42 (64.147.113.42)
Transmission Control Protocol, Src Port: 55771 (55771), Dst Port: http (80), Seq: 1, Ack: 1, Len: 1

No.     Time        Source                Destination           Protocol Info
      9 35.797198   172.21.1.0            64.147.113.42         TCP      [TCP ZeroWindowProbe] 55771 > http [ACK] Seq=1 Ack=1 Win=65535 [TCP CHECKSUM INCORRECT] Len=1

Frame 9 (55 bytes on wire, 55 bytes captured)
Ethernet II, Src: Giga-Byt_80:cd:51 (00:16:e6:80:cd:51), Dst: Olicom_c0:33:71 (00:00:24:c0:33:71)
Internet Protocol, Src: 172.21.1.0 (172.21.1.0), Dst: 64.147.113.42 (64.147.113.42)
Transmission Control Protocol, Src Port: 55771 (55771), Dst Port: http (80), Seq: 1, Ack: 1, Len: 1

No.     Time        Source                Destination           Protocol Info
     10 41.158461   172.21.1.0            64.147.113.42         HTTP     Continuation or non-HTTP traffic

Frame 10 (55 bytes on wire, 55 bytes captured)
Ethernet II, Src: Giga-Byt_80:cd:51 (00:16:e6:80:cd:51), Dst: Olicom_c0:33:71 (00:00:24:c0:33:71)
Internet Protocol, Src: 172.21.1.0 (172.21.1.0), Dst: 64.147.113.42 (64.147.113.42)
Transmission Control Protocol, Src Port: 51037 (51037), Dst Port: http (80), Seq: 0, Ack: 0, Len: 1
Hypertext Transfer Protocol

No.     Time        Source                Destination           Protocol Info
     11 62.348550   172.21.1.0            64.147.113.42         TCP      [TCP ZeroWindowProbe] 55771 > http [ACK] Seq=1 Ack=1 Win=65535 [TCP CHECKSUM INCORRECT] Len=1

Frame 11 (55 bytes on wire, 55 bytes captured)
Ethernet II, Src: Giga-Byt_80:cd:51 (00:16:e6:80:cd:51), Dst: Olicom_c0:33:71 (00:00:24:c0:33:71)
Internet Protocol, Src: 172.21.1.0 (172.21.1.0), Dst: 64.147.113.42 (64.147.113.42)
Transmission Control Protocol, Src Port: 55771 (55771), Dst Port: http (80), Seq: 1, Ack: 1, Len: 1

No.     Time        Source                Destination           Protocol Info
     12 73.955802   172.21.1.0            64.147.113.42         TCP      [TCP Keep-Alive] 60906 > http [ACK] Seq=0 Ack=0 Win=65535 Len=1

Frame 12 (55 bytes on wire, 55 bytes captured)
Ethernet II, Src: Giga-Byt_80:cd:51 (00:16:e6:80:cd:51), Dst: Olicom_c0:33:71 (00:00:24:c0:33:71)
Internet Protocol, Src: 172.21.1.0 (172.21.1.0), Dst: 64.147.113.42 (64.147.113.42)
Transmission Control Protocol, Src Port: 60906 (60906), Dst Port: http (80), Seq: 0, Ack: 0, Len: 1

>Fix:

	


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->yongari 
Responsible-Changed-By: remko 
Responsible-Changed-When: Sun Apr 8 19:38:46 UTC 2007 
Responsible-Changed-Why:  
Hi, can you look into the ticket please? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=111384 

From: Harald Schmalzbauer <harry@schmalzbauer.de>
To: FreeBSD-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org
Cc:  
Subject: Re: kern/111384: msk hw checksum problem
Date: Sun, 8 Apr 2007 22:58:12 +0200

 I did a quick check on 6.2-stable and couldn't see the symptom (no connection 
 to freeshports). But I haven't captured traffic, so I can't guarantee that 
 the "TCP checksum mismatch" doesn't aplly to 6.2-stable as well.
 
 -Harry
 
State-Changed-From-To: open->feedback 
State-Changed-By: remko 
State-Changed-When: Tue Apr 10 05:11:59 UTC 2007 
State-Changed-Why:  
A possible solution had been provided, reflect the feedback 
request in the PR state. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=111384 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/111384: commit references a PR
Date: Wed, 11 Apr 2007 00:47:36 +0000 (UTC)

 yongari     2007-04-11 00:47:29 UTC
 
   FreeBSD src repository
 
   Modified files:
     sys/dev/msk          if_msk.c 
   Log:
   Add work around for hardware Tx checksum offload bug in Yukon II.
   Yukon II generated corrupted TCP checksum for short TCP packets
   that's less than 60 bytes in size(e.g. window probe packet, pure ACK
   packet etc). Padding the frame with zeros to make the frame minimum
   ethernet frame size didn't work at all. Instead of dropping Tx
   checksum offload support we calculate TCP checksum with S/W method
   when we encounter short TCP frames.
   Fortunately it seems that short UDP datagrams appear to be handled
   correctly by Yukon II.
   
   While I'm here simplify ethernet/VLAN header size calculation logic.
   
   PR:     111384
   
   Revision  Changes    Path
   1.13      +25 -5     src/sys/dev/msk/if_msk.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/111384: commit references a PR
Date: Sat, 14 Apr 2007 02:39:40 +0000 (UTC)

 yongari     2007-04-14 02:39:33 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     sys/dev/msk          if_msk.c 
   Log:
   MFC if_msk.c, rev. 1.13 to RELENG_6
     Add work around for hardware Tx checksum offload bug in Yukon II.
     Yukon II generated corrupted TCP checksum for short TCP packets
     that's less than 60 bytes in size(e.g. window probe packet, pure ACK
     packet etc). Padding the frame with zeros to make the frame minimum
     ethernet frame size didn't work at all. Instead of dropping Tx
     checksum offload support we calculate TCP checksum with S/W method
     when we encounter short TCP frames.
     Fortunately it seems that short UDP datagrams appear to be handled
     correctly by Yukon II.
   
     While I'm here simplify ethernet/VLAN header size calculation logic.
   
     PR:   111384
   
   Revision  Changes    Path
   1.11.2.4  +25 -5     src/sys/dev/msk/if_msk.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: feedback->closed 
State-Changed-By: yongari 
State-Changed-When: Sat Apr 14 02:43:12 UTC 2007 
State-Changed-Why:  
Patch committed to HEAD and MFCed. 
Thank you for reporting. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=111384 
>Unformatted:
