From owner-freebsd-usb@FreeBSD.ORG Sun Jun 18 22:32:54 2006 Return-Path: X-Original-To: freebsd-usb@freebsd.org Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3E7D816A474 for ; Sun, 18 Jun 2006 22:32:54 +0000 (UTC) (envelope-from mainland@apeiron.net) Received: from mail.apeiron.net (h-68-164-219-98.cmbrmaor.covad.net [68.164.219.98]) by mx1.FreeBSD.org (Postfix) with ESMTP id B439C43D46 for ; Sun, 18 Jun 2006 22:32:52 +0000 (GMT) (envelope-from mainland@apeiron.net) Received: from localhost (localhost.apeiron.net [127.0.0.1]) by mail.apeiron.net (Postfix) with ESMTP id 360F722861; Sun, 18 Jun 2006 18:32:52 -0400 (EDT) X-Virus-Scanned: amavisd-new at apeiron.net Received: from mail.apeiron.net ([127.0.0.1]) by localhost (mail.apeiron.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tPytooTJ+YwS; Sun, 18 Jun 2006 18:32:51 -0400 (EDT) Received: from [192.168.0.11] (hamilton.apeiron.net [192.168.0.11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.apeiron.net (Postfix) with ESMTP id 9BD7222862; Sun, 18 Jun 2006 18:32:51 -0400 (EDT) Message-ID: <4495D48C.2000601@apeiron.net> Date: Sun, 18 Jun 2006 18:32:44 -0400 From: Geoffrey Mainland User-Agent: Thunderbird 1.5.0.4 (X11/20060604) MIME-Version: 1.0 Newsgroups: gmane.os.freebsd.devel.usb To: "M. Warner Losh" References: <20060616.170242.1467007423.imp@bsdimp.com> <20060617.131208.1589021232.imp@bsdimp.com> In-Reply-To: <20060617.131208.1589021232.imp@bsdimp.com> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-usb@freebsd.org Subject: Re: ucom/uftdi dropping bytes, with debug logs FIXED X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jun 2006 22:32:54 -0000 M. Warner Losh wrote: > In message: > Geoffrey Mainland writes: > : The fact that this runs fine under VMWare makes me strongly suspect a > : timing issue that is fixed by some sort of buffering at the VMWare > : level. Where should I start to look to hack something in to test this? > : The ucom driver seems to be setting up the read transfers that don't > : complete on time. > > I'd start looking into ucom.c and uftdi.c. > > Warner Here's a diff against ucom.c version 1.57 that fixes the problem for me. I'm sure this is not the "correct" fix, but it stops bytes from being dropped :). I assume aborting the read and immediately restarting it flushes some pending data. Why is ucomstop is called so frequently by the tty code? Geoff Index: ucom.c =================================================================== --- ucom.c (revision 3) +++ ucom.c (working copy) @@ -622,10 +622,12 @@ DPRINTF(("ucomstop: %d\n", flag)); +#if 0 if ((flag & FREAD) && (sc->sc_state & UCS_RXSTOP) == 0) { DPRINTF(("ucomstop: read\n")); ucomstopread(sc); ucomstartread(sc); +#endif } if (flag & FWRITE) {