diff options
Diffstat (limited to 'drivers/net/wan/hdlc.c')
-rw-r--r-- | drivers/net/wan/hdlc.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c index 1f2a140c9f7c..5ce437205558 100644 --- a/drivers/net/wan/hdlc.c +++ b/drivers/net/wan/hdlc.c | |||
@@ -44,7 +44,7 @@ static const char* version = "HDLC support module revision 1.22"; | |||
44 | 44 | ||
45 | static struct hdlc_proto *first_proto; | 45 | static struct hdlc_proto *first_proto; |
46 | 46 | ||
47 | static int hdlc_change_mtu(struct net_device *dev, int new_mtu) | 47 | int hdlc_change_mtu(struct net_device *dev, int new_mtu) |
48 | { | 48 | { |
49 | if ((new_mtu < 68) || (new_mtu > HDLC_MAX_MTU)) | 49 | if ((new_mtu < 68) || (new_mtu > HDLC_MAX_MTU)) |
50 | return -EINVAL; | 50 | return -EINVAL; |
@@ -52,15 +52,6 @@ static int hdlc_change_mtu(struct net_device *dev, int new_mtu) | |||
52 | return 0; | 52 | return 0; |
53 | } | 53 | } |
54 | 54 | ||
55 | |||
56 | |||
57 | static struct net_device_stats *hdlc_get_stats(struct net_device *dev) | ||
58 | { | ||
59 | return &dev->stats; | ||
60 | } | ||
61 | |||
62 | |||
63 | |||
64 | static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev, | 55 | static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev, |
65 | struct packet_type *p, struct net_device *orig_dev) | 56 | struct packet_type *p, struct net_device *orig_dev) |
66 | { | 57 | { |
@@ -75,7 +66,15 @@ static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev, | |||
75 | return hdlc->proto->netif_rx(skb); | 66 | return hdlc->proto->netif_rx(skb); |
76 | } | 67 | } |
77 | 68 | ||
69 | int hdlc_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||
70 | { | ||
71 | hdlc_device *hdlc = dev_to_hdlc(dev); | ||
72 | |||
73 | if (hdlc->proto->xmit) | ||
74 | return hdlc->proto->xmit(skb, dev); | ||
78 | 75 | ||
76 | return hdlc->xmit(skb, dev); /* call hardware driver directly */ | ||
77 | } | ||
79 | 78 | ||
80 | static inline void hdlc_proto_start(struct net_device *dev) | 79 | static inline void hdlc_proto_start(struct net_device *dev) |
81 | { | 80 | { |
@@ -102,11 +101,11 @@ static int hdlc_device_event(struct notifier_block *this, unsigned long event, | |||
102 | hdlc_device *hdlc; | 101 | hdlc_device *hdlc; |
103 | unsigned long flags; | 102 | unsigned long flags; |
104 | int on; | 103 | int on; |
105 | 104 | ||
106 | if (dev_net(dev) != &init_net) | 105 | if (dev_net(dev) != &init_net) |
107 | return NOTIFY_DONE; | 106 | return NOTIFY_DONE; |
108 | 107 | ||
109 | if (dev->get_stats != hdlc_get_stats) | 108 | if (!(dev->priv_flags & IFF_WAN_HDLC)) |
110 | return NOTIFY_DONE; /* not an HDLC device */ | 109 | return NOTIFY_DONE; /* not an HDLC device */ |
111 | 110 | ||
112 | if (event != NETDEV_CHANGE) | 111 | if (event != NETDEV_CHANGE) |
@@ -233,15 +232,13 @@ static void hdlc_setup_dev(struct net_device *dev) | |||
233 | /* Re-init all variables changed by HDLC protocol drivers, | 232 | /* Re-init all variables changed by HDLC protocol drivers, |
234 | * including ether_setup() called from hdlc_raw_eth.c. | 233 | * including ether_setup() called from hdlc_raw_eth.c. |
235 | */ | 234 | */ |
236 | dev->get_stats = hdlc_get_stats; | ||
237 | dev->flags = IFF_POINTOPOINT | IFF_NOARP; | 235 | dev->flags = IFF_POINTOPOINT | IFF_NOARP; |
236 | dev->priv_flags = IFF_WAN_HDLC; | ||
238 | dev->mtu = HDLC_MAX_MTU; | 237 | dev->mtu = HDLC_MAX_MTU; |
239 | dev->type = ARPHRD_RAWHDLC; | 238 | dev->type = ARPHRD_RAWHDLC; |
240 | dev->hard_header_len = 16; | 239 | dev->hard_header_len = 16; |
241 | dev->addr_len = 0; | 240 | dev->addr_len = 0; |
242 | dev->header_ops = &hdlc_null_ops; | 241 | dev->header_ops = &hdlc_null_ops; |
243 | |||
244 | dev->change_mtu = hdlc_change_mtu; | ||
245 | } | 242 | } |
246 | 243 | ||
247 | static void hdlc_setup(struct net_device *dev) | 244 | static void hdlc_setup(struct net_device *dev) |
@@ -339,6 +336,8 @@ MODULE_AUTHOR("Krzysztof Halasa <khc@pm.waw.pl>"); | |||
339 | MODULE_DESCRIPTION("HDLC support module"); | 336 | MODULE_DESCRIPTION("HDLC support module"); |
340 | MODULE_LICENSE("GPL v2"); | 337 | MODULE_LICENSE("GPL v2"); |
341 | 338 | ||
339 | EXPORT_SYMBOL(hdlc_change_mtu); | ||
340 | EXPORT_SYMBOL(hdlc_start_xmit); | ||
342 | EXPORT_SYMBOL(hdlc_open); | 341 | EXPORT_SYMBOL(hdlc_open); |
343 | EXPORT_SYMBOL(hdlc_close); | 342 | EXPORT_SYMBOL(hdlc_close); |
344 | EXPORT_SYMBOL(hdlc_ioctl); | 343 | EXPORT_SYMBOL(hdlc_ioctl); |
@@ -350,7 +349,7 @@ EXPORT_SYMBOL(attach_hdlc_protocol); | |||
350 | EXPORT_SYMBOL(detach_hdlc_protocol); | 349 | EXPORT_SYMBOL(detach_hdlc_protocol); |
351 | 350 | ||
352 | static struct packet_type hdlc_packet_type = { | 351 | static struct packet_type hdlc_packet_type = { |
353 | .type = __constant_htons(ETH_P_HDLC), | 352 | .type = cpu_to_be16(ETH_P_HDLC), |
354 | .func = hdlc_rcv, | 353 | .func = hdlc_rcv, |
355 | }; | 354 | }; |
356 | 355 | ||