From Mike_Karels@mcafee.com  Mon Dec 31 03:01:10 2012
Return-Path: <Mike_Karels@mcafee.com>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 3578B2F3
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 31 Dec 2012 03:01:10 +0000 (UTC)
	(envelope-from Mike_Karels@mcafee.com)
Received: from MIVWSMAILOUT1.mcafee.com (mivwsmailout1.mcafee.com [161.69.47.167])
	by mx1.freebsd.org (Postfix) with ESMTP id 7A4E88FC0C
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 31 Dec 2012 03:01:08 +0000 (UTC)
Received: from MIVEXAMER1N2.corp.nai.org (unknown [10.48.48.12]) by MIVWSMAILOUT1.mcafee.com with smtp
	 id 7ab5_576c_69249b57_e4eb_4ee7_8edd_97b6d3798894;
	Sun, 30 Dec 2012 21:01:07 -0600
Received: from MIVEXAPP2N1.corp.nai.org (10.48.48.71) by
 MIVEXAMER1N2.corp.nai.org (10.48.48.12) with Microsoft SMTP Server (TLS) id
 14.2.318.1; Sun, 30 Dec 2012 21:58:10 -0500
Received: from frodo.scur.com (10.48.48.241) by mail.na.nai.com (10.48.48.71)
 with Microsoft SMTP Server id 14.2.318.1; Sun, 30 Dec 2012 21:58:10 -0500
Received: from mcafee.com (localhost [127.0.0.1])	by frodo.scur.com
 (8.14.5/8.14.5) with ESMTP id qBV2w9T3051201	for
 <FreeBSD-gnats-submit@freebsd.org>; Sun, 30 Dec 2012 20:58:09 -0600 (CST)
	(envelope-from mkarels@mcafee.com)
Received: (from mkarels@localhost)	by mcafee.com (8.14.5/8.14.5/Submit) id
 qBV2w9Hl051200;	Sun, 30 Dec 2012 20:58:09 -0600 (CST)	(envelope-from mkarels)
Message-Id: <201212310258.qBV2w9Hl051200@mcafee.com>
Date: Sun, 30 Dec 2012 20:58:09 -0600
From: Mike Karels <mike_karels@mcafee.com>
Reply-To: Mike Karels <mike_karels@mcafee.com>
To: <FreeBSD-gnats-submit@freebsd.org>
Cc:
Subject: UDP checksum offload is wrong in bxe driver
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         174851
>Category:       kern
>Synopsis:       [bxe] [patch] UDP checksum offload is wrong in bxe driver
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-net
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 31 03:10:00 UTC 2012
>Closed-Date:    Wed Mar 12 20:40:05 UTC 2014
>Last-Modified:  Wed Mar 12 20:40:05 UTC 2014
>Originator:     Mike Karels
>Release:        FreeBSD 10.0-CURRENT amd64
>Organization:
McAfee, Inc
>Environment:
System: FreeBSD freebsd-current.karels.net 10.0-CURRENT FreeBSD 10.0-CURRENT #1 r244048: Sun Dec  9 18:48:31 UTC 2012     root@snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
	
>Description:
	UDP checksums are wrong when checksum offload is enabled with
	the bxe driver
	Note: problem was found and fixed on a FreeBSD 8.2 derivative;
	the patch compiles with -current.
>How-To-Repeat:
	send UDP traffic via bxe; note that it doesn't work because the
	checksums are bad on the receiving system.
>Fix:
Index: if_bxe.c
===================================================================
--- if_bxe.c	(revision 244606)
+++ if_bxe.c	(working copy)
@@ -9194,15 +9194,15 @@
 				 * Calculate a pseudo header checksum over
 				 * the 10 bytes	before the UDP header.
 				 */
-				tmp_csum = in_pseudo(ntohl(*tmp_uh),
-				    ntohl(*(tmp_uh + 1)),
-				    ntohl((*(tmp_uh + 2)) & 0x0000FFFF));
+				tmp_csum = in_pseudo(*tmp_uh,
+				    *(tmp_uh + 1),
+				    *(uint16_t *)(tmp_uh + 2));
 
 				/* Update the enet + IP + UDP header length. */
 				tx_parse_bd->total_hlen +=
 				    (sizeof(struct udphdr) >> 1);
 				tx_parse_bd->tcp_pseudo_csum =
-				    ~in_addword(uh->uh_sum, ~tmp_csum);
+				    ntohs(in_addword(uh->uh_sum, ~tmp_csum));
 			}
 
 			/* Update the offload flags. */
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-net 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Dec 31 07:28:11 UTC 2012 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=174851 
State-Changed-From-To: open->feedback 
State-Changed-By: edavis 
State-Changed-When: Tue Mar 11 18:26:37 UTC 2014 
State-Changed-Why:  

The bxe driver has been re-written and committed. UDP checksums 
are working properly. Please verify on latest head or the tip 
of any stable branch. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=174851 
State-Changed-From-To: feedback->closed 
State-Changed-By: edavis 
State-Changed-When: Wed Mar 12 20:39:00 UTC 2014 
State-Changed-Why:  

fixed in new driver version 


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