diff options
Diffstat (limited to 'drivers/net/wan/hdlc.c')
| -rw-r--r-- | drivers/net/wan/hdlc.c | 24 | 
1 files changed, 9 insertions, 15 deletions
| diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c index d553e6f32851..39951d0c34d6 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 | ||
| 42 | static const char* version = "HDLC support module revision 1.21"; | 42 | static 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) | |||
| 66 | static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev, | 66 | static 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) | |||
| 263 | struct net_device *alloc_hdlcdev(void *priv) | 259 | struct 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 | ||
| 283 | int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto, | 278 | int 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 | ||
