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: | |||
1922 | goto fill_defaults; | 1922 | goto fill_defaults; |
1923 | } | 1923 | } |
1924 | 1924 | ||
1925 | static const struct net_device_ops de_netdev_ops = { | ||
1926 | .ndo_open = de_open, | ||
1927 | .ndo_stop = de_close, | ||
1928 | .ndo_set_multicast_list = de_set_rx_mode, | ||
1929 | .ndo_start_xmit = de_start_xmit, | ||
1930 | .ndo_get_stats = de_get_stats, | ||
1931 | .ndo_tx_timeout = de_tx_timeout, | ||
1932 | .ndo_change_mtu = eth_change_mtu, | ||
1933 | .ndo_set_mac_address = eth_mac_addr, | ||
1934 | .ndo_validate_addr = eth_validate_addr, | ||
1935 | }; | ||
1936 | |||
1925 | static int __devinit de_init_one (struct pci_dev *pdev, | 1937 | static int __devinit de_init_one (struct pci_dev *pdev, |
1926 | const struct pci_device_id *ent) | 1938 | const struct pci_device_id *ent) |
1927 | { | 1939 | { |
@@ -1944,14 +1956,9 @@ static int __devinit de_init_one (struct pci_dev *pdev, | |||
1944 | if (!dev) | 1956 | if (!dev) |
1945 | return -ENOMEM; | 1957 | return -ENOMEM; |
1946 | 1958 | ||
1959 | dev->netdev_ops = &de_netdev_ops; | ||
1947 | SET_NETDEV_DEV(dev, &pdev->dev); | 1960 | SET_NETDEV_DEV(dev, &pdev->dev); |
1948 | dev->open = de_open; | ||
1949 | dev->stop = de_close; | ||
1950 | dev->set_multicast_list = de_set_rx_mode; | ||
1951 | dev->hard_start_xmit = de_start_xmit; | ||
1952 | dev->get_stats = de_get_stats; | ||
1953 | dev->ethtool_ops = &de_ethtool_ops; | 1961 | dev->ethtool_ops = &de_ethtool_ops; |
1954 | dev->tx_timeout = de_tx_timeout; | ||
1955 | dev->watchdog_timeo = TX_TIMEOUT; | 1962 | dev->watchdog_timeo = TX_TIMEOUT; |
1956 | 1963 | ||
1957 | de = netdev_priv(dev); | 1964 | 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 *) = { | |||
1077 | mdelay(2); /* Wait for 2ms */\ | 1077 | mdelay(2); /* Wait for 2ms */\ |
1078 | } | 1078 | } |
1079 | 1079 | ||
1080 | static const struct net_device_ops de4x5_netdev_ops = { | ||
1081 | .ndo_open = de4x5_open, | ||
1082 | .ndo_stop = de4x5_close, | ||
1083 | .ndo_start_xmit = de4x5_queue_pkt, | ||
1084 | .ndo_get_stats = de4x5_get_stats, | ||
1085 | .ndo_set_multicast_list = set_multicast_list, | ||
1086 | .ndo_do_ioctl = de4x5_ioctl, | ||
1087 | .ndo_change_mtu = eth_change_mtu, | ||
1088 | .ndo_set_mac_address= eth_mac_addr, | ||
1089 | .ndo_validate_addr = eth_validate_addr, | ||
1090 | }; | ||
1091 | |||
1080 | 1092 | ||
1081 | static int __devinit | 1093 | static int __devinit |
1082 | de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev) | 1094 | 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) | |||
1258 | 1270 | ||
1259 | /* The DE4X5-specific entries in the device structure. */ | 1271 | /* The DE4X5-specific entries in the device structure. */ |
1260 | SET_NETDEV_DEV(dev, gendev); | 1272 | SET_NETDEV_DEV(dev, gendev); |
1261 | dev->open = &de4x5_open; | 1273 | dev->netdev_ops = &de4x5_netdev_ops; |
1262 | dev->hard_start_xmit = &de4x5_queue_pkt; | ||
1263 | dev->stop = &de4x5_close; | ||
1264 | dev->get_stats = &de4x5_get_stats; | ||
1265 | dev->set_multicast_list = &set_multicast_list; | ||
1266 | dev->do_ioctl = &de4x5_ioctl; | ||
1267 | |||
1268 | dev->mem_start = 0; | 1274 | dev->mem_start = 0; |
1269 | 1275 | ||
1270 | /* Fill in the generic fields of the device structure. */ | 1276 | /* 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 { | |||
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 | |||
316 | static int dmfe_open(struct DEVICE *); | 313 | static int dmfe_open(struct DEVICE *); |
317 | static int dmfe_start_xmit(struct sk_buff *, struct DEVICE *); | 314 | static int dmfe_start_xmit(struct sk_buff *, struct DEVICE *); |
318 | static int dmfe_stop(struct DEVICE *); | 315 | static int dmfe_stop(struct DEVICE *); |
319 | static struct net_device_stats * dmfe_get_stats(struct DEVICE *); | ||
320 | static void dmfe_set_filter_mode(struct DEVICE *); | 316 | static void dmfe_set_filter_mode(struct DEVICE *); |
321 | static const struct ethtool_ops netdev_ethtool_ops; | 317 | static const struct ethtool_ops netdev_ethtool_ops; |
322 | static u16 read_srom_word(long ,int); | 318 | static 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 | ||
350 | static 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 | |||
1032 | static 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 */ |
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) | |||
1225 | return 0; | 1225 | return 0; |
1226 | } | 1226 | } |
1227 | 1227 | ||
1228 | static const struct net_device_ops tulip_netdev_ops = { | ||
1229 | .ndo_open = tulip_open, | ||
1230 | .ndo_start_xmit = tulip_start_xmit, | ||
1231 | .ndo_tx_timeout = tulip_tx_timeout, | ||
1232 | .ndo_stop = tulip_close, | ||
1233 | .ndo_get_stats = tulip_get_stats, | ||
1234 | .ndo_do_ioctl = private_ioctl, | ||
1235 | .ndo_set_multicast_list = set_rx_mode, | ||
1236 | .ndo_change_mtu = eth_change_mtu, | ||
1237 | .ndo_set_mac_address = eth_mac_addr, | ||
1238 | .ndo_validate_addr = eth_validate_addr, | ||
1239 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
1240 | .ndo_poll_controller = poll_tulip, | ||
1241 | #endif | ||
1242 | }; | ||
1243 | |||
1228 | static int __devinit tulip_init_one (struct pci_dev *pdev, | 1244 | static int __devinit tulip_init_one (struct pci_dev *pdev, |
1229 | const struct pci_device_id *ent) | 1245 | const struct pci_device_id *ent) |
1230 | { | 1246 | { |
@@ -1601,20 +1617,11 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, | |||
1601 | } | 1617 | } |
1602 | 1618 | ||
1603 | /* The Tulip-specific entries in the device structure. */ | 1619 | /* The Tulip-specific entries in the device structure. */ |
1604 | dev->open = tulip_open; | 1620 | dev->netdev_ops = &tulip_netdev_ops; |
1605 | dev->hard_start_xmit = tulip_start_xmit; | ||
1606 | dev->tx_timeout = tulip_tx_timeout; | ||
1607 | dev->watchdog_timeo = TX_TIMEOUT; | 1621 | dev->watchdog_timeo = TX_TIMEOUT; |
1608 | #ifdef CONFIG_TULIP_NAPI | 1622 | #ifdef CONFIG_TULIP_NAPI |
1609 | netif_napi_add(dev, &tp->napi, tulip_poll, 16); | 1623 | netif_napi_add(dev, &tp->napi, tulip_poll, 16); |
1610 | #endif | 1624 | #endif |
1611 | dev->stop = tulip_close; | ||
1612 | dev->get_stats = tulip_get_stats; | ||
1613 | dev->do_ioctl = private_ioctl; | ||
1614 | dev->set_multicast_list = set_rx_mode; | ||
1615 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
1616 | dev->poll_controller = &poll_tulip; | ||
1617 | #endif | ||
1618 | SET_ETHTOOL_OPS(dev, &ops); | 1625 | SET_ETHTOOL_OPS(dev, &ops); |
1619 | 1626 | ||
1620 | if (register_netdev(dev)) | 1627 | 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 { | |||
168 | u8 wait_reset; /* Hardware failed, need to reset */ | 168 | u8 wait_reset; /* Hardware failed, need to reset */ |
169 | struct timer_list timer; | 169 | struct timer_list timer; |
170 | 170 | ||
171 | /* System defined statistic counter */ | ||
172 | struct net_device_stats stats; | ||
173 | |||
174 | /* Driver defined statistic counter */ | 171 | /* Driver defined statistic counter */ |
175 | unsigned long tx_fifo_underrun; | 172 | unsigned long tx_fifo_underrun; |
176 | unsigned long tx_loss_carrier; | 173 | unsigned long tx_loss_carrier; |
@@ -220,7 +217,6 @@ static int mode = 8; | |||
220 | static int uli526x_open(struct net_device *); | 217 | static int uli526x_open(struct net_device *); |
221 | static int uli526x_start_xmit(struct sk_buff *, struct net_device *); | 218 | static int uli526x_start_xmit(struct sk_buff *, struct net_device *); |
222 | static int uli526x_stop(struct net_device *); | 219 | static int uli526x_stop(struct net_device *); |
223 | static struct net_device_stats * uli526x_get_stats(struct net_device *); | ||
224 | static void uli526x_set_filter_mode(struct net_device *); | 220 | static void uli526x_set_filter_mode(struct net_device *); |
225 | static const struct ethtool_ops netdev_ethtool_ops; | 221 | static const struct ethtool_ops netdev_ethtool_ops; |
226 | static u16 read_srom_word(long, int); | 222 | static u16 read_srom_word(long, int); |
@@ -251,6 +247,19 @@ static void uli526x_set_phyxcer(struct uli526x_board_info *); | |||
251 | 247 | ||
252 | /* ULI526X network board routine ---------------------------- */ | 248 | /* ULI526X network board routine ---------------------------- */ |
253 | 249 | ||
250 | static const struct net_device_ops netdev_ops = { | ||
251 | .ndo_open = uli526x_open, | ||
252 | .ndo_stop = uli526x_stop, | ||
253 | .ndo_start_xmit = uli526x_start_xmit, | ||
254 | .ndo_set_multicast_list = uli526x_set_filter_mode, | ||
255 | .ndo_change_mtu = eth_change_mtu, | ||
256 | .ndo_set_mac_address = eth_mac_addr, | ||
257 | .ndo_validate_addr = eth_validate_addr, | ||
258 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
259 | .ndo_poll_controller = uli526x_poll, | ||
260 | #endif | ||
261 | }; | ||
262 | |||
254 | /* | 263 | /* |
255 | * Search ULI526X board, allocate space and register it | 264 | * Search ULI526X board, allocate space and register it |
256 | */ | 265 | */ |
@@ -335,15 +344,9 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev, | |||
335 | pci_set_drvdata(pdev, dev); | 344 | pci_set_drvdata(pdev, dev); |
336 | 345 | ||
337 | /* Register some necessary functions */ | 346 | /* Register some necessary functions */ |
338 | dev->open = &uli526x_open; | 347 | dev->netdev_ops = &netdev_ops; |
339 | dev->hard_start_xmit = &uli526x_start_xmit; | ||
340 | dev->stop = &uli526x_stop; | ||
341 | dev->get_stats = &uli526x_get_stats; | ||
342 | dev->set_multicast_list = &uli526x_set_filter_mode; | ||
343 | dev->ethtool_ops = &netdev_ethtool_ops; | 348 | dev->ethtool_ops = &netdev_ethtool_ops; |
344 | #ifdef CONFIG_NET_POLL_CONTROLLER | 349 | |
345 | dev->poll_controller = &uli526x_poll; | ||
346 | #endif | ||
347 | spin_lock_init(&db->lock); | 350 | spin_lock_init(&db->lock); |
348 | 351 | ||
349 | 352 | ||
@@ -733,7 +736,8 @@ static void uli526x_poll(struct net_device *dev) | |||
733 | * Free TX resource after TX complete | 736 | * Free TX resource after TX complete |
734 | */ | 737 | */ |
735 | 738 | ||
736 | static void uli526x_free_tx_pkt(struct net_device *dev, struct uli526x_board_info * db) | 739 | static void uli526x_free_tx_pkt(struct net_device *dev, |
740 | struct uli526x_board_info * db) | ||
737 | { | 741 | { |
738 | struct tx_desc *txptr; | 742 | struct tx_desc *txptr; |
739 | u32 tdes0; | 743 | u32 tdes0; |
@@ -747,15 +751,15 @@ static void uli526x_free_tx_pkt(struct net_device *dev, struct uli526x_board_inf | |||
747 | 751 | ||
748 | /* A packet sent completed */ | 752 | /* A packet sent completed */ |
749 | db->tx_packet_cnt--; | 753 | db->tx_packet_cnt--; |
750 | db->stats.tx_packets++; | 754 | dev->stats.tx_packets++; |
751 | 755 | ||
752 | /* Transmit statistic counter */ | 756 | /* Transmit statistic counter */ |
753 | if ( tdes0 != 0x7fffffff ) { | 757 | if ( tdes0 != 0x7fffffff ) { |
754 | /* printk(DRV_NAME ": tdes0=%x\n", tdes0); */ | 758 | /* printk(DRV_NAME ": tdes0=%x\n", tdes0); */ |
755 | db->stats.collisions += (tdes0 >> 3) & 0xf; | 759 | dev->stats.collisions += (tdes0 >> 3) & 0xf; |
756 | db->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff; | 760 | dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff; |
757 | if (tdes0 & TDES0_ERR_MASK) { | 761 | if (tdes0 & TDES0_ERR_MASK) { |
758 | db->stats.tx_errors++; | 762 | dev->stats.tx_errors++; |
759 | if (tdes0 & 0x0002) { /* UnderRun */ | 763 | if (tdes0 & 0x0002) { /* UnderRun */ |
760 | db->tx_fifo_underrun++; | 764 | db->tx_fifo_underrun++; |
761 | if ( !(db->cr6_data & CR6_SFT) ) { | 765 | if ( !(db->cr6_data & CR6_SFT) ) { |
@@ -825,13 +829,13 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info | |||
825 | if (rdes0 & 0x8000) { | 829 | if (rdes0 & 0x8000) { |
826 | /* This is a error packet */ | 830 | /* This is a error packet */ |
827 | //printk(DRV_NAME ": rdes0: %lx\n", rdes0); | 831 | //printk(DRV_NAME ": rdes0: %lx\n", rdes0); |
828 | db->stats.rx_errors++; | 832 | dev->stats.rx_errors++; |
829 | if (rdes0 & 1) | 833 | if (rdes0 & 1) |
830 | db->stats.rx_fifo_errors++; | 834 | dev->stats.rx_fifo_errors++; |
831 | if (rdes0 & 2) | 835 | if (rdes0 & 2) |
832 | db->stats.rx_crc_errors++; | 836 | dev->stats.rx_crc_errors++; |
833 | if (rdes0 & 0x80) | 837 | if (rdes0 & 0x80) |
834 | db->stats.rx_length_errors++; | 838 | dev->stats.rx_length_errors++; |
835 | } | 839 | } |
836 | 840 | ||
837 | if ( !(rdes0 & 0x8000) || | 841 | if ( !(rdes0 & 0x8000) || |
@@ -854,8 +858,8 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info | |||
854 | 858 | ||
855 | skb->protocol = eth_type_trans(skb, dev); | 859 | skb->protocol = eth_type_trans(skb, dev); |
856 | netif_rx(skb); | 860 | netif_rx(skb); |
857 | db->stats.rx_packets++; | 861 | dev->stats.rx_packets++; |
858 | db->stats.rx_bytes += rxlen; | 862 | dev->stats.rx_bytes += rxlen; |
859 | 863 | ||
860 | } else { | 864 | } else { |
861 | /* Reuse SKB buffer when the packet is error */ | 865 | /* 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 | |||
872 | 876 | ||
873 | 877 | ||
874 | /* | 878 | /* |
875 | * Get statistics from driver. | ||
876 | */ | ||
877 | |||
878 | static struct net_device_stats * uli526x_get_stats(struct net_device *dev) | ||
879 | { | ||
880 | struct uli526x_board_info *db = netdev_priv(dev); | ||
881 | |||
882 | ULI526X_DBUG(0, "uli526x_get_stats", 0); | ||
883 | return &db->stats; | ||
884 | } | ||
885 | |||
886 | |||
887 | /* | ||
888 | * Set ULI526X multicast address | 879 | * Set ULI526X multicast address |
889 | */ | 880 | */ |
890 | 881 | ||
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); | |||
343 | static const struct ethtool_ops netdev_ethtool_ops; | 343 | static const struct ethtool_ops netdev_ethtool_ops; |
344 | static int netdev_close(struct net_device *dev); | 344 | static int netdev_close(struct net_device *dev); |
345 | 345 | ||
346 | 346 | static const struct net_device_ops netdev_ops = { | |
347 | .ndo_open = netdev_open, | ||
348 | .ndo_stop = netdev_close, | ||
349 | .ndo_start_xmit = start_tx, | ||
350 | .ndo_get_stats = get_stats, | ||
351 | .ndo_set_multicast_list = set_rx_mode, | ||
352 | .ndo_do_ioctl = netdev_ioctl, | ||
353 | .ndo_tx_timeout = tx_timeout, | ||
354 | .ndo_change_mtu = eth_change_mtu, | ||
355 | .ndo_set_mac_address = eth_mac_addr, | ||
356 | .ndo_validate_addr = eth_validate_addr, | ||
357 | }; | ||
347 | 358 | ||
348 | static int __devinit w840_probe1 (struct pci_dev *pdev, | 359 | static int __devinit w840_probe1 (struct pci_dev *pdev, |
349 | const struct pci_device_id *ent) | 360 | const struct pci_device_id *ent) |
@@ -420,14 +431,8 @@ static int __devinit w840_probe1 (struct pci_dev *pdev, | |||
420 | np->mii_if.force_media = 1; | 431 | np->mii_if.force_media = 1; |
421 | 432 | ||
422 | /* The chip-specific entries in the device structure. */ | 433 | /* The chip-specific entries in the device structure. */ |
423 | dev->open = &netdev_open; | 434 | dev->netdev_ops = &netdev_ops; |
424 | dev->hard_start_xmit = &start_tx; | ||
425 | dev->stop = &netdev_close; | ||
426 | dev->get_stats = &get_stats; | ||
427 | dev->set_multicast_list = &set_rx_mode; | ||
428 | dev->do_ioctl = &netdev_ioctl; | ||
429 | dev->ethtool_ops = &netdev_ethtool_ops; | 435 | dev->ethtool_ops = &netdev_ethtool_ops; |
430 | dev->tx_timeout = &tx_timeout; | ||
431 | dev->watchdog_timeo = TX_TIMEOUT; | 436 | dev->watchdog_timeo = TX_TIMEOUT; |
432 | 437 | ||
433 | i = register_netdev(dev); | 438 | i = register_netdev(dev); |
@@ -1555,7 +1560,7 @@ static void __devexit w840_remove1 (struct pci_dev *pdev) | |||
1555 | * rtnl_lock, & netif_device_detach after the rtnl_unlock. | 1560 | * rtnl_lock, & netif_device_detach after the rtnl_unlock. |
1556 | * - get_stats: | 1561 | * - get_stats: |
1557 | * spin_lock_irq(np->lock), doesn't touch hw if not present | 1562 | * spin_lock_irq(np->lock), doesn't touch hw if not present |
1558 | * - hard_start_xmit: | 1563 | * - start_xmit: |
1559 | * synchronize_irq + netif_tx_disable; | 1564 | * synchronize_irq + netif_tx_disable; |
1560 | * - tx_timeout: | 1565 | * - tx_timeout: |
1561 | * netif_device_detach + netif_tx_disable; | 1566 | * 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 { | |||
104 | */ | 104 | */ |
105 | spinlock_t lock; | 105 | spinlock_t lock; |
106 | 106 | ||
107 | |||
108 | struct pci_dev *pdev; | 107 | struct pci_dev *pdev; |
109 | struct net_device *dev; | 108 | struct net_device *dev; |
110 | struct net_device_stats stats; | ||
111 | }; | 109 | }; |
112 | 110 | ||
113 | 111 | ||
@@ -119,7 +117,6 @@ static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev); | |||
119 | static int xircom_open(struct net_device *dev); | 117 | static int xircom_open(struct net_device *dev); |
120 | static int xircom_close(struct net_device *dev); | 118 | static int xircom_close(struct net_device *dev); |
121 | static void xircom_up(struct xircom_private *card); | 119 | static void xircom_up(struct xircom_private *card); |
122 | static struct net_device_stats *xircom_get_stats(struct net_device *dev); | ||
123 | #ifdef CONFIG_NET_POLL_CONTROLLER | 120 | #ifdef CONFIG_NET_POLL_CONTROLLER |
124 | static void xircom_poll_controller(struct net_device *dev); | 121 | static void xircom_poll_controller(struct net_device *dev); |
125 | #endif | 122 | #endif |
@@ -194,6 +191,18 @@ static const struct ethtool_ops netdev_ethtool_ops = { | |||
194 | .get_drvinfo = netdev_get_drvinfo, | 191 | .get_drvinfo = netdev_get_drvinfo, |
195 | }; | 192 | }; |
196 | 193 | ||
194 | static const struct net_device_ops netdev_ops = { | ||
195 | .ndo_open = xircom_open, | ||
196 | .ndo_stop = xircom_close, | ||
197 | .ndo_start_xmit = xircom_start_xmit, | ||
198 | .ndo_change_mtu = eth_change_mtu, | ||
199 | .ndo_set_mac_address = eth_mac_addr, | ||
200 | .ndo_validate_addr = eth_validate_addr, | ||
201 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
202 | .ndo_poll_controller = xircom_poll_controller, | ||
203 | #endif | ||
204 | }; | ||
205 | |||
197 | /* xircom_probe is the code that gets called on device insertion. | 206 | /* xircom_probe is the code that gets called on device insertion. |
198 | it sets up the hardware and registers the device to the networklayer. | 207 | it sets up the hardware and registers the device to the networklayer. |
199 | 208 | ||
@@ -266,13 +275,7 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_ | |||
266 | read_mac_address(private); | 275 | read_mac_address(private); |
267 | setup_descriptors(private); | 276 | setup_descriptors(private); |
268 | 277 | ||
269 | dev->open = &xircom_open; | 278 | dev->netdev_ops = &netdev_ops; |
270 | dev->hard_start_xmit = &xircom_start_xmit; | ||
271 | dev->stop = &xircom_close; | ||
272 | dev->get_stats = &xircom_get_stats; | ||
273 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
274 | dev->poll_controller = &xircom_poll_controller; | ||
275 | #endif | ||
276 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | 279 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); |
277 | pci_set_drvdata(pdev, dev); | 280 | pci_set_drvdata(pdev, dev); |
278 | 281 | ||
@@ -497,14 +500,6 @@ static int xircom_close(struct net_device *dev) | |||
497 | } | 500 | } |
498 | 501 | ||
499 | 502 | ||
500 | |||
501 | static struct net_device_stats *xircom_get_stats(struct net_device *dev) | ||
502 | { | ||
503 | struct xircom_private *card = netdev_priv(dev); | ||
504 | return &card->stats; | ||
505 | } | ||
506 | |||
507 | |||
508 | #ifdef CONFIG_NET_POLL_CONTROLLER | 503 | #ifdef CONFIG_NET_POLL_CONTROLLER |
509 | static void xircom_poll_controller(struct net_device *dev) | 504 | static void xircom_poll_controller(struct net_device *dev) |
510 | { | 505 | { |
@@ -1193,7 +1188,7 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri | |||
1193 | 1188 | ||
1194 | skb = dev_alloc_skb(pkt_len + 2); | 1189 | skb = dev_alloc_skb(pkt_len + 2); |
1195 | if (skb == NULL) { | 1190 | if (skb == NULL) { |
1196 | card->stats.rx_dropped++; | 1191 | dev->stats.rx_dropped++; |
1197 | goto out; | 1192 | goto out; |
1198 | } | 1193 | } |
1199 | skb_reserve(skb, 2); | 1194 | skb_reserve(skb, 2); |
@@ -1201,8 +1196,8 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri | |||
1201 | skb_put(skb, pkt_len); | 1196 | skb_put(skb, pkt_len); |
1202 | skb->protocol = eth_type_trans(skb, dev); | 1197 | skb->protocol = eth_type_trans(skb, dev); |
1203 | netif_rx(skb); | 1198 | netif_rx(skb); |
1204 | card->stats.rx_packets++; | 1199 | dev->stats.rx_packets++; |
1205 | card->stats.rx_bytes += pkt_len; | 1200 | dev->stats.rx_bytes += pkt_len; |
1206 | 1201 | ||
1207 | out: | 1202 | out: |
1208 | /* give the buffer back to the card */ | 1203 | /* give the buffer back to the card */ |
@@ -1232,16 +1227,16 @@ static void investigate_write_descriptor(struct net_device *dev, struct xircom_p | |||
1232 | #endif | 1227 | #endif |
1233 | if (status > 0) { /* bit 31 is 0 when done */ | 1228 | if (status > 0) { /* bit 31 is 0 when done */ |
1234 | if (card->tx_skb[descnr]!=NULL) { | 1229 | if (card->tx_skb[descnr]!=NULL) { |
1235 | card->stats.tx_bytes += card->tx_skb[descnr]->len; | 1230 | dev->stats.tx_bytes += card->tx_skb[descnr]->len; |
1236 | dev_kfree_skb_irq(card->tx_skb[descnr]); | 1231 | dev_kfree_skb_irq(card->tx_skb[descnr]); |
1237 | } | 1232 | } |
1238 | card->tx_skb[descnr] = NULL; | 1233 | card->tx_skb[descnr] = NULL; |
1239 | /* Bit 8 in the status field is 1 if there was a collision */ | 1234 | /* Bit 8 in the status field is 1 if there was a collision */ |
1240 | if (status&(1<<8)) | 1235 | if (status&(1<<8)) |
1241 | card->stats.collisions++; | 1236 | dev->stats.collisions++; |
1242 | card->tx_buffer[4*descnr] = 0; /* descriptor is free again */ | 1237 | card->tx_buffer[4*descnr] = 0; /* descriptor is free again */ |
1243 | netif_wake_queue (dev); | 1238 | netif_wake_queue (dev); |
1244 | card->stats.tx_packets++; | 1239 | dev->stats.tx_packets++; |
1245 | } | 1240 | } |
1246 | 1241 | ||
1247 | leave("investigate_write_descriptor"); | 1242 | leave("investigate_write_descriptor"); |