diff options
author | merge <null@invalid> | 2009-01-22 13:55:32 +0000 |
---|---|---|
committer | Andy Green <agreen@octopus.localdomain> | 2009-01-22 13:55:32 +0000 |
commit | aa6f5ffbdba45aa8e19e5048648fc6c7b25376d3 (patch) | |
tree | fbb786d0ac6f8a774fd834e9ce951197e60fbffa /drivers/net/tulip/uli526x.c | |
parent | f2d78193eae5dccd3d588d2c8ea0866efc368332 (diff) |
MERGE-via-pending-tracking-hist-MERGE-via-stable-tracking-MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040-1232632141
pending-tracking-hist top was MERGE-via-stable-tracking-MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040-1232632141 / fdf777a63bcb59e0dfd78bfe2c6242e01f6d4eb9 ... parent commitmessage:
From: merge <null@invalid>
MERGE-via-stable-tracking-hist-MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040
stable-tracking-hist top was MERGE-via-mokopatches-tracking-fix-stray-endmenu-patch-1232632040 / 90463bfd2d5a3c8b52f6e6d71024a00e052b0ced ... parent commitmessage:
From: merge <null@invalid>
MERGE-via-mokopatches-tracking-hist-fix-stray-endmenu-patch
mokopatches-tracking-hist top was fix-stray-endmenu-patch / 3630e0be570de8057e7f8d2fe501ed353cdf34e6 ... parent commitmessage:
From: Andy Green <andy@openmoko.com>
fix-stray-endmenu.patch
Signed-off-by: Andy Green <andy@openmoko.com>
Diffstat (limited to 'drivers/net/tulip/uli526x.c')
-rw-r--r-- | drivers/net/tulip/uli526x.c | 71 |
1 files changed, 30 insertions, 41 deletions
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c index e9e62862163..030e02e6302 100644 --- a/drivers/net/tulip/uli526x.c +++ b/drivers/net/tulip/uli526x.c @@ -168,9 +168,6 @@ struct uli526x_board_info { u8 wait_reset; /* Hardware failed, need to reset */ struct timer_list timer; - /* System defined statistic counter */ - struct net_device_stats stats; - /* Driver defined statistic counter */ unsigned long tx_fifo_underrun; unsigned long tx_loss_carrier; @@ -220,7 +217,6 @@ static int mode = 8; static int uli526x_open(struct net_device *); static int uli526x_start_xmit(struct sk_buff *, struct net_device *); static int uli526x_stop(struct net_device *); -static struct net_device_stats * uli526x_get_stats(struct net_device *); static void uli526x_set_filter_mode(struct net_device *); static const struct ethtool_ops netdev_ethtool_ops; static u16 read_srom_word(long, int); @@ -251,6 +247,19 @@ static void uli526x_set_phyxcer(struct uli526x_board_info *); /* ULI526X network board routine ---------------------------- */ +static const struct net_device_ops netdev_ops = { + .ndo_open = uli526x_open, + .ndo_stop = uli526x_stop, + .ndo_start_xmit = uli526x_start_xmit, + .ndo_set_multicast_list = uli526x_set_filter_mode, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = uli526x_poll, +#endif +}; + /* * Search ULI526X board, allocate space and register it */ @@ -261,7 +270,6 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev, struct uli526x_board_info *db; /* board information structure */ struct net_device *dev; int i, err; - DECLARE_MAC_BUF(mac); ULI526X_DBUG(0, "uli526x_init_one()", 0); @@ -336,15 +344,9 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev, pci_set_drvdata(pdev, dev); /* Register some necessary functions */ - dev->open = &uli526x_open; - dev->hard_start_xmit = &uli526x_start_xmit; - dev->stop = &uli526x_stop; - dev->get_stats = &uli526x_get_stats; - dev->set_multicast_list = &uli526x_set_filter_mode; + dev->netdev_ops = &netdev_ops; dev->ethtool_ops = &netdev_ethtool_ops; -#ifdef CONFIG_NET_POLL_CONTROLLER - dev->poll_controller = &uli526x_poll; -#endif + spin_lock_init(&db->lock); @@ -379,9 +381,9 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev, if (err) goto err_out_res; - printk(KERN_INFO "%s: ULi M%04lx at pci%s, %s, irq %d.\n", + printk(KERN_INFO "%s: ULi M%04lx at pci%s, %pM, irq %d.\n", dev->name,ent->driver_data >> 16,pci_name(pdev), - print_mac(mac, dev->dev_addr), dev->irq); + dev->dev_addr, dev->irq); pci_set_master(pdev); @@ -734,7 +736,8 @@ static void uli526x_poll(struct net_device *dev) * Free TX resource after TX complete */ -static void uli526x_free_tx_pkt(struct net_device *dev, struct uli526x_board_info * db) +static void uli526x_free_tx_pkt(struct net_device *dev, + struct uli526x_board_info * db) { struct tx_desc *txptr; u32 tdes0; @@ -748,15 +751,15 @@ static void uli526x_free_tx_pkt(struct net_device *dev, struct uli526x_board_inf /* A packet sent completed */ db->tx_packet_cnt--; - db->stats.tx_packets++; + dev->stats.tx_packets++; /* Transmit statistic counter */ if ( tdes0 != 0x7fffffff ) { /* printk(DRV_NAME ": tdes0=%x\n", tdes0); */ - db->stats.collisions += (tdes0 >> 3) & 0xf; - db->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff; + dev->stats.collisions += (tdes0 >> 3) & 0xf; + dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff; if (tdes0 & TDES0_ERR_MASK) { - db->stats.tx_errors++; + dev->stats.tx_errors++; if (tdes0 & 0x0002) { /* UnderRun */ db->tx_fifo_underrun++; if ( !(db->cr6_data & CR6_SFT) ) { @@ -826,13 +829,13 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info if (rdes0 & 0x8000) { /* This is a error packet */ //printk(DRV_NAME ": rdes0: %lx\n", rdes0); - db->stats.rx_errors++; + dev->stats.rx_errors++; if (rdes0 & 1) - db->stats.rx_fifo_errors++; + dev->stats.rx_fifo_errors++; if (rdes0 & 2) - db->stats.rx_crc_errors++; + dev->stats.rx_crc_errors++; if (rdes0 & 0x80) - db->stats.rx_length_errors++; + dev->stats.rx_length_errors++; } if ( !(rdes0 & 0x8000) || @@ -855,9 +858,8 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info skb->protocol = eth_type_trans(skb, dev); netif_rx(skb); - dev->last_rx = jiffies; - db->stats.rx_packets++; - db->stats.rx_bytes += rxlen; + dev->stats.rx_packets++; + dev->stats.rx_bytes += rxlen; } else { /* Reuse SKB buffer when the packet is error */ @@ -874,25 +876,12 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info /* - * Get statistics from driver. - */ - -static struct net_device_stats * uli526x_get_stats(struct net_device *dev) -{ - struct uli526x_board_info *db = netdev_priv(dev); - - ULI526X_DBUG(0, "uli526x_get_stats", 0); - return &db->stats; -} - - -/* * Set ULI526X multicast address */ static void uli526x_set_filter_mode(struct net_device * dev) { - struct uli526x_board_info *db = dev->priv; + struct uli526x_board_info *db = netdev_priv(dev); unsigned long flags; ULI526X_DBUG(0, "uli526x_set_filter_mode()", 0); |