git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
drivers
/
net
/
wan
/
hdlc_x25.c
diff --git
a/drivers/net/wan/hdlc_x25.c
b/drivers/net/wan/hdlc_x25.c
index
5231063
..
e4bb9f8
100644
(file)
--- a/
drivers/net/wan/hdlc_x25.c
+++ b/
drivers/net/wan/hdlc_x25.c
@@
-2,7
+2,7
@@
* Generic HDLC support routines for Linux
* X.25 support
*
* Generic HDLC support routines for Linux
* X.25 support
*
- * Copyright (C) 1999 - 200
3
Krzysztof Halasa <khc@pm.waw.pl>
+ * Copyright (C) 1999 - 200
6
Krzysztof Halasa <khc@pm.waw.pl>
*
* 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
*
* 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
@@
-23,6
+23,10
@@
#include <linux/rtnetlink.h>
#include <linux/hdlc.h>
#include <linux/rtnetlink.h>
#include <linux/hdlc.h>
+#include <net/x25device.h>
+
+static int x25_ioctl(struct net_device *dev, struct ifreq *ifr);
+
/* These functions are callbacks called by LAPB layer */
static void x25_connect_disconnect(struct net_device *dev, int reason, int code)
/* These functions are callbacks called by LAPB layer */
static void x25_connect_disconnect(struct net_device *dev, int reason, int code)
@@
-38,11
+42,7
@@
static void x25_connect_disconnect(struct net_device *dev, int reason, int code)
ptr = skb_put(skb, 1);
*ptr = code;
ptr = skb_put(skb, 1);
*ptr = code;
- skb->dev = dev;
- skb->protocol = htons(ETH_P_X25);
- skb->mac.raw = skb->data;
- skb->pkt_type = PACKET_HOST;
-
+ skb->protocol = x25_type_trans(skb, dev);
netif_rx(skb);
}
netif_rx(skb);
}
@@
-74,11
+74,7
@@
static int x25_data_indication(struct net_device *dev, struct sk_buff *skb)
ptr = skb->data;
*ptr = 0;
ptr = skb->data;
*ptr = 0;
- skb->dev = dev;
- skb->protocol = htons(ETH_P_X25);
- skb->mac.raw = skb->data;
- skb->pkt_type = PACKET_HOST;
-
+ skb->protocol = x25_type_trans(skb, dev);
return netif_rx(skb);
}
return netif_rx(skb);
}
@@
-168,30
+164,39
@@
static void x25_close(struct net_device *dev)
static int x25_rx(struct sk_buff *skb)
{
static int x25_rx(struct sk_buff *skb)
{
-
hdlc_device *hdlc = dev_to_hdl
c(skb->dev);
+
struct hdlc_device_desc *desc = dev_to_des
c(skb->dev);
if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) {
if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) {
-
hdl
c->stats.rx_dropped++;
+
des
c->stats.rx_dropped++;
return NET_RX_DROP;
}
if (lapb_data_received(skb->dev, skb) == LAPB_OK)
return NET_RX_SUCCESS;
return NET_RX_DROP;
}
if (lapb_data_received(skb->dev, skb) == LAPB_OK)
return NET_RX_SUCCESS;
-
hdl
c->stats.rx_errors++;
+
des
c->stats.rx_errors++;
dev_kfree_skb_any(skb);
return NET_RX_DROP;
}
dev_kfree_skb_any(skb);
return NET_RX_DROP;
}
+static struct hdlc_proto proto = {
+ .open = x25_open,
+ .close = x25_close,
+ .ioctl = x25_ioctl,
+ .module = THIS_MODULE,
+};
+
-
int hdlc_
x25_ioctl(struct net_device *dev, struct ifreq *ifr)
+
static int
x25_ioctl(struct net_device *dev, struct ifreq *ifr)
{
hdlc_device *hdlc = dev_to_hdlc(dev);
int result;
switch (ifr->ifr_settings.type) {
case IF_GET_PROTO:
{
hdlc_device *hdlc = dev_to_hdlc(dev);
int result;
switch (ifr->ifr_settings.type) {
case IF_GET_PROTO:
+ if (dev_to_hdlc(dev)->proto != &proto)
+ return -EINVAL;
ifr->ifr_settings.type = IF_PROTO_X25;
return 0; /* return protocol only, no settable parameters */
ifr->ifr_settings.type = IF_PROTO_X25;
return 0; /* return protocol only, no settable parameters */
@@
-206,20
+211,38
@@
int hdlc_x25_ioctl(struct net_device *dev, struct ifreq *ifr)
if (result)
return result;
if (result)
return result;
- hdlc_proto_detach(hdlc);
- memset(&hdlc->proto, 0, sizeof(hdlc->proto));
-
- hdlc->proto.open = x25_open;
- hdlc->proto.close = x25_close;
- hdlc->proto.netif_rx = x25_rx;
- hdlc->proto.type_trans = NULL;
- hdlc->proto.id = IF_PROTO_X25;
+ if ((result = attach_hdlc_protocol(dev, &proto,
+ x25_rx, 0)) != 0)
+ return result;
dev->hard_start_xmit = x25_xmit;
dev->hard_header = NULL;
dev->type = ARPHRD_X25;
dev->addr_len = 0;
dev->hard_start_xmit = x25_xmit;
dev->hard_header = NULL;
dev->type = ARPHRD_X25;
dev->addr_len = 0;
+ netif_dormant_off(dev);
return 0;
}
return -EINVAL;
}
return 0;
}
return -EINVAL;
}
+
+
+static int __init mod_init(void)
+{
+ register_hdlc_protocol(&proto);
+ return 0;
+}
+
+
+
+static void __exit mod_exit(void)
+{
+ unregister_hdlc_protocol(&proto);
+}
+
+
+module_init(mod_init);
+module_exit(mod_exit);
+
+MODULE_AUTHOR("Krzysztof Halasa <khc@pm.waw.pl>");
+MODULE_DESCRIPTION("X.25 protocol support for generic HDLC");
+MODULE_LICENSE("GPL v2");