From owner-cvs-all@FreeBSD.ORG Sun Sep 7 19:11:27 2003 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6C8FD16A4BF; Sun, 7 Sep 2003 19:11:27 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id B7D9B43FE3; Sun, 7 Sep 2003 19:11:25 -0700 (PDT) (envelope-from wpaul@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h882BP0U010352; Sun, 7 Sep 2003 19:11:25 -0700 (PDT) (envelope-from wpaul@repoman.freebsd.org) Received: (from wpaul@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h882BPqd010351; Sun, 7 Sep 2003 19:11:25 -0700 (PDT) Message-Id: <200309080211.h882BPqd010351@repoman.freebsd.org> From: Bill Paul Date: Sun, 7 Sep 2003 19:11:25 -0700 (PDT) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/usr.sbin/sysinstall devices.c src/sys/modules Makefile src/sys/modules/re Makefile src/sys/conf files src/sys/i386/conf GENERIC src/sys/pc98/conf GENERIC src/sys/sparc64/conf GENERIC src/sys/ia64/conf GENERIC ... X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Sep 2003 02:11:27 -0000 wpaul 2003/09/07 19:11:25 PDT FreeBSD src repository Modified files: usr.sbin/sysinstall devices.c sys/modules Makefile sys/conf files sys/i386/conf GENERIC sys/pc98/conf GENERIC sys/sparc64/conf GENERIC sys/ia64/conf GENERIC sys/amd64/conf GENERIC sys/pci if_rl.c if_rlreg.h sys/dev/mii rlphy.c share/man/man4 Makefile rl.4 Added files: sys/modules/re Makefile sys/dev/re if_re.c Log: Take the support for the 8139C+/8169/8169S/8110S chips out of the rl(4) driver and put it in a new re(4) driver. The re(4) driver shares the if_rlreg.h file with rl(4) but is a separate module. (Ultimately I may change this. For now, it's convenient.) rl(4) has been modified so that it will never attach to an 8139C+ chip, leaving it to re(4) instead. Only re(4) has the PCI IDs to match the 8169/8169S/8110S gigE chips. if_re.c contains the same basic code that was originally bolted onto if_rl.c, with the following updates: - Added support for jumbo frames. Currently, there seems to be a limit of approximately 6200 bytes for jumbo frames on transmit. (This was determined via experimentation.) The 8169S/8110S chips apparently are limited to 7.5K frames on transmit. This may require some more work, though the framework to handle jumbo frames on RX is in place: the re_rxeof() routine will gather up frames than span multiple 2K clusters into a single mbuf list. - Fixed bug in re_txeof(): if we reap some of the TX buffers, but there are still some pending, re-arm the timer before exiting re_txeof() so that another timeout interrupt will be generated, just in case re_start() doesn't do it for us. - Handle the 'link state changed' interrupt - Fix a detach bug. If re(4) is loaded as a module, and you do tcpdump -i re0, then you do 'kldunload if_re,' the system will panic after a few seconds. This happens because ether_ifdetach() ends up calling the BPF detach code, which notices the interface is in promiscuous mode and tries to switch promisc mode off while detaching the BPF listner. This ultimately results in a call to re_ioctl() (due to SIOCSIFFLAGS), which in turn calls re_init() to handle the IFF_PROMISC flag change. Unfortunately, calling re_init() here turns the chip back on and restarts the 1-second timeout loop that drives re_tick(). By the time the timeout fires, if_re.ko has been unloaded, which results in a call to invalid code and blows up the system. To fix this, I cleared the IFF_UP flag before calling ether_ifdetach(), which stops the ioctl routine from trying to reset the chip. - Modified comments in re_rxeof() relating to the difference in RX descriptor status bit layout between the 8139C+ and the gigE chips. The layout is different because the frame length field was expanded from 12 bits to 13, and they got rid of one of the status bits to make room. - Add diagnostic code (re_diag()) to test for the case where a user has installed a broken 32-bit 8169 PCI NIC in a 64-bit slot. Some NICs have the REQ64# and ACK64# lines connected even though the board is 32-bit only (in this case, they should be pulled high). This fools the chip into doing 64-bit DMA transfers even though there is no 64-bit data path. To detect this, re_diag() puts the chip into digital loopback mode and sets the receiver to promiscuous mode, then initiates a single 64-byte packet transmission. The frame is echoed back to the host, and if the frame contents are intact, we know DMA is working correctly, otherwise we complain loudly on the console and abort the device attach. (At the moment, I don't know of any way to work around the problem other than physically modifying the board, so until/unless I can think of a software workaround, this will have do to.) - Created re(4) man page - Modified rlphy.c to allow re(4) to attach as well as rl(4). Note that this code works for the sample 8169/Marvell 88E1000 NIC that I have, but probably won't work for the 8169S/8110S chips. RealTek has sent me some sample NICs, but they haven't arrived yet. I will probably need to add an rlgphy driver to handle the on-board PHY in the 8169S/8110S (it needs special DSP initialization). Revision Changes Path 1.222 +1 -0 src/share/man/man4/Makefile 1.28 +4 -15 src/share/man/man4/rl.4 1.392 +1 -0 src/sys/amd64/conf/GENERIC 1.821 +1 -0 src/sys/conf/files 1.18 +3 -2 src/sys/dev/mii/rlphy.c 1.1 +2430 -0 src/sys/dev/re/if_re.c (new) 1.388 +1 -0 src/sys/i386/conf/GENERIC 1.57 +1 -0 src/sys/ia64/conf/GENERIC 1.349 +1 -0 src/sys/modules/Makefile 1.1 +9 -0 src/sys/modules/re/Makefile (new) 1.237 +1 -0 src/sys/pc98/conf/GENERIC 1.116 +127 -1241 src/sys/pci/if_rl.c 1.35 +27 -7 src/sys/pci/if_rlreg.h 1.60 +1 -0 src/sys/sparc64/conf/GENERIC 1.151 +2 -0 src/usr.sbin/sysinstall/devices.c