From owner-freebsd-hackers Tue Dec 21 16:24: 8 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from skynet.ctr.columbia.edu (skynet.ctr.columbia.edu [128.59.64.70]) by hub.freebsd.org (Postfix) with SMTP id D7D8815022; Tue, 21 Dec 1999 16:24:02 -0800 (PST) (envelope-from wpaul@skynet.ctr.columbia.edu) Received: (from wpaul@localhost) by skynet.ctr.columbia.edu (8.6.12/8.6.9) id TAA07925; Tue, 21 Dec 1999 19:28:11 -0500 From: Bill Paul Message-Id: <199912220028.TAA07925@skynet.ctr.columbia.edu> Subject: Possible solution for USB Ethernet problem To: hackers@freebsd.org Date: Tue, 21 Dec 1999 19:28:09 -0500 (EST) Cc: n_hibma@freebsd.org X-Mailer: ELM [version 2.4 PL24] Content-Type: text Content-Length: 2876 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Previously I mentioned that I was having trouble sending full sized ethernet frames (1500 bytes) over USB using my ADMtek AN986 Pegasus eval board. The problem turned out to be in the uhci driver, however I'm not certain exactly how to incorporate my fix. The problem I was seeing was that large frames would trigger babble errors, which would cause an endpoint halt and wedge the RX or TX pipe. Julian brought up another driver written by Doug Ambrisko which appeared to be able to transfer 1500-byte frames without any trouble. However, neither he nor Doug bothered to mention if their test machines had UHCI or OHCI hubs. Given what I've learned, I suspect they were OHCI. I downloaded a copy of the Intel UHCI spec document from ftp://download.intel.com/design/usb/UHCI11D.PDF and scrutinized it for a while. On page 17, it describes the MAXP bit in the command register. The description reads: Max Packet (MAXP). 1=64 bytes, 0=32 bytes. This bit selects the maximum packet size that can be used for full speed bandwitdh reclamation at the end of a frame. This value is used by the Host Controller to determine whether it should initiate another transaction based on the time remaining in the SOF counter. Use of reclamation packets larger than the programmed size will cause a Babble error if executed during the critical window at frame end. The Babble error results in the offending endpoint being stalled. Software is responsible for ensuring that any packet which could be executed under bandwidth reclamation be within this size limit. The ADMtek part is documented to use 64-byte USB packets for frame transfers. However, /sys/dev/usb/uhci.c:uhci_run() never sets the MAXP bit in the command register when it starts the controller running. I modified uhci_run() to include the UHCI_CMD_MAXP bit and now the ADMtek ethernet controller sends and receives 1500-byte frames with no problems. The question is, how should this be handled? Should the UHCI_CMD_MAXP bit be set all the time, or just when high speed devices are attached to the bus? The Intel manual seems to imply that it's safe to leave this bit enabled all the time, however I can't test this since I only have the one USB device. Also, should something similar be done with OHCI controllers, or do they handle this sort of thing correctly? -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