Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: magma@nic.cerf.net (Ed Romascan)
Subject: Re: DEC 3000-300 serial port speed?
Date: 31 May 1994 21:48:00 GMT	[thread overview]
Message-ID: <2sgbah$3m5@news.cerf.net> (raw)
In-Reply-To: 1994May28.104510.196@macro.demon.co.uk


   Perhaps I can clear up a few things regarding serial ports, drivers
and UNIX.  I work for an outfit that manufactures serial boards, both
for DEC (TURBOchannel line) and SUN (SBus) workstations, I write the
drivers for them.  

  First thing to keep in mind;  The serial I/O paradigm for UNIX
was developed about 25 years ago.  Termio(s) allows speeds of 50, 110,
300 ... bps (notice the lack of a *K* before the bps).  I believe the
default for ULTRIX is still 300 bps.  OSF/1, SunOS and Solaris default
to the blinding speed of 9600.  Other than the advent of STREAMS, I do
not believe that there has since been any work/thought/consideration
to improve serial I/O.  I guess the vendors still believe that the only
devices useful at the end of a serial port are paper tapes and teletypes.
So much for head space.

  The nitty gritty:  Currently there are two frameworks for serial
drivers,  STREAMS drivers and berkeley clist drivers.  SUN went
to the STREAMS approach some time ago.  DEC is just now offering
STREAMS in OSF/1.  STREAMS is better in two regards (IMHO), it 
separates the receive character processing (ie, line discipline)
from interrupt context, and it provides better buffering of receive
characters.  Hopefully this will become clear, but we need to look
at hardware for a bit.

  SUN has used the Z8530 SCC on their workstations, I'm not
sure about DEC.  The 8530 is about as flexible as they come,
sync, bisync, monosync, async, you name it, this chip can do it.
It also supports DMA.  It is a *bugger* to program but once you
get it, there is nothing it won't do.  I have run the thing
at speeds exceeding 1 Mbps, synchronous with DMA.  Great chip,
but old technology.  The receive fifo is all of one character long,
and here is where the many problems begin.  Running this guy in async
and not interfacing it to a DMA controller means that for every receive
character you field an interrupt, if you are lucky, you can get two 
characters per interrupt (the 8530 has a receive shift and hold register).
Obviously, cranking up the speed cranks up the interrupt rate.  Well,
the ability to efficiently field interrupts is not on the rather long
list of UNIX strengths.  You can read that as "high interrupt rate
seriously degrades your system performance".  Gee, there is news.  
This also applies to the transmit side, it is pretty symmetric
up to this point.

  The good news is that the SCC (serial communications controller)
vendors started putting larger fifo's on the chips.  Most of our
boards use the Cirrus Logic CD1400 async chips which provide 12
byte fifo's with programmable threshholds (eg, interrupt me when, say,
8 bytes are in the receive fifo).  This can reduce the interrupt rate
by a factor of 8 (or 12 if you let the fifo fill), a big help.  Zilog
has done essentially the same thing with the 85C30 and 85130 chips.
Anyway, now for 100 received characters we have fielded somewhere
between 8 and 13 interrupts, something less than 100.  I am
not going to worry about stale data timeouts for this discussion.
The cirrus chips are also capable of performing most of the line
discipline processing, eg, CRLF, ISTRIP, XOFF/XON detection/generation,
etc.  Im not sure if this is true of the 85{c1}30's, it's been
awhile.  The cirrus chips also do automatic hardware flow control
(rts/cts).  Of course there are many SCC choices out there, I am
limiting this to the ones I have had familiarity with.  I hope
this gives you some idea as to what the hardware can provide.

  Click. Back to software, start with berkeley style drivers and
an SCC programmed to interrupt when the recieve fifo level gets 
to 8.  I will only address the recieve side, as it is the most 
limiting.  Enter the interrupt service routine, do what needs to
be done to determine board/port/type of interrupt, discover that
it is a receive character(s) available interrupt.  First check the
receive fifo count register to determine how many characters are 
available.  The traditional (berkeley) thing to do now is pull
each character out of the fifo and pass them (one at a time)
to the line discipline receive character interrupt routine (ttyin).
ttyin does the full line discipline thing for that character and
then (hopefully) sticks it on the appropriate (raw or canonical)
clist.  You would not even believe how much work needs to be done
to "line discipline" that character.  Remember, all of this is
being done at interrupt context, further interrupts at this
level (spltty) are blocked.  Now, I am hanging out in this interrupt
routine for 8 character processing times.  In the mean time more
characters are streaming in and the receive fifo is filling on
one end while the isr is draining them on the other.  It should
not be difficult to see that at some line speed the arrival rate 
will exceed the drain rate.  Hah! the infamous "silo overflow"
message appears, in tech speak, this is a receive overrun. You have
lost a character (or more).  Bummer.  Well, for some reason, the
UNIX system vendors (in this case, specifically, DEC and SUN) have
been very slow to discover out-of-band (aka, hardware or rts/cts)
flow control.  This certainly is a good way to prevent overruns.

  I hear someone asking, "at what line speeds?".  DECstation 5000/200
starts puking at as low as 19200.  More dismaying is that a flamingo
(3000/500 AXP) will begin to overrun at 38400.  Don't blame it on DEC,
blame the fossil relic of the line discipline, which POSIX has adopted
and cast in stone.  Even worse, the problem does not stop here, but
let me digress.

 SUN adopted the STREAMS approach, this has the big advantage of
moving the line discipline receive processing out of interrupt
context.  The driver isr just needs to empty the fifo and queue
the characters.  The streams scheduler will get around to processing
them eventually.  This, and the fact that STREAMS is willing to buffer
more characters, is probably the reason SUNS don't crap out until
around 56000 bps.  SUN still has to supply the cpu cycles to push
each character through the line discipline, which is still POSIX
and still sucks.  sigh.

  DEC has maintained their disadvantage in the serial speed
race by maintaining the very ugly "ttyhog" limit of 255 characters
max on a character queue (clist).  Yup, you got it, the ttyin
routine will flush the clists when ttyhog is exceeded.  It is
amazing how quietly 256 characters can hit the floor.  If you
want it will ring a bell to muffle the lack of sound.  (Anyone
notice that my level of disgust is rising?).  The point is, even 
if you prevent the loss of characters from receive overruns, the 
tty subsystem will still trash you.  

  Well, there are ways around these problems, and I have used a lot 
of them.  I can run our CD1400 based boards at 115200 bps per port
without character loss (that is as fast as the CD1400 goes).  
Naturally the effective throughput is slightly less due to hardware
flow control and buffer management.  Our CD2400 based boards can do
twice that speed with *very few* interrupts.  The wonders of DMA
makes this chip very attractive for packet oriented data streams
(slip, ppp).  

  Now I am going to flame DEC and their knee-jerk (emphasis on
the jerk) "terminal servers are the only solution" reaction to
serial comm.   What they fail to disclose (or have yet to open
their eyes and discover) is that high telnet traffic to/from
a host via a TS can also bring the host to its knees, as bad,
sometimes worse than that lousy little rs232 device.  TCP/IP
traffic into and out of a host is not for free.  I have already 
used up my bandwith for the month, so I am not going to go into
nauseating detail on why this is true.  But, for supporting
evidence, look at the success Livingston is having with some
of their (fine) products.

  Hope this helps clear (as opposed to muddying) up some
of the issues.

bruce schoenleber
bruce@magma.com

  







  parent reply	other threads:[~1994-05-31 21:48 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-05-26  0:08 DEC 3000-300 serial port speed? Greg Kilcup
1994-05-27  4:50 ` Jerry Leslie
1994-05-27 14:19   ` Peter da Silva
1994-05-27 15:46     ` Charles M Richmond
1994-06-01 20:57     ` George Papison
1994-06-02 13:28       ` Peter da Silva
1994-05-27 21:29   ` Craig Zeller
1994-05-28  0:18     ` Aaron Leonard
1994-05-28  9:45       ` Neill Clift
1994-05-28 14:58         ` Castor Fu
1994-05-28 17:01           ` Terry Kennedy, Operations Mgr.
1994-05-31 21:48         ` Ed Romascan [this message]
1994-06-01 15:55           ` ivie
1994-06-01 20:09           ` Carl J Appellof
1994-06-01 22:40             ` Ed Romascan
1994-06-01 22:16           ` Peter da Silva
1994-05-28 19:48       ` Andrew Fullford
1994-05-28 22:40         ` Thor Lancelot Simon
1994-05-30  1:02           ` Jerry Leslie
1994-05-30 11:54             ` Rupert Moss-Eccardt
1994-05-30 15:51               ` Terry Kennedy, Operations Mgr.
1994-05-30 16:05                 ` Rupert Moss-Eccardt
1994-05-30 18:30                   ` Terry Kennedy, Operations Mgr.
1994-05-30 17:05               ` Andrew Fullford
1994-05-30 23:04                 ` Rupert Moss-Eccardt
1994-05-31  0:35                   ` Andrew Fullford
1994-05-31 14:47                     ` Charles M Richmond
1994-05-31 18:46                       ` Eric Thomas
1994-06-01 22:40                         ` Peter da Silva
1994-05-31  1:35                   ` John Wilson
1994-05-31  5:41                     ` Rupert Moss-Eccardt
1994-05-31 17:03                   ` Peter da Silva
1994-05-31 16:57               ` Peter da Silva
     [not found]     ` <2s62k6$f4c@news.ccit.arizona.edu>
1994-05-28 13:19       ` John Hascall
1994-05-31 16:03     ` Peter da Silva
1994-06-04  3:41 ` Steven Vere
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox