blob: ad7e3f7c3bbf1078269df19d7a4f88dd5e5ac895 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001PLIP: The Parallel Line Internet Protocol Device
2
3Donald Becker (becker@super.org)
4I.D.A. Supercomputing Research Center, Bowie MD 20715
5
6At some point T. Thorn will probably contribute text,
7Tommy Thorn (tthorn@daimi.aau.dk)
8
9PLIP Introduction
10-----------------
11
12This document describes the parallel port packet pusher for Net/LGX.
13This device interface allows a point-to-point connection between two
14parallel ports to appear as a IP network interface.
15
16What is PLIP?
17=============
18
19PLIP is Parallel Line IP, that is, the transportation of IP packages
20over a parallel port. In the case of a PC, the obvious choice is the
21printer port. PLIP is a non-standard, but [can use] uses the standard
22LapLink null-printer cable [can also work in turbo mode, with a PLIP
23cable]. [The protocol used to pack IP packages, is a simple one
24initiated by Crynwr.]
25
26Advantages of PLIP
27==================
28
29It's cheap, it's available everywhere, and it's easy.
30
31The PLIP cable is all that's needed to connect two Linux boxes, and it
32can be built for very few bucks.
33
34Connecting two Linux boxes takes only a second's decision and a few
35minutes' work, no need to search for a [supported] netcard. This might
36even be especially important in the case of notebooks, where netcards
37are not easily available.
38
39Not requiring a netcard also means that apart from connecting the
40cables, everything else is software configuration [which in principle
41could be made very easy.]
42
43Disadvantages of PLIP
44=====================
45
46Doesn't work over a modem, like SLIP and PPP. Limited range, 15 m.
47Can only be used to connect three (?) Linux boxes. Doesn't connect to
48an existing Ethernet. Isn't standard (not even de facto standard, like
49SLIP).
50
51Performance
52===========
53
54PLIP easily outperforms Ethernet cards....(ups, I was dreaming, but
55it *is* getting late. EOB)
56
57PLIP driver details
58-------------------
59
60The Linux PLIP driver is an implementation of the original Crynwr protocol,
61that uses the parallel port subsystem of the kernel in order to properly
62share parallel ports between PLIP and other services.
63
64IRQs and trigger timeouts
65=========================
66
67When a parallel port used for a PLIP driver has an IRQ configured to it, the
68PLIP driver is signaled whenever data is sent to it via the cable, such that
69when no data is available, the driver isn't being used.
70
71However, on some machines it is hard, if not impossible, to configure an IRQ
72to a certain parallel port, mainly because it is used by some other device.
73On these machines, the PLIP driver can be used in IRQ-less mode, where
74the PLIP driver would constantly poll the parallel port for data waiting,
75and if such data is available, process it. This mode is less efficient than
76the IRQ mode, because the driver has to check the parallel port many times
77per second, even when no data at all is sent. Some rough measurements
78indicate that there isn't a noticeable performance drop when using IRQ-less
79mode as compared to IRQ mode as far as the data transfer speed is involved.
80There is a performance drop on the machine hosting the driver.
81
82When the PLIP driver is used in IRQ mode, the timeout used for triggering a
83data transfer (the maximal time the PLIP driver would allow the other side
84before announcing a timeout, when trying to handshake a transfer of some
85data) is, by default, 500usec. As IRQ delivery is more or less immediate,
86this timeout is quite sufficient.
87
88When in IRQ-less mode, the PLIP driver polls the parallel port HZ times
89per second (where HZ is typically 100 on most platforms, and 1024 on an
90Alpha, as of this writing). Between two such polls, there are 10^6/HZ usecs.
91On an i386, for example, 10^6/100 = 10000usec. It is easy to see that it is
92quite possible for the trigger timeout to expire between two such polls, as
93the timeout is only 500usec long. As a result, it is required to change the
94trigger timeout on the *other* side of a PLIP connection, to about
9510^6/HZ usecs. If both sides of a PLIP connection are used in IRQ-less mode,
96this timeout is required on both sides.
97
98It appears that in practice, the trigger timeout can be shorter than in the
99above calculation. It isn't an important issue, unless the wire is faulty,
100in which case a long timeout would stall the machine when, for whatever
101reason, bits are dropped.
102
103A utility that can perform this change in Linux is plipconfig, which is part
104of the net-tools package (its location can be found in the
105Documentation/Changes file). An example command would be
106'plipconfig plipX trigger 10000', where plipX is the appropriate
107PLIP device.
108
109PLIP hardware interconnection
110-----------------------------
111
112PLIP uses several different data transfer methods. The first (and the
113only one implemented in the early version of the code) uses a standard
114printer "null" cable to transfer data four bits at a time using
115data bit outputs connected to status bit inputs.
116
117The second data transfer method relies on both machines having
118bi-directional parallel ports, rather than output-only ``printer''
119ports. This allows byte-wide transfers and avoids reconstructing
120nibbles into bytes, leading to much faster transfers.
121
122Parallel Transfer Mode 0 Cable
123==============================
124
125The cable for the first transfer mode is a standard
126printer "null" cable which transfers data four bits at a time using
127data bit outputs of the first port (machine T) connected to the
128status bit inputs of the second port (machine R). There are five
129status inputs, and they are used as four data inputs and a clock (data
130strobe) input, arranged so that the data input bits appear as contiguous
131bits with standard status register implementation.
132
133A cable that implements this protocol is available commercially as a
134"Null Printer" or "Turbo Laplink" cable. It can be constructed with
135two DB-25 male connectors symmetrically connected as follows:
136
137 STROBE output 1*
138 D0->ERROR 2 - 15 15 - 2
139 D1->SLCT 3 - 13 13 - 3
140 D2->PAPOUT 4 - 12 12 - 4
141 D3->ACK 5 - 10 10 - 5
142 D4->BUSY 6 - 11 11 - 6
143 D5,D6,D7 are 7*, 8*, 9*
144 AUTOFD output 14*
145 INIT output 16*
146 SLCTIN 17 - 17
147 extra grounds are 18*,19*,20*,21*,22*,23*,24*
148 GROUND 25 - 25
149* Do not connect these pins on either end
150
151If the cable you are using has a metallic shield it should be
152connected to the metallic DB-25 shell at one end only.
153
154Parallel Transfer Mode 1
155========================
156
157The second data transfer method relies on both machines having
158bi-directional parallel ports, rather than output-only ``printer''
159ports. This allows byte-wide transfers, and avoids reconstructing
160nibbles into bytes. This cable should not be used on unidirectional
161``printer'' (as opposed to ``parallel'') ports or when the machine
162isn't configured for PLIP, as it will result in output driver
163conflicts and the (unlikely) possibility of damage.
164
165The cable for this transfer mode should be constructed as follows:
166
167 STROBE->BUSY 1 - 11
168 D0->D0 2 - 2
169 D1->D1 3 - 3
170 D2->D2 4 - 4
171 D3->D3 5 - 5
172 D4->D4 6 - 6
173 D5->D5 7 - 7
174 D6->D6 8 - 8
175 D7->D7 9 - 9
176 INIT -> ACK 16 - 10
177 AUTOFD->PAPOUT 14 - 12
178 SLCT->SLCTIN 13 - 17
179 GND->ERROR 18 - 15
180 extra grounds are 19*,20*,21*,22*,23*,24*
181 GROUND 25 - 25
182* Do not connect these pins on either end
183
184Once again, if the cable you are using has a metallic shield it should
185be connected to the metallic DB-25 shell at one end only.
186
187PLIP Mode 0 transfer protocol
188=============================
189
190The PLIP driver is compatible with the "Crynwr" parallel port transfer
191standard in Mode 0. That standard specifies the following protocol:
192
193 send header nibble '0x8'
194 count-low octet
195 count-high octet
196 ... data octets
197 checksum octet
198
199Each octet is sent as
200 <wait for rx. '0x1?'> <send 0x10+(octet&0x0F)>
201 <wait for rx. '0x0?'> <send 0x00+((octet>>4)&0x0F)>
202
203To start a transfer the transmitting machine outputs a nibble 0x08.
204That raises the ACK line, triggering an interrupt in the receiving
205machine. The receiving machine disables interrupts and raises its own ACK
206line.
207
208Restated:
209
210(OUT is bit 0-4, OUT.j is bit j from OUT. IN likewise)
211Send_Byte:
212 OUT := low nibble, OUT.4 := 1
213 WAIT FOR IN.4 = 1
214 OUT := high nibble, OUT.4 := 0
215 WAIT FOR IN.4 = 0