diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-09-02 23:52:43 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-03 12:44:51 -0400 |
commit | 1a18abaa87c4c68a13c2ffcace39a078605b980a (patch) | |
tree | 3ac7ed4d7ef48ae8d3095f60272eb5681596d982 | |
parent | ae8abfa00efb8ec550f772cbd1e1854977d06212 (diff) |
tulip: use integrated netdev stats
struct tulip_private is a bit large (order-1 allocation even on 32bit
arch), try to shrink it, remove its net_device_stats field.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/tulip/interrupt.c | 77 | ||||
-rw-r--r-- | drivers/net/tulip/tulip.h | 3 | ||||
-rw-r--r-- | drivers/net/tulip/tulip_core.c | 10 |
3 files changed, 50 insertions, 40 deletions
diff --git a/drivers/net/tulip/interrupt.c b/drivers/net/tulip/interrupt.c index 1faf7a4d7202..0013642903ee 100644 --- a/drivers/net/tulip/interrupt.c +++ b/drivers/net/tulip/interrupt.c | |||
@@ -180,21 +180,24 @@ int tulip_poll(struct napi_struct *napi, int budget) | |||
180 | dev_warn(&dev->dev, | 180 | dev_warn(&dev->dev, |
181 | "Oversized Ethernet frame spanned multiple buffers, status %08x!\n", | 181 | "Oversized Ethernet frame spanned multiple buffers, status %08x!\n", |
182 | status); | 182 | status); |
183 | tp->stats.rx_length_errors++; | 183 | dev->stats.rx_length_errors++; |
184 | } | 184 | } |
185 | } else { | 185 | } else { |
186 | /* There was a fatal error. */ | 186 | /* There was a fatal error. */ |
187 | if (tulip_debug > 2) | 187 | if (tulip_debug > 2) |
188 | printk(KERN_DEBUG "%s: Receive error, Rx status %08x\n", | 188 | printk(KERN_DEBUG "%s: Receive error, Rx status %08x\n", |
189 | dev->name, status); | 189 | dev->name, status); |
190 | tp->stats.rx_errors++; /* end of a packet.*/ | 190 | dev->stats.rx_errors++; /* end of a packet.*/ |
191 | if (pkt_len > 1518 || | 191 | if (pkt_len > 1518 || |
192 | (status & RxDescRunt)) | 192 | (status & RxDescRunt)) |
193 | tp->stats.rx_length_errors++; | 193 | dev->stats.rx_length_errors++; |
194 | 194 | ||
195 | if (status & 0x0004) tp->stats.rx_frame_errors++; | 195 | if (status & 0x0004) |
196 | if (status & 0x0002) tp->stats.rx_crc_errors++; | 196 | dev->stats.rx_frame_errors++; |
197 | if (status & 0x0001) tp->stats.rx_fifo_errors++; | 197 | if (status & 0x0002) |
198 | dev->stats.rx_crc_errors++; | ||
199 | if (status & 0x0001) | ||
200 | dev->stats.rx_fifo_errors++; | ||
198 | } | 201 | } |
199 | } else { | 202 | } else { |
200 | struct sk_buff *skb; | 203 | struct sk_buff *skb; |
@@ -244,8 +247,8 @@ int tulip_poll(struct napi_struct *napi, int budget) | |||
244 | 247 | ||
245 | netif_receive_skb(skb); | 248 | netif_receive_skb(skb); |
246 | 249 | ||
247 | tp->stats.rx_packets++; | 250 | dev->stats.rx_packets++; |
248 | tp->stats.rx_bytes += pkt_len; | 251 | dev->stats.rx_bytes += pkt_len; |
249 | } | 252 | } |
250 | #ifdef CONFIG_TULIP_NAPI_HW_MITIGATION | 253 | #ifdef CONFIG_TULIP_NAPI_HW_MITIGATION |
251 | received++; | 254 | received++; |
@@ -404,20 +407,23 @@ static int tulip_rx(struct net_device *dev) | |||
404 | dev_warn(&dev->dev, | 407 | dev_warn(&dev->dev, |
405 | "Oversized Ethernet frame spanned multiple buffers, status %08x!\n", | 408 | "Oversized Ethernet frame spanned multiple buffers, status %08x!\n", |
406 | status); | 409 | status); |
407 | tp->stats.rx_length_errors++; | 410 | dev->stats.rx_length_errors++; |
408 | } | 411 | } |
409 | } else { | 412 | } else { |
410 | /* There was a fatal error. */ | 413 | /* There was a fatal error. */ |
411 | if (tulip_debug > 2) | 414 | if (tulip_debug > 2) |
412 | printk(KERN_DEBUG "%s: Receive error, Rx status %08x\n", | 415 | printk(KERN_DEBUG "%s: Receive error, Rx status %08x\n", |
413 | dev->name, status); | 416 | dev->name, status); |
414 | tp->stats.rx_errors++; /* end of a packet.*/ | 417 | dev->stats.rx_errors++; /* end of a packet.*/ |
415 | if (pkt_len > 1518 || | 418 | if (pkt_len > 1518 || |
416 | (status & RxDescRunt)) | 419 | (status & RxDescRunt)) |
417 | tp->stats.rx_length_errors++; | 420 | dev->stats.rx_length_errors++; |
418 | if (status & 0x0004) tp->stats.rx_frame_errors++; | 421 | if (status & 0x0004) |
419 | if (status & 0x0002) tp->stats.rx_crc_errors++; | 422 | dev->stats.rx_frame_errors++; |
420 | if (status & 0x0001) tp->stats.rx_fifo_errors++; | 423 | if (status & 0x0002) |
424 | dev->stats.rx_crc_errors++; | ||
425 | if (status & 0x0001) | ||
426 | dev->stats.rx_fifo_errors++; | ||
421 | } | 427 | } |
422 | } else { | 428 | } else { |
423 | struct sk_buff *skb; | 429 | struct sk_buff *skb; |
@@ -467,8 +473,8 @@ static int tulip_rx(struct net_device *dev) | |||
467 | 473 | ||
468 | netif_rx(skb); | 474 | netif_rx(skb); |
469 | 475 | ||
470 | tp->stats.rx_packets++; | 476 | dev->stats.rx_packets++; |
471 | tp->stats.rx_bytes += pkt_len; | 477 | dev->stats.rx_bytes += pkt_len; |
472 | } | 478 | } |
473 | received++; | 479 | received++; |
474 | entry = (++tp->cur_rx) % RX_RING_SIZE; | 480 | entry = (++tp->cur_rx) % RX_RING_SIZE; |
@@ -602,18 +608,22 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance) | |||
602 | printk(KERN_DEBUG "%s: Transmit error, Tx status %08x\n", | 608 | printk(KERN_DEBUG "%s: Transmit error, Tx status %08x\n", |
603 | dev->name, status); | 609 | dev->name, status); |
604 | #endif | 610 | #endif |
605 | tp->stats.tx_errors++; | 611 | dev->stats.tx_errors++; |
606 | if (status & 0x4104) tp->stats.tx_aborted_errors++; | 612 | if (status & 0x4104) |
607 | if (status & 0x0C00) tp->stats.tx_carrier_errors++; | 613 | dev->stats.tx_aborted_errors++; |
608 | if (status & 0x0200) tp->stats.tx_window_errors++; | 614 | if (status & 0x0C00) |
609 | if (status & 0x0002) tp->stats.tx_fifo_errors++; | 615 | dev->stats.tx_carrier_errors++; |
616 | if (status & 0x0200) | ||
617 | dev->stats.tx_window_errors++; | ||
618 | if (status & 0x0002) | ||
619 | dev->stats.tx_fifo_errors++; | ||
610 | if ((status & 0x0080) && tp->full_duplex == 0) | 620 | if ((status & 0x0080) && tp->full_duplex == 0) |
611 | tp->stats.tx_heartbeat_errors++; | 621 | dev->stats.tx_heartbeat_errors++; |
612 | } else { | 622 | } else { |
613 | tp->stats.tx_bytes += | 623 | dev->stats.tx_bytes += |
614 | tp->tx_buffers[entry].skb->len; | 624 | tp->tx_buffers[entry].skb->len; |
615 | tp->stats.collisions += (status >> 3) & 15; | 625 | dev->stats.collisions += (status >> 3) & 15; |
616 | tp->stats.tx_packets++; | 626 | dev->stats.tx_packets++; |
617 | } | 627 | } |
618 | 628 | ||
619 | pci_unmap_single(tp->pdev, tp->tx_buffers[entry].mapping, | 629 | pci_unmap_single(tp->pdev, tp->tx_buffers[entry].mapping, |
@@ -655,7 +665,8 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance) | |||
655 | if (csr5 & AbnormalIntr) { /* Abnormal error summary bit. */ | 665 | if (csr5 & AbnormalIntr) { /* Abnormal error summary bit. */ |
656 | if (csr5 == 0xffffffff) | 666 | if (csr5 == 0xffffffff) |
657 | break; | 667 | break; |
658 | if (csr5 & TxJabber) tp->stats.tx_errors++; | 668 | if (csr5 & TxJabber) |
669 | dev->stats.tx_errors++; | ||
659 | if (csr5 & TxFIFOUnderflow) { | 670 | if (csr5 & TxFIFOUnderflow) { |
660 | if ((tp->csr6 & 0xC000) != 0xC000) | 671 | if ((tp->csr6 & 0xC000) != 0xC000) |
661 | tp->csr6 += 0x4000; /* Bump up the Tx threshold */ | 672 | tp->csr6 += 0x4000; /* Bump up the Tx threshold */ |
@@ -672,8 +683,8 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance) | |||
672 | } | 683 | } |
673 | } | 684 | } |
674 | if (csr5 & RxDied) { /* Missed a Rx frame. */ | 685 | if (csr5 & RxDied) { /* Missed a Rx frame. */ |
675 | tp->stats.rx_missed_errors += ioread32(ioaddr + CSR8) & 0xffff; | 686 | dev->stats.rx_missed_errors += ioread32(ioaddr + CSR8) & 0xffff; |
676 | tp->stats.rx_errors++; | 687 | dev->stats.rx_errors++; |
677 | tulip_start_rxtx(tp); | 688 | tulip_start_rxtx(tp); |
678 | } | 689 | } |
679 | /* | 690 | /* |
@@ -789,7 +800,7 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance) | |||
789 | #endif /* CONFIG_TULIP_NAPI */ | 800 | #endif /* CONFIG_TULIP_NAPI */ |
790 | 801 | ||
791 | if ((missed = ioread32(ioaddr + CSR8) & 0x1ffff)) { | 802 | if ((missed = ioread32(ioaddr + CSR8) & 0x1ffff)) { |
792 | tp->stats.rx_dropped += missed & 0x10000 ? 0x10000 : missed; | 803 | dev->stats.rx_dropped += missed & 0x10000 ? 0x10000 : missed; |
793 | } | 804 | } |
794 | 805 | ||
795 | if (tulip_debug > 4) | 806 | if (tulip_debug > 4) |
diff --git a/drivers/net/tulip/tulip.h b/drivers/net/tulip/tulip.h index e525875ed67d..ed66a16711dc 100644 --- a/drivers/net/tulip/tulip.h +++ b/drivers/net/tulip/tulip.h | |||
@@ -417,7 +417,6 @@ struct tulip_private { | |||
417 | int revision; | 417 | int revision; |
418 | int flags; | 418 | int flags; |
419 | struct napi_struct napi; | 419 | struct napi_struct napi; |
420 | struct net_device_stats stats; | ||
421 | struct timer_list timer; /* Media selection timer. */ | 420 | struct timer_list timer; /* Media selection timer. */ |
422 | struct timer_list oom_timer; /* Out of memory timer. */ | 421 | struct timer_list oom_timer; /* Out of memory timer. */ |
423 | u32 mc_filter[2]; | 422 | u32 mc_filter[2]; |
@@ -570,7 +569,7 @@ static inline void tulip_tx_timeout_complete(struct tulip_private *tp, void __io | |||
570 | /* Trigger an immediate transmit demand. */ | 569 | /* Trigger an immediate transmit demand. */ |
571 | iowrite32(0, ioaddr + CSR1); | 570 | iowrite32(0, ioaddr + CSR1); |
572 | 571 | ||
573 | tp->stats.tx_errors++; | 572 | tp->dev->stats.tx_errors++; |
574 | } | 573 | } |
575 | 574 | ||
576 | #endif /* __NET_TULIP_H__ */ | 575 | #endif /* __NET_TULIP_H__ */ |
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index 3a8d7efa2acf..2c39f2591216 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -725,7 +725,7 @@ static void tulip_clean_tx_ring(struct tulip_private *tp) | |||
725 | int status = le32_to_cpu(tp->tx_ring[entry].status); | 725 | int status = le32_to_cpu(tp->tx_ring[entry].status); |
726 | 726 | ||
727 | if (status < 0) { | 727 | if (status < 0) { |
728 | tp->stats.tx_errors++; /* It wasn't Txed */ | 728 | tp->dev->stats.tx_errors++; /* It wasn't Txed */ |
729 | tp->tx_ring[entry].status = 0; | 729 | tp->tx_ring[entry].status = 0; |
730 | } | 730 | } |
731 | 731 | ||
@@ -781,8 +781,8 @@ static void tulip_down (struct net_device *dev) | |||
781 | /* release any unconsumed transmit buffers */ | 781 | /* release any unconsumed transmit buffers */ |
782 | tulip_clean_tx_ring(tp); | 782 | tulip_clean_tx_ring(tp); |
783 | 783 | ||
784 | if (ioread32 (ioaddr + CSR6) != 0xffffffff) | 784 | if (ioread32(ioaddr + CSR6) != 0xffffffff) |
785 | tp->stats.rx_missed_errors += ioread32 (ioaddr + CSR8) & 0xffff; | 785 | dev->stats.rx_missed_errors += ioread32(ioaddr + CSR8) & 0xffff; |
786 | 786 | ||
787 | spin_unlock_irqrestore (&tp->lock, flags); | 787 | spin_unlock_irqrestore (&tp->lock, flags); |
788 | 788 | ||
@@ -864,12 +864,12 @@ static struct net_device_stats *tulip_get_stats(struct net_device *dev) | |||
864 | 864 | ||
865 | spin_lock_irqsave (&tp->lock, flags); | 865 | spin_lock_irqsave (&tp->lock, flags); |
866 | 866 | ||
867 | tp->stats.rx_missed_errors += ioread32(ioaddr + CSR8) & 0xffff; | 867 | dev->stats.rx_missed_errors += ioread32(ioaddr + CSR8) & 0xffff; |
868 | 868 | ||
869 | spin_unlock_irqrestore(&tp->lock, flags); | 869 | spin_unlock_irqrestore(&tp->lock, flags); |
870 | } | 870 | } |
871 | 871 | ||
872 | return &tp->stats; | 872 | return &dev->stats; |
873 | } | 873 | } |
874 | 874 | ||
875 | 875 | ||