From owner-freebsd-bugs@FreeBSD.ORG Fri Jul 28 20:30:34 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C32C316A4DF for ; Fri, 28 Jul 2006 20:30:34 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 317FB43D7F for ; Fri, 28 Jul 2006 20:30:26 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k6SKUQQd006408 for ; Fri, 28 Jul 2006 20:30:26 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k6SKUQdB006407; Fri, 28 Jul 2006 20:30:26 GMT (envelope-from gnats) Resent-Date: Fri, 28 Jul 2006 20:30:26 GMT Resent-Message-Id: <200607282030.k6SKUQdB006407@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Doug Havir Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B342416A4E1 for ; Fri, 28 Jul 2006 20:28:05 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9D29843D66 for ; Fri, 28 Jul 2006 20:28:00 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k6SKS0Gj092040 for ; Fri, 28 Jul 2006 20:28:00 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id k6SKS03q092039; Fri, 28 Jul 2006 20:28:00 GMT (envelope-from nobody) Message-Id: <200607282028.k6SKS03q092039@www.freebsd.org> Date: Fri, 28 Jul 2006 20:28:00 GMT From: Doug Havir To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Cc: Subject: kern/101000: I may have found a subtle bug in the "em" driver in relase 6.1 - duplex/collision mismatch X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2006 20:30:34 -0000 >Number: 101000 >Category: kern >Synopsis: I may have found a subtle bug in the "em" driver in relase 6.1 - duplex/collision mismatch >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jul 28 20:30:25 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Doug Havir >Release: i386 release 6.1 >Organization: National Bankcard Services, Inc. >Environment: FreeBSD bsd.nbs 6.1-RELEASE FreeBSD 6.1-RELEASE #2: Mon Jul 10 09:56:35 CDT 2006 user@bsd.nbs:/usr/obj/usr/src/sys/QNXKERNEL i386 >Description: In the file dev/em/if_em_hw.h, which is part of the Intel 825xx ethernet driver, the defines for DUPLEX are as follows: #define HALF_DUPLEX 1 #define FULL_DUPLEX 2 In the file dev/em/if_em.c the message printed at the end of the em_attach() call is: printf("em%d: Speed:%d Mbps Duplex:%s\n", adapter->unit, adapter->link_speed, adapter->link_duplex == FULL_DUPLEX ? "Full" : "Half"); Given that the code reads right, and nobody has complained about the message being wrong, one might assume the definitions for FULL and HALF duplex are correct. BUT THEN, In the file dev/em/if_em.c, function em_initialize_transmit_unit(struct adapter * adapter), line 2396-2400: if (adapter->link_duplex == 1) { reg_tctl |= E1000_FDX_COLLISION_DISTANCE << E1000_COLD_SHIFT; } else { reg_tctl |= E1000_HDX_COLLISION_DISTANCE << E1000_COLD_SHIFT; } Correct me if I'm wrong, but what that really says is if link_duplex == HALF_DUPLEX then set the collision distance to the full duplex setting. At least one of the two usages are incorrect. I figured I'd point it out just in case it actually has a meaningful impact. Could it possibly explain some of the half duplex workaround stuff in here? One can only hope.... >How-To-Repeat: Lookie at the source code. >Fix: 1) Use the define for FULL_DUPLEX or HALF_DUPLEX instead of "1" 2) Make sure the effects of the if/else match whichever duplex definition you choose 3) Spend copious free time seeing if it has any effect on performance or reliability :-) Best regards, -Doug >Release-Note: >Audit-Trail: >Unformatted: