From owner-freebsd-hackers Tue Aug 11 08:51:47 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id IAA24074 for freebsd-hackers-outgoing; Tue, 11 Aug 1998 08:51:47 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from skynet.ctr.columbia.edu (skynet.ctr.columbia.edu [128.59.64.70]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id IAA24069 for ; Tue, 11 Aug 1998 08:51:41 -0700 (PDT) (envelope-from wpaul@skynet.ctr.columbia.edu) Received: (from wpaul@localhost) by skynet.ctr.columbia.edu (8.6.12/8.6.9) id LAA24486; Tue, 11 Aug 1998 11:54:10 -0400 From: Bill Paul Message-Id: <199808111554.LAA24486@skynet.ctr.columbia.edu> Subject: Re: Some errors in XL driver ? To: bazilio@monitord.vrn.ru (Vasily V. Grechishnikov) Date: Tue, 11 Aug 1998 11:54:08 -0400 (EDT) Cc: hackers@FreeBSD.ORG In-Reply-To: <000301bdc51e$d7798cc0$0a64a8c0@baz_station.monitord.vrn.ru> from "Vasily V. Grechishnikov" at Aug 11, 98 03:54:45 pm X-Mailer: ELM [version 2.4 PL24] Content-Type: text Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Of all the gin joints in all the towns in all the world, Vasily V. Grechishnikov had to walk into mine and say: > Hi ! > Today I had to test 3C905 NIC. After downloading XL driver > from www.freebsd.org/~/wpaul I had strange results. NIC detection > and autonegotiation works fine but some performance problem > occured - 380-400Kb/s at 10Mbps. After looking at network > statistic I saw very high Ierrs count. Here netstat -ni from my > test box running 2.2.7-RELEASE after downloading 12MB > file from local ftp. Whats happen ? > > Name Mtu Network Address Ipkts Ierrs Opkts Oerrs > Coll > xl0 1500 00.a0.24.4d.c3.3b 9305 1757 4113 0 > 0 > xl0 1500 192.168.100 192.168.100.245 9305 1757 4113 0 > 0 Aieeee! I think I found the cause of this problem. The autonegotiation code is setting the modes incorrectly. Please try to fix this using one of the following methods: - Force the card to 10mbps/half-duplex mode using the following command: # ifconfig xl0 media 10baseT/UTP mediaopt half-duplex This is just to see if setting the mode correctly clears up the problem. If so, do one of the next to things. - Apply the following patch to if_xl.c, recompile your kernel, and reboot: --- if_xl.c 1998/08/11 02:13:59 1.33 +++ if_xl.c 1998/08/11 15:26:28 @@ -796,13 +796,13 @@ ability & PHY_ANAR_10BTFULL) { ifm->ifm_media = IFM_ETHER|IFM_10_T|IFM_FDX; media &= ~PHY_BMCR_SPEEDSEL; - media &= ~PHY_BMCR_DUPLEX; + media |= PHY_BMCR_DUPLEX; printf("(full-duplex, 10Mbps)\n"); } else if (advert & PHY_ANAR_10BTHALF && ability & PHY_ANAR_10BTHALF) { ifm->ifm_media = IFM_ETHER|IFM_10_T|IFM_HDX; media &= ~PHY_BMCR_SPEEDSEL; - media |= PHY_BMCR_DUPLEX; + media &= ~PHY_BMCR_DUPLEX; printf("(half-duplex, 10Mbps)\n"); } - Download a new copy of if_xl.c from www.freebsd.org/~wpaul/3Com, recompile your kernel and reboot. As you can see, I transposed a couple of lines: the chip is detecting the right modes, but the code later sets the duplex mode incorrectly. I'm not sure how this crept in, but it explains the poor performance at 10Mbps: if you set the duplex bit incorrectly, the card behaves very strangely. I didn't notice this initially because the machine I use for 10Mbps testing has a 3c900 card, which does not have a PHY, hance the autoneg code is never used. The other code in xl_setmode_mii() which manually sets the chip modes gets this right, which is why setting the mode manually works. I apologize for this stupid mistake; that's what I get for not doing proper testing. Naturally, at 100Mbps, which is what my 3c905B test machines were set for, it works right. [chop] > dmesg output (disabled XL_USEIOSPACE), else if this variable > defined we has supplement warning xl0: command never completed!: [chop] This I want to know more about. It anybody else sees this, please let me know. Try to show me where the warning appears and whether or not it affects the operation of the NIC. -Bill -- ============================================================================= -Bill Paul (212) 854-6020 | System Manager, Master of Unix-Fu Work: wpaul@ctr.columbia.edu | Center for Telecommunications Research Home: wpaul@skynet.ctr.columbia.edu | Columbia University, New York City ============================================================================= "It is not I who am crazy; it is I who am mad!" - Ren Hoek, "Space Madness" ============================================================================= To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message