From owner-freebsd-hackers@FreeBSD.ORG Wed Nov 16 22:06:06 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 594B416A420 for ; Wed, 16 Nov 2005 22:06:06 +0000 (GMT) (envelope-from dirkx@webweaving.org) Received: from skutsje.san.webweaving.org (skutsje.san.webweaving.org [209.132.96.45]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0013443D46 for ; Wed, 16 Nov 2005 22:06:05 +0000 (GMT) (envelope-from dirkx@webweaving.org) Received: from skutsje.san.webweaving.org (skutsje.san.webweaving.org [209.132.96.45] (may be forged)) by skutsje.san.webweaving.org (8.12.9/8.12.9) with ESMTP id jAGM659H026791 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 16 Nov 2005 14:06:05 -0800 (PST) (envelope-from dirkx@webweaving.org) Received: from localhost (dirkx@localhost) by skutsje.san.webweaving.org (8.12.9/8.12.9/Submit) with ESMTP id jAGM6517026788 for ; Wed, 16 Nov 2005 14:06:05 -0800 (PST) (envelope-from dirkx@webweaving.org) X-Authentication-Warning: skutsje.san.webweaving.org: dirkx owned process doing -bs Date: Wed, 16 Nov 2005 14:06:05 -0800 (PST) From: Dirk-Willem van Gulik X-X-Sender: dirkx@skutsje.san.webweaving.org To: freebsd-hackers@freebsd.org In-Reply-To: Message-ID: <20051116140145.V22890@skutsje.san.webweaving.org> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Dealing with silo overflow and interrupt-level buffer overflow in sio(4) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Nov 2005 22:06:06 -0000 I found that for virtually all GPRS and UMTS cards I tried that I get so many interopt and silo overflow errors as to virtually make the card unusable. Attached patch below allows one to increase the buffer a bit; relative to the speed of the connection. Thanks, Dw. *** sio.c.orig Wed Nov 16 21:49:23 2005 --- sio.c Wed Nov 16 21:57:46 2005 *************** *** 1906,1911 **** --- 1907,1915 ---- return (0); } + + static int cp4tick_rate = 4; + TUNABLE_INT("machdep.sio.cp4tick_rate", &cp4tick_rate); /* * This function must be called with the sio_lock mutex released and will * return with it obtained. *************** *** 1926,1932 **** * (about 3 ticks if input flow control is not used or not honoured, * but a bit less for CS5-CS7 modes). */ ! cp4ticks = 40 * speed / 10 / hz * 4; for (ibufsize = 128; ibufsize < cp4ticks;) ibufsize <<= 1; if (ibufsize == com->ibufsize) { --- 1930,1936 ---- * (about 3 ticks if input flow control is not used or not honoured, * but a bit less for CS5-CS7 modes). */ ! cp4ticks = (cp4tick_rate ? cp4tick_rate : 4) * speed / 10 / hz; for (ibufsize = 128; ibufsize < cp4ticks;) ibufsize <<= 1; if (ibufsize == com->ibufsize) {root@builld-jv# diff -c sio.4.orig sio.4 *** sio.4.orig Wed Nov 16 21:57:33 2005 --- sio.4 Wed Nov 16 22:02:04 2005 *************** *** 363,368 **** --- 363,381 ---- .Pp The device numbers are made from the set [0-9a-v] so that more than 10 ports can be supported. + .Sh TUNABLES + The driver supports the following tunable parameters, which may be + added to + .Pa /boot/loader.conf + or set via the + .Xr sysctl 8 + command: + .Bl -tag -width ".Cm machdep.sio.cp4tick_rate " -compact + .It Cm machdep.sio.cp4tick_rate + Rate by which to increase the buffer ti handle softtty interrupt + latency. Default value is 4; to deal with about 2-3 ticks without + loss of throughput or data. + .El .Sh DIAGNOSTICS .Bl -diag .It sio%d: silo overflow. *************** *** 370,382 **** .El .Bl -diag .It sio%d: interrupt-level buffer overflow. ! Problem in the bottom half of the driver. .El .Bl -diag .It sio%d: tty-level buffer overflow. Problem in the application. Input has arrived faster than the given module could process it ! and some has been lost. .El .\" .Bl -diag .\" .It sio%d: reduced fifo trigger level to %d. --- 383,395 ---- .El .Bl -diag .It sio%d: interrupt-level buffer overflow. ! Problem in the bottom half of the driver. Try increasing machdep.sio.cp4tick_rate. .El .Bl -diag .It sio%d: tty-level buffer overflow. Problem in the application. Input has arrived faster than the given module could process it ! and some has been lost. Try increasing machdep.sio.cp4tick_rate. .El .\" .Bl -diag .\" .It sio%d: reduced fifo trigger level to %d.