From: andrew@megadata.mega.oz.au (Andrew McRae)
Subject: Announcement: CSLIP for SunOS 4.1.x
Keywords: CSLIP, SunOS
Organization: Megadata P/L, North Ryde, Sydney, Aust.
Date: Sat, 2 Jan 1993 11:53:04 GMT

A revamped SL/IP package for SunOS 4.1.x is available for
anonymous ftp from dmssyd.syd.dms.csiro.au, under
the file src/cslip-sunos.tar.Z

Kam Tam from the CSIRO has kindly allowed me to place the
package on dmssyd, as we do not have a direct Internet
connection. Any comments, complaints or corrections should
*not* be directed to anyone at the CSIRO, but to
me (andrew@mega.oz.au).

I have seen several people asking about cslip for 4.1.x, and
I have sent a few people this package and they tell me it works,
and that I should make it publicly available, so here it is.

The first origins of the software is lost in the mists of time;
Mark Andrews (from CSIRO) converted it to use SunOS STREAMS.
I used that package as a base, and have hacked it mercilessly to
add VJ TCP header compression, and to streamline it so that it can
run a little faster.

It has been tested and used on IPC's, SS1's and some other
Suns we have lying around, all under SunOS 4.1.1 - I don't
see any reason why it wouldn't drop into any 4.1.x system,
but your mileage may vary.

The primary motivation for doing this was to get TCP
header compression running on low speed (2400 baud) SL/IP
lines - PPP could not be used because the terminal servers
on the other end can't talk PPP. Even if you do not
use header compress, it is probably worth using this
package for ordinary SL/IP because of the CPU cycles you
will save.

Please send any comments, patches etc. to me. It would help
if someone compiled it and ran it on 4.1.3 just to see
if it works.

The README is attached.

Enjoy!

Andrew McRae			inet:	andrew@mega.oz.au
Megadata Pty Ltd,		uucp:	..!uunet!mega.oz.au!andrew
North Ryde  2113		Phone:	+61 2 805 0899
NSW    AUSTRALIA		Fax:	+61 2 887 4847
------------------
README for SunOS 4.1.1 Compressed SL/IP

The original package was developed by Mark Andrews @ CSIRO DMS Sydney,
from the original SL/IP stuff.

This version has been much modified, with the dual goal of adding
Van Jacobsen's TCP header compression, and improved performance.
Even if you do not use the header compression stuff, the reduced
load on the CPU is worth it.
It should be completely compatible with old SL/IP drivers, as
the TCP header compression can be enabled/allowed via an option
to slip-attach.

A summary of changes:

- Added TCP header compression - The standard header compression code
  was used unmodified *except* for a small mod to use mbufs in the
  decompression so that the caller would not have to allocate 128 bytes
  at the start of every packet. The new slcompress.c is included.

- Collapsed the SL/IP frame encoding from a separate STREAMS module
  into the main module. An attempt to reduce extra overhead.

- Removed re-copies of data. As a result of having two STREAMS modules
  in the stack, the same data was copied to and fro several times.

- Attempted to guess some buffer sizes to avoid scanning the whole
  packet and count the ESCaped characters.

- Added the FLAGS setting code, and also put in the slip stats
  counting.

By far and away the biggest difference in performance is due to the
(almost paranoid :-) avoidance of data copying. In the old code I
counted 4 copies of the same data; 1) from zs driver to STREAMS mblk,
2) in slipencode, from STREAMS mblk to internal buffer, 3) at end
of packet to another mblk for xfer to str_ip, 4) in str_ip from
the mblk to the mbufs. On output the code scanned the entire packet
and counted the escapes before allocating a mblk, then had to
scan the packet again to copy it.

The new code copies the mblk data from the zs driver directly to mbufs,
after doing the SL/IP frame decoding.
On output a buffer is allocated after a scratch-the-head fudge
factor is added to the actual length of the packet, and then the
packet is copied. If it runs out of room, it retries with a bigger
packet etc. I keep a track of the number of recopies, and it has
never needed to do one yet, so I figure it's a win.

The SunOS 4.1.1 serial driver for the Zilog 8530 (at least on
all the Suns I have tried) is still a performance black hole, but
at least the rest has been leaned down somewhat. It does make
a difference. The problem seems to be related to extra interrupts
and CPU load when the SL/IP is busy. For example, in one test I
sent large ping packets to an idle workstation on a 19.2 Kbaud
SL/IP line; the system time went to over 50%, and the number of
interrupts went to over 27000 per second (I would only expect around
4000 max), so if *anybody* knows what's going on and can give
me a magic fix, I would appreciate it.

Installation Instructions.
--------------------------
cp slip_var.h slcompress.h /usr/include/sys
cp slip_var.h slcompress.h /sys/sys
cp streamsip.c slcompress.c /sys/os

edit /sys/conf.common/files.cmn and add the lines:

os/streamsip.c                optional slip
os/slcompress.c               optional slip


edit /sys/sun/str_conf.c and add:

#include "slip.h"

#if     NSLIP > 0
extern  struct  streamtab streams_ip;
#endif

#if     NSLIP > 0
	{ "str_ip", &streams_ip },
#endif

Edit your kernel configuration /sys/sun?/conf/MACHINE and add the
line below to install the SL/IP psuedo devices.

pseudo-device    slip2

Build the new kernel, install and reboot.

make and install slip-attach and slipstat

run slip-attach
	slip-attach [ -csa] device speed local remote netmask

Where -c will turn on header compression, -a will only turn it on
if a valid compressed SL/IP packet is received. The default is
to disable the header compression. -s will set a small MTU (256 bytes);
the default is 1006 bytes.
e.g.
/usr/local/etc/slip-attach -c /dev/ttya 19200 my_host their_host 255.255.255.0

slipstat will give you statistics about normal and compressed packets sent
and received. Run it with stdin set to the device that the SL/IP module
is running on e.g.

	slipstat < /dev/ttya

Slipstat has an option (-c) to print the header compression stats, and
you can also put a delay and count in to continuously print the stats e.g:

	slipstat -c 10 5000 < /dev/ttya

will print the header compression stats every 10 seconds for 5000 samples.

Enjoy!
Andrew McRae (andrew@megadata.mega.oz.au)
Newsgroups: news.future