Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Jul 1998 19:44:46 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        FreeBSD-current@FreeBSD.ORG, pierre.dampure@k2c.co.uk
Subject:   Re: Current values of TTYHOG and RS_IBUFSIZE
Message-ID:  <199807220944.TAA09666@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>Way back in 1996 (23 Nov), Brian Litzinger posted a follow-up to "Hayes
>ESP and interrupt-level buffer overflow" and advised altering the
>following constants :
>
>	In /sys/sys/tty.h:	TTYHOG		Change to 4096
>	In /sys/i386/isa/sio.c	RS_IBUFSIZE	Change to 1024
>
>I applied the above and haven't had any problems since -- in fact, it
>seems the connections are _much_ faster.
>
>Can anybody confirms whether these changes are valid and, if so, can we
>include them in -current (#ifdef'd via COM_ESP, of course)?

These changes waste a lot of memory for ptys and any other non-ESP ttys,
and don't get input flow control quite right (due to hard-coded 256's in
tty.c).

-current has support for allocating correctly sized buffers depending
on the device type and port speed, but nothing actually uses this yet.
The changes to use if for normal sio ports are something like:

*** sio.c~	Wed Jul 15 22:30:11 1998
--- sio.c	Wed Jul 15 22:30:15 1998
***************
*** 106,109 ****
  
  #define	LOTS_OF_EVENTS	64	/* helps separate urgent events from input */
- #define	RB_I_HIGH_WATER	(TTYHOG - 2 * RS_IBUFSIZE)
  #define	RS_IBUFSIZE	256
--- 110,112 ----
  
  #define	LOTS_OF_EVENTS	64	/* helps separate urgent events from input */
  #define	RS_IBUFSIZE	256
***************
*** 1190,1191 ****
--- 1217,1221 ----
  				? com->it_out : com->it_in;
+ 		tp->t_ififosize = 2 * RS_IBUFSIZE;
+ 		tp->t_ispeedwat = (speed_t)-1;
+ 		tp->t_ospeedwat = (speed_t)-1;
  		(void)commctl(com, TIOCM_DTR | TIOCM_RTS, DMSET);
***************
*** 1201,1203 ****
  		 */
- 		ttsetwater(tp);
  		iobase = com->iobase;
--- 1231,1232 ----
***************
*** 1983,1985 ****
  		if (tp->t_state & TS_CAN_BYPASS_L_RINT) {
! 			if (tp->t_rawq.c_cc + incc >= RB_I_HIGH_WATER
  			    && (com->state & CS_RTS_IFLOW
--- 2081,2083 ----
  		if (tp->t_state & TS_CAN_BYPASS_L_RINT) {
! 			if (tp->t_rawq.c_cc + incc > tp->t_ihiwat
  			    && (com->state & CS_RTS_IFLOW

This gives an effective TTYHOG of about 11520 for 115200 bps, etc.

RS_IBUFSIZE still needs to be increased for speeds larger than 115200 bps.
RS_IBUFSIZE and/or tp->t_ififosize needs to be increased for hardware with
large h/w fifos like the ESP.

Bruce

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199807220944.TAA09666>