Commit b3dd65f9 authored by Krzysztof Halasa's avatar Krzysztof Halasa Committed by Jeff Garzik

[PATCH] Generic HDLC update

The attached patch updates generic HDLC to version 1.18.
FR Cisco LMI production-tested. Please apply to Linux 2.6. Thanks.

Changes:
- doc updates
- added Cisco LMI support to Frame-Relay code
- cleaned hdlc_fr.c a bit, removed some orphaned #defines etc.
- fixed a problem with non-functional LMI in FR DCE mode.
- changed diagnostic messages to better conform to FR standards
- all protocols: information about carrier changes (DCD line) is now
  printed to kernel logs.
Signed-Off-By: default avatarKrzysztof Halasa <khc@pm.waw.pl>
parent 88d7bd8c
Generic HDLC layer Generic HDLC layer
Krzysztof Halasa <khc@pm.waw.pl> Krzysztof Halasa <khc@pm.waw.pl>
January, 2003
Generic HDLC layer currently supports: Generic HDLC layer currently supports:
- Frame Relay (ANSI, CCITT and no LMI), with ARP support (no InARP). 1. Frame Relay (ANSI, CCITT, Cisco and no LMI).
Normal (routed) and Ethernet-bridged (Ethernet device emulation) - Normal (routed) and Ethernet-bridged (Ethernet device emulation)
interfaces can share a single PVC. interfaces can share a single PVC.
- raw HDLC - either IP (IPv4) interface or Ethernet device emulation. - ARP support (no InARP support in the kernel - there is an
- Cisco HDLC, experimental InARP user-space daemon available on:
- PPP (uses syncppp.c), http://www.kernel.org/pub/linux/utils/net/hdlc/).
- X.25 (uses X.25 routines). 2. raw HDLC - either IP (IPv4) interface or Ethernet device emulation.
3. Cisco HDLC.
There are hardware drivers for the following cards: 4. PPP (uses syncppp.c).
- C101 by Moxa Technologies Co., Ltd. 5. X.25 (uses X.25 routines).
- RISCom/N2 by SDL Communications Inc.
- and others, some not in the official kernel. Generic HDLC is a protocol driver only - it needs a low-level driver
for your particular hardware.
Ethernet device emulation (using HDLC or Frame-Relay PVC) is compatible Ethernet device emulation (using HDLC or Frame-Relay PVC) is compatible
with IEEE 802.1Q (VLANs) and 802.1D (Ethernet bridging). with IEEE 802.1Q (VLANs) and 802.1D (Ethernet bridging).
...@@ -24,7 +24,7 @@ with IEEE 802.1Q (VLANs) and 802.1D (Ethernet bridging). ...@@ -24,7 +24,7 @@ with IEEE 802.1Q (VLANs) and 802.1D (Ethernet bridging).
Make sure the hdlc.o and the hardware driver are loaded. It should Make sure the hdlc.o and the hardware driver are loaded. It should
create a number of "hdlc" (hdlc0 etc) network devices, one for each create a number of "hdlc" (hdlc0 etc) network devices, one for each
WAN port. You'll need the "sethdlc" utility, get it from: WAN port. You'll need the "sethdlc" utility, get it from:
http://hq.pm.waw.pl/hdlc/ http://www.kernel.org/pub/linux/utils/net/hdlc/
Compile sethdlc.c utility: Compile sethdlc.c utility:
gcc -O2 -Wall -o sethdlc sethdlc.c gcc -O2 -Wall -o sethdlc sethdlc.c
...@@ -52,12 +52,12 @@ Setting interface: ...@@ -52,12 +52,12 @@ Setting interface:
* v35 | rs232 | x21 | t1 | e1 - sets physical interface for a given port * v35 | rs232 | x21 | t1 | e1 - sets physical interface for a given port
if the card has software-selectable interfaces if the card has software-selectable interfaces
loopback - activate hardware loopback (for testing only) loopback - activate hardware loopback (for testing only)
* clock ext - external clock (uses DTE RX and TX clock) * clock ext - both RX clock and TX clock external
* clock int - internal clock (provides clock signal on DCE clock output) * clock int - both RX clock and TX clock internal
* clock txint - TX internal, RX external (provides TX clock on DCE output) * clock txint - RX clock external, TX clock internal
* clock txfromrx - TX clock derived from RX clock (TX clock on DCE output) * clock txfromrx - RX clock external, TX clock derived from RX clock
* rate - sets clock rate in bps (not required for external clock or * rate - sets clock rate in bps (for "int" or "txint" clock only)
for txfromrx)
Setting protocol: Setting protocol:
...@@ -79,7 +79,7 @@ Setting protocol: ...@@ -79,7 +79,7 @@ Setting protocol:
* x25 - sets X.25 mode * x25 - sets X.25 mode
* fr - Frame Relay mode * fr - Frame Relay mode
lmi ansi / ccitt / none - LMI (link management) type lmi ansi / ccitt / cisco / none - LMI (link management) type
dce - Frame Relay DCE (network) side LMI instead of default DTE (user). dce - Frame Relay DCE (network) side LMI instead of default DTE (user).
It has nothing to do with clocks! It has nothing to do with clocks!
t391 - link integrity verification polling timer (in seconds) - user t391 - link integrity verification polling timer (in seconds) - user
...@@ -119,13 +119,14 @@ or ...@@ -119,13 +119,14 @@ or
If you have a problem with N2 or C101 card, you can issue the "private" If you have a problem with N2, C101 or PLX200SYN card, you can issue the
command to see port's packet descriptor rings (in kernel logs): "private" command to see port's packet descriptor rings (in kernel logs):
sethdlc hdlc0 private sethdlc hdlc0 private
The hardware driver has to be build with CONFIG_HDLC_DEBUG_RINGS. The hardware driver has to be build with #define DEBUG_RINGS.
Attaching this info to bug reports would be helpful. Anyway, let me know Attaching this info to bug reports would be helpful. Anyway, let me know
if you have problems using this. if you have problems using this.
For patches and other info look at http://hq.pm.waw.pl/hdlc/ For patches and other info look at:
<http://www.kernel.org/pub/linux/utils/net/hdlc/>.
This diff is collapsed.
/* /*
* Generic HDLC support routines for Linux * Generic HDLC support routines for Linux
* *
* Copyright (C) 1999 - 2003 Krzysztof Halasa <khc@pm.waw.pl> * Copyright (C) 1999 - 2005 Krzysztof Halasa <khc@pm.waw.pl>
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License * under the terms of version 2 of the GNU General Public License
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#include <linux/hdlc.h> #include <linux/hdlc.h>
static const char* version = "HDLC support module revision 1.17"; static const char* version = "HDLC support module revision 1.18";
#undef DEBUG_LINK #undef DEBUG_LINK
...@@ -126,10 +126,13 @@ void hdlc_set_carrier(int on, struct net_device *dev) ...@@ -126,10 +126,13 @@ void hdlc_set_carrier(int on, struct net_device *dev)
if (!hdlc->open) if (!hdlc->open)
goto carrier_exit; goto carrier_exit;
if (hdlc->carrier) if (hdlc->carrier) {
printk(KERN_INFO "%s: Carrier detected\n", dev->name);
__hdlc_set_carrier_on(dev); __hdlc_set_carrier_on(dev);
else } else {
printk(KERN_INFO "%s: Carrier lost\n", dev->name);
__hdlc_set_carrier_off(dev); __hdlc_set_carrier_off(dev);
}
carrier_exit: carrier_exit:
spin_unlock_irqrestore(&hdlc->state_lock, flags); spin_unlock_irqrestore(&hdlc->state_lock, flags);
...@@ -157,8 +160,11 @@ int hdlc_open(struct net_device *dev) ...@@ -157,8 +160,11 @@ int hdlc_open(struct net_device *dev)
spin_lock_irq(&hdlc->state_lock); spin_lock_irq(&hdlc->state_lock);
if (hdlc->carrier) if (hdlc->carrier) {
printk(KERN_INFO "%s: Carrier detected\n", dev->name);
__hdlc_set_carrier_on(dev); __hdlc_set_carrier_on(dev);
} else
printk(KERN_INFO "%s: No carrier\n", dev->name);
hdlc->open = 1; hdlc->open = 1;
......
/* /*
* Generic HDLC support routines for Linux * Generic HDLC support routines for Linux
* *
* Copyright (C) 1999-2003 Krzysztof Halasa <khc@pm.waw.pl> * Copyright (C) 1999-2005 Krzysztof Halasa <khc@pm.waw.pl>
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License * under the terms of version 2 of the GNU General Public License
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#define LMI_NONE 1 /* No LMI, all PVCs are static */ #define LMI_NONE 1 /* No LMI, all PVCs are static */
#define LMI_ANSI 2 /* ANSI Annex D */ #define LMI_ANSI 2 /* ANSI Annex D */
#define LMI_CCITT 3 /* ITU-T Annex A */ #define LMI_CCITT 3 /* ITU-T Annex A */
#define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */
#define HDLC_MAX_MTU 1500 /* Ethernet 1500 bytes */ #define HDLC_MAX_MTU 1500 /* Ethernet 1500 bytes */
#define HDLC_MAX_MRU (HDLC_MAX_MTU + 10 + 14 + 4) /* for ETH+VLAN over FR */ #define HDLC_MAX_MRU (HDLC_MAX_MTU + 10 + 14 + 4) /* for ETH+VLAN over FR */
...@@ -89,6 +90,7 @@ typedef struct pvc_device_struct { ...@@ -89,6 +90,7 @@ typedef struct pvc_device_struct {
unsigned int deleted: 1; unsigned int deleted: 1;
unsigned int fecn: 1; unsigned int fecn: 1;
unsigned int becn: 1; unsigned int becn: 1;
unsigned int bandwidth; /* Cisco LMI reporting only */
}state; }state;
}pvc_device; }pvc_device;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment