brintos

brintos / linux-shallow public Read only

0
0
Text · 8.2 KiB · 0eda745 Raw
223 lines · plain
1.. SPDX-License-Identifier: GPL-2.02 3================================================4PLIP: The Parallel Line Internet Protocol Device5================================================6 7Donald Becker (becker@super.org)8I.D.A. Supercomputing Research Center, Bowie MD 207159 10At some point T. Thorn will probably contribute text,11Tommy Thorn (tthorn@daimi.aau.dk)12 13PLIP Introduction14-----------------15 16This document describes the parallel port packet pusher for Net/LGX.17This device interface allows a point-to-point connection between two18parallel ports to appear as a IP network interface.19 20What is PLIP?21=============22 23PLIP is Parallel Line IP, that is, the transportation of IP packages24over a parallel port. In the case of a PC, the obvious choice is the25printer port.  PLIP is a non-standard, but [can use] uses the standard26LapLink null-printer cable [can also work in turbo mode, with a PLIP27cable]. [The protocol used to pack IP packages, is a simple one28initiated by Crynwr.]29 30Advantages of PLIP31==================32 33It's cheap, it's available everywhere, and it's easy.34 35The PLIP cable is all that's needed to connect two Linux boxes, and it36can be built for very few bucks.37 38Connecting two Linux boxes takes only a second's decision and a few39minutes' work, no need to search for a [supported] netcard. This might40even be especially important in the case of notebooks, where netcards41are not easily available.42 43Not requiring a netcard also means that apart from connecting the44cables, everything else is software configuration [which in principle45could be made very easy.]46 47Disadvantages of PLIP48=====================49 50Doesn't work over a modem, like SLIP and PPP. Limited range, 15 m.51Can only be used to connect three (?) Linux boxes. Doesn't connect to52an existing Ethernet. Isn't standard (not even de facto standard, like53SLIP).54 55Performance56===========57 58PLIP easily outperforms Ethernet cards....(ups, I was dreaming, but59it *is* getting late. EOB)60 61PLIP driver details62-------------------63 64The Linux PLIP driver is an implementation of the original Crynwr protocol,65that uses the parallel port subsystem of the kernel in order to properly66share parallel ports between PLIP and other services.67 68IRQs and trigger timeouts69=========================70 71When a parallel port used for a PLIP driver has an IRQ configured to it, the72PLIP driver is signaled whenever data is sent to it via the cable, such that73when no data is available, the driver isn't being used.74 75However, on some machines it is hard, if not impossible, to configure an IRQ76to a certain parallel port, mainly because it is used by some other device.77On these machines, the PLIP driver can be used in IRQ-less mode, where78the PLIP driver would constantly poll the parallel port for data waiting,79and if such data is available, process it. This mode is less efficient than80the IRQ mode, because the driver has to check the parallel port many times81per second, even when no data at all is sent. Some rough measurements82indicate that there isn't a noticeable performance drop when using IRQ-less83mode as compared to IRQ mode as far as the data transfer speed is involved.84There is a performance drop on the machine hosting the driver.85 86When the PLIP driver is used in IRQ mode, the timeout used for triggering a87data transfer (the maximal time the PLIP driver would allow the other side88before announcing a timeout, when trying to handshake a transfer of some89data) is, by default, 500usec. As IRQ delivery is more or less immediate,90this timeout is quite sufficient.91 92When in IRQ-less mode, the PLIP driver polls the parallel port HZ times93per second (where HZ is typically 100 on most platforms, and 1024 on an94Alpha, as of this writing). Between two such polls, there are 10^6/HZ usecs.95On an i386, for example, 10^6/100 = 10000usec. It is easy to see that it is96quite possible for the trigger timeout to expire between two such polls, as97the timeout is only 500usec long. As a result, it is required to change the98trigger timeout on the *other* side of a PLIP connection, to about9910^6/HZ usecs. If both sides of a PLIP connection are used in IRQ-less mode,100this timeout is required on both sides.101 102It appears that in practice, the trigger timeout can be shorter than in the103above calculation. It isn't an important issue, unless the wire is faulty,104in which case a long timeout would stall the machine when, for whatever105reason, bits are dropped.106 107A utility that can perform this change in Linux is plipconfig, which is part108of the net-tools package (its location can be found in the109Documentation/Changes file). An example command would be110'plipconfig plipX trigger 10000', where plipX is the appropriate111PLIP device.112 113PLIP hardware interconnection114-----------------------------115 116PLIP uses several different data transfer methods.  The first (and the117only one implemented in the early version of the code) uses a standard118printer "null" cable to transfer data four bits at a time using119data bit outputs connected to status bit inputs.120 121The second data transfer method relies on both machines having122bi-directional parallel ports, rather than output-only ``printer``123ports.  This allows byte-wide transfers and avoids reconstructing124nibbles into bytes, leading to much faster transfers.125 126Parallel Transfer Mode 0 Cable127==============================128 129The cable for the first transfer mode is a standard130printer "null" cable which transfers data four bits at a time using131data bit outputs of the first port (machine T) connected to the132status bit inputs of the second port (machine R).  There are five133status inputs, and they are used as four data inputs and a clock (data134strobe) input, arranged so that the data input bits appear as contiguous135bits with standard status register implementation.136 137A cable that implements this protocol is available commercially as a138"Null Printer" or "Turbo Laplink" cable.  It can be constructed with139two DB-25 male connectors symmetrically connected as follows::140 141    STROBE output	1*142    D0->ERROR	2 - 15		15 - 2143    D1->SLCT	3 - 13		13 - 3144    D2->PAPOUT	4 - 12		12 - 4145    D3->ACK	5 - 10		10 - 5146    D4->BUSY	6 - 11		11 - 6147    D5,D6,D7 are   7*, 8*, 9*148    AUTOFD output 14*149    INIT   output 16*150    SLCTIN	17 - 17151    extra grounds are 18*,19*,20*,21*,22*,23*,24*152    GROUND	25 - 25153 154    * Do not connect these pins on either end155 156If the cable you are using has a metallic shield it should be157connected to the metallic DB-25 shell at one end only.158 159Parallel Transfer Mode 1160========================161 162The second data transfer method relies on both machines having163bi-directional parallel ports, rather than output-only ``printer``164ports.  This allows byte-wide transfers, and avoids reconstructing165nibbles into bytes.  This cable should not be used on unidirectional166``printer`` (as opposed to ``parallel``) ports or when the machine167isn't configured for PLIP, as it will result in output driver168conflicts and the (unlikely) possibility of damage.169 170The cable for this transfer mode should be constructed as follows::171 172    STROBE->BUSY 1 - 11173    D0->D0	2 - 2174    D1->D1	3 - 3175    D2->D2	4 - 4176    D3->D3	5 - 5177    D4->D4	6 - 6178    D5->D5	7 - 7179    D6->D6	8 - 8180    D7->D7	9 - 9181    INIT -> ACK  16 - 10182    AUTOFD->PAPOUT 14 - 12183    SLCT->SLCTIN 13 - 17184    GND->ERROR	18 - 15185    extra grounds are 19*,20*,21*,22*,23*,24*186    GROUND	25 - 25187 188    * Do not connect these pins on either end189 190Once again, if the cable you are using has a metallic shield it should191be connected to the metallic DB-25 shell at one end only.192 193PLIP Mode 0 transfer protocol194=============================195 196The PLIP driver is compatible with the "Crynwr" parallel port transfer197standard in Mode 0.  That standard specifies the following protocol::198 199   send header nibble '0x8'200   count-low octet201   count-high octet202   ... data octets203   checksum octet204 205Each octet is sent as::206 207	<wait for rx. '0x1?'>	<send 0x10+(octet&0x0F)>208	<wait for rx. '0x0?'>	<send 0x00+((octet>>4)&0x0F)>209 210To start a transfer the transmitting machine outputs a nibble 0x08.211That raises the ACK line, triggering an interrupt in the receiving212machine.  The receiving machine disables interrupts and raises its own ACK213line.214 215Restated::216 217  (OUT is bit 0-4, OUT.j is bit j from OUT. IN likewise)218  Send_Byte:219     OUT := low nibble, OUT.4 := 1220     WAIT FOR IN.4 = 1221     OUT := high nibble, OUT.4 := 0222     WAIT FOR IN.4 = 0223