Back to home page

OSCL-LXR

 
 

    


0001 .. SPDX-License-Identifier: GPL-2.0
0002 
0003 ================================================
0004 PLIP: The Parallel Line Internet Protocol Device
0005 ================================================
0006 
0007 Donald Becker (becker@super.org)
0008 I.D.A. Supercomputing Research Center, Bowie MD 20715
0009 
0010 At some point T. Thorn will probably contribute text,
0011 Tommy Thorn (tthorn@daimi.aau.dk)
0012 
0013 PLIP Introduction
0014 -----------------
0015 
0016 This document describes the parallel port packet pusher for Net/LGX.
0017 This device interface allows a point-to-point connection between two
0018 parallel ports to appear as a IP network interface.
0019 
0020 What is PLIP?
0021 =============
0022 
0023 PLIP is Parallel Line IP, that is, the transportation of IP packages
0024 over a parallel port. In the case of a PC, the obvious choice is the
0025 printer port.  PLIP is a non-standard, but [can use] uses the standard
0026 LapLink null-printer cable [can also work in turbo mode, with a PLIP
0027 cable]. [The protocol used to pack IP packages, is a simple one
0028 initiated by Crynwr.]
0029 
0030 Advantages of PLIP
0031 ==================
0032 
0033 It's cheap, it's available everywhere, and it's easy.
0034 
0035 The PLIP cable is all that's needed to connect two Linux boxes, and it
0036 can be built for very few bucks.
0037 
0038 Connecting two Linux boxes takes only a second's decision and a few
0039 minutes' work, no need to search for a [supported] netcard. This might
0040 even be especially important in the case of notebooks, where netcards
0041 are not easily available.
0042 
0043 Not requiring a netcard also means that apart from connecting the
0044 cables, everything else is software configuration [which in principle
0045 could be made very easy.]
0046 
0047 Disadvantages of PLIP
0048 =====================
0049 
0050 Doesn't work over a modem, like SLIP and PPP. Limited range, 15 m.
0051 Can only be used to connect three (?) Linux boxes. Doesn't connect to
0052 an existing Ethernet. Isn't standard (not even de facto standard, like
0053 SLIP).
0054 
0055 Performance
0056 ===========
0057 
0058 PLIP easily outperforms Ethernet cards....(ups, I was dreaming, but
0059 it *is* getting late. EOB)
0060 
0061 PLIP driver details
0062 -------------------
0063 
0064 The Linux PLIP driver is an implementation of the original Crynwr protocol,
0065 that uses the parallel port subsystem of the kernel in order to properly
0066 share parallel ports between PLIP and other services.
0067 
0068 IRQs and trigger timeouts
0069 =========================
0070 
0071 When a parallel port used for a PLIP driver has an IRQ configured to it, the
0072 PLIP driver is signaled whenever data is sent to it via the cable, such that
0073 when no data is available, the driver isn't being used.
0074 
0075 However, on some machines it is hard, if not impossible, to configure an IRQ
0076 to a certain parallel port, mainly because it is used by some other device.
0077 On these machines, the PLIP driver can be used in IRQ-less mode, where
0078 the PLIP driver would constantly poll the parallel port for data waiting,
0079 and if such data is available, process it. This mode is less efficient than
0080 the IRQ mode, because the driver has to check the parallel port many times
0081 per second, even when no data at all is sent. Some rough measurements
0082 indicate that there isn't a noticeable performance drop when using IRQ-less
0083 mode as compared to IRQ mode as far as the data transfer speed is involved.
0084 There is a performance drop on the machine hosting the driver.
0085 
0086 When the PLIP driver is used in IRQ mode, the timeout used for triggering a
0087 data transfer (the maximal time the PLIP driver would allow the other side
0088 before announcing a timeout, when trying to handshake a transfer of some
0089 data) is, by default, 500usec. As IRQ delivery is more or less immediate,
0090 this timeout is quite sufficient.
0091 
0092 When in IRQ-less mode, the PLIP driver polls the parallel port HZ times
0093 per second (where HZ is typically 100 on most platforms, and 1024 on an
0094 Alpha, as of this writing). Between two such polls, there are 10^6/HZ usecs.
0095 On an i386, for example, 10^6/100 = 10000usec. It is easy to see that it is
0096 quite possible for the trigger timeout to expire between two such polls, as
0097 the timeout is only 500usec long. As a result, it is required to change the
0098 trigger timeout on the *other* side of a PLIP connection, to about
0099 10^6/HZ usecs. If both sides of a PLIP connection are used in IRQ-less mode,
0100 this timeout is required on both sides.
0101 
0102 It appears that in practice, the trigger timeout can be shorter than in the
0103 above calculation. It isn't an important issue, unless the wire is faulty,
0104 in which case a long timeout would stall the machine when, for whatever
0105 reason, bits are dropped.
0106 
0107 A utility that can perform this change in Linux is plipconfig, which is part
0108 of the net-tools package (its location can be found in the
0109 Documentation/Changes file). An example command would be
0110 'plipconfig plipX trigger 10000', where plipX is the appropriate
0111 PLIP device.
0112 
0113 PLIP hardware interconnection
0114 -----------------------------
0115 
0116 PLIP uses several different data transfer methods.  The first (and the
0117 only one implemented in the early version of the code) uses a standard
0118 printer "null" cable to transfer data four bits at a time using
0119 data bit outputs connected to status bit inputs.
0120 
0121 The second data transfer method relies on both machines having
0122 bi-directional parallel ports, rather than output-only ``printer``
0123 ports.  This allows byte-wide transfers and avoids reconstructing
0124 nibbles into bytes, leading to much faster transfers.
0125 
0126 Parallel Transfer Mode 0 Cable
0127 ==============================
0128 
0129 The cable for the first transfer mode is a standard
0130 printer "null" cable which transfers data four bits at a time using
0131 data bit outputs of the first port (machine T) connected to the
0132 status bit inputs of the second port (machine R).  There are five
0133 status inputs, and they are used as four data inputs and a clock (data
0134 strobe) input, arranged so that the data input bits appear as contiguous
0135 bits with standard status register implementation.
0136 
0137 A cable that implements this protocol is available commercially as a
0138 "Null Printer" or "Turbo Laplink" cable.  It can be constructed with
0139 two DB-25 male connectors symmetrically connected as follows::
0140 
0141     STROBE output       1*
0142     D0->ERROR   2 - 15          15 - 2
0143     D1->SLCT    3 - 13          13 - 3
0144     D2->PAPOUT  4 - 12          12 - 4
0145     D3->ACK     5 - 10          10 - 5
0146     D4->BUSY    6 - 11          11 - 6
0147     D5,D6,D7 are   7*, 8*, 9*
0148     AUTOFD output 14*
0149     INIT   output 16*
0150     SLCTIN      17 - 17
0151     extra grounds are 18*,19*,20*,21*,22*,23*,24*
0152     GROUND      25 - 25
0153 
0154     * Do not connect these pins on either end
0155 
0156 If the cable you are using has a metallic shield it should be
0157 connected to the metallic DB-25 shell at one end only.
0158 
0159 Parallel Transfer Mode 1
0160 ========================
0161 
0162 The second data transfer method relies on both machines having
0163 bi-directional parallel ports, rather than output-only ``printer``
0164 ports.  This allows byte-wide transfers, and avoids reconstructing
0165 nibbles into bytes.  This cable should not be used on unidirectional
0166 ``printer`` (as opposed to ``parallel``) ports or when the machine
0167 isn't configured for PLIP, as it will result in output driver
0168 conflicts and the (unlikely) possibility of damage.
0169 
0170 The cable for this transfer mode should be constructed as follows::
0171 
0172     STROBE->BUSY 1 - 11
0173     D0->D0      2 - 2
0174     D1->D1      3 - 3
0175     D2->D2      4 - 4
0176     D3->D3      5 - 5
0177     D4->D4      6 - 6
0178     D5->D5      7 - 7
0179     D6->D6      8 - 8
0180     D7->D7      9 - 9
0181     INIT -> ACK  16 - 10
0182     AUTOFD->PAPOUT 14 - 12
0183     SLCT->SLCTIN 13 - 17
0184     GND->ERROR  18 - 15
0185     extra grounds are 19*,20*,21*,22*,23*,24*
0186     GROUND      25 - 25
0187 
0188     * Do not connect these pins on either end
0189 
0190 Once again, if the cable you are using has a metallic shield it should
0191 be connected to the metallic DB-25 shell at one end only.
0192 
0193 PLIP Mode 0 transfer protocol
0194 =============================
0195 
0196 The PLIP driver is compatible with the "Crynwr" parallel port transfer
0197 standard in Mode 0.  That standard specifies the following protocol::
0198 
0199    send header nibble '0x8'
0200    count-low octet
0201    count-high octet
0202    ... data octets
0203    checksum octet
0204 
0205 Each octet is sent as::
0206 
0207         <wait for rx. '0x1?'>   <send 0x10+(octet&0x0F)>
0208         <wait for rx. '0x0?'>   <send 0x00+((octet>>4)&0x0F)>
0209 
0210 To start a transfer the transmitting machine outputs a nibble 0x08.
0211 That raises the ACK line, triggering an interrupt in the receiving
0212 machine.  The receiving machine disables interrupts and raises its own ACK
0213 line.
0214 
0215 Restated::
0216 
0217   (OUT is bit 0-4, OUT.j is bit j from OUT. IN likewise)
0218   Send_Byte:
0219      OUT := low nibble, OUT.4 := 1
0220      WAIT FOR IN.4 = 1
0221      OUT := high nibble, OUT.4 := 0
0222      WAIT FOR IN.4 = 0