diff options
Diffstat (limited to 'drivers/net/tulip')
-rw-r--r-- | drivers/net/tulip/de2104x.c | 19 | ||||
-rw-r--r-- | drivers/net/tulip/de4x5.c | 20 | ||||
-rw-r--r-- | drivers/net/tulip/dmfe.c | 62 | ||||
-rw-r--r-- | drivers/net/tulip/tulip_core.c | 27 | ||||
-rw-r--r-- | drivers/net/tulip/uli526x.c | 63 | ||||
-rw-r--r-- | drivers/net/tulip/winbond-840.c | 23 | ||||
-rw-r--r-- | drivers/net/tulip/xircom_cb.c | 43 |
7 files changed, 128 insertions, 129 deletions
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index 5166be930a52..d5d53b633cf8 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c @@ -1922,6 +1922,18 @@ bad_srom: goto fill_defaults; } +static const struct net_device_ops de_netdev_ops = { + .ndo_open = de_open, + .ndo_stop = de_close, + .ndo_set_multicast_list = de_set_rx_mode, + .ndo_start_xmit = de_start_xmit, + .ndo_get_stats = de_get_stats, + .ndo_tx_timeout = de_tx_timeout, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; + static int __devinit de_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) { @@ -1944,14 +1956,9 @@ static int __devinit de_init_one (struct pci_dev *pdev, if (!dev) return -ENOMEM; + dev->netdev_ops = &de_netdev_ops; SET_NETDEV_DEV(dev, &pdev->dev); - dev->open = de_open; - dev->stop = de_close; - dev->set_multicast_list = de_set_rx_mode; - dev->hard_start_xmit = de_start_xmit; - dev->get_stats = de_get_stats; dev->ethtool_ops = &de_ethtool_ops; - dev->tx_timeout = de_tx_timeout; dev->watchdog_timeo = TX_TIMEOUT; de = netdev_priv(dev); diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c index 67bfd6f43366..6418f74415d7 100644 --- a/drivers/net/tulip/de4x5.c +++ b/drivers/net/tulip/de4x5.c @@ -1077,6 +1077,18 @@ static int (*dc_infoblock[])(struct net_device *dev, u_char, u_char *) = { mdelay(2); /* Wait for 2ms */\ } +static const struct net_device_ops de4x5_netdev_ops = { + .ndo_open = de4x5_open, + .ndo_stop = de4x5_close, + .ndo_start_xmit = de4x5_queue_pkt, + .ndo_get_stats = de4x5_get_stats, + .ndo_set_multicast_list = set_multicast_list, + .ndo_do_ioctl = de4x5_ioctl, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address= eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; + static int __devinit de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev) @@ -1258,13 +1270,7 @@ de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev) /* The DE4X5-specific entries in the device structure. */ SET_NETDEV_DEV(dev, gendev); - dev->open = &de4x5_open; - dev->hard_start_xmit = &de4x5_queue_pkt; - dev->stop = &de4x5_close; - dev->get_stats = &de4x5_get_stats; - dev->set_multicast_list = &set_multicast_list; - dev->do_ioctl = &de4x5_ioctl; - + dev->netdev_ops = &de4x5_netdev_ops; dev->mem_start = 0; /* Fill in the generic fields of the device structure. */ 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 { u8 wol_mode; /* user WOL settings */ 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; @@ -316,7 +313,6 @@ static u8 SF_mode; /* Special Function: 1:VLAN, 2:RX Flow Control static int dmfe_open(struct DEVICE *); static int dmfe_start_xmit(struct sk_buff *, struct DEVICE *); static int dmfe_stop(struct DEVICE *); -static struct net_device_stats * dmfe_get_stats(struct DEVICE *); static void dmfe_set_filter_mode(struct DEVICE *); static const struct ethtool_ops netdev_ethtool_ops; static u16 read_srom_word(long ,int); @@ -351,6 +347,19 @@ static void dmfe_set_phyxcer(struct dmfe_board_info *); /* DM910X network board routine ---------------------------- */ +static const struct net_device_ops netdev_ops = { + .ndo_open = dmfe_open, + .ndo_stop = dmfe_stop, + .ndo_start_xmit = dmfe_start_xmit, + .ndo_set_multicast_list = dmfe_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 = poll_dmfe, +#endif +}; + /* * Search DM910X board ,allocate space and register it */ @@ -442,14 +451,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev, dev->base_addr = db->ioaddr; dev->irq = pdev->irq; pci_set_drvdata(pdev, dev); - dev->open = &dmfe_open; - dev->hard_start_xmit = &dmfe_start_xmit; - dev->stop = &dmfe_stop; - dev->get_stats = &dmfe_get_stats; - dev->set_multicast_list = &dmfe_set_filter_mode; -#ifdef CONFIG_NET_POLL_CONTROLLER - dev->poll_controller = &poll_dmfe; -#endif + dev->netdev_ops = &netdev_ops; dev->ethtool_ops = &netdev_ethtool_ops; netif_carrier_off(dev); spin_lock_init(&db->lock); @@ -867,15 +869,15 @@ static void dmfe_free_tx_pkt(struct DEVICE *dev, struct dmfe_board_info * db) /* 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++; @@ -969,13 +971,13 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db) 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) || @@ -1008,8 +1010,8 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db) skb->protocol = eth_type_trans(skb, dev); netif_rx(skb); - 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 */ @@ -1024,20 +1026,6 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db) db->rx_ready_ptr = rxptr; } - -/* - * Get statistics from driver. - */ - -static struct net_device_stats * dmfe_get_stats(struct DEVICE *dev) -{ - struct dmfe_board_info *db = netdev_priv(dev); - - DMFE_DBUG(0, "dmfe_get_stats", 0); - return &db->stats; -} - - /* * Set DM910X multicast address */ @@ -1161,7 +1149,7 @@ static void dmfe_timer(unsigned long data) /* Operating Mode Check */ if ( (db->dm910x_chk_mode & 0x1) && - (db->stats.rx_packets > MAX_CHECK_PACKET) ) + (dev->stats.rx_packets > MAX_CHECK_PACKET) ) db->dm910x_chk_mode = 0x4; /* Dynamic reset DM910X : system error or transmit time-out */ diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index ff84babb3ff3..bee75fa87a9c 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c @@ -1225,6 +1225,22 @@ static int tulip_uli_dm_quirk(struct pci_dev *pdev) return 0; } +static const struct net_device_ops tulip_netdev_ops = { + .ndo_open = tulip_open, + .ndo_start_xmit = tulip_start_xmit, + .ndo_tx_timeout = tulip_tx_timeout, + .ndo_stop = tulip_close, + .ndo_get_stats = tulip_get_stats, + .ndo_do_ioctl = private_ioctl, + .ndo_set_multicast_list = set_rx_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 = poll_tulip, +#endif +}; + static int __devinit tulip_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) { @@ -1601,20 +1617,11 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, } /* The Tulip-specific entries in the device structure. */ - dev->open = tulip_open; - dev->hard_start_xmit = tulip_start_xmit; - dev->tx_timeout = tulip_tx_timeout; + dev->netdev_ops = &tulip_netdev_ops; dev->watchdog_timeo = TX_TIMEOUT; #ifdef CONFIG_TULIP_NAPI netif_napi_add(dev, &tp->napi, tulip_poll, 16); #endif - dev->stop = tulip_close; - dev->get_stats = tulip_get_stats; - dev->do_ioctl = private_ioctl; - dev->set_multicast_list = set_rx_mode; -#ifdef CONFIG_NET_POLL_CONTROLLER - dev->poll_controller = &poll_tulip; -#endif SET_ETHTOOL_OPS(dev, &ops); if (register_netdev(dev)) diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c index 00cbc5251dcc..030e02e63023 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 */ @@ -335,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); @@ -733,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; @@ -747,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) ) { @@ -825,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) || @@ -854,8 +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); - 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 */ @@ -872,19 +876,6 @@ 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 */ diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c index 022d99af8646..f467bf87817d 100644 --- a/drivers/net/tulip/winbond-840.c +++ b/drivers/net/tulip/winbond-840.c @@ -343,7 +343,18 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); static const struct ethtool_ops netdev_ethtool_ops; static int netdev_close(struct net_device *dev); - +static const struct net_device_ops netdev_ops = { + .ndo_open = netdev_open, + .ndo_stop = netdev_close, + .ndo_start_xmit = start_tx, + .ndo_get_stats = get_stats, + .ndo_set_multicast_list = set_rx_mode, + .ndo_do_ioctl = netdev_ioctl, + .ndo_tx_timeout = tx_timeout, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; static int __devinit w840_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent) @@ -420,14 +431,8 @@ static int __devinit w840_probe1 (struct pci_dev *pdev, np->mii_if.force_media = 1; /* The chip-specific entries in the device structure. */ - dev->open = &netdev_open; - dev->hard_start_xmit = &start_tx; - dev->stop = &netdev_close; - dev->get_stats = &get_stats; - dev->set_multicast_list = &set_rx_mode; - dev->do_ioctl = &netdev_ioctl; + dev->netdev_ops = &netdev_ops; dev->ethtool_ops = &netdev_ethtool_ops; - dev->tx_timeout = &tx_timeout; dev->watchdog_timeo = TX_TIMEOUT; i = register_netdev(dev); @@ -1555,7 +1560,7 @@ static void __devexit w840_remove1 (struct pci_dev *pdev) * rtnl_lock, & netif_device_detach after the rtnl_unlock. * - get_stats: * spin_lock_irq(np->lock), doesn't touch hw if not present - * - hard_start_xmit: + * - start_xmit: * synchronize_irq + netif_tx_disable; * - tx_timeout: * netif_device_detach + netif_tx_disable; diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c index 13c8703ecb9f..c2ca9f40e40e 100644 --- a/drivers/net/tulip/xircom_cb.c +++ b/drivers/net/tulip/xircom_cb.c @@ -104,10 +104,8 @@ struct xircom_private { */ spinlock_t lock; - struct pci_dev *pdev; struct net_device *dev; - struct net_device_stats stats; }; @@ -119,7 +117,6 @@ static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev); static int xircom_open(struct net_device *dev); static int xircom_close(struct net_device *dev); static void xircom_up(struct xircom_private *card); -static struct net_device_stats *xircom_get_stats(struct net_device *dev); #ifdef CONFIG_NET_POLL_CONTROLLER static void xircom_poll_controller(struct net_device *dev); #endif @@ -194,6 +191,18 @@ static const struct ethtool_ops netdev_ethtool_ops = { .get_drvinfo = netdev_get_drvinfo, }; +static const struct net_device_ops netdev_ops = { + .ndo_open = xircom_open, + .ndo_stop = xircom_close, + .ndo_start_xmit = xircom_start_xmit, + .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 = xircom_poll_controller, +#endif +}; + /* xircom_probe is the code that gets called on device insertion. it sets up the hardware and registers the device to the networklayer. @@ -266,13 +275,7 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_ read_mac_address(private); setup_descriptors(private); - dev->open = &xircom_open; - dev->hard_start_xmit = &xircom_start_xmit; - dev->stop = &xircom_close; - dev->get_stats = &xircom_get_stats; -#ifdef CONFIG_NET_POLL_CONTROLLER - dev->poll_controller = &xircom_poll_controller; -#endif + dev->netdev_ops = &netdev_ops; SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); pci_set_drvdata(pdev, dev); @@ -497,14 +500,6 @@ static int xircom_close(struct net_device *dev) } - -static struct net_device_stats *xircom_get_stats(struct net_device *dev) -{ - struct xircom_private *card = netdev_priv(dev); - return &card->stats; -} - - #ifdef CONFIG_NET_POLL_CONTROLLER static void xircom_poll_controller(struct net_device *dev) { @@ -1193,7 +1188,7 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri skb = dev_alloc_skb(pkt_len + 2); if (skb == NULL) { - card->stats.rx_dropped++; + dev->stats.rx_dropped++; goto out; } skb_reserve(skb, 2); @@ -1201,8 +1196,8 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri skb_put(skb, pkt_len); skb->protocol = eth_type_trans(skb, dev); netif_rx(skb); - card->stats.rx_packets++; - card->stats.rx_bytes += pkt_len; + dev->stats.rx_packets++; + dev->stats.rx_bytes += pkt_len; out: /* give the buffer back to the card */ @@ -1232,16 +1227,16 @@ static void investigate_write_descriptor(struct net_device *dev, struct xircom_p #endif if (status > 0) { /* bit 31 is 0 when done */ if (card->tx_skb[descnr]!=NULL) { - card->stats.tx_bytes += card->tx_skb[descnr]->len; + dev->stats.tx_bytes += card->tx_skb[descnr]->len; dev_kfree_skb_irq(card->tx_skb[descnr]); } card->tx_skb[descnr] = NULL; /* Bit 8 in the status field is 1 if there was a collision */ if (status&(1<<8)) - card->stats.collisions++; + dev->stats.collisions++; card->tx_buffer[4*descnr] = 0; /* descriptor is free again */ netif_wake_queue (dev); - card->stats.tx_packets++; + dev->stats.tx_packets++; } leave("investigate_write_descriptor"); |