diff options
author | Krzysztof Hałasa <khc@pm.waw.pl> | 2009-01-08 16:52:11 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-21 17:03:37 -0500 |
commit | 991990a12de42281f81b4e3a6471586d2d0caf6a (patch) | |
tree | 7b7ad34cf8218dab2ddd882a87b7c7a687b7d2ee /drivers/net/wan | |
parent | dff3fde7be8f08c78914fca3d25e1cffe7625faa (diff) |
WAN: Convert generic HDLC drivers to netdev_ops.
Also remove unneeded last_rx update from Synclink drivers.
Synclink part mostly by Stephen Hemminger.
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wan')
-rw-r--r-- | drivers/net/wan/c101.c | 12 | ||||
-rw-r--r-- | drivers/net/wan/cosa.c | 14 | ||||
-rw-r--r-- | drivers/net/wan/dscc4.c | 18 | ||||
-rw-r--r-- | drivers/net/wan/farsync.c | 18 | ||||
-rw-r--r-- | drivers/net/wan/hdlc.c | 14 | ||||
-rw-r--r-- | drivers/net/wan/hdlc_cisco.c | 1 | ||||
-rw-r--r-- | drivers/net/wan/hdlc_fr.c | 28 | ||||
-rw-r--r-- | drivers/net/wan/hdlc_ppp.c | 2 | ||||
-rw-r--r-- | drivers/net/wan/hdlc_raw.c | 3 | ||||
-rw-r--r-- | drivers/net/wan/hdlc_raw_eth.c | 8 | ||||
-rw-r--r-- | drivers/net/wan/hdlc_x25.c | 2 | ||||
-rw-r--r-- | drivers/net/wan/hostess_sv11.c | 12 | ||||
-rw-r--r-- | drivers/net/wan/ixp4xx_hss.c | 12 | ||||
-rw-r--r-- | drivers/net/wan/lmc/lmc_main.c | 19 | ||||
-rw-r--r-- | drivers/net/wan/lmc/lmc_proto.c | 17 | ||||
-rw-r--r-- | drivers/net/wan/n2.c | 12 | ||||
-rw-r--r-- | drivers/net/wan/pc300too.c | 12 | ||||
-rw-r--r-- | drivers/net/wan/pci200syn.c | 12 | ||||
-rw-r--r-- | drivers/net/wan/sealevel.c | 12 | ||||
-rw-r--r-- | drivers/net/wan/wanxl.c | 14 |
20 files changed, 137 insertions, 105 deletions
diff --git a/drivers/net/wan/c101.c b/drivers/net/wan/c101.c index b46897996f7e..9693b0fd323d 100644 --- a/drivers/net/wan/c101.c +++ b/drivers/net/wan/c101.c | |||
@@ -296,7 +296,13 @@ static void c101_destroy_card(card_t *card) | |||
296 | kfree(card); | 296 | kfree(card); |
297 | } | 297 | } |
298 | 298 | ||
299 | 299 | static const struct net_device_ops c101_ops = { | |
300 | .ndo_open = c101_open, | ||
301 | .ndo_stop = c101_close, | ||
302 | .ndo_change_mtu = hdlc_change_mtu, | ||
303 | .ndo_start_xmit = hdlc_start_xmit, | ||
304 | .ndo_do_ioctl = c101_ioctl, | ||
305 | }; | ||
300 | 306 | ||
301 | static int __init c101_run(unsigned long irq, unsigned long winbase) | 307 | static int __init c101_run(unsigned long irq, unsigned long winbase) |
302 | { | 308 | { |
@@ -367,9 +373,7 @@ static int __init c101_run(unsigned long irq, unsigned long winbase) | |||
367 | dev->mem_start = winbase; | 373 | dev->mem_start = winbase; |
368 | dev->mem_end = winbase + C101_MAPPED_RAM_SIZE - 1; | 374 | dev->mem_end = winbase + C101_MAPPED_RAM_SIZE - 1; |
369 | dev->tx_queue_len = 50; | 375 | dev->tx_queue_len = 50; |
370 | dev->do_ioctl = c101_ioctl; | 376 | dev->netdev_ops = &c101_ops; |
371 | dev->open = c101_open; | ||
372 | dev->stop = c101_close; | ||
373 | hdlc->attach = sca_attach; | 377 | hdlc->attach = sca_attach; |
374 | hdlc->xmit = sca_xmit; | 378 | hdlc->xmit = sca_xmit; |
375 | card->settings.clock_type = CLOCK_EXT; | 379 | card->settings.clock_type = CLOCK_EXT; |
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index d80b72e22dea..0d7ba117ef60 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c | |||
@@ -427,6 +427,15 @@ static void __exit cosa_exit(void) | |||
427 | } | 427 | } |
428 | module_exit(cosa_exit); | 428 | module_exit(cosa_exit); |
429 | 429 | ||
430 | static const struct net_device_ops cosa_ops = { | ||
431 | .ndo_open = cosa_net_open, | ||
432 | .ndo_stop = cosa_net_close, | ||
433 | .ndo_change_mtu = hdlc_change_mtu, | ||
434 | .ndo_start_xmit = hdlc_start_xmit, | ||
435 | .ndo_do_ioctl = cosa_net_ioctl, | ||
436 | .ndo_tx_timeout = cosa_net_timeout, | ||
437 | }; | ||
438 | |||
430 | static int cosa_probe(int base, int irq, int dma) | 439 | static int cosa_probe(int base, int irq, int dma) |
431 | { | 440 | { |
432 | struct cosa_data *cosa = cosa_cards+nr_cards; | 441 | struct cosa_data *cosa = cosa_cards+nr_cards; |
@@ -575,10 +584,7 @@ static int cosa_probe(int base, int irq, int dma) | |||
575 | } | 584 | } |
576 | dev_to_hdlc(chan->netdev)->attach = cosa_net_attach; | 585 | dev_to_hdlc(chan->netdev)->attach = cosa_net_attach; |
577 | dev_to_hdlc(chan->netdev)->xmit = cosa_net_tx; | 586 | dev_to_hdlc(chan->netdev)->xmit = cosa_net_tx; |
578 | chan->netdev->open = cosa_net_open; | 587 | chan->netdev->netdev_ops = &cosa_ops; |
579 | chan->netdev->stop = cosa_net_close; | ||
580 | chan->netdev->do_ioctl = cosa_net_ioctl; | ||
581 | chan->netdev->tx_timeout = cosa_net_timeout; | ||
582 | chan->netdev->watchdog_timeo = TX_TIMEOUT; | 588 | chan->netdev->watchdog_timeo = TX_TIMEOUT; |
583 | chan->netdev->base_addr = chan->cosa->datareg; | 589 | chan->netdev->base_addr = chan->cosa->datareg; |
584 | chan->netdev->irq = chan->cosa->irq; | 590 | chan->netdev->irq = chan->cosa->irq; |
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c index 888025db2f02..8face5db8f32 100644 --- a/drivers/net/wan/dscc4.c +++ b/drivers/net/wan/dscc4.c | |||
@@ -883,6 +883,15 @@ static inline int dscc4_set_quartz(struct dscc4_dev_priv *dpriv, int hz) | |||
883 | return ret; | 883 | return ret; |
884 | } | 884 | } |
885 | 885 | ||
886 | static const struct net_device_ops dscc4_ops = { | ||
887 | .ndo_open = dscc4_open, | ||
888 | .ndo_stop = dscc4_close, | ||
889 | .ndo_change_mtu = hdlc_change_mtu, | ||
890 | .ndo_start_xmit = hdlc_start_xmit, | ||
891 | .ndo_do_ioctl = dscc4_ioctl, | ||
892 | .ndo_tx_timeout = dscc4_tx_timeout, | ||
893 | }; | ||
894 | |||
886 | static int dscc4_found1(struct pci_dev *pdev, void __iomem *ioaddr) | 895 | static int dscc4_found1(struct pci_dev *pdev, void __iomem *ioaddr) |
887 | { | 896 | { |
888 | struct dscc4_pci_priv *ppriv; | 897 | struct dscc4_pci_priv *ppriv; |
@@ -916,13 +925,8 @@ static int dscc4_found1(struct pci_dev *pdev, void __iomem *ioaddr) | |||
916 | hdlc_device *hdlc = dev_to_hdlc(d); | 925 | hdlc_device *hdlc = dev_to_hdlc(d); |
917 | 926 | ||
918 | d->base_addr = (unsigned long)ioaddr; | 927 | d->base_addr = (unsigned long)ioaddr; |
919 | d->init = NULL; | ||
920 | d->irq = pdev->irq; | 928 | d->irq = pdev->irq; |
921 | d->open = dscc4_open; | 929 | d->netdev_ops = &dscc4_ops; |
922 | d->stop = dscc4_close; | ||
923 | d->set_multicast_list = NULL; | ||
924 | d->do_ioctl = dscc4_ioctl; | ||
925 | d->tx_timeout = dscc4_tx_timeout; | ||
926 | d->watchdog_timeo = TX_TIMEOUT; | 930 | d->watchdog_timeo = TX_TIMEOUT; |
927 | SET_NETDEV_DEV(d, &pdev->dev); | 931 | SET_NETDEV_DEV(d, &pdev->dev); |
928 | 932 | ||
@@ -1048,7 +1052,7 @@ static int dscc4_open(struct net_device *dev) | |||
1048 | struct dscc4_pci_priv *ppriv; | 1052 | struct dscc4_pci_priv *ppriv; |
1049 | int ret = -EAGAIN; | 1053 | int ret = -EAGAIN; |
1050 | 1054 | ||
1051 | if ((dscc4_loopback_check(dpriv) < 0) || !dev->hard_start_xmit) | 1055 | if ((dscc4_loopback_check(dpriv) < 0)) |
1052 | goto err; | 1056 | goto err; |
1053 | 1057 | ||
1054 | if ((ret = hdlc_open(dev))) | 1058 | if ((ret = hdlc_open(dev))) |
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index 48a2c9d28950..00945f7c1e9b 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c | |||
@@ -2424,6 +2424,15 @@ fst_init_card(struct fst_card_info *card) | |||
2424 | type_strings[card->type], card->irq, card->nports); | 2424 | type_strings[card->type], card->irq, card->nports); |
2425 | } | 2425 | } |
2426 | 2426 | ||
2427 | static const struct net_device_ops fst_ops = { | ||
2428 | .ndo_open = fst_open, | ||
2429 | .ndo_stop = fst_close, | ||
2430 | .ndo_change_mtu = hdlc_change_mtu, | ||
2431 | .ndo_start_xmit = hdlc_start_xmit, | ||
2432 | .ndo_do_ioctl = fst_ioctl, | ||
2433 | .ndo_tx_timeout = fst_tx_timeout, | ||
2434 | }; | ||
2435 | |||
2427 | /* | 2436 | /* |
2428 | * Initialise card when detected. | 2437 | * Initialise card when detected. |
2429 | * Returns 0 to indicate success, or errno otherwise. | 2438 | * Returns 0 to indicate success, or errno otherwise. |
@@ -2565,12 +2574,9 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2565 | dev->base_addr = card->pci_conf; | 2574 | dev->base_addr = card->pci_conf; |
2566 | dev->irq = card->irq; | 2575 | dev->irq = card->irq; |
2567 | 2576 | ||
2568 | dev->tx_queue_len = FST_TX_QUEUE_LEN; | 2577 | dev->netdev_ops = &fst_ops; |
2569 | dev->open = fst_open; | 2578 | dev->tx_queue_len = FST_TX_QUEUE_LEN; |
2570 | dev->stop = fst_close; | 2579 | dev->watchdog_timeo = FST_TX_TIMEOUT; |
2571 | dev->do_ioctl = fst_ioctl; | ||
2572 | dev->watchdog_timeo = FST_TX_TIMEOUT; | ||
2573 | dev->tx_timeout = fst_tx_timeout; | ||
2574 | hdlc->attach = fst_attach; | 2580 | hdlc->attach = fst_attach; |
2575 | hdlc->xmit = fst_start_xmit; | 2581 | hdlc->xmit = fst_start_xmit; |
2576 | } | 2582 | } |
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c index dbc179887f8b..43da8bd72973 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; |
@@ -66,7 +66,15 @@ static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev, | |||
66 | return hdlc->proto->netif_rx(skb); | 66 | return hdlc->proto->netif_rx(skb); |
67 | } | 67 | } |
68 | 68 | ||
69 | int hdlc_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||
70 | { | ||
71 | hdlc_device *hdlc = dev_to_hdlc(dev); | ||
69 | 72 | ||
73 | if (hdlc->proto->xmit) | ||
74 | return hdlc->proto->xmit(skb, dev); | ||
75 | |||
76 | return hdlc->xmit(skb, dev); /* call hardware driver directly */ | ||
77 | } | ||
70 | 78 | ||
71 | static inline void hdlc_proto_start(struct net_device *dev) | 79 | static inline void hdlc_proto_start(struct net_device *dev) |
72 | { | 80 | { |
@@ -231,8 +239,6 @@ static void hdlc_setup_dev(struct net_device *dev) | |||
231 | dev->hard_header_len = 16; | 239 | dev->hard_header_len = 16; |
232 | dev->addr_len = 0; | 240 | dev->addr_len = 0; |
233 | dev->header_ops = &hdlc_null_ops; | 241 | dev->header_ops = &hdlc_null_ops; |
234 | |||
235 | dev->change_mtu = hdlc_change_mtu; | ||
236 | } | 242 | } |
237 | 243 | ||
238 | static void hdlc_setup(struct net_device *dev) | 244 | static void hdlc_setup(struct net_device *dev) |
@@ -330,6 +336,8 @@ MODULE_AUTHOR("Krzysztof Halasa <khc@pm.waw.pl>"); | |||
330 | MODULE_DESCRIPTION("HDLC support module"); | 336 | MODULE_DESCRIPTION("HDLC support module"); |
331 | MODULE_LICENSE("GPL v2"); | 337 | MODULE_LICENSE("GPL v2"); |
332 | 338 | ||
339 | EXPORT_SYMBOL(hdlc_change_mtu); | ||
340 | EXPORT_SYMBOL(hdlc_start_xmit); | ||
333 | EXPORT_SYMBOL(hdlc_open); | 341 | EXPORT_SYMBOL(hdlc_open); |
334 | EXPORT_SYMBOL(hdlc_close); | 342 | EXPORT_SYMBOL(hdlc_close); |
335 | EXPORT_SYMBOL(hdlc_ioctl); | 343 | EXPORT_SYMBOL(hdlc_ioctl); |
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c index 44e64b15dbd1..af3fd4fead8a 100644 --- a/drivers/net/wan/hdlc_cisco.c +++ b/drivers/net/wan/hdlc_cisco.c | |||
@@ -382,7 +382,6 @@ static int cisco_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
382 | 382 | ||
383 | memcpy(&state(hdlc)->settings, &new_settings, size); | 383 | memcpy(&state(hdlc)->settings, &new_settings, size); |
384 | spin_lock_init(&state(hdlc)->lock); | 384 | spin_lock_init(&state(hdlc)->lock); |
385 | dev->hard_start_xmit = hdlc->xmit; | ||
386 | dev->header_ops = &cisco_header_ops; | 385 | dev->header_ops = &cisco_header_ops; |
387 | dev->type = ARPHRD_CISCO; | 386 | dev->type = ARPHRD_CISCO; |
388 | netif_dormant_on(dev); | 387 | netif_dormant_on(dev); |
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c index f1ddd7c3459c..70e57cebc955 100644 --- a/drivers/net/wan/hdlc_fr.c +++ b/drivers/net/wan/hdlc_fr.c | |||
@@ -444,18 +444,6 @@ static int pvc_xmit(struct sk_buff *skb, struct net_device *dev) | |||
444 | return 0; | 444 | return 0; |
445 | } | 445 | } |
446 | 446 | ||
447 | |||
448 | |||
449 | static int pvc_change_mtu(struct net_device *dev, int new_mtu) | ||
450 | { | ||
451 | if ((new_mtu < 68) || (new_mtu > HDLC_MAX_MTU)) | ||
452 | return -EINVAL; | ||
453 | dev->mtu = new_mtu; | ||
454 | return 0; | ||
455 | } | ||
456 | |||
457 | |||
458 | |||
459 | static inline void fr_log_dlci_active(pvc_device *pvc) | 447 | static inline void fr_log_dlci_active(pvc_device *pvc) |
460 | { | 448 | { |
461 | printk(KERN_INFO "%s: DLCI %d [%s%s%s]%s %s\n", | 449 | printk(KERN_INFO "%s: DLCI %d [%s%s%s]%s %s\n", |
@@ -1068,6 +1056,14 @@ static void pvc_setup(struct net_device *dev) | |||
1068 | dev->addr_len = 2; | 1056 | dev->addr_len = 2; |
1069 | } | 1057 | } |
1070 | 1058 | ||
1059 | static const struct net_device_ops pvc_ops = { | ||
1060 | .ndo_open = pvc_open, | ||
1061 | .ndo_stop = pvc_close, | ||
1062 | .ndo_change_mtu = hdlc_change_mtu, | ||
1063 | .ndo_start_xmit = pvc_xmit, | ||
1064 | .ndo_do_ioctl = pvc_ioctl, | ||
1065 | }; | ||
1066 | |||
1071 | static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) | 1067 | static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) |
1072 | { | 1068 | { |
1073 | hdlc_device *hdlc = dev_to_hdlc(frad); | 1069 | hdlc_device *hdlc = dev_to_hdlc(frad); |
@@ -1104,11 +1100,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) | |||
1104 | *(__be16*)dev->dev_addr = htons(dlci); | 1100 | *(__be16*)dev->dev_addr = htons(dlci); |
1105 | dlci_to_q922(dev->broadcast, dlci); | 1101 | dlci_to_q922(dev->broadcast, dlci); |
1106 | } | 1102 | } |
1107 | dev->hard_start_xmit = pvc_xmit; | 1103 | dev->netdev_ops = &pvc_ops; |
1108 | dev->open = pvc_open; | ||
1109 | dev->stop = pvc_close; | ||
1110 | dev->do_ioctl = pvc_ioctl; | ||
1111 | dev->change_mtu = pvc_change_mtu; | ||
1112 | dev->mtu = HDLC_MAX_MTU; | 1104 | dev->mtu = HDLC_MAX_MTU; |
1113 | dev->tx_queue_len = 0; | 1105 | dev->tx_queue_len = 0; |
1114 | dev->ml_priv = pvc; | 1106 | dev->ml_priv = pvc; |
@@ -1260,8 +1252,6 @@ static int fr_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
1260 | state(hdlc)->dce_pvc_count = 0; | 1252 | state(hdlc)->dce_pvc_count = 0; |
1261 | } | 1253 | } |
1262 | memcpy(&state(hdlc)->settings, &new_settings, size); | 1254 | memcpy(&state(hdlc)->settings, &new_settings, size); |
1263 | |||
1264 | dev->hard_start_xmit = hdlc->xmit; | ||
1265 | dev->type = ARPHRD_FRAD; | 1255 | dev->type = ARPHRD_FRAD; |
1266 | return 0; | 1256 | return 0; |
1267 | 1257 | ||
diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c index 57fe714c1c7f..7b8a5eae201d 100644 --- a/drivers/net/wan/hdlc_ppp.c +++ b/drivers/net/wan/hdlc_ppp.c | |||
@@ -558,7 +558,6 @@ out: | |||
558 | return NET_RX_DROP; | 558 | return NET_RX_DROP; |
559 | } | 559 | } |
560 | 560 | ||
561 | |||
562 | static void ppp_timer(unsigned long arg) | 561 | static void ppp_timer(unsigned long arg) |
563 | { | 562 | { |
564 | struct proto *proto = (struct proto *)arg; | 563 | struct proto *proto = (struct proto *)arg; |
@@ -679,7 +678,6 @@ static int ppp_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
679 | ppp->keepalive_interval = 10; | 678 | ppp->keepalive_interval = 10; |
680 | ppp->keepalive_timeout = 60; | 679 | ppp->keepalive_timeout = 60; |
681 | 680 | ||
682 | dev->hard_start_xmit = hdlc->xmit; | ||
683 | dev->hard_header_len = sizeof(struct hdlc_header); | 681 | dev->hard_header_len = sizeof(struct hdlc_header); |
684 | dev->header_ops = &ppp_header_ops; | 682 | dev->header_ops = &ppp_header_ops; |
685 | dev->type = ARPHRD_PPP; | 683 | dev->type = ARPHRD_PPP; |
diff --git a/drivers/net/wan/hdlc_raw.c b/drivers/net/wan/hdlc_raw.c index 8612311748f4..6e92c64ebd0f 100644 --- a/drivers/net/wan/hdlc_raw.c +++ b/drivers/net/wan/hdlc_raw.c | |||
@@ -30,8 +30,6 @@ static __be16 raw_type_trans(struct sk_buff *skb, struct net_device *dev) | |||
30 | return __constant_htons(ETH_P_IP); | 30 | return __constant_htons(ETH_P_IP); |
31 | } | 31 | } |
32 | 32 | ||
33 | |||
34 | |||
35 | static struct hdlc_proto proto = { | 33 | static struct hdlc_proto proto = { |
36 | .type_trans = raw_type_trans, | 34 | .type_trans = raw_type_trans, |
37 | .ioctl = raw_ioctl, | 35 | .ioctl = raw_ioctl, |
@@ -86,7 +84,6 @@ static int raw_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
86 | if (result) | 84 | if (result) |
87 | return result; | 85 | return result; |
88 | memcpy(hdlc->state, &new_settings, size); | 86 | memcpy(hdlc->state, &new_settings, size); |
89 | dev->hard_start_xmit = hdlc->xmit; | ||
90 | dev->type = ARPHRD_RAWHDLC; | 87 | dev->type = ARPHRD_RAWHDLC; |
91 | netif_dormant_off(dev); | 88 | netif_dormant_off(dev); |
92 | return 0; | 89 | return 0; |
diff --git a/drivers/net/wan/hdlc_raw_eth.c b/drivers/net/wan/hdlc_raw_eth.c index a13fc3207520..49e68f5ca5f2 100644 --- a/drivers/net/wan/hdlc_raw_eth.c +++ b/drivers/net/wan/hdlc_raw_eth.c | |||
@@ -45,6 +45,7 @@ static int eth_tx(struct sk_buff *skb, struct net_device *dev) | |||
45 | 45 | ||
46 | static struct hdlc_proto proto = { | 46 | static struct hdlc_proto proto = { |
47 | .type_trans = eth_type_trans, | 47 | .type_trans = eth_type_trans, |
48 | .xmit = eth_tx, | ||
48 | .ioctl = raw_eth_ioctl, | 49 | .ioctl = raw_eth_ioctl, |
49 | .module = THIS_MODULE, | 50 | .module = THIS_MODULE, |
50 | }; | 51 | }; |
@@ -56,9 +57,7 @@ static int raw_eth_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
56 | const size_t size = sizeof(raw_hdlc_proto); | 57 | const size_t size = sizeof(raw_hdlc_proto); |
57 | raw_hdlc_proto new_settings; | 58 | raw_hdlc_proto new_settings; |
58 | hdlc_device *hdlc = dev_to_hdlc(dev); | 59 | hdlc_device *hdlc = dev_to_hdlc(dev); |
59 | int result; | 60 | int result, old_qlen; |
60 | int (*old_ch_mtu)(struct net_device *, int); | ||
61 | int old_qlen; | ||
62 | 61 | ||
63 | switch (ifr->ifr_settings.type) { | 62 | switch (ifr->ifr_settings.type) { |
64 | case IF_GET_PROTO: | 63 | case IF_GET_PROTO: |
@@ -99,11 +98,8 @@ static int raw_eth_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
99 | if (result) | 98 | if (result) |
100 | return result; | 99 | return result; |
101 | memcpy(hdlc->state, &new_settings, size); | 100 | memcpy(hdlc->state, &new_settings, size); |
102 | dev->hard_start_xmit = eth_tx; | ||
103 | old_ch_mtu = dev->change_mtu; | ||
104 | old_qlen = dev->tx_queue_len; | 101 | old_qlen = dev->tx_queue_len; |
105 | ether_setup(dev); | 102 | ether_setup(dev); |
106 | dev->change_mtu = old_ch_mtu; | ||
107 | dev->tx_queue_len = old_qlen; | 103 | dev->tx_queue_len = old_qlen; |
108 | random_ether_addr(dev->dev_addr); | 104 | random_ether_addr(dev->dev_addr); |
109 | netif_dormant_off(dev); | 105 | netif_dormant_off(dev); |
diff --git a/drivers/net/wan/hdlc_x25.c b/drivers/net/wan/hdlc_x25.c index cbcbf6f0414c..b1dc29ed1583 100644 --- a/drivers/net/wan/hdlc_x25.c +++ b/drivers/net/wan/hdlc_x25.c | |||
@@ -184,6 +184,7 @@ static struct hdlc_proto proto = { | |||
184 | .close = x25_close, | 184 | .close = x25_close, |
185 | .ioctl = x25_ioctl, | 185 | .ioctl = x25_ioctl, |
186 | .netif_rx = x25_rx, | 186 | .netif_rx = x25_rx, |
187 | .xmit = x25_xmit, | ||
187 | .module = THIS_MODULE, | 188 | .module = THIS_MODULE, |
188 | }; | 189 | }; |
189 | 190 | ||
@@ -213,7 +214,6 @@ static int x25_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
213 | 214 | ||
214 | if ((result = attach_hdlc_protocol(dev, &proto, 0))) | 215 | if ((result = attach_hdlc_protocol(dev, &proto, 0))) |
215 | return result; | 216 | return result; |
216 | dev->hard_start_xmit = x25_xmit; | ||
217 | dev->type = ARPHRD_X25; | 217 | dev->type = ARPHRD_X25; |
218 | netif_dormant_off(dev); | 218 | netif_dormant_off(dev); |
219 | return 0; | 219 | return 0; |
diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c index af54f0cf1b35..567d4f5062d6 100644 --- a/drivers/net/wan/hostess_sv11.c +++ b/drivers/net/wan/hostess_sv11.c | |||
@@ -173,6 +173,14 @@ static int hostess_attach(struct net_device *dev, unsigned short encoding, | |||
173 | * Description block for a Comtrol Hostess SV11 card | 173 | * Description block for a Comtrol Hostess SV11 card |
174 | */ | 174 | */ |
175 | 175 | ||
176 | static const struct net_device_ops hostess_ops = { | ||
177 | .ndo_open = hostess_open, | ||
178 | .ndo_stop = hostess_close, | ||
179 | .ndo_change_mtu = hdlc_change_mtu, | ||
180 | .ndo_start_xmit = hdlc_start_xmit, | ||
181 | .ndo_do_ioctl = hostess_ioctl, | ||
182 | }; | ||
183 | |||
176 | static struct z8530_dev *sv11_init(int iobase, int irq) | 184 | static struct z8530_dev *sv11_init(int iobase, int irq) |
177 | { | 185 | { |
178 | struct z8530_dev *sv; | 186 | struct z8530_dev *sv; |
@@ -267,9 +275,7 @@ static struct z8530_dev *sv11_init(int iobase, int irq) | |||
267 | 275 | ||
268 | dev_to_hdlc(netdev)->attach = hostess_attach; | 276 | dev_to_hdlc(netdev)->attach = hostess_attach; |
269 | dev_to_hdlc(netdev)->xmit = hostess_queue_xmit; | 277 | dev_to_hdlc(netdev)->xmit = hostess_queue_xmit; |
270 | netdev->open = hostess_open; | 278 | netdev->netdev_ops = &hostess_ops; |
271 | netdev->stop = hostess_close; | ||
272 | netdev->do_ioctl = hostess_ioctl; | ||
273 | netdev->base_addr = iobase; | 279 | netdev->base_addr = iobase; |
274 | netdev->irq = irq; | 280 | netdev->irq = irq; |
275 | 281 | ||
diff --git a/drivers/net/wan/ixp4xx_hss.c b/drivers/net/wan/ixp4xx_hss.c index 0dbd85b0162d..7e8bbba2cc1b 100644 --- a/drivers/net/wan/ixp4xx_hss.c +++ b/drivers/net/wan/ixp4xx_hss.c | |||
@@ -1230,6 +1230,14 @@ static int hss_hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1230 | * initialization | 1230 | * initialization |
1231 | ****************************************************************************/ | 1231 | ****************************************************************************/ |
1232 | 1232 | ||
1233 | static const struct net_device_ops hss_hdlc_ops = { | ||
1234 | .ndo_open = hss_hdlc_open, | ||
1235 | .ndo_stop = hss_hdlc_close, | ||
1236 | .ndo_change_mtu = hdlc_change_mtu, | ||
1237 | .ndo_start_xmit = hdlc_start_xmit, | ||
1238 | .ndo_do_ioctl = hss_hdlc_ioctl, | ||
1239 | }; | ||
1240 | |||
1233 | static int __devinit hss_init_one(struct platform_device *pdev) | 1241 | static int __devinit hss_init_one(struct platform_device *pdev) |
1234 | { | 1242 | { |
1235 | struct port *port; | 1243 | struct port *port; |
@@ -1254,9 +1262,7 @@ static int __devinit hss_init_one(struct platform_device *pdev) | |||
1254 | hdlc = dev_to_hdlc(dev); | 1262 | hdlc = dev_to_hdlc(dev); |
1255 | hdlc->attach = hss_hdlc_attach; | 1263 | hdlc->attach = hss_hdlc_attach; |
1256 | hdlc->xmit = hss_hdlc_xmit; | 1264 | hdlc->xmit = hss_hdlc_xmit; |
1257 | dev->open = hss_hdlc_open; | 1265 | dev->netdev_ops = &hss_hdlc_ops; |
1258 | dev->stop = hss_hdlc_close; | ||
1259 | dev->do_ioctl = hss_hdlc_ioctl; | ||
1260 | dev->tx_queue_len = 100; | 1266 | dev->tx_queue_len = 100; |
1261 | port->clock_type = CLOCK_EXT; | 1267 | port->clock_type = CLOCK_EXT; |
1262 | port->clock_rate = 2048000; | 1268 | port->clock_rate = 2048000; |
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c index feac3b99f8fe..45b1822c962d 100644 --- a/drivers/net/wan/lmc/lmc_main.c +++ b/drivers/net/wan/lmc/lmc_main.c | |||
@@ -806,6 +806,16 @@ static int lmc_attach(struct net_device *dev, unsigned short encoding, | |||
806 | return -EINVAL; | 806 | return -EINVAL; |
807 | } | 807 | } |
808 | 808 | ||
809 | static const struct net_device_ops lmc_ops = { | ||
810 | .ndo_open = lmc_open, | ||
811 | .ndo_stop = lmc_close, | ||
812 | .ndo_change_mtu = hdlc_change_mtu, | ||
813 | .ndo_start_xmit = hdlc_start_xmit, | ||
814 | .ndo_do_ioctl = lmc_ioctl, | ||
815 | .ndo_tx_timeout = lmc_driver_timeout, | ||
816 | .ndo_get_stats = lmc_get_stats, | ||
817 | }; | ||
818 | |||
809 | static int __devinit lmc_init_one(struct pci_dev *pdev, | 819 | static int __devinit lmc_init_one(struct pci_dev *pdev, |
810 | const struct pci_device_id *ent) | 820 | const struct pci_device_id *ent) |
811 | { | 821 | { |
@@ -849,11 +859,7 @@ static int __devinit lmc_init_one(struct pci_dev *pdev, | |||
849 | dev->type = ARPHRD_HDLC; | 859 | dev->type = ARPHRD_HDLC; |
850 | dev_to_hdlc(dev)->xmit = lmc_start_xmit; | 860 | dev_to_hdlc(dev)->xmit = lmc_start_xmit; |
851 | dev_to_hdlc(dev)->attach = lmc_attach; | 861 | dev_to_hdlc(dev)->attach = lmc_attach; |
852 | dev->open = lmc_open; | 862 | dev->netdev_ops = &lmc_ops; |
853 | dev->stop = lmc_close; | ||
854 | dev->get_stats = lmc_get_stats; | ||
855 | dev->do_ioctl = lmc_ioctl; | ||
856 | dev->tx_timeout = lmc_driver_timeout; | ||
857 | dev->watchdog_timeo = HZ; /* 1 second */ | 863 | dev->watchdog_timeo = HZ; /* 1 second */ |
858 | dev->tx_queue_len = 100; | 864 | dev->tx_queue_len = 100; |
859 | sc->lmc_device = dev; | 865 | sc->lmc_device = dev; |
@@ -1059,9 +1065,6 @@ static int lmc_open(struct net_device *dev) | |||
1059 | if ((err = lmc_proto_open(sc)) != 0) | 1065 | if ((err = lmc_proto_open(sc)) != 0) |
1060 | return err; | 1066 | return err; |
1061 | 1067 | ||
1062 | dev->do_ioctl = lmc_ioctl; | ||
1063 | |||
1064 | |||
1065 | netif_start_queue(dev); | 1068 | netif_start_queue(dev); |
1066 | sc->extra_stats.tx_tbusy0++; | 1069 | sc->extra_stats.tx_tbusy0++; |
1067 | 1070 | ||
diff --git a/drivers/net/wan/lmc/lmc_proto.c b/drivers/net/wan/lmc/lmc_proto.c index 94b4c208b013..044a48175c42 100644 --- a/drivers/net/wan/lmc/lmc_proto.c +++ b/drivers/net/wan/lmc/lmc_proto.c | |||
@@ -51,30 +51,15 @@ | |||
51 | void lmc_proto_attach(lmc_softc_t *sc) /*FOLD00*/ | 51 | void lmc_proto_attach(lmc_softc_t *sc) /*FOLD00*/ |
52 | { | 52 | { |
53 | lmc_trace(sc->lmc_device, "lmc_proto_attach in"); | 53 | lmc_trace(sc->lmc_device, "lmc_proto_attach in"); |
54 | switch(sc->if_type){ | 54 | if (sc->if_type == LMC_NET) { |
55 | case LMC_PPP: | ||
56 | { | ||
57 | struct net_device *dev = sc->lmc_device; | ||
58 | dev->do_ioctl = lmc_ioctl; | ||
59 | } | ||
60 | break; | ||
61 | case LMC_NET: | ||
62 | { | ||
63 | struct net_device *dev = sc->lmc_device; | 55 | struct net_device *dev = sc->lmc_device; |
64 | /* | 56 | /* |
65 | * They set a few basics because they don't use HDLC | 57 | * They set a few basics because they don't use HDLC |
66 | */ | 58 | */ |
67 | dev->flags |= IFF_POINTOPOINT; | 59 | dev->flags |= IFF_POINTOPOINT; |
68 | |||
69 | dev->hard_header_len = 0; | 60 | dev->hard_header_len = 0; |
70 | dev->addr_len = 0; | 61 | dev->addr_len = 0; |
71 | } | 62 | } |
72 | case LMC_RAW: /* Setup the task queue, maybe we should notify someone? */ | ||
73 | { | ||
74 | } | ||
75 | default: | ||
76 | break; | ||
77 | } | ||
78 | lmc_trace(sc->lmc_device, "lmc_proto_attach out"); | 63 | lmc_trace(sc->lmc_device, "lmc_proto_attach out"); |
79 | } | 64 | } |
80 | 65 | ||
diff --git a/drivers/net/wan/n2.c b/drivers/net/wan/n2.c index 697715ae80f4..83da596e2052 100644 --- a/drivers/net/wan/n2.c +++ b/drivers/net/wan/n2.c | |||
@@ -324,7 +324,13 @@ static void n2_destroy_card(card_t *card) | |||
324 | kfree(card); | 324 | kfree(card); |
325 | } | 325 | } |
326 | 326 | ||
327 | 327 | static const struct net_device_ops n2_ops = { | |
328 | .ndo_open = n2_open, | ||
329 | .ndo_stop = n2_close, | ||
330 | .ndo_change_mtu = hdlc_change_mtu, | ||
331 | .ndo_start_xmit = hdlc_start_xmit, | ||
332 | .ndo_do_ioctl = n2_ioctl, | ||
333 | }; | ||
328 | 334 | ||
329 | static int __init n2_run(unsigned long io, unsigned long irq, | 335 | static int __init n2_run(unsigned long io, unsigned long irq, |
330 | unsigned long winbase, long valid0, long valid1) | 336 | unsigned long winbase, long valid0, long valid1) |
@@ -460,9 +466,7 @@ static int __init n2_run(unsigned long io, unsigned long irq, | |||
460 | dev->mem_start = winbase; | 466 | dev->mem_start = winbase; |
461 | dev->mem_end = winbase + USE_WINDOWSIZE - 1; | 467 | dev->mem_end = winbase + USE_WINDOWSIZE - 1; |
462 | dev->tx_queue_len = 50; | 468 | dev->tx_queue_len = 50; |
463 | dev->do_ioctl = n2_ioctl; | 469 | dev->netdev_ops = &n2_ops; |
464 | dev->open = n2_open; | ||
465 | dev->stop = n2_close; | ||
466 | hdlc->attach = sca_attach; | 470 | hdlc->attach = sca_attach; |
467 | hdlc->xmit = sca_xmit; | 471 | hdlc->xmit = sca_xmit; |
468 | port->settings.clock_type = CLOCK_EXT; | 472 | port->settings.clock_type = CLOCK_EXT; |
diff --git a/drivers/net/wan/pc300too.c b/drivers/net/wan/pc300too.c index f247e5d9002a..60ece54bdd94 100644 --- a/drivers/net/wan/pc300too.c +++ b/drivers/net/wan/pc300too.c | |||
@@ -287,7 +287,13 @@ static void pc300_pci_remove_one(struct pci_dev *pdev) | |||
287 | kfree(card); | 287 | kfree(card); |
288 | } | 288 | } |
289 | 289 | ||
290 | 290 | static const struct net_device_ops pc300_ops = { | |
291 | .ndo_open = pc300_open, | ||
292 | .ndo_stop = pc300_close, | ||
293 | .ndo_change_mtu = hdlc_change_mtu, | ||
294 | .ndo_start_xmit = hdlc_start_xmit, | ||
295 | .ndo_do_ioctl = pc300_ioctl, | ||
296 | }; | ||
291 | 297 | ||
292 | static int __devinit pc300_pci_init_one(struct pci_dev *pdev, | 298 | static int __devinit pc300_pci_init_one(struct pci_dev *pdev, |
293 | const struct pci_device_id *ent) | 299 | const struct pci_device_id *ent) |
@@ -448,9 +454,7 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev, | |||
448 | dev->mem_start = ramphys; | 454 | dev->mem_start = ramphys; |
449 | dev->mem_end = ramphys + ramsize - 1; | 455 | dev->mem_end = ramphys + ramsize - 1; |
450 | dev->tx_queue_len = 50; | 456 | dev->tx_queue_len = 50; |
451 | dev->do_ioctl = pc300_ioctl; | 457 | dev->netdev_ops = &pc300_ops; |
452 | dev->open = pc300_open; | ||
453 | dev->stop = pc300_close; | ||
454 | hdlc->attach = sca_attach; | 458 | hdlc->attach = sca_attach; |
455 | hdlc->xmit = sca_xmit; | 459 | hdlc->xmit = sca_xmit; |
456 | port->settings.clock_type = CLOCK_EXT; | 460 | port->settings.clock_type = CLOCK_EXT; |
diff --git a/drivers/net/wan/pci200syn.c b/drivers/net/wan/pci200syn.c index 1104d3a692f7..e035d8c57e11 100644 --- a/drivers/net/wan/pci200syn.c +++ b/drivers/net/wan/pci200syn.c | |||
@@ -265,7 +265,13 @@ static void pci200_pci_remove_one(struct pci_dev *pdev) | |||
265 | kfree(card); | 265 | kfree(card); |
266 | } | 266 | } |
267 | 267 | ||
268 | 268 | static const struct net_device_ops pci200_ops = { | |
269 | .ndo_open = pci200_open, | ||
270 | .ndo_stop = pci200_close, | ||
271 | .ndo_change_mtu = hdlc_change_mtu, | ||
272 | .ndo_start_xmit = hdlc_start_xmit, | ||
273 | .ndo_do_ioctl = pci200_ioctl, | ||
274 | }; | ||
269 | 275 | ||
270 | static int __devinit pci200_pci_init_one(struct pci_dev *pdev, | 276 | static int __devinit pci200_pci_init_one(struct pci_dev *pdev, |
271 | const struct pci_device_id *ent) | 277 | const struct pci_device_id *ent) |
@@ -395,9 +401,7 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev, | |||
395 | dev->mem_start = ramphys; | 401 | dev->mem_start = ramphys; |
396 | dev->mem_end = ramphys + ramsize - 1; | 402 | dev->mem_end = ramphys + ramsize - 1; |
397 | dev->tx_queue_len = 50; | 403 | dev->tx_queue_len = 50; |
398 | dev->do_ioctl = pci200_ioctl; | 404 | dev->netdev_ops = &pci200_ops; |
399 | dev->open = pci200_open; | ||
400 | dev->stop = pci200_close; | ||
401 | hdlc->attach = sca_attach; | 405 | hdlc->attach = sca_attach; |
402 | hdlc->xmit = sca_xmit; | 406 | hdlc->xmit = sca_xmit; |
403 | port->settings.clock_type = CLOCK_EXT; | 407 | port->settings.clock_type = CLOCK_EXT; |
diff --git a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c index 0941a26f6e3f..23b269027453 100644 --- a/drivers/net/wan/sealevel.c +++ b/drivers/net/wan/sealevel.c | |||
@@ -169,6 +169,14 @@ static int sealevel_attach(struct net_device *dev, unsigned short encoding, | |||
169 | return -EINVAL; | 169 | return -EINVAL; |
170 | } | 170 | } |
171 | 171 | ||
172 | static const struct net_device_ops sealevel_ops = { | ||
173 | .ndo_open = sealevel_open, | ||
174 | .ndo_stop = sealevel_close, | ||
175 | .ndo_change_mtu = hdlc_change_mtu, | ||
176 | .ndo_start_xmit = hdlc_start_xmit, | ||
177 | .ndo_do_ioctl = sealevel_ioctl, | ||
178 | }; | ||
179 | |||
172 | static int slvl_setup(struct slvl_device *sv, int iobase, int irq) | 180 | static int slvl_setup(struct slvl_device *sv, int iobase, int irq) |
173 | { | 181 | { |
174 | struct net_device *dev = alloc_hdlcdev(sv); | 182 | struct net_device *dev = alloc_hdlcdev(sv); |
@@ -177,9 +185,7 @@ static int slvl_setup(struct slvl_device *sv, int iobase, int irq) | |||
177 | 185 | ||
178 | dev_to_hdlc(dev)->attach = sealevel_attach; | 186 | dev_to_hdlc(dev)->attach = sealevel_attach; |
179 | dev_to_hdlc(dev)->xmit = sealevel_queue_xmit; | 187 | dev_to_hdlc(dev)->xmit = sealevel_queue_xmit; |
180 | dev->open = sealevel_open; | 188 | dev->netdev_ops = &sealevel_ops; |
181 | dev->stop = sealevel_close; | ||
182 | dev->do_ioctl = sealevel_ioctl; | ||
183 | dev->base_addr = iobase; | 189 | dev->base_addr = iobase; |
184 | dev->irq = irq; | 190 | dev->irq = irq; |
185 | 191 | ||
diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c index 4bffb67ebcae..887acb0dc807 100644 --- a/drivers/net/wan/wanxl.c +++ b/drivers/net/wan/wanxl.c | |||
@@ -547,6 +547,15 @@ static void wanxl_pci_remove_one(struct pci_dev *pdev) | |||
547 | 547 | ||
548 | #include "wanxlfw.inc" | 548 | #include "wanxlfw.inc" |
549 | 549 | ||
550 | static const struct net_device_ops wanxl_ops = { | ||
551 | .ndo_open = wanxl_open, | ||
552 | .ndo_stop = wanxl_close, | ||
553 | .ndo_change_mtu = hdlc_change_mtu, | ||
554 | .ndo_start_xmit = hdlc_start_xmit, | ||
555 | .ndo_do_ioctl = wanxl_ioctl, | ||
556 | .ndo_get_stats = wanxl_get_stats, | ||
557 | }; | ||
558 | |||
550 | static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, | 559 | static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, |
551 | const struct pci_device_id *ent) | 560 | const struct pci_device_id *ent) |
552 | { | 561 | { |
@@ -777,12 +786,9 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, | |||
777 | hdlc = dev_to_hdlc(dev); | 786 | hdlc = dev_to_hdlc(dev); |
778 | spin_lock_init(&port->lock); | 787 | spin_lock_init(&port->lock); |
779 | dev->tx_queue_len = 50; | 788 | dev->tx_queue_len = 50; |
780 | dev->do_ioctl = wanxl_ioctl; | 789 | dev->netdev_ops = &wanxl_ops; |
781 | dev->open = wanxl_open; | ||
782 | dev->stop = wanxl_close; | ||
783 | hdlc->attach = wanxl_attach; | 790 | hdlc->attach = wanxl_attach; |
784 | hdlc->xmit = wanxl_xmit; | 791 | hdlc->xmit = wanxl_xmit; |
785 | dev->get_stats = wanxl_get_stats; | ||
786 | port->card = card; | 792 | port->card = card; |
787 | port->node = i; | 793 | port->node = i; |
788 | get_status(port)->clocking = CLOCK_EXT; | 794 | get_status(port)->clocking = CLOCK_EXT; |