1 |
1275 |
phoenix |
Generic HDLC layer
|
2 |
|
|
Krzysztof Halasa
|
3 |
|
|
January, 2003
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
Generic HDLC layer currently supports:
|
7 |
|
|
- Frame Relay (ANSI, CCITT and no LMI), with ARP support (no InARP).
|
8 |
|
|
Normal (routed) and Ethernet-bridged (Ethernet device emulation)
|
9 |
|
|
interfaces can share a single PVC.
|
10 |
|
|
- raw HDLC - either IP (IPv4) interface or Ethernet device emulation.
|
11 |
|
|
- Cisco HDLC,
|
12 |
|
|
- PPP (uses syncppp.c),
|
13 |
|
|
- X.25 (uses X.25 routines).
|
14 |
|
|
|
15 |
|
|
There are hardware drivers for the following cards:
|
16 |
|
|
- C101 by Moxa Technologies Co., Ltd.
|
17 |
|
|
- RISCom/N2 by SDL Communications Inc.
|
18 |
|
|
- and others, some not in the official kernel.
|
19 |
|
|
|
20 |
|
|
Ethernet device emulation (using HDLC or Frame-Relay PVC) is compatible
|
21 |
|
|
with IEEE 802.1Q (VLANs) and 802.1D (Ethernet bridging).
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
Make sure the hdlc.o and the hardware driver are loaded. It should
|
25 |
|
|
create a number of "hdlc" (hdlc0 etc) network devices, one for each
|
26 |
|
|
WAN port. You'll need the "sethdlc" utility, get it from:
|
27 |
|
|
http://hq.pm.waw.pl/hdlc/
|
28 |
|
|
|
29 |
|
|
Compile sethdlc.c utility:
|
30 |
|
|
gcc -O2 -Wall -o sethdlc sethdlc.c
|
31 |
|
|
Make sure you're using a correct version of sethdlc for your kernel.
|
32 |
|
|
|
33 |
|
|
Use sethdlc to set physical interface, clock rate, HDLC mode used,
|
34 |
|
|
and add any required PVCs if using Frame Relay.
|
35 |
|
|
Usually you want something like:
|
36 |
|
|
|
37 |
|
|
sethdlc hdlc0 clock int rate 128000
|
38 |
|
|
sethdlc hdlc0 cisco interval 10 timeout 25
|
39 |
|
|
or
|
40 |
|
|
sethdlc hdlc0 rs232 clock ext
|
41 |
|
|
sethdlc hdlc0 fr lmi ansi
|
42 |
|
|
sethdlc hdlc0 create 99
|
43 |
|
|
ifconfig hdlc0 up
|
44 |
|
|
ifconfig pvc0 localIP pointopoint remoteIP
|
45 |
|
|
|
46 |
|
|
In Frame Relay mode, ifconfig master hdlc device up (without assigning
|
47 |
|
|
any IP address to it) before using pvc devices.
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
Setting interface:
|
51 |
|
|
|
52 |
|
|
* v35 | rs232 | x21 | t1 | e1 - sets physical interface for a given port
|
53 |
|
|
if the card has software-selectable interfaces
|
54 |
|
|
loopback - activate hardware loopback (for testing only)
|
55 |
|
|
* clock ext - external clock (uses DTE RX and TX clock)
|
56 |
|
|
* clock int - internal clock (provides clock signal on DCE clock output)
|
57 |
|
|
* clock txint - TX internal, RX external (provides TX clock on DCE output)
|
58 |
|
|
* clock txfromrx - TX clock derived from RX clock (TX clock on DCE output)
|
59 |
|
|
* rate - sets clock rate in bps (not required for external clock or
|
60 |
|
|
for txfromrx)
|
61 |
|
|
|
62 |
|
|
Setting protocol:
|
63 |
|
|
|
64 |
|
|
* hdlc - sets raw HDLC (IP-only) mode
|
65 |
|
|
nrz / nrzi / fm-mark / fm-space / manchester - sets transmission code
|
66 |
|
|
no-parity / crc16 / crc16-pr0 (CRC16 with preset zeros) / crc32-itu
|
67 |
|
|
crc16-itu (CRC16 with ITU-T polynomial) / crc16-itu-pr0 - sets parity
|
68 |
|
|
|
69 |
|
|
* hdlc-eth - Ethernet device emulation using HDLC. Parity and encoding
|
70 |
|
|
as above.
|
71 |
|
|
|
72 |
|
|
* cisco - sets Cisco HDLC mode (IP, IPv6 and IPX supported)
|
73 |
|
|
interval - time in seconds between keepalive packets
|
74 |
|
|
timeout - time in seconds after last received keepalive packet before
|
75 |
|
|
we assume the link is down
|
76 |
|
|
|
77 |
|
|
* ppp - sets synchronous PPP mode
|
78 |
|
|
|
79 |
|
|
* x25 - sets X.25 mode
|
80 |
|
|
|
81 |
|
|
* fr - Frame Relay mode
|
82 |
|
|
lmi ansi / ccitt / none - LMI (link management) type
|
83 |
|
|
dce - Frame Relay DCE (network) side LMI instead of default DTE (user).
|
84 |
|
|
It has nothing to do with clocks!
|
85 |
|
|
t391 - link integrity verification polling timer (in seconds) - user
|
86 |
|
|
t392 - polling verification timer (in seconds) - network
|
87 |
|
|
n391 - full status polling counter - user
|
88 |
|
|
n392 - error threshold - both user and network
|
89 |
|
|
n393 - monitored events count - both user and network
|
90 |
|
|
|
91 |
|
|
Frame-Relay only:
|
92 |
|
|
* create n | delete n - adds / deletes PVC interface with DLCI #n.
|
93 |
|
|
Newly created interface will be named pvc0, pvc1 etc.
|
94 |
|
|
|
95 |
|
|
* create ether n | delete ether n - adds a device for Ethernet-bridged
|
96 |
|
|
frames. The device will be named pvceth0, pvceth1 etc.
|
97 |
|
|
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
Board-specific issues
|
102 |
|
|
---------------------
|
103 |
|
|
|
104 |
|
|
n2.o and c101.o need parameters to work (note double quotes):
|
105 |
|
|
|
106 |
|
|
insmod n2 hw='"io,irq,ram,ports[:io,irq,...]"'
|
107 |
|
|
example:
|
108 |
|
|
insmod n2 hw='"0x300,10,0xD0000,01"'
|
109 |
|
|
|
110 |
|
|
or
|
111 |
|
|
insmod c101 hw='"irq,ram[:irq,...]"
|
112 |
|
|
example:
|
113 |
|
|
insmod c101 hw='"9,0xdc000"'
|
114 |
|
|
|
115 |
|
|
If built into the kernel, these drivers need kernel (command line) parameters:
|
116 |
|
|
n2=io,irq,ram,ports:...
|
117 |
|
|
or
|
118 |
|
|
c101=irq,ram:...
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
If you have a problem with N2 or C101 card, you can issue the "private"
|
123 |
|
|
command to see port's packet descriptor rings (in kernel logs):
|
124 |
|
|
|
125 |
|
|
sethdlc hdlc0 private
|
126 |
|
|
|
127 |
|
|
The hardware driver has to be build with CONFIG_HDLC_DEBUG_RINGS.
|
128 |
|
|
Attaching this info to bug reports would be helpful. Anyway, let me know
|
129 |
|
|
if you have problems using this.
|
130 |
|
|
|
131 |
|
|
For patches and other info look at http://hq.pm.waw.pl/hdlc/
|