|
|
Configuration changes may be necessary to support transfer rates that are higher than 14,400bps. The optimum configuration varies from system to system. You may need to experiment in order to find the configuration that works best for you.
Three steps are needed to configure a system to support high-speed modems:
For serial ports using the 16550AFN UART chip, change the default values for the receive-interrupt trigger level in the sio_fifoctl kernel array from 14 to a lower value. This causes the 16550AFN to interrupt when there are fewer characters in its receive buffer and makes it less likely that the buffer will overflow during the time that the kernel takes to service the interrupt. This delay is referred to as the interrupt latency.
Possible values for the interrupt trigger level are 14 (the default), 8, 4, and 1. The default high value gives the best performance because the kernel has to service fewer interrupts. Setting the trigger level down to 4 is a good starting point. If the kernel has a high maximum interrupt latency, you may need to set the interrupt trigger level as low as 1.
At 115,200bps, three characters will take about 200 microseconds to arrive in the receive buffer. If the trigger level is set to 14, and the interrupt latency is longer than 200 microseconds, the UART's receive buffer will overflow. If the trigger level is reduced to 4, this allows 845 microseconds for the kernel to service the interrupt, but it will cause the UART to generate about three times as many interrupts.
See ``Serial device resources'' for details of how you can monitor and tune the performance of the serial driver.
The sio_fifoctl array is initialized in the file /etc/conf/pack.d/sio/space.c. The elements of the array correspond to the lowest seven bits of the minor numbers of the serial ports.
To determine the minor number for a serial port, type ls -l /dev/port and note the comma-separated integers that are listed just in front of the date. The first integer is the major number; the second number is the minor number.
As you are using a modem control port such as /dev/tty2A, subtract 128 from its minor number to remove the uppermost bit. The resulting number is the one to use for the sio_fifoctl array index.
For example, type ls -l /dev/tty2A and you might see:
crw-r----- 1 uucp uucp 5,136 Feb 01 17:07 /dev/tty2AThe minor number is the number after the comma in 5,136: 136. Subtracting 128 (because this is a modem control port) leaves 8. In this example, you would modify the ninth array element (sio_fifoctl[8]).
FCR_Rx14 | 15
lines do not appear in
the shipped file, and need not be added):
/* * 16550 FIFO control by minor dev: the high two bits are the RX fifo * trigger level, and the low four bits are the size-1 to use for the * TX fifo. Statically initialize the array here, so that buffering * of individual channels can be disabled, e.g., for serial mouse. * * NB: The format of this array must not be changed, since it is * edited by the 'mkdev mouse' script, which relies on having one * entry per line. */ unsigned char sio_fifoctl[CHANNELS] = { 0, /* <- 1st array element, sio_fifoctl[0] */ FCR_Rx14 | 15, /* <- 2nd array element, sio_fifoctl[1] */ FCR_Rx14 | 15, /* <- 3rd array element, sio_fifoctl[2] */ ... FCR_Rx14 | 15, /* <- 9th array element, sio_fifoctl[8] */ ...
The TTHOG variable determines the size of the raw input queue of the terminal driver. It places a limit on the amount of data that can be written to the serial port by the modem. Increasing TTHOG increases the number of characters that can wait to be read from the port before characters are dropped.
The default value for TTHOG is 256 which is too small for high-speed throughput. A TTHOG value of 2048 is a good starting point. Even higher values may be called for in some applications. (Higher values for TTHOG also require you to increase the NCLIST kernel parameter.)
NCLIST determines the number of character list buffers (``cblocks'') that are available to the terminal driver. Each serial port is allowed to consume cblocks until it has used the number of bytes specified by the TTHOG kernel variable. Each cblock holds 64 bytes. This means that each serial port can use up to 32 cblocks for a TTHOG value of 2048, or 64 cblocks for a TTHOG value of 4096.
To increase TTHOG and NCLIST:
Determine the new value for NCLIST using the following
formula:
new NCLIST = old NCLIST + ( TTHOG fast_lines / 64 )
If you have one fast modem, the number of fast serial lines, fast_lines, is 1. Use the value of TTHOG that you will set in step 7. For example, if TTHOG is to be set to 4096 and the old NCLIST value is 120, set the new value of NCLIST to 184 (calculated from 120 + ( 4096 1 / 64 )).