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