Книга: Linux Network Administrator Guide, Second Edition

The PLIP Driver

The PLIP Driver

Parallel Line IP (PLIP) is a cheap way to network when you want to connect only two machines. It uses a parallel port and a special cable, achieving speeds of 10 kilobytes per second to 20 kilobytes per second.

PLIP was originally developed by Crynwr, Inc. Its design at the time was rather ingenious (or, if you prefer, a hack), because the original parallel ports on IBM PCs were designed to spend their time being unidirectional printer ports; the eight data lines could be used only to send data from the PC to the peripheral device, but not the other way around.[21] The Cyrnwr PLIP design worked around this limitation by using the port's five status lines for input, which limited it to transferring all data as nibbles (half bytes) only, but allowed for bidirectional transfer. This mode of operation was called PLIP "mode 0." Today, the parallel ports supplied on PC hardware cater to full bidirectional 8-bit data transfer, and PLIP has been extended to accomodate this with the addition of PLIP "mode 1."

Linux kernels up to and including Version 2.0 support PLIP mode 0 only, and an enhanced parallel port driver exists as a patch against the 2.0 kernel and as a standard part of the 2.2 kernel code to provide PLIP mode 1 operation, too.[22] Unlike earlier versions of the PLIP code, the driver now attempts to be compatible with the PLIP implementations from Crynwr, as well as the PLIP driver in NCSA telnet.[23] To connect two machines using PLIP, you need a special cable sold at some shops as a Null Printer or Turbo Laplink cable. You can, however, make one yourself fairly easily; Appendix B, Useful Cable Configurations shows you how.

The PLIP driver for Linux is the work of almost countless persons. It is currently maintained by Niibe Yutaka.[24] If compiled into the kernel, it sets up a network interface for each of the possible printer ports, with plip0 corresponding to parallel port lp0, plip1 corresponding to lp1, etc. The mapping of interfaces to ports differs in the 2.0 kernels and the 2.2 kernels. In the 2.0 kernels, the mapping was hardwired in the drivers/net/Spacd.c file in the kernel source. The default mappings in this file are:

Interface I/O Port IRQ
plip0 0x3BC 7
plip1 0x378 7
plip2 0x278 5

If you configured your printer port in a different way, you must change these values in drivers/net/Space.c in the Linux kernel source and build a new kernel.

In the 2.2 kernels, the PLIP driver uses the "parport" parallel port sharing driver developed by Philip Blundell.[25] The new driver allocates the PLIP network device names serially, just as for the Ethernet or PPP drivers, so the first PLIP device created is plip0, the second is plip1, and so on. The physical parallel port hardware is also allocated serially. By default, the parallel port driver will attempt to detect your parallel port hardware with an autoprobe routine, recording the physical device information in the order found. It is better practice to explicitly tell the kernel the physical I/O parameters. You can do this by supplying arguments to the parport_pc.o module as you load it, or if you have compiled the driver into your kernel, using lilo to supply arguments to the kernel at boot time. The IRQ setting of any device may be changed later by writing the new IRQ value to the related /proc/parport/*/irq file.

Configuring the physical I/O parameters in a 2.2 kernel when loading the module is straightforward. For instance, to tell the driver that you have two PC-style parallel ports at I/O addresses 0x278 and 0c378 and IRQs 5 and 7, respectively, you would load the module with the following arguments:

modprobe parport_pc io=0x278,0x378 irq=5,7

The corresponding arguments to pass to the kernel for a compiled-in driver are:

parport=0x278,5 parport=0x378,7

You would use the lilo append keyword to have these arguments passed to the kernel automatically at boot time.

When the PLIP driver is initialized, either at boot time if it is built-in, or when the plip.o module is loaded, each of the parallel ports will have a plip network device associated with it. plip0 will be assigned to the first parallel port device, plip1 the second, and so on. You can manually override this automatic assignment using another set of kernel arguments. For instance, to assign parport0 to network device plip0, and parport1 to network device plip1, you would use kernel arguments of:

plip=parport1 plip=parport0

This mapping does not mean, however, that you cannot use these parallel ports for printing or other purposes. The physical parallel port devices are used by the PLIP driver only when the corresponding interface is configured up.

Оглавление книги


Генерация: 1.354. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз