xref: /OK3568_Linux_fs/kernel/Documentation/networking/generic-hdlc.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun==================
4*4882a593SmuzhiyunGeneric HDLC layer
5*4882a593Smuzhiyun==================
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunKrzysztof Halasa <khc@pm.waw.pl>
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunGeneric HDLC layer currently supports:
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun1. Frame Relay (ANSI, CCITT, Cisco and no LMI)
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun   - Normal (routed) and Ethernet-bridged (Ethernet device emulation)
15*4882a593Smuzhiyun     interfaces can share a single PVC.
16*4882a593Smuzhiyun   - ARP support (no InARP support in the kernel - there is an
17*4882a593Smuzhiyun     experimental InARP user-space daemon available on:
18*4882a593Smuzhiyun     http://www.kernel.org/pub/linux/utils/net/hdlc/).
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun2. raw HDLC - either IP (IPv4) interface or Ethernet device emulation
21*4882a593Smuzhiyun3. Cisco HDLC
22*4882a593Smuzhiyun4. PPP
23*4882a593Smuzhiyun5. X.25 (uses X.25 routines).
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunGeneric HDLC is a protocol driver only - it needs a low-level driver
26*4882a593Smuzhiyunfor your particular hardware.
27*4882a593Smuzhiyun
28*4882a593SmuzhiyunEthernet device emulation (using HDLC or Frame-Relay PVC) is compatible
29*4882a593Smuzhiyunwith IEEE 802.1Q (VLANs) and 802.1D (Ethernet bridging).
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun
32*4882a593SmuzhiyunMake sure the hdlc.o and the hardware driver are loaded. It should
33*4882a593Smuzhiyuncreate a number of "hdlc" (hdlc0 etc) network devices, one for each
34*4882a593SmuzhiyunWAN port. You'll need the "sethdlc" utility, get it from:
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun	http://www.kernel.org/pub/linux/utils/net/hdlc/
37*4882a593Smuzhiyun
38*4882a593SmuzhiyunCompile sethdlc.c utility::
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun	gcc -O2 -Wall -o sethdlc sethdlc.c
41*4882a593Smuzhiyun
42*4882a593SmuzhiyunMake sure you're using a correct version of sethdlc for your kernel.
43*4882a593Smuzhiyun
44*4882a593SmuzhiyunUse sethdlc to set physical interface, clock rate, HDLC mode used,
45*4882a593Smuzhiyunand add any required PVCs if using Frame Relay.
46*4882a593SmuzhiyunUsually you want something like::
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun	sethdlc hdlc0 clock int rate 128000
49*4882a593Smuzhiyun	sethdlc hdlc0 cisco interval 10 timeout 25
50*4882a593Smuzhiyun
51*4882a593Smuzhiyunor::
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun	sethdlc hdlc0 rs232 clock ext
54*4882a593Smuzhiyun	sethdlc hdlc0 fr lmi ansi
55*4882a593Smuzhiyun	sethdlc hdlc0 create 99
56*4882a593Smuzhiyun	ifconfig hdlc0 up
57*4882a593Smuzhiyun	ifconfig pvc0 localIP pointopoint remoteIP
58*4882a593Smuzhiyun
59*4882a593SmuzhiyunIn Frame Relay mode, ifconfig master hdlc device up (without assigning
60*4882a593Smuzhiyunany IP address to it) before using pvc devices.
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun
63*4882a593SmuzhiyunSetting interface:
64*4882a593Smuzhiyun
65*4882a593Smuzhiyun* v35 | rs232 | x21 | t1 | e1
66*4882a593Smuzhiyun    - sets physical interface for a given port
67*4882a593Smuzhiyun      if the card has software-selectable interfaces
68*4882a593Smuzhiyun  loopback
69*4882a593Smuzhiyun    - activate hardware loopback (for testing only)
70*4882a593Smuzhiyun* clock ext
71*4882a593Smuzhiyun    - both RX clock and TX clock external
72*4882a593Smuzhiyun* clock int
73*4882a593Smuzhiyun    - both RX clock and TX clock internal
74*4882a593Smuzhiyun* clock txint
75*4882a593Smuzhiyun    - RX clock external, TX clock internal
76*4882a593Smuzhiyun* clock txfromrx
77*4882a593Smuzhiyun    - RX clock external, TX clock derived from RX clock
78*4882a593Smuzhiyun* rate
79*4882a593Smuzhiyun    - sets clock rate in bps (for "int" or "txint" clock only)
80*4882a593Smuzhiyun
81*4882a593Smuzhiyun
82*4882a593SmuzhiyunSetting protocol:
83*4882a593Smuzhiyun
84*4882a593Smuzhiyun* hdlc - sets raw HDLC (IP-only) mode
85*4882a593Smuzhiyun
86*4882a593Smuzhiyun  nrz / nrzi / fm-mark / fm-space / manchester - sets transmission code
87*4882a593Smuzhiyun
88*4882a593Smuzhiyun  no-parity / crc16 / crc16-pr0 (CRC16 with preset zeros) / crc32-itu
89*4882a593Smuzhiyun
90*4882a593Smuzhiyun  crc16-itu (CRC16 with ITU-T polynomial) / crc16-itu-pr0 - sets parity
91*4882a593Smuzhiyun
92*4882a593Smuzhiyun* hdlc-eth - Ethernet device emulation using HDLC. Parity and encoding
93*4882a593Smuzhiyun  as above.
94*4882a593Smuzhiyun
95*4882a593Smuzhiyun* cisco - sets Cisco HDLC mode (IP, IPv6 and IPX supported)
96*4882a593Smuzhiyun
97*4882a593Smuzhiyun  interval - time in seconds between keepalive packets
98*4882a593Smuzhiyun
99*4882a593Smuzhiyun  timeout - time in seconds after last received keepalive packet before
100*4882a593Smuzhiyun	    we assume the link is down
101*4882a593Smuzhiyun
102*4882a593Smuzhiyun* ppp - sets synchronous PPP mode
103*4882a593Smuzhiyun
104*4882a593Smuzhiyun* x25 - sets X.25 mode
105*4882a593Smuzhiyun
106*4882a593Smuzhiyun* fr - Frame Relay mode
107*4882a593Smuzhiyun
108*4882a593Smuzhiyun  lmi ansi / ccitt / cisco / none - LMI (link management) type
109*4882a593Smuzhiyun
110*4882a593Smuzhiyun  dce - Frame Relay DCE (network) side LMI instead of default DTE (user).
111*4882a593Smuzhiyun
112*4882a593Smuzhiyun  It has nothing to do with clocks!
113*4882a593Smuzhiyun
114*4882a593Smuzhiyun  - t391 - link integrity verification polling timer (in seconds) - user
115*4882a593Smuzhiyun  - t392 - polling verification timer (in seconds) - network
116*4882a593Smuzhiyun  - n391 - full status polling counter - user
117*4882a593Smuzhiyun  - n392 - error threshold - both user and network
118*4882a593Smuzhiyun  - n393 - monitored events count - both user and network
119*4882a593Smuzhiyun
120*4882a593SmuzhiyunFrame-Relay only:
121*4882a593Smuzhiyun
122*4882a593Smuzhiyun* create n | delete n - adds / deletes PVC interface with DLCI #n.
123*4882a593Smuzhiyun  Newly created interface will be named pvc0, pvc1 etc.
124*4882a593Smuzhiyun
125*4882a593Smuzhiyun* create ether n | delete ether n - adds a device for Ethernet-bridged
126*4882a593Smuzhiyun  frames. The device will be named pvceth0, pvceth1 etc.
127*4882a593Smuzhiyun
128*4882a593Smuzhiyun
129*4882a593Smuzhiyun
130*4882a593Smuzhiyun
131*4882a593SmuzhiyunBoard-specific issues
132*4882a593Smuzhiyun---------------------
133*4882a593Smuzhiyun
134*4882a593Smuzhiyunn2.o and c101.o need parameters to work::
135*4882a593Smuzhiyun
136*4882a593Smuzhiyun	insmod n2 hw=io,irq,ram,ports[:io,irq,...]
137*4882a593Smuzhiyun
138*4882a593Smuzhiyunexample::
139*4882a593Smuzhiyun
140*4882a593Smuzhiyun	insmod n2 hw=0x300,10,0xD0000,01
141*4882a593Smuzhiyun
142*4882a593Smuzhiyunor::
143*4882a593Smuzhiyun
144*4882a593Smuzhiyun	insmod c101 hw=irq,ram[:irq,...]
145*4882a593Smuzhiyun
146*4882a593Smuzhiyunexample::
147*4882a593Smuzhiyun
148*4882a593Smuzhiyun	insmod c101 hw=9,0xdc000
149*4882a593Smuzhiyun
150*4882a593SmuzhiyunIf built into the kernel, these drivers need kernel (command line) parameters::
151*4882a593Smuzhiyun
152*4882a593Smuzhiyun	n2.hw=io,irq,ram,ports:...
153*4882a593Smuzhiyun
154*4882a593Smuzhiyunor::
155*4882a593Smuzhiyun
156*4882a593Smuzhiyun	c101.hw=irq,ram:...
157*4882a593Smuzhiyun
158*4882a593Smuzhiyun
159*4882a593Smuzhiyun
160*4882a593SmuzhiyunIf you have a problem with N2, C101 or PLX200SYN card, you can issue the
161*4882a593Smuzhiyun"private" command to see port's packet descriptor rings (in kernel logs)::
162*4882a593Smuzhiyun
163*4882a593Smuzhiyun	sethdlc hdlc0 private
164*4882a593Smuzhiyun
165*4882a593SmuzhiyunThe hardware driver has to be build with #define DEBUG_RINGS.
166*4882a593SmuzhiyunAttaching this info to bug reports would be helpful. Anyway, let me know
167*4882a593Smuzhiyunif you have problems using this.
168*4882a593Smuzhiyun
169*4882a593SmuzhiyunFor patches and other info look at:
170*4882a593Smuzhiyun<http://www.kernel.org/pub/linux/utils/net/hdlc/>.
171