PLIP.txt 8.0 KB

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