aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wavelan.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2009-03-26 11:11:27 -0400
committerDavid S. Miller <davem@davemloft.net>2009-03-27 03:46:46 -0400
commit0687478a9977db0698d40f0024d4b06fd42e01a0 (patch)
treee91fbba257acad23ccc915f044399ee005337185 /drivers/net/wireless/wavelan.c
parent8fdcf1aba33a61475d411d91ab47c2c9adb3e4c3 (diff)
wireless: convert wavelan to net_device_ops
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/wavelan.c')
-rw-r--r--drivers/net/wireless/wavelan.c79
1 files changed, 36 insertions, 43 deletions
diff --git a/drivers/net/wireless/wavelan.c b/drivers/net/wireless/wavelan.c
index b728541f2fb5..3ab3eb957189 100644
--- a/drivers/net/wireless/wavelan.c
+++ b/drivers/net/wireless/wavelan.c
@@ -735,9 +735,9 @@ if (lp->tx_n_in_use > 0)
735 if (tx_status & AC_SFLD_OK) { 735 if (tx_status & AC_SFLD_OK) {
736 int ncollisions; 736 int ncollisions;
737 737
738 lp->stats.tx_packets++; 738 dev->stats.tx_packets++;
739 ncollisions = tx_status & AC_SFLD_MAXCOL; 739 ncollisions = tx_status & AC_SFLD_MAXCOL;
740 lp->stats.collisions += ncollisions; 740 dev->stats.collisions += ncollisions;
741#ifdef DEBUG_TX_INFO 741#ifdef DEBUG_TX_INFO
742 if (ncollisions > 0) 742 if (ncollisions > 0)
743 printk(KERN_DEBUG 743 printk(KERN_DEBUG
@@ -745,9 +745,9 @@ if (lp->tx_n_in_use > 0)
745 dev->name, ncollisions); 745 dev->name, ncollisions);
746#endif 746#endif
747 } else { 747 } else {
748 lp->stats.tx_errors++; 748 dev->stats.tx_errors++;
749 if (tx_status & AC_SFLD_S10) { 749 if (tx_status & AC_SFLD_S10) {
750 lp->stats.tx_carrier_errors++; 750 dev->stats.tx_carrier_errors++;
751#ifdef DEBUG_TX_FAIL 751#ifdef DEBUG_TX_FAIL
752 printk(KERN_DEBUG 752 printk(KERN_DEBUG
753 "%s: wv_complete(): tx error: no CS.\n", 753 "%s: wv_complete(): tx error: no CS.\n",
@@ -755,7 +755,7 @@ if (lp->tx_n_in_use > 0)
755#endif 755#endif
756 } 756 }
757 if (tx_status & AC_SFLD_S9) { 757 if (tx_status & AC_SFLD_S9) {
758 lp->stats.tx_carrier_errors++; 758 dev->stats.tx_carrier_errors++;
759#ifdef DEBUG_TX_FAIL 759#ifdef DEBUG_TX_FAIL
760 printk(KERN_DEBUG 760 printk(KERN_DEBUG
761 "%s: wv_complete(): tx error: lost CTS.\n", 761 "%s: wv_complete(): tx error: lost CTS.\n",
@@ -763,7 +763,7 @@ if (lp->tx_n_in_use > 0)
763#endif 763#endif
764 } 764 }
765 if (tx_status & AC_SFLD_S8) { 765 if (tx_status & AC_SFLD_S8) {
766 lp->stats.tx_fifo_errors++; 766 dev->stats.tx_fifo_errors++;
767#ifdef DEBUG_TX_FAIL 767#ifdef DEBUG_TX_FAIL
768 printk(KERN_DEBUG 768 printk(KERN_DEBUG
769 "%s: wv_complete(): tx error: slow DMA.\n", 769 "%s: wv_complete(): tx error: slow DMA.\n",
@@ -771,7 +771,7 @@ if (lp->tx_n_in_use > 0)
771#endif 771#endif
772 } 772 }
773 if (tx_status & AC_SFLD_S6) { 773 if (tx_status & AC_SFLD_S6) {
774 lp->stats.tx_heartbeat_errors++; 774 dev->stats.tx_heartbeat_errors++;
775#ifdef DEBUG_TX_FAIL 775#ifdef DEBUG_TX_FAIL
776 printk(KERN_DEBUG 776 printk(KERN_DEBUG
777 "%s: wv_complete(): tx error: heart beat.\n", 777 "%s: wv_complete(): tx error: heart beat.\n",
@@ -779,7 +779,7 @@ if (lp->tx_n_in_use > 0)
779#endif 779#endif
780 } 780 }
781 if (tx_status & AC_SFLD_S5) { 781 if (tx_status & AC_SFLD_S5) {
782 lp->stats.tx_aborted_errors++; 782 dev->stats.tx_aborted_errors++;
783#ifdef DEBUG_TX_FAIL 783#ifdef DEBUG_TX_FAIL
784 printk(KERN_DEBUG 784 printk(KERN_DEBUG
785 "%s: wv_complete(): tx error: too many collisions.\n", 785 "%s: wv_complete(): tx error: too many collisions.\n",
@@ -1346,20 +1346,6 @@ static void wv_init_info(struct net_device * dev)
1346 * or wireless extensions 1346 * or wireless extensions
1347 */ 1347 */
1348 1348
1349/*------------------------------------------------------------------*/
1350/*
1351 * Get the current Ethernet statistics. This may be called with the
1352 * card open or closed.
1353 * Used when the user read /proc/net/dev
1354 */
1355static en_stats *wavelan_get_stats(struct net_device * dev)
1356{
1357#ifdef DEBUG_IOCTL_TRACE
1358 printk(KERN_DEBUG "%s: <>wavelan_get_stats()\n", dev->name);
1359#endif
1360
1361 return &((net_local *)netdev_priv(dev))->stats;
1362}
1363 1349
1364/*------------------------------------------------------------------*/ 1350/*------------------------------------------------------------------*/
1365/* 1351/*
@@ -2466,7 +2452,7 @@ wv_packet_read(struct net_device * dev, u16 buf_off, int sksize)
2466 "%s: wv_packet_read(): could not alloc_skb(%d, GFP_ATOMIC).\n", 2452 "%s: wv_packet_read(): could not alloc_skb(%d, GFP_ATOMIC).\n",
2467 dev->name, sksize); 2453 dev->name, sksize);
2468#endif 2454#endif
2469 lp->stats.rx_dropped++; 2455 dev->stats.rx_dropped++;
2470 return; 2456 return;
2471 } 2457 }
2472 2458
@@ -2526,8 +2512,8 @@ wv_packet_read(struct net_device * dev, u16 buf_off, int sksize)
2526 netif_rx(skb); 2512 netif_rx(skb);
2527 2513
2528 /* Keep statistics up to date */ 2514 /* Keep statistics up to date */
2529 lp->stats.rx_packets++; 2515 dev->stats.rx_packets++;
2530 lp->stats.rx_bytes += sksize; 2516 dev->stats.rx_bytes += sksize;
2531 2517
2532#ifdef DEBUG_RX_TRACE 2518#ifdef DEBUG_RX_TRACE
2533 printk(KERN_DEBUG "%s: <-wv_packet_read()\n", dev->name); 2519 printk(KERN_DEBUG "%s: <-wv_packet_read()\n", dev->name);
@@ -2608,7 +2594,7 @@ static void wv_receive(struct net_device * dev)
2608#endif 2594#endif
2609 } else { /* If reception was no successful */ 2595 } else { /* If reception was no successful */
2610 2596
2611 lp->stats.rx_errors++; 2597 dev->stats.rx_errors++;
2612 2598
2613#ifdef DEBUG_RX_INFO 2599#ifdef DEBUG_RX_INFO
2614 printk(KERN_DEBUG 2600 printk(KERN_DEBUG
@@ -2624,7 +2610,7 @@ static void wv_receive(struct net_device * dev)
2624#endif 2610#endif
2625 2611
2626 if ((fd.fd_status & FD_STATUS_S7) != 0) { 2612 if ((fd.fd_status & FD_STATUS_S7) != 0) {
2627 lp->stats.rx_length_errors++; 2613 dev->stats.rx_length_errors++;
2628#ifdef DEBUG_RX_FAIL 2614#ifdef DEBUG_RX_FAIL
2629 printk(KERN_DEBUG 2615 printk(KERN_DEBUG
2630 "%s: wv_receive(): frame too short.\n", 2616 "%s: wv_receive(): frame too short.\n",
@@ -2633,7 +2619,7 @@ static void wv_receive(struct net_device * dev)
2633 } 2619 }
2634 2620
2635 if ((fd.fd_status & FD_STATUS_S8) != 0) { 2621 if ((fd.fd_status & FD_STATUS_S8) != 0) {
2636 lp->stats.rx_over_errors++; 2622 dev->stats.rx_over_errors++;
2637#ifdef DEBUG_RX_FAIL 2623#ifdef DEBUG_RX_FAIL
2638 printk(KERN_DEBUG 2624 printk(KERN_DEBUG
2639 "%s: wv_receive(): rx DMA overrun.\n", 2625 "%s: wv_receive(): rx DMA overrun.\n",
@@ -2642,7 +2628,7 @@ static void wv_receive(struct net_device * dev)
2642 } 2628 }
2643 2629
2644 if ((fd.fd_status & FD_STATUS_S9) != 0) { 2630 if ((fd.fd_status & FD_STATUS_S9) != 0) {
2645 lp->stats.rx_fifo_errors++; 2631 dev->stats.rx_fifo_errors++;
2646#ifdef DEBUG_RX_FAIL 2632#ifdef DEBUG_RX_FAIL
2647 printk(KERN_DEBUG 2633 printk(KERN_DEBUG
2648 "%s: wv_receive(): ran out of resources.\n", 2634 "%s: wv_receive(): ran out of resources.\n",
@@ -2651,7 +2637,7 @@ static void wv_receive(struct net_device * dev)
2651 } 2637 }
2652 2638
2653 if ((fd.fd_status & FD_STATUS_S10) != 0) { 2639 if ((fd.fd_status & FD_STATUS_S10) != 0) {
2654 lp->stats.rx_frame_errors++; 2640 dev->stats.rx_frame_errors++;
2655#ifdef DEBUG_RX_FAIL 2641#ifdef DEBUG_RX_FAIL
2656 printk(KERN_DEBUG 2642 printk(KERN_DEBUG
2657 "%s: wv_receive(): alignment error.\n", 2643 "%s: wv_receive(): alignment error.\n",
@@ -2660,7 +2646,7 @@ static void wv_receive(struct net_device * dev)
2660 } 2646 }
2661 2647
2662 if ((fd.fd_status & FD_STATUS_S11) != 0) { 2648 if ((fd.fd_status & FD_STATUS_S11) != 0) {
2663 lp->stats.rx_crc_errors++; 2649 dev->stats.rx_crc_errors++;
2664#ifdef DEBUG_RX_FAIL 2650#ifdef DEBUG_RX_FAIL
2665 printk(KERN_DEBUG 2651 printk(KERN_DEBUG
2666 "%s: wv_receive(): CRC error.\n", 2652 "%s: wv_receive(): CRC error.\n",
@@ -2826,7 +2812,7 @@ static int wv_packet_write(struct net_device * dev, void *buf, short length)
2826 dev->trans_start = jiffies; 2812 dev->trans_start = jiffies;
2827 2813
2828 /* Keep stats up to date. */ 2814 /* Keep stats up to date. */
2829 lp->stats.tx_bytes += length; 2815 dev->stats.tx_bytes += length;
2830 2816
2831 if (lp->tx_first_in_use == I82586NULL) 2817 if (lp->tx_first_in_use == I82586NULL)
2832 lp->tx_first_in_use = txblock; 2818 lp->tx_first_in_use = txblock;
@@ -4038,6 +4024,22 @@ static int wavelan_close(struct net_device * dev)
4038 return 0; 4024 return 0;
4039} 4025}
4040 4026
4027static const struct net_device_ops wavelan_netdev_ops = {
4028 .ndo_open = wavelan_open,
4029 .ndo_stop = wavelan_close,
4030 .ndo_start_xmit = wavelan_packet_xmit,
4031 .ndo_set_multicast_list = wavelan_set_multicast_list,
4032 .ndo_tx_timeout = wavelan_watchdog,
4033 .ndo_change_mtu = eth_change_mtu,
4034 .ndo_validate_addr = eth_validate_addr,
4035#ifdef SET_MAC_ADDRESS
4036 .ndo_set_mac_address = wavelan_set_mac_address
4037#else
4038 .ndo_set_mac_address = eth_mac_addr,
4039#endif
4040};
4041
4042
4041/*------------------------------------------------------------------*/ 4043/*------------------------------------------------------------------*/
4042/* 4044/*
4043 * Probe an I/O address, and if the WaveLAN is there configure the 4045 * Probe an I/O address, and if the WaveLAN is there configure the
@@ -4130,17 +4132,8 @@ static int __init wavelan_config(struct net_device *dev, unsigned short ioaddr)
4130 /* Init spinlock */ 4132 /* Init spinlock */
4131 spin_lock_init(&lp->spinlock); 4133 spin_lock_init(&lp->spinlock);
4132 4134
4133 dev->open = wavelan_open; 4135 dev->netdev_ops = &wavelan_netdev_ops;
4134 dev->stop = wavelan_close; 4136 dev->watchdog_timeo = WATCHDOG_JIFFIES;
4135 dev->hard_start_xmit = wavelan_packet_xmit;
4136 dev->get_stats = wavelan_get_stats;
4137 dev->set_multicast_list = &wavelan_set_multicast_list;
4138 dev->tx_timeout = &wavelan_watchdog;
4139 dev->watchdog_timeo = WATCHDOG_JIFFIES;
4140#ifdef SET_MAC_ADDRESS
4141 dev->set_mac_address = &wavelan_set_mac_address;
4142#endif /* SET_MAC_ADDRESS */
4143
4144 dev->wireless_handlers = &wavelan_handler_def; 4137 dev->wireless_handlers = &wavelan_handler_def;
4145 lp->wireless_data.spy_data = &lp->spy_data; 4138 lp->wireless_data.spy_data = &lp->spy_data;
4146 dev->wireless_data = &lp->wireless_data; 4139 dev->wireless_data = &lp->wireless_data;