April 11, 2006 LMC 4

### NAME

lmc - device driver for LMC (and some SBE) wide-area network interface cards

### SYNOPSIS

#### FreeBSD Synopsis

The driver can be loaded into a kernel at boot-time by adding

      if_lmc_load="YES"

to ```/boot/loader.conf`; see loader.conf(5).

The driver can be loaded into a running kernel after boot-time with kldload(8).

      kldload if_lmc

securelevel must be 0 to load modules after boot-time; see init(8).

The driver can be built into a kernel by adding the following to ```/sys/ARCH/conf/YOURKERNEL`:

      device        lmc
      device        sppp
      device        bpf
      device        pf      # for altq
      options       ALTQ
      options       ALTQ_HFSC # for altq example
      options       NETGRAPH
      options       DEVICE_POLLING

The driver can send and receive raw IP packets even if neither SPPP nor Netgraph are configured into the kernel.

#### NetBSD & OpenBSD Synopsis

This driver is built into the GENERIC kernel so it should "just work". The driver can be loaded into a running kernel with modload(8).

      modload if_lmc.o

The kernel must be built with support for Loadable Kernel Modules, lkm(8).

      options       LKM
      option        LKM

securelevel must be 0 to load modules; see init(8).

The driver can be built into a kernel by adding the following to ```/sys/arch/ARCH/conf/YOURKERNEL`:

      lmc*          at pci?
      options       ALTQ
      options       ALTQ_HFSC # for altq example
      option        ALTQ
      option        ALTQ_HFSC # for altq example
      pseudo-device sppp
      pseudo-device bpfilter

The driver can send and receive raw IP packets even if SPPP is not configured into the kernel.

#### BSD/OS Synopsis

The driver can be built into a custom kernel by adding the following to ```/sys/i386/conf/YOURKERNEL`:

      lmc*  at pci?
      options       PPP
      options       FR
      options       CISCO_HDLC
      pseudo-device bpfilter 16

The driver can send and receive raw IP packets even if P2P is not configured into the kernel.

#### Linux Synopsis

Configure the driver and line protocol for your kernel with

      make menuconfig

Navigating through the menus, select this device driver and the GenericHDLC layer as loadable kernel modules or built into the kernel:

      Device Drivers --->
      Networking Support --->
      Wan interfaces --->

Selecting LanMedia support selects the GenericHDLC and SyncPPP layers:

       LanMedia (and some SBE) WAN card support
      [*] Use NAPI to prevent livelock
      [*] Use the Generic HDLC layer
      [*] Use the SyncPPP layer

Selecting the GenericHDLC layer selects these protocols:

       Generic HDLC layer
      [*] Synchronous Point-to-Point Protocol (PPP) support
      [*] Cisco-HDLC support
      [*] Frame Relay support
      [*] Raw HDLC support
      [*] Raw HDLC Ethernet device support

Selecting the SyncPPP layer includes support for PPP and Cisco-HDLC protocols.

       SyncPPP layer

If configured as above, the kernel will recognize an LMC card when it boots and load this driver and the GenericHDLC code. Messages similar to the following will appear in ```/var/log/messages`:

      Cronyx Ltd, Synchronous PPP and CISCO HDLC (c) 1994
      Linux port (c) 1998 Building Number Three Ltd & Jan 'Yenya' Kasprzak.
      HDLC support module revision 1.18
      LMC Driver version 2006/1/20; Options NAPI GEN_HDLC SYNC_PPP.
      hdlc0:  T3 card> at pci 0000:00:13.0 irq 11

The driver can send and receive raw IP packets even if neither SyncPPP nor GenericHDLC are configured into the kernel. The device name will be hdlc if GenericHDLC layer is configured, or lmc otherwise.

The driver accepts two optional parameters:

debug
  Sets the driver's debug flag at initialization time--earlier than it can be set using lmcconfig or ifconfig.

verbose
  Enables additional log messages describing the hardware while booting or module-loading.

If the driver is built into the kernel, parameters are passed on the kernel command line:

      if_lmc.debug=1

If the driver is loaded into the kernel as a module, parameters are passed in the modprobe(8) command:

      modprobe if_lmc debug=1

### DESCRIPTION

This is an open-source Unix device driver for PCI-bus wide-area network interface cards. It sends and receives packets in HDLC frames over synchronous circuits. A computer plus UNIX plus some LMC cards makes an open wide-area network router.

The lmc driver works with FreeBSD, NetBSD, OpenBSD, BSD/OS, and Linux OSs. It has been tested on i386 (SMP 32-bit little-end), PowerPC (32-bit big-end), Alpha (64-bit little-end), and Sparc (64-bit big-end) architectures.

The lmc driver works with the following cards:

LMC5200
  HSSI--High Speed Serial Interface,

      EIA612/613, 50-pin connector,
      0 to 52 Mb/s, DTE only.

LMC5245
  T3, 2xBNC conns, 75 ohm

      C-Parity or M13 Framing,
      DSX-3 up to 910 ft.

LMC1000
  SSI--Synchronous Serial Interface,

      V.35, X.21, EIA449, EIA530(A), EIA232,
      0 to 10 Mb/s, DTE or DCE.

LMC1200
  T1/E1, RJ45 conn, 100 or 120 ohms,

      T1-B8ZS-ESF, T1-AMI-SF, E1-HDB3-many,
      DSX-1 up to 1500 ft; CSU up to 6 Kft.

LMC cards contain a high-performance PCI interface, an HDLC function and either integrated modems (T1, T3) or modem interfaces (HSSI and SSI).

PCI
  The PCI interface is a DEC 21140A Tulip Fast Ethernet chip. This chip has an efficient PCI implementation with scatter/gather DMA, and can run at 100 Mb/s full duplex (twice as fast as needed here).

HDLC
  The HDLC functions (ISO-3309: flags, bit-stuffing, CRC) are implemented in a Field Programmable Gate Array (FPGA) which talks to the Ethernet chip through a Media Independent Interface (MII). The hardware in the FPGA translates between Ethernet packets and HDLC frames on-the-fly; think of it as a WAN PHY chip for Ethernet.

Modem
  The modem chips are the main differences between cards. HSSI cards use ECL10K chips to implement the EIA-612/613 interface. T3 cards use a TranSwitch TXC-03401 framer chip. SSI cards use Linear Technology LTC1343 modem interface chips. T1 cards use a BrookTree/Conexant/Mindspeed Bt8370 framer and line interface chip.

Line protocol stacks exist above device drivers and below internet protocol stacks. They typically encapsulate packets in HDLC frames and deal with higher-level issues like protocol multiplexing and security. The driver is compatible with several line protocol stacks:

Netgraph
  Netgraph(4) implements many basic packet-handling functions as kernel loadable modules. They can be interconnected in a graph to implement many protocols. Configuration is done from userland without rebuilding the kernel. ASCII configuration control messages are not currently supported.

SPPP
  sppp(4) implements Synchronous-PPP, Cisco-HDLC and Frame-Relay in the kernel.

SPPP
  sppp(4) implements Synchronous-PPP and Cisco-HDLC in the kernel.

P2P
  p2p(4) implements Synchronous-PPP, Cisco-HDLC and Frame-Relay in the kernel.

GenericHDLC
  implements Synchronous-PPP, Cisco-HDLC, Frame-Relay, Ether-in-HDLC, IPv4-in-HDLC, and X.25 in the kernel.

SyncPPP
  implements Synchronous-PPP and Cisco-HDLC in the kernel. GenericHDLC uses SyncPPP as it's in-kernel PPP implementation.

RawIP
  The null line protocol, built into the driver, sends and receives raw IPv4 and IPv6 packets in HDLC frames with no extra bytes of overhead and no state at the end points.

### EXAMPLES

#### ifconfig and lmcconfig

The program lmcconfig(8) manipulates interface parameters beyond the scope of ifconfig(8). lmcconfig has many flags and options, but in normal operation only a few are needed.

      lmcconfig lmc0

displays interface configuration and status.

      lmcconfig lmc0 -X 1

selects the built-in RawIP line protocol stack.

      lmcconfig lmc0 -X 2 -x 2

selects the SPPP stack and the PPP protocol.

      lmcconfig lmc0 -X 3 -x 2

selects the P2P stack and the PPP protocol.

      lmcconfig lmc0 -X 4 -x 2

selects the GenericHDLC stack and the PPP protocol.

      lmcconfig lmc0 -X 5 -x 2

selects the SyncPPP stack and the PPP protocol.

      lmcconfig lmc0 -X 6

selects the Netgraph stack.

Some configuration options are available through ifconfig as well as lmcconfig.

      ifconfig -m lmc0

lists the available media options.

      ifconfig lmc0 mediaopt loopback

loops the interface transmitter to the receiver for testing. This loopback uses a path present in every card type. lmcconfig can select card-specific loopbacks, such as outbound payload loopback.

      ifconfig lmc0 media e1 timeslot all

selects E1 format using all 32 timeslots.

      ifconfig lmc0 mediaopt ppp

selects Point-to-Point Protocol.

      ifconfig lmc0 mediaopt master

selects the on-board crystal oscillator as the transmitter clock.

      ifconfig lmc0 debug

enables debugging output from the device driver and from the line protocol stack above it.

      lmcconfig lmc0 -D

enables debugging output from the device driver.

Debugging messages that appear on the console are also written to file ```/var/log/messages`. Caution: when things go very wrong, a torrent of debugging messages can swamp the console and bring a machine to its knees.

#### FreeBSD Operation

Configure a PPP link using SPPP and Netgraph with

      lmcconfig lmc0 -X 6
      ngctl mkpeer lmc0: sppp rawdata downstream
      ifconfig sppp0 10.0.0.1 10.0.0.2

Configure a PPP link using only SPPP with

      lmcconfig lmc0 -X 2 -x 2
      ifconfig lmc0 10.0.0.1 10.0.0.2

Configure a Cisco-HDLC link using SPPP and Netgraph with

      lmcconfig lmc0 -X 6
      ngctl mkpeer lmc0: sppp rawdata downstream
      ifconfig sppp0 10.0.0.1 10.0.0.2 link2

Configure a Cisco-HDLC link using only SPPP with

      lmcconfig lmc0 -X 2 -x 3
      ifconfig lmc0 10.0.0.1 10.0.0.2

Configure a Cisco-HDLC link using only Netgraph with

      lmcconfig lmc0 -X 6
      ngctl mkpeer lmc0: cisco rawdata downstream
      ngctl mkpeer lmc0:rawdata iface inet inet
      ifconfig ng0 10.0.0.1 10.0.0.2

Configure a Frame-Relay DTE link using SPPP with

      lmcconfig lmc0 -X 2 -x 4
      ifconfig lmc0 10.0.0.1 10.0.0.2

SPPP implements the ANSI link management interface (LMI).

Configure a Frame-Relay DTE link using Netgraph with

      lmcconfig lmc0 -X 6
      ngctl mkpeer lmc0: frame_relay rawdata downstream
      ngctl mkpeer lmc0:rawdata lmi dlci0 auto0
      ngctl connect lmc0:rawdata dlci0 dlci1023 auto1023
      ngctl mkpeer lmc0:rawdata rfc1490 dlci500 downstream
      ngctl mkpeer lmc0:rawdata.dlci500 iface inet inet
      ifconfig ng0 10.0.0.1 10.0.0.2

Netgraph implements ANSI, ITU, and FRIF link management interfaces (LMIs).

Configure a RAWIP link using only the driver with

      lmcconfig lmc0 -X 1
      ifconfig lmc0 10.0.0.1 10.0.0.2

Configure a RAWIP link using Netgraph with

      lmcconfig lmc0 -X 6
      ngctl mkpeer lmc0: iface rawdata inet
      ifconfig ng0 10.0.0.1 10.0.0.2

#### NetBSD & OpenBSD Operation

Configure a PPP link using SPPP with

      lmcconfig lmc0 -X 2 -x 2
      ifconfig lmc0 10.0.0.1 10.0.0.2

Configure a Cisco-HDLC link using SPPP with

      lmcconfig lmc0 -X 2 -x 3
      ifconfig lmc0 10.0.0.1 10.0.0.2

Configure a RAWIP link with

      lmcconfig lmc0 -X 1
      ifconfig lmc0 10.0.0.1 10.0.0.2

#### BSD/OS Operation

Configure a PPP link using P2P by creating file ```/etc/ppp.sys` containing

      Plmc0:        :device=lmc0:
                    :local-addr=10.0.0.1:
                    :remote-addr=10.0.0.2:
                    :immediate:dialout:direct:
                    :-pfc:-acfc:-tcpc:

Then run ppp(8):

      ppp -bd Plmc0

Add -X debug-all to watch protocol events happen.

Configure a Cisco-HDLC link by setting LINKTYPE with

      ifconfig lmc0 10.0.0.1 10.0.0.2 linktype chdlc

Configure a Fame-Relay link with

      ifconfig lmc0 linktype fr
      frconfig lmc0 lmi ansi [type dce]
      frconfig lmc0 dlci 500 10.0.0.2
      ifconfig lmc0 10.0.0.1 10.0.0.2

Adding ``type dce'' after ``ansi'' configures it as a DCE (switch). P2P implements ANSI, ITU and FRIF link management interfaces (LMIs).

Configure a RAWIP link with

      lmcconfig lmc0 -X 1
      ifconfig lmc0 10.0.0.1 10.0.0.2

#### Linux operation

The sethdlc program configures the GenericHDLC code.

      sethdlc hdlc0
      (or
      pvc0
      for frame relay)

displays the current settings of a given device. Note that sethdlc must be run before ifconfig. Sethdlc and the GenericHDLC kernel code are documented in ```/usr/src/linux/Documentation/networking/generic-hdlc.txt` and at ```http://www.kernel.org:/pub/linux/utils/net/hdlc`

Configure a PPP link using GenericHDLC with

      lmcconfig lmc0 -X 4 -x 2
      sethdlc hdlc0 ppp
      ifconfig hdlc0 10.0.0.1 pointopoint 10.0.0.2

Configure a PPP link using SyncPPP with

      lmcconfig hdlc0 -X 5 -x 2
      ifconfig hdlc0 10.0.0.1 pointopoint 10.0.0.2

Configure a Cisco-HDLC link using GenericHDLC with

      lmcconfig lmc0 -X 4
      sethdlc hdlc0 cisco
      ifconfig hdlc0 10.0.0.1 pointopoint 10.0.0.2

Configure a Cisco-HDLC link using SyncPPP with

      lmcconfig hdlc0 -X 5 -x 3
      ifconfig hdlc0 10.0.0.1 pointopoint 10.0.0.2

Configure a Frame-Relay DTE link using GenericHDLC with

      lmcconfig lmc0 -X 4
      sethdlc hdlc0 fr lmi ansi [dce]
      sethdlc hdlc0 create 500
      ifconfig hdlc0 up
      ifconfig pvc0 10.0.0.1 pointopoint 10.0.0.2

Adding ``dce'' after ``ansi'' configures it as a DCE (switch). GenericHDLC implements ANSI and ITU link management interfaces (LMIs).

Configure a RAWIP link using GenericHDLC with

      lmcconfig lmc0 -X 4
      sethdlc hdlc0 hdlc
      ifconfig hdlc0 10.0.0.1 pointopoint 10.0.0.2

Configure a RAWIP link using only the driver with

      lmcconfig hdlc0 -X 1
      ifconfig hdlc0 10.0.0.1 pointopoint 10.0.0.2

### TESTING

#### Testing with Loopbacks

Testing with loopbacks requires only one card and can test everything on that card. Packets can be looped back at many points: in the PCI chip, in the modem chips, through a loopback plug, in the local external equipment, or at the far end of a circuit.

All cards can be looped through the PCI chip. Cards with internal modems can be looped through the modem framer and the modem line interface. Cards for external modems can be looped through the driver/receiver chips. See lmcconfig(8) for details.

Configure the card with

      ifconfig lmc0 10.0.0.1 10.0.0.1

HSSI
  Loopback plugs can be ordered from SBE (and others). Transmit clock is normally supplied by the external modem. When an HSSI card is operated with a loopback plug, the PCI bus clock must be used as the transmit clock, typically 33 MHz. When testing an HSSI card with a loopback plug, configure it with

        lmcconfig lmc0 -a 2

  ``-a`` `2`'' selects the PCI bus clock as the transmit clock.

T3
  Connect the two BNC jacks with a short coax cable.

SSI
  Loopback plugs can be ordered from SBE (only). Transmit clock is normally supplied by the external modem. When an SSI card is operated with a loopback plug, the on-board clock synthesizer must be used. When testing an SSI card with a loopback plug, configure it with

        lmcconfig lmc0 -E -f 10000000

      ``-E''
      puts the card in DCE mode to source a transmit clock.
      ``-f 10000000''
      sets the internal clock source to 10 Mb/s.

T1/E1
  A loopback plug is a modular plug with two wires connecting pin 1 to pin 4 and pin 2 to pin 5.

One can also test by connecting to a local modem (HSSI and SSI) or NI (T1 and T3) configured to loop back. Cards can generate signals to loopback remote equipment so that complete circuits can be tested; see lmcconfig(8) for details.

#### Testing with a Modem

Testing with a modem requires two cards of different types. The cards can be in the same machine or different machines.

Configure the two cards with

      ifconfig lmc0 10.0.0.1 10.0.0.2
      ifconfig lmc1 10.0.0.2 10.0.0.1

T3/HSSI
  If you have a T3 modem with an HSSI interface (made by Digital Link, Larscom, Kentrox etc.) then use an HSSI card and a T3 card. The coax cables between the card and the modem must ``cross over'' (see below).

T1/V.35
  If you have a T1 (or E1) modem with a V.35, X.21 or EIA530 interface, then use an SSI card and a T1 card. Use a T1 null modem cable (see below) between the external modem and the T1 card.

#### Testing with a Null Modem Cable

Testing with a null modem cable requires two cards of the same type. The cards can be in the same machine or different machines.

Configure the two cards with

      ifconfig lmc0 10.0.0.1 10.0.0.2
      ifconfig lmc1 10.0.0.2 10.0.0.1

HSSI
  Three-meter HSSI null-modem cables can be ordered from SBE. In a pinch, a 50-pin SCSI-II cable up to a few meters will work as a straight HSSI cable (not a null modem cable). Longer cables should be purpose-built HSSI cables because the cable impedance is different. Transmit clock is normally supplied by the external modem. When an HSSI card is connected by a null modem cable, the PCI bus clock can be used as the transmit clock, typically 33 MHz. When testing an HSSI card with a null modem cable, configure it with

        lmcconfig lmc0 -a 2

  ``-a`` `2`'' selects the PCI bus clock as the transmit clock.

T3
  T3 null modem cables are just 75-ohm coax cables with BNC connectors. TX OUT on one card should be connected to RX IN on the other card. In a pinch, 50-ohm thin Ethernet cables usually work up to a few meters, but they will not work for longer runs--75-ohm coax is required.

SSI
  Three-meter SSI null modem cables can be ordered from SBE. An SSI null modem cable reports a cable type of V.36/EIA449. Transmit clock is normally supplied by the external modem. When an SSI card is connected by a null modem cable, an on-board clock synthesizer is used. When testing an SSI card with a null modem cable, configure it with

        lmcconfig lmc0 -E -f 10000000

      ``-E''
      puts the card in DCE mode to source a transmit clock.
      ``-f 10000000''
      sets the internal clock source to 10 Mb/s.

T1/E1
  A T1 null modem cable has two twisted pairs that connect pins 1 and 2 on one plug to pins 4 and 5 on the other plug. Looking into the cable entry hole of a plug, with the locking tab oriented down, pin 1 is on the left. A twisted pair Ethernet cable makes an excellent straight T1 cable. Alas, Ethernet cross-over cables do not work as T1 null modem cables.

### OPERATING NOTES

#### LEDs

HSSI and SSI cards should be operational if all three green LEDs are on (the upper-left one should be blinking) and the red LED is off.

RED | upper-right | No Transmit clock
GREEN | upper-left | Device driver is alive if blinking
GREEN | lower-right | Modem signals are good
GREEN | lower-left | Cable is plugged in (SSI only)

T1/E1 and T3 cards should be operational if the upper-left green LED is blinking and all other LEDs are off. For the T3 card, if other LEDs are on or blinking, try swapping the coax cables!

RED | upper-right | Received signal is wrong
GREEN | upper-left | Device driver is alive if blinking
BLUE | lower-right | Alarm Information Signal (AIS)
YELLOW | lower-left | Remote Alarm Indication (RAI)

RED | blinks if an outward loopback is active.
GREEN | blinks if the device driver is alive.
BLUE | blinks if sending AIS, on solid if receiving AIS.
YELLOW | blinks if sending RAI, on solid if receiving RAI.

#### Packet Lengths

    Maximum transmit and receive packet length is unlimited.
    Minimum transmit and receive packet length is one byte.

Cleaning up after one packet and setting up for the next packet involves making several DMA references. This can take longer than the duration of a short packet, causing the adapter to fall behind. For typical PCI bus traffic levels and memory system latencies, back-to-back packets longer than about 20 bytes will always work (53 byte cells work), but a burst of several hundred back-to-back packets shorter than 20 bytes will cause packets to be dropped. This usually is not a problem since an IPv4 packet header is at least 20 bytes long.

The device driver imposes no constraints on packet size. Most operating systems set the default Maximum Transmission Unit (MTU) to 1500 bytes; the legal range is usually (72..65535). This can be changed with

      ifconfig lmc0 mtu 2000

SPPP enforces an MTU of 1500 bytes for PPP and Cisco-HDLC. P2P enforces an MTU of 1500 bytes for PPP and Cisco-HDLC, and 4000 bytes for Frame Relay. GenericHDLC enforces an MTU range of (68..1500) bytes. RAWIP sets the default MTU to 4032 bytes, but allows it to be changed to anything.

#### ALTQ: Alternate Output Queue Disciplines

The driver has hooks for altq(9), the Alternate Queueing package. To see ALTQ in action, use your favorite traffic generation program to generate three flows sending down one T3 circuit. Without ALTQ, the speeds of the three connections will vary chaotically. Enable ALTQ and two of the connections will run at about 20 Mb/s and the third will run at about 2 Mb/s.

#### FreeBSD ALTQ example

Enable pf(4) and add the following lines to ```/etc/pf.conf`:

      altq on lmc0 bandwidth 44Mb hfsc queue{ a b c}
      queue a  on lmc0 bandwidth 48%
      pass in  on lmc0 queue a from 10.0.0.2 port 12345 to 10.0.0.1
      pass out on lmc0 queue a from 10.0.0.1 to 10.0.0.2 port 12345
      queue b  on lmc0 bandwidth 48%
      pass in  on lmc0 queue b from 10.0.0.2 port 12346 to 10.0.0.1
      pass out on lmc0 queue b from 10.0.0.1 to 10.0.0.2 port 12346
      queue c  on lmc0 bandwidth 4% hfsc(default)
      pass in  on lmc0 queue c from 10.0.0.2 port 12347 to 10.0.0.1
      pass out on lmc0 queue c from 10.0.0.1 to 10.0.0.2 port 12347

#### NetBSD and OpenBSD ALTQ example

Enable altqd(8) and add the following lines to ```/etc/altq.conf`:

      interface lmc0 bandwidth 44M hfsc
      class hfsc lmc0 a root pshare 48
      filter lmc0 a 10.0.0.2 12345 10.0.0.1 0 6
      filter lmc0 a 10.0.0.1 0 10.0.0.2 12345 6
      class hfsc lmc0 b root pshare 48
      filter lmc0 b 10.0.0.2 12346 10.0.0.1 0 6
      filter lmc0 b 10.0.0.1 0 10.0.0.2 12346 6
      class hfsc lmc0 c root pshare 4 default
      filter lmc0 c 10.0.0.2 12347 10.0.0.1 0 6
      filter lmc0 c 10.0.0.1 0 10.0.0.2 12347 6

The example above requires the Packet Filter pf(4) and the altq(4) Hierarchical Fair Service Curve queue discipline to be configured in ```conf/YOURKERNEL`:

      device pf
      option ALTQ
      option ALTQ_HFSC.
      options ALTQ
      options ALTQ_HFSC.

#### BPF: Berkeley Packet Filter

The driver has hooks for bpf(4), the Berkeley Packet Filter, a protocol-independent raw interface to data link layers.

To test the BPF kernel interface, bring up a link between two machines, then run ping(8) and tcpdump(1):

      ping 10.0.0.1

and in a different window:

      tcpdump -i lmc0

The output from tcpdump should look like this:

      03:54:35.979965 10.0.0.2 > 10.0.0.1: icmp: echo request
      03:54:35.981423 10.0.0.1 > 10.0.0.2: icmp: echo reply

Line protocol control packets may appear among the ping packets occasionally.

The kernel must be configured with

      device bpf
      options bpfilter
      option bpfilter
      pseudo-device bpfilter

#### Device Polling

A T3 receiver can generate over 100K interrupts per second, This can cause a system to ``live-lock'': spend all of its time servicing interrupts. Linux's polling mechanism disables a card's interrupt when it interrupts, calls the card's interrupt service routine with kernel interrupts enabled, and then reenables the card's interrupt. The driver is permitted to process a limited number of packets each time it is called by the kernel. Card interrupts are left disabled if more packets arrive than are permitted to be processed, which in extreme cases will result in packets being dropped in hardware at no cost to software.

Polling is enabled using menuconfig by selecting

       LanMedia (and some SBE) WAN card support
      [*] Use NAPI to prevent livelock

#### Device Polling

A T3 receiver can generate over 100K interrupts per second, This can cause a system to ``live-lock'': spend all of its time servicing interrupts. FreeBSD's polling(4) mechanism permanently disables interrupts from the card and instead the card's interrupt service routine is polled each time the kernel is entered (syscall, timer interrupt, etc.) and from the kernel idle loop; this adds some latency. The driver is permitted to process a limited number of packets each time it is called by the kernel.

Polling is enabled with

      ifconfig lmc0 polling

The kernel must be configured with

      options DEVICE_POLLING

#### SNMP: Simple Network Management Protocol

The driver is aware of what is required to be a Network Interface Object managed by an Agent of the Simple Network Management Protocol. The driver exports SNMP-formatted configuration and status information sufficient for an SNMP Agent to create MIBs for:

RFC-2233
RFC-2496
RFC-2495
RFC-1659

An SNMP Agent is a user program, not a kernel function. Agents can retrieve configuration and status information by using Netgraph control messages or ioctl(2) system calls. User programs should poll sc->cfg.ticks which increments once per second after the SNMP state has been updated.

#### E1 Framing

Phone companies usually insist that customers put a Frame Alignment Signal (FAS) in time slot 0. A Cyclic Redundancy Checksum (CRC) can also ride in time slot 0. Channel Associated Signalling (CAS) uses Time Slot 16. In telco-speak signalling is on/off hook, ringing, busy, etc. Signalling is not needed here and consumes 64 Kb/s. Only use E1-CAS formats if the other end insists on it! Use E1-FAS+CRC framing format on a public circuit. Depending on the equipment installed in a private circuit, it may be possible to use all 32 time slots for data (E1-NONE).

#### T3 Framing

M13 is a technique for multiplexing 28 T1s into a T3. Muxes use the C-bits for speed-matching the tributaries. Muxing is not needed here and usurps the FEBE and FEAC bits. Only use T3-M13 format if the other end insists on it! Use T3-CParity framing format if possible. Loop Timing, Fractional T3, and HDLC packets in the Facility Data Link are not supported.

#### T1 & T3 Frame Overhead Functions

    Performance Report Messages (PRMs) are enabled in T1-ESF.
    Bit Oriented Protocol (BOP) messages are enabled in T1-ESF.
    In-band loopback control (framed or not) is enabled in T1-SF.
    Far End Alarm and Control (FEAC) msgs are enabled in T3-CPar.
    Far End Block Error (FEBE) reports are enabled in T3-CPar.
    Remote Alarm Indication (RAI) is enabled in T3-Any.
    Loopbacks initiated remotely time out after 300 seconds.

#### T1/E1 'Fractional' 64 kb/s Time Slots

T1 uses time slots 24..1; E1 uses time slots 31..0. E1 uses TS0 for FAS overhead and TS16 for CAS overhead. E1-NONE has no overhead, so all 32 TSs are available for data. Enable/disable time slots by setting 32 1s/0s in a config param. Enabling an E1 overhead time slot, or enabling TS0 or TS25-TS31 for T1, is ignored by the driver, which knows better. The default TS param, 0xFFFFFFFF, enables the maximum number of time slots for whatever frame format is selected. 56 Kb/s time slots are not supported.

### SEE ALSO

tcpdump(1), tcpdump(1), tcpdump(1), tcpdump(1), ioctl(2), bpf(4), bpf(4), bpf(4), bpf(4), de(4), de(4), de(4), de(4), kld(4), netgraph(4), p2p(4), pf(4), polling(4), sppp(4), sppp(4), sppp(4), altq.conf(5), altq.conf(5), loader.conf(5), pf.conf(5), altqd(8), altqd(8), frconfig(8), ifconfig(8), init(8), init(8), init(8), kldload(8), lkm(8), lkm(8), lmcconfig(8), modload(8), modload(8), modprobe(8), ngctl(8), ping(8), ppp(8), tcpdump(8), altq(9), altq(9), altq(9), ifnet(9) ifnet(9) ifnet(9) ifnet(9)

    http://www.sbei.net/
    http://www.kernel.org:/pub/linux/utils/net/hdlc
    file://usr/src/linux/Documentation/networking/generic-hdlc.txt

### HISTORY

Ron Crane
had the idea to use a Fast Ethernet chip as a PCI interface and add an Ethernet-to-HDLC gate array to make a WAN card. David Boggs
designed the Ethernet-to-HDLC gate array and PC cards. We did this at our company, LAN Media Corporation (LMC). SBE Corporation aquired LMC and continues to make the cards.

Since the cards use Tulip Ethernet chips, we started with Matt Thomas'
ubiquitous de(4) driver. Michael Graff
stripped out the Ethernet stuff and added HSSI stuff. Basil Gunn
ported it to Solaris (lost) and Rob Braun
ported it to Linux. Andrew Stanley-Jones
added support for three more cards. David Boggs
rewrote everything and now feels responsible for it.

### AUTHORS

David Boggs <boggs@boggs.palo-alto.ca.us>