patch-2.4.23 linux-2.4.23/drivers/net/wan/hdlc_generic.c

Next file: linux-2.4.23/drivers/net/wan/hdlc_ppp.c
Previous file: linux-2.4.23/drivers/net/wan/hdlc_fr.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.22/drivers/net/wan/hdlc_generic.c linux-2.4.23/drivers/net/wan/hdlc_generic.c
@@ -1,17 +1,13 @@
 /*
  * Generic HDLC support routines for Linux
  *
- * Copyright (C) 1999 - 2001 Krzysztof Halasa <khc@pm.waw.pl>
+ * Copyright (C) 1999 - 2003 Krzysztof Halasa <khc@pm.waw.pl>
  *
  * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * under the terms of version 2 of the GNU General Public License
+ * as published by the Free Software Foundation.
  *
- * Current status:
- *    - this is work in progress
- *    - not heavily tested on SMP
- *    - currently supported:
+ * Currently supported:
  *	* raw IP-in-HDLC
  *	* Cisco HDLC
  *	* Frame Relay with ANSI or CCITT LMI (both user and network side)
@@ -37,7 +33,7 @@
 #include <linux/hdlc.h>
 
 
-static const char* version = "HDLC support module revision 1.11";
+static const char* version = "HDLC support module revision 1.14";
 
 
 static int hdlc_change_mtu(struct net_device *dev, int new_mtu)
@@ -60,7 +56,13 @@
 static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
 		    struct packet_type *p)
 {
-	dev_to_hdlc(dev)->netif_rx(skb);
+	hdlc_device *hdlc = dev_to_hdlc(dev);
+	if (hdlc->netif_rx)
+		hdlc->netif_rx(skb);
+	else {
+		hdlc->stats.rx_dropped++; /* Shouldn't happen */
+		dev_kfree_skb(skb);
+	}
 	return 0;
 }
 
@@ -69,6 +71,10 @@
 #define hdlc_raw_ioctl(hdlc, ifr)	-ENOSYS
 #endif
 
+#ifndef CONFIG_HDLC_RAW_ETH
+#define hdlc_raw_eth_ioctl(hdlc, ifr)	-ENOSYS
+#endif
+
 #ifndef CONFIG_HDLC_PPP
 #define hdlc_ppp_ioctl(hdlc, ifr)	-ENOSYS
 #endif
@@ -96,6 +102,7 @@
 
 	switch(ifr->ifr_settings.type) {
 	case IF_PROTO_HDLC:
+	case IF_PROTO_HDLC_ETH:
 	case IF_PROTO_PPP:
 	case IF_PROTO_CISCO:
 	case IF_PROTO_FR:
@@ -109,6 +116,7 @@
 
 	switch(proto) {
 	case IF_PROTO_HDLC:	return hdlc_raw_ioctl(hdlc, ifr);
+	case IF_PROTO_HDLC_ETH:	return hdlc_raw_eth_ioctl(hdlc, ifr);
 	case IF_PROTO_PPP:	return hdlc_ppp_ioctl(hdlc, ifr);
 	case IF_PROTO_CISCO:	return hdlc_cisco_ioctl(hdlc, ifr);
 	case IF_PROTO_FR:	return hdlc_fr_ioctl(hdlc, ifr);
@@ -152,9 +160,10 @@
 
 void unregister_hdlc_device(hdlc_device *hdlc)
 {
+	rtnl_lock();
 	hdlc_proto_detach(hdlc);
-
-	unregister_netdev(hdlc_to_dev(hdlc));
+	unregister_netdevice(hdlc_to_dev(hdlc));
+	rtnl_unlock();
 	MOD_DEC_USE_COUNT;
 }
 
@@ -162,7 +171,7 @@
 
 MODULE_AUTHOR("Krzysztof Halasa <khc@pm.waw.pl>");
 MODULE_DESCRIPTION("HDLC support module");
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
 
 EXPORT_SYMBOL(hdlc_ioctl);
 EXPORT_SYMBOL(register_hdlc_device);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)