aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/tulip/dmfe.c62
1 files changed, 25 insertions, 37 deletions
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
index 28a5c51b43a0..2e5c99941f35 100644
--- a/drivers/net/tulip/dmfe.c
+++ b/drivers/net/tulip/dmfe.c
@@ -257,9 +257,6 @@ struct dmfe_board_info {
257 u8 wol_mode; /* user WOL settings */ 257 u8 wol_mode; /* user WOL settings */
258 struct timer_list timer; 258 struct timer_list timer;
259 259
260 /* System defined statistic counter */
261 struct net_device_stats stats;
262
263 /* Driver defined statistic counter */ 260 /* Driver defined statistic counter */
264 unsigned long tx_fifo_underrun; 261 unsigned long tx_fifo_underrun;
265 unsigned long tx_loss_carrier; 262 unsigned long tx_loss_carrier;
@@ -316,7 +313,6 @@ static u8 SF_mode; /* Special Function: 1:VLAN, 2:RX Flow Control
316static int dmfe_open(struct DEVICE *); 313static int dmfe_open(struct DEVICE *);
317static int dmfe_start_xmit(struct sk_buff *, struct DEVICE *); 314static int dmfe_start_xmit(struct sk_buff *, struct DEVICE *);
318static int dmfe_stop(struct DEVICE *); 315static int dmfe_stop(struct DEVICE *);
319static struct net_device_stats * dmfe_get_stats(struct DEVICE *);
320static void dmfe_set_filter_mode(struct DEVICE *); 316static void dmfe_set_filter_mode(struct DEVICE *);
321static const struct ethtool_ops netdev_ethtool_ops; 317static const struct ethtool_ops netdev_ethtool_ops;
322static u16 read_srom_word(long ,int); 318static u16 read_srom_word(long ,int);
@@ -351,6 +347,19 @@ static void dmfe_set_phyxcer(struct dmfe_board_info *);
351 347
352/* DM910X network board routine ---------------------------- */ 348/* DM910X network board routine ---------------------------- */
353 349
350static const struct net_device_ops netdev_ops = {
351 .ndo_open = dmfe_open,
352 .ndo_stop = dmfe_stop,
353 .ndo_start_xmit = dmfe_start_xmit,
354 .ndo_set_multicast_list = dmfe_set_filter_mode,
355 .ndo_change_mtu = eth_change_mtu,
356 .ndo_set_mac_address = eth_mac_addr,
357 .ndo_validate_addr = eth_validate_addr,
358#ifdef CONFIG_NET_POLL_CONTROLLER
359 .ndo_poll_controller = poll_dmfe,
360#endif
361};
362
354/* 363/*
355 * Search DM910X board ,allocate space and register it 364 * Search DM910X board ,allocate space and register it
356 */ 365 */
@@ -442,14 +451,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
442 dev->base_addr = db->ioaddr; 451 dev->base_addr = db->ioaddr;
443 dev->irq = pdev->irq; 452 dev->irq = pdev->irq;
444 pci_set_drvdata(pdev, dev); 453 pci_set_drvdata(pdev, dev);
445 dev->open = &dmfe_open; 454 dev->netdev_ops = &netdev_ops;
446 dev->hard_start_xmit = &dmfe_start_xmit;
447 dev->stop = &dmfe_stop;
448 dev->get_stats = &dmfe_get_stats;
449 dev->set_multicast_list = &dmfe_set_filter_mode;
450#ifdef CONFIG_NET_POLL_CONTROLLER
451 dev->poll_controller = &poll_dmfe;
452#endif
453 dev->ethtool_ops = &netdev_ethtool_ops; 455 dev->ethtool_ops = &netdev_ethtool_ops;
454 netif_carrier_off(dev); 456 netif_carrier_off(dev);
455 spin_lock_init(&db->lock); 457 spin_lock_init(&db->lock);
@@ -867,15 +869,15 @@ static void dmfe_free_tx_pkt(struct DEVICE *dev, struct dmfe_board_info * db)
867 869
868 /* A packet sent completed */ 870 /* A packet sent completed */
869 db->tx_packet_cnt--; 871 db->tx_packet_cnt--;
870 db->stats.tx_packets++; 872 dev->stats.tx_packets++;
871 873
872 /* Transmit statistic counter */ 874 /* Transmit statistic counter */
873 if ( tdes0 != 0x7fffffff ) { 875 if ( tdes0 != 0x7fffffff ) {
874 /* printk(DRV_NAME ": tdes0=%x\n", tdes0); */ 876 /* printk(DRV_NAME ": tdes0=%x\n", tdes0); */
875 db->stats.collisions += (tdes0 >> 3) & 0xf; 877 dev->stats.collisions += (tdes0 >> 3) & 0xf;
876 db->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff; 878 dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff;
877 if (tdes0 & TDES0_ERR_MASK) { 879 if (tdes0 & TDES0_ERR_MASK) {
878 db->stats.tx_errors++; 880 dev->stats.tx_errors++;
879 881
880 if (tdes0 & 0x0002) { /* UnderRun */ 882 if (tdes0 & 0x0002) { /* UnderRun */
881 db->tx_fifo_underrun++; 883 db->tx_fifo_underrun++;
@@ -969,13 +971,13 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db)
969 if (rdes0 & 0x8000) { 971 if (rdes0 & 0x8000) {
970 /* This is a error packet */ 972 /* This is a error packet */
971 //printk(DRV_NAME ": rdes0: %lx\n", rdes0); 973 //printk(DRV_NAME ": rdes0: %lx\n", rdes0);
972 db->stats.rx_errors++; 974 dev->stats.rx_errors++;
973 if (rdes0 & 1) 975 if (rdes0 & 1)
974 db->stats.rx_fifo_errors++; 976 dev->stats.rx_fifo_errors++;
975 if (rdes0 & 2) 977 if (rdes0 & 2)
976 db->stats.rx_crc_errors++; 978 dev->stats.rx_crc_errors++;
977 if (rdes0 & 0x80) 979 if (rdes0 & 0x80)
978 db->stats.rx_length_errors++; 980 dev->stats.rx_length_errors++;
979 } 981 }
980 982
981 if ( !(rdes0 & 0x8000) || 983 if ( !(rdes0 & 0x8000) ||
@@ -1008,8 +1010,8 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db)
1008 1010
1009 skb->protocol = eth_type_trans(skb, dev); 1011 skb->protocol = eth_type_trans(skb, dev);
1010 netif_rx(skb); 1012 netif_rx(skb);
1011 db->stats.rx_packets++; 1013 dev->stats.rx_packets++;
1012 db->stats.rx_bytes += rxlen; 1014 dev->stats.rx_bytes += rxlen;
1013 } 1015 }
1014 } else { 1016 } else {
1015 /* Reuse SKB buffer when the packet is error */ 1017 /* Reuse SKB buffer when the packet is error */
@@ -1024,20 +1026,6 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db)
1024 db->rx_ready_ptr = rxptr; 1026 db->rx_ready_ptr = rxptr;
1025} 1027}
1026 1028
1027
1028/*
1029 * Get statistics from driver.
1030 */
1031
1032static struct net_device_stats * dmfe_get_stats(struct DEVICE *dev)
1033{
1034 struct dmfe_board_info *db = netdev_priv(dev);
1035
1036 DMFE_DBUG(0, "dmfe_get_stats", 0);
1037 return &db->stats;
1038}
1039
1040
1041/* 1029/*
1042 * Set DM910X multicast address 1030 * Set DM910X multicast address
1043 */ 1031 */
@@ -1161,7 +1149,7 @@ static void dmfe_timer(unsigned long data)
1161 1149
1162 /* Operating Mode Check */ 1150 /* Operating Mode Check */
1163 if ( (db->dm910x_chk_mode & 0x1) && 1151 if ( (db->dm910x_chk_mode & 0x1) &&
1164 (db->stats.rx_packets > MAX_CHECK_PACKET) ) 1152 (dev->stats.rx_packets > MAX_CHECK_PACKET) )
1165 db->dm910x_chk_mode = 0x4; 1153 db->dm910x_chk_mode = 0x4;
1166 1154
1167 /* Dynamic reset DM910X : system error or transmit time-out */ 1155 /* Dynamic reset DM910X : system error or transmit time-out */