diff options
Diffstat (limited to 'drivers/net/yellowfin.c')
-rw-r--r-- | drivers/net/yellowfin.c | 63 |
1 files changed, 26 insertions, 37 deletions
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c index 29e96950be65..709623e1c611 100644 --- a/drivers/net/yellowfin.c +++ b/drivers/net/yellowfin.c | |||
@@ -318,7 +318,6 @@ struct yellowfin_private { | |||
318 | dma_addr_t tx_status_dma; | 318 | dma_addr_t tx_status_dma; |
319 | 319 | ||
320 | struct timer_list timer; /* Media selection timer. */ | 320 | struct timer_list timer; /* Media selection timer. */ |
321 | struct net_device_stats stats; | ||
322 | /* Frequently used and paired value: keep adjacent for cache effect. */ | 321 | /* Frequently used and paired value: keep adjacent for cache effect. */ |
323 | int chip_id, drv_flags; | 322 | int chip_id, drv_flags; |
324 | struct pci_dev *pci_dev; | 323 | struct pci_dev *pci_dev; |
@@ -353,7 +352,6 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance); | |||
353 | static int yellowfin_rx(struct net_device *dev); | 352 | static int yellowfin_rx(struct net_device *dev); |
354 | static void yellowfin_error(struct net_device *dev, int intr_status); | 353 | static void yellowfin_error(struct net_device *dev, int intr_status); |
355 | static int yellowfin_close(struct net_device *dev); | 354 | static int yellowfin_close(struct net_device *dev); |
356 | static struct net_device_stats *yellowfin_get_stats(struct net_device *dev); | ||
357 | static void set_rx_mode(struct net_device *dev); | 355 | static void set_rx_mode(struct net_device *dev); |
358 | static const struct ethtool_ops ethtool_ops; | 356 | static const struct ethtool_ops ethtool_ops; |
359 | 357 | ||
@@ -469,7 +467,6 @@ static int __devinit yellowfin_init_one(struct pci_dev *pdev, | |||
469 | dev->open = &yellowfin_open; | 467 | dev->open = &yellowfin_open; |
470 | dev->hard_start_xmit = &yellowfin_start_xmit; | 468 | dev->hard_start_xmit = &yellowfin_start_xmit; |
471 | dev->stop = &yellowfin_close; | 469 | dev->stop = &yellowfin_close; |
472 | dev->get_stats = &yellowfin_get_stats; | ||
473 | dev->set_multicast_list = &set_rx_mode; | 470 | dev->set_multicast_list = &set_rx_mode; |
474 | dev->do_ioctl = &netdev_ioctl; | 471 | dev->do_ioctl = &netdev_ioctl; |
475 | SET_ETHTOOL_OPS(dev, ðtool_ops); | 472 | SET_ETHTOOL_OPS(dev, ðtool_ops); |
@@ -717,7 +714,7 @@ static void yellowfin_tx_timeout(struct net_device *dev) | |||
717 | netif_wake_queue (dev); /* Typical path */ | 714 | netif_wake_queue (dev); /* Typical path */ |
718 | 715 | ||
719 | dev->trans_start = jiffies; | 716 | dev->trans_start = jiffies; |
720 | yp->stats.tx_errors++; | 717 | dev->stats.tx_errors++; |
721 | } | 718 | } |
722 | 719 | ||
723 | /* Initialize the Rx and Tx rings, along with various 'dev' bits. */ | 720 | /* Initialize the Rx and Tx rings, along with various 'dev' bits. */ |
@@ -923,8 +920,8 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance) | |||
923 | if (yp->tx_ring[entry].result_status == 0) | 920 | if (yp->tx_ring[entry].result_status == 0) |
924 | break; | 921 | break; |
925 | skb = yp->tx_skbuff[entry]; | 922 | skb = yp->tx_skbuff[entry]; |
926 | yp->stats.tx_packets++; | 923 | dev->stats.tx_packets++; |
927 | yp->stats.tx_bytes += skb->len; | 924 | dev->stats.tx_bytes += skb->len; |
928 | /* Free the original skb. */ | 925 | /* Free the original skb. */ |
929 | pci_unmap_single(yp->pci_dev, yp->tx_ring[entry].addr, | 926 | pci_unmap_single(yp->pci_dev, yp->tx_ring[entry].addr, |
930 | skb->len, PCI_DMA_TODEVICE); | 927 | skb->len, PCI_DMA_TODEVICE); |
@@ -968,20 +965,20 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance) | |||
968 | printk(KERN_DEBUG "%s: Transmit error, Tx status %4.4x.\n", | 965 | printk(KERN_DEBUG "%s: Transmit error, Tx status %4.4x.\n", |
969 | dev->name, tx_errs); | 966 | dev->name, tx_errs); |
970 | #endif | 967 | #endif |
971 | yp->stats.tx_errors++; | 968 | dev->stats.tx_errors++; |
972 | if (tx_errs & 0xF800) yp->stats.tx_aborted_errors++; | 969 | if (tx_errs & 0xF800) dev->stats.tx_aborted_errors++; |
973 | if (tx_errs & 0x0800) yp->stats.tx_carrier_errors++; | 970 | if (tx_errs & 0x0800) dev->stats.tx_carrier_errors++; |
974 | if (tx_errs & 0x2000) yp->stats.tx_window_errors++; | 971 | if (tx_errs & 0x2000) dev->stats.tx_window_errors++; |
975 | if (tx_errs & 0x8000) yp->stats.tx_fifo_errors++; | 972 | if (tx_errs & 0x8000) dev->stats.tx_fifo_errors++; |
976 | } else { | 973 | } else { |
977 | #ifndef final_version | 974 | #ifndef final_version |
978 | if (yellowfin_debug > 4) | 975 | if (yellowfin_debug > 4) |
979 | printk(KERN_DEBUG "%s: Normal transmit, Tx status %4.4x.\n", | 976 | printk(KERN_DEBUG "%s: Normal transmit, Tx status %4.4x.\n", |
980 | dev->name, tx_errs); | 977 | dev->name, tx_errs); |
981 | #endif | 978 | #endif |
982 | yp->stats.tx_bytes += skb->len; | 979 | dev->stats.tx_bytes += skb->len; |
983 | yp->stats.collisions += tx_errs & 15; | 980 | dev->stats.collisions += tx_errs & 15; |
984 | yp->stats.tx_packets++; | 981 | dev->stats.tx_packets++; |
985 | } | 982 | } |
986 | /* Free the original skb. */ | 983 | /* Free the original skb. */ |
987 | pci_unmap_single(yp->pci_dev, | 984 | pci_unmap_single(yp->pci_dev, |
@@ -1076,26 +1073,26 @@ static int yellowfin_rx(struct net_device *dev) | |||
1076 | if (data_size != 0) | 1073 | if (data_size != 0) |
1077 | printk(KERN_WARNING "%s: Oversized Ethernet frame spanned multiple buffers," | 1074 | printk(KERN_WARNING "%s: Oversized Ethernet frame spanned multiple buffers," |
1078 | " status %4.4x, data_size %d!\n", dev->name, desc_status, data_size); | 1075 | " status %4.4x, data_size %d!\n", dev->name, desc_status, data_size); |
1079 | yp->stats.rx_length_errors++; | 1076 | dev->stats.rx_length_errors++; |
1080 | } else if ((yp->drv_flags & IsGigabit) && (frame_status & 0x0038)) { | 1077 | } else if ((yp->drv_flags & IsGigabit) && (frame_status & 0x0038)) { |
1081 | /* There was a error. */ | 1078 | /* There was a error. */ |
1082 | if (yellowfin_debug > 3) | 1079 | if (yellowfin_debug > 3) |
1083 | printk(KERN_DEBUG " yellowfin_rx() Rx error was %4.4x.\n", | 1080 | printk(KERN_DEBUG " yellowfin_rx() Rx error was %4.4x.\n", |
1084 | frame_status); | 1081 | frame_status); |
1085 | yp->stats.rx_errors++; | 1082 | dev->stats.rx_errors++; |
1086 | if (frame_status & 0x0060) yp->stats.rx_length_errors++; | 1083 | if (frame_status & 0x0060) dev->stats.rx_length_errors++; |
1087 | if (frame_status & 0x0008) yp->stats.rx_frame_errors++; | 1084 | if (frame_status & 0x0008) dev->stats.rx_frame_errors++; |
1088 | if (frame_status & 0x0010) yp->stats.rx_crc_errors++; | 1085 | if (frame_status & 0x0010) dev->stats.rx_crc_errors++; |
1089 | if (frame_status < 0) yp->stats.rx_dropped++; | 1086 | if (frame_status < 0) dev->stats.rx_dropped++; |
1090 | } else if ( !(yp->drv_flags & IsGigabit) && | 1087 | } else if ( !(yp->drv_flags & IsGigabit) && |
1091 | ((buf_addr[data_size-1] & 0x85) || buf_addr[data_size-2] & 0xC0)) { | 1088 | ((buf_addr[data_size-1] & 0x85) || buf_addr[data_size-2] & 0xC0)) { |
1092 | u8 status1 = buf_addr[data_size-2]; | 1089 | u8 status1 = buf_addr[data_size-2]; |
1093 | u8 status2 = buf_addr[data_size-1]; | 1090 | u8 status2 = buf_addr[data_size-1]; |
1094 | yp->stats.rx_errors++; | 1091 | dev->stats.rx_errors++; |
1095 | if (status1 & 0xC0) yp->stats.rx_length_errors++; | 1092 | if (status1 & 0xC0) dev->stats.rx_length_errors++; |
1096 | if (status2 & 0x03) yp->stats.rx_frame_errors++; | 1093 | if (status2 & 0x03) dev->stats.rx_frame_errors++; |
1097 | if (status2 & 0x04) yp->stats.rx_crc_errors++; | 1094 | if (status2 & 0x04) dev->stats.rx_crc_errors++; |
1098 | if (status2 & 0x80) yp->stats.rx_dropped++; | 1095 | if (status2 & 0x80) dev->stats.rx_dropped++; |
1099 | #ifdef YF_PROTOTYPE /* Support for prototype hardware errata. */ | 1096 | #ifdef YF_PROTOTYPE /* Support for prototype hardware errata. */ |
1100 | } else if ((yp->flags & HasMACAddrBug) && | 1097 | } else if ((yp->flags & HasMACAddrBug) && |
1101 | memcmp(le32_to_cpu(yp->rx_ring_dma + | 1098 | memcmp(le32_to_cpu(yp->rx_ring_dma + |
@@ -1145,8 +1142,8 @@ static int yellowfin_rx(struct net_device *dev) | |||
1145 | skb->protocol = eth_type_trans(skb, dev); | 1142 | skb->protocol = eth_type_trans(skb, dev); |
1146 | netif_rx(skb); | 1143 | netif_rx(skb); |
1147 | dev->last_rx = jiffies; | 1144 | dev->last_rx = jiffies; |
1148 | yp->stats.rx_packets++; | 1145 | dev->stats.rx_packets++; |
1149 | yp->stats.rx_bytes += pkt_len; | 1146 | dev->stats.rx_bytes += pkt_len; |
1150 | } | 1147 | } |
1151 | entry = (++yp->cur_rx) % RX_RING_SIZE; | 1148 | entry = (++yp->cur_rx) % RX_RING_SIZE; |
1152 | } | 1149 | } |
@@ -1180,15 +1177,13 @@ static int yellowfin_rx(struct net_device *dev) | |||
1180 | 1177 | ||
1181 | static void yellowfin_error(struct net_device *dev, int intr_status) | 1178 | static void yellowfin_error(struct net_device *dev, int intr_status) |
1182 | { | 1179 | { |
1183 | struct yellowfin_private *yp = netdev_priv(dev); | ||
1184 | |||
1185 | printk(KERN_ERR "%s: Something Wicked happened! %4.4x.\n", | 1180 | printk(KERN_ERR "%s: Something Wicked happened! %4.4x.\n", |
1186 | dev->name, intr_status); | 1181 | dev->name, intr_status); |
1187 | /* Hmmmmm, it's not clear what to do here. */ | 1182 | /* Hmmmmm, it's not clear what to do here. */ |
1188 | if (intr_status & (IntrTxPCIErr | IntrTxPCIFault)) | 1183 | if (intr_status & (IntrTxPCIErr | IntrTxPCIFault)) |
1189 | yp->stats.tx_errors++; | 1184 | dev->stats.tx_errors++; |
1190 | if (intr_status & (IntrRxPCIErr | IntrRxPCIFault)) | 1185 | if (intr_status & (IntrRxPCIErr | IntrRxPCIFault)) |
1191 | yp->stats.rx_errors++; | 1186 | dev->stats.rx_errors++; |
1192 | } | 1187 | } |
1193 | 1188 | ||
1194 | static int yellowfin_close(struct net_device *dev) | 1189 | static int yellowfin_close(struct net_device *dev) |
@@ -1280,12 +1275,6 @@ static int yellowfin_close(struct net_device *dev) | |||
1280 | return 0; | 1275 | return 0; |
1281 | } | 1276 | } |
1282 | 1277 | ||
1283 | static struct net_device_stats *yellowfin_get_stats(struct net_device *dev) | ||
1284 | { | ||
1285 | struct yellowfin_private *yp = netdev_priv(dev); | ||
1286 | return &yp->stats; | ||
1287 | } | ||
1288 | |||
1289 | /* Set or clear the multicast filter for this adaptor. */ | 1278 | /* Set or clear the multicast filter for this adaptor. */ |
1290 | 1279 | ||
1291 | static void set_rx_mode(struct net_device *dev) | 1280 | static void set_rx_mode(struct net_device *dev) |