aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wan/hdlc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-06 13:47:18 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-06 13:47:18 -0500
commit8755e568250ecd3149ecd3495d8070f3a5384f73 (patch)
tree26e76b657020cd864b3e6fbfcee9ca86a96059c2 /drivers/net/wan/hdlc.c
parente33f6635da037ed4d2634ee6bdf5c4d601946c18 (diff)
parent655d2ce073f5927194dbc28d2bd3c062a4a3caac (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (35 commits) virtio net: fix oops on interface-up Fix PHY Lib support for gianfar and ucc_geth forcedeth: preserve registers forcedeth: phy status fix forcedeth: restart tx/rx ipvs: Make wrr "no available servers" error message rate-limited [PPPOL2TP]: Label unused warning when CONFIG_PROC_FS is not set. [NET_SCHED]: cls_flow: support classification based on VLAN tag [VLAN]: Constify skb argument to vlan_get_tag() [NET_SCHED]: cls_flow: fix key mask validity check [NET_SCHED]: em_meta: fix compile warning b43: Fix DMA for 30/32-bit DMA engines b43: fix build with CONFIG_SSB_PCIHOST=n mac80211: Is not EXPERIMENTAL anymore iwl3945-base.c: fix off-by-one errors b43legacy: fix DMA slot resource leakage b43legacy: drop packets we are not able to encrypt b43legacy: fix suspend/resume b43legacy: fix PIO crash Generic HDLC - use random_ether_addr() ...
Diffstat (limited to 'drivers/net/wan/hdlc.c')
-rw-r--r--drivers/net/wan/hdlc.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c
index d553e6f3285..39951d0c34d 100644
--- a/drivers/net/wan/hdlc.c
+++ b/drivers/net/wan/hdlc.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Generic HDLC support routines for Linux 2 * Generic HDLC support routines for Linux
3 * 3 *
4 * Copyright (C) 1999 - 2006 Krzysztof Halasa <khc@pm.waw.pl> 4 * Copyright (C) 1999 - 2008 Krzysztof Halasa <khc@pm.waw.pl>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of version 2 of the GNU General Public License 7 * under the terms of version 2 of the GNU General Public License
@@ -39,7 +39,7 @@
39#include <net/net_namespace.h> 39#include <net/net_namespace.h>
40 40
41 41
42static const char* version = "HDLC support module revision 1.21"; 42static const char* version = "HDLC support module revision 1.22";
43 43
44#undef DEBUG_LINK 44#undef DEBUG_LINK
45 45
@@ -66,19 +66,15 @@ static struct net_device_stats *hdlc_get_stats(struct net_device *dev)
66static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev, 66static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
67 struct packet_type *p, struct net_device *orig_dev) 67 struct packet_type *p, struct net_device *orig_dev)
68{ 68{
69 struct hdlc_device_desc *desc = dev_to_desc(dev); 69 struct hdlc_device *hdlc = dev_to_hdlc(dev);
70 70
71 if (dev->nd_net != &init_net) { 71 if (dev->nd_net != &init_net) {
72 kfree_skb(skb); 72 kfree_skb(skb);
73 return 0; 73 return 0;
74 } 74 }
75 75
76 if (desc->netif_rx) 76 BUG_ON(!hdlc->proto->netif_rx);
77 return desc->netif_rx(skb); 77 return hdlc->proto->netif_rx(skb);
78
79 desc->stats.rx_dropped++; /* Shouldn't happen */
80 dev_kfree_skb(skb);
81 return NET_RX_DROP;
82} 78}
83 79
84 80
@@ -87,7 +83,7 @@ static inline void hdlc_proto_start(struct net_device *dev)
87{ 83{
88 hdlc_device *hdlc = dev_to_hdlc(dev); 84 hdlc_device *hdlc = dev_to_hdlc(dev);
89 if (hdlc->proto->start) 85 if (hdlc->proto->start)
90 return hdlc->proto->start(dev); 86 hdlc->proto->start(dev);
91} 87}
92 88
93 89
@@ -96,7 +92,7 @@ static inline void hdlc_proto_stop(struct net_device *dev)
96{ 92{
97 hdlc_device *hdlc = dev_to_hdlc(dev); 93 hdlc_device *hdlc = dev_to_hdlc(dev);
98 if (hdlc->proto->stop) 94 if (hdlc->proto->stop)
99 return hdlc->proto->stop(dev); 95 hdlc->proto->stop(dev);
100} 96}
101 97
102 98
@@ -263,8 +259,7 @@ static void hdlc_setup(struct net_device *dev)
263struct net_device *alloc_hdlcdev(void *priv) 259struct net_device *alloc_hdlcdev(void *priv)
264{ 260{
265 struct net_device *dev; 261 struct net_device *dev;
266 dev = alloc_netdev(sizeof(struct hdlc_device_desc) + 262 dev = alloc_netdev(sizeof(struct hdlc_device), "hdlc%d", hdlc_setup);
267 sizeof(hdlc_device), "hdlc%d", hdlc_setup);
268 if (dev) 263 if (dev)
269 dev_to_hdlc(dev)->priv = priv; 264 dev_to_hdlc(dev)->priv = priv;
270 return dev; 265 return dev;
@@ -281,7 +276,7 @@ void unregister_hdlc_device(struct net_device *dev)
281 276
282 277
283int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto, 278int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
284 int (*rx)(struct sk_buff *skb), size_t size) 279 size_t size)
285{ 280{
286 detach_hdlc_protocol(dev); 281 detach_hdlc_protocol(dev);
287 282
@@ -297,7 +292,6 @@ int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
297 return -ENOBUFS; 292 return -ENOBUFS;
298 } 293 }
299 dev_to_hdlc(dev)->proto = proto; 294 dev_to_hdlc(dev)->proto = proto;
300 dev_to_desc(dev)->netif_rx = rx;
301 return 0; 295 return 0;
302} 296}
303 297