diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-10-03 20:41:50 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:51:16 -0400 |
commit | 09f75cd7bf13720738e6a196cc0107ce9a5bd5a0 (patch) | |
tree | 4c85b0b395abe7f88c87162fc22570e5de255cb1 /drivers/net/rrunner.c | |
parent | ff8ac60948ba819b89e9c87083e8050fc2f89999 (diff) |
[NET] drivers/net: statistics cleanup #1 -- save memory and shrink code
We now have struct net_device_stats embedded in struct net_device,
and the default ->get_stats() hook does the obvious thing for us.
Run through drivers/net/* and remove the driver-local storage of
statistics, and driver-local ->get_stats() hook where applicable.
This was just the low-hanging fruit in drivers/net; plenty more drivers
remain to be updated.
[ Resolved conflicts with napi_struct changes and fix sunqe build
regression... -DaveM ]
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/rrunner.c')
-rw-r--r-- | drivers/net/rrunner.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c index 41f877d482c7..03facba05259 100644 --- a/drivers/net/rrunner.c +++ b/drivers/net/rrunner.c | |||
@@ -126,7 +126,6 @@ static int __devinit rr_init_one(struct pci_dev *pdev, | |||
126 | dev->open = &rr_open; | 126 | dev->open = &rr_open; |
127 | dev->hard_start_xmit = &rr_start_xmit; | 127 | dev->hard_start_xmit = &rr_start_xmit; |
128 | dev->stop = &rr_close; | 128 | dev->stop = &rr_close; |
129 | dev->get_stats = &rr_get_stats; | ||
130 | dev->do_ioctl = &rr_ioctl; | 129 | dev->do_ioctl = &rr_ioctl; |
131 | 130 | ||
132 | dev->base_addr = pci_resource_start(pdev, 0); | 131 | dev->base_addr = pci_resource_start(pdev, 0); |
@@ -808,7 +807,7 @@ static u32 rr_handle_event(struct net_device *dev, u32 prodidx, u32 eidx) | |||
808 | case E_CON_REJ: | 807 | case E_CON_REJ: |
809 | printk(KERN_WARNING "%s: Connection rejected\n", | 808 | printk(KERN_WARNING "%s: Connection rejected\n", |
810 | dev->name); | 809 | dev->name); |
811 | rrpriv->stats.tx_aborted_errors++; | 810 | dev->stats.tx_aborted_errors++; |
812 | break; | 811 | break; |
813 | case E_CON_TMOUT: | 812 | case E_CON_TMOUT: |
814 | printk(KERN_WARNING "%s: Connection timeout\n", | 813 | printk(KERN_WARNING "%s: Connection timeout\n", |
@@ -817,7 +816,7 @@ static u32 rr_handle_event(struct net_device *dev, u32 prodidx, u32 eidx) | |||
817 | case E_DISC_ERR: | 816 | case E_DISC_ERR: |
818 | printk(KERN_WARNING "%s: HIPPI disconnect error\n", | 817 | printk(KERN_WARNING "%s: HIPPI disconnect error\n", |
819 | dev->name); | 818 | dev->name); |
820 | rrpriv->stats.tx_aborted_errors++; | 819 | dev->stats.tx_aborted_errors++; |
821 | break; | 820 | break; |
822 | case E_INT_PRTY: | 821 | case E_INT_PRTY: |
823 | printk(KERN_ERR "%s: HIPPI Internal Parity error\n", | 822 | printk(KERN_ERR "%s: HIPPI Internal Parity error\n", |
@@ -833,7 +832,7 @@ static u32 rr_handle_event(struct net_device *dev, u32 prodidx, u32 eidx) | |||
833 | case E_TX_LINK_DROP: | 832 | case E_TX_LINK_DROP: |
834 | printk(KERN_WARNING "%s: Link lost during transmit\n", | 833 | printk(KERN_WARNING "%s: Link lost during transmit\n", |
835 | dev->name); | 834 | dev->name); |
836 | rrpriv->stats.tx_aborted_errors++; | 835 | dev->stats.tx_aborted_errors++; |
837 | writel(readl(®s->HostCtrl)|HALT_NIC|RR_CLEAR_INT, | 836 | writel(readl(®s->HostCtrl)|HALT_NIC|RR_CLEAR_INT, |
838 | ®s->HostCtrl); | 837 | ®s->HostCtrl); |
839 | wmb(); | 838 | wmb(); |
@@ -973,7 +972,7 @@ static void rx_int(struct net_device *dev, u32 rxlimit, u32 index) | |||
973 | printk("len %x, mode %x\n", pkt_len, desc->mode); | 972 | printk("len %x, mode %x\n", pkt_len, desc->mode); |
974 | #endif | 973 | #endif |
975 | if ( (rrpriv->rx_ring[index].mode & PACKET_BAD) == PACKET_BAD){ | 974 | if ( (rrpriv->rx_ring[index].mode & PACKET_BAD) == PACKET_BAD){ |
976 | rrpriv->stats.rx_dropped++; | 975 | dev->stats.rx_dropped++; |
977 | goto defer; | 976 | goto defer; |
978 | } | 977 | } |
979 | 978 | ||
@@ -986,7 +985,7 @@ static void rx_int(struct net_device *dev, u32 rxlimit, u32 index) | |||
986 | skb = alloc_skb(pkt_len, GFP_ATOMIC); | 985 | skb = alloc_skb(pkt_len, GFP_ATOMIC); |
987 | if (skb == NULL){ | 986 | if (skb == NULL){ |
988 | printk(KERN_WARNING "%s: Unable to allocate skb (%i bytes), deferring packet\n", dev->name, pkt_len); | 987 | printk(KERN_WARNING "%s: Unable to allocate skb (%i bytes), deferring packet\n", dev->name, pkt_len); |
989 | rrpriv->stats.rx_dropped++; | 988 | dev->stats.rx_dropped++; |
990 | goto defer; | 989 | goto defer; |
991 | } else { | 990 | } else { |
992 | pci_dma_sync_single_for_cpu(rrpriv->pci_dev, | 991 | pci_dma_sync_single_for_cpu(rrpriv->pci_dev, |
@@ -1024,7 +1023,7 @@ static void rx_int(struct net_device *dev, u32 rxlimit, u32 index) | |||
1024 | } else { | 1023 | } else { |
1025 | printk("%s: Out of memory, deferring " | 1024 | printk("%s: Out of memory, deferring " |
1026 | "packet\n", dev->name); | 1025 | "packet\n", dev->name); |
1027 | rrpriv->stats.rx_dropped++; | 1026 | dev->stats.rx_dropped++; |
1028 | goto defer; | 1027 | goto defer; |
1029 | } | 1028 | } |
1030 | } | 1029 | } |
@@ -1033,8 +1032,8 @@ static void rx_int(struct net_device *dev, u32 rxlimit, u32 index) | |||
1033 | netif_rx(skb); /* send it up */ | 1032 | netif_rx(skb); /* send it up */ |
1034 | 1033 | ||
1035 | dev->last_rx = jiffies; | 1034 | dev->last_rx = jiffies; |
1036 | rrpriv->stats.rx_packets++; | 1035 | dev->stats.rx_packets++; |
1037 | rrpriv->stats.rx_bytes += pkt_len; | 1036 | dev->stats.rx_bytes += pkt_len; |
1038 | } | 1037 | } |
1039 | defer: | 1038 | defer: |
1040 | desc->mode = 0; | 1039 | desc->mode = 0; |
@@ -1102,8 +1101,8 @@ static irqreturn_t rr_interrupt(int irq, void *dev_id) | |||
1102 | desc = &(rrpriv->tx_ring[txcon]); | 1101 | desc = &(rrpriv->tx_ring[txcon]); |
1103 | skb = rrpriv->tx_skbuff[txcon]; | 1102 | skb = rrpriv->tx_skbuff[txcon]; |
1104 | 1103 | ||
1105 | rrpriv->stats.tx_packets++; | 1104 | dev->stats.tx_packets++; |
1106 | rrpriv->stats.tx_bytes += skb->len; | 1105 | dev->stats.tx_bytes += skb->len; |
1107 | 1106 | ||
1108 | pci_unmap_single(rrpriv->pci_dev, | 1107 | pci_unmap_single(rrpriv->pci_dev, |
1109 | desc->addr.addrlo, skb->len, | 1108 | desc->addr.addrlo, skb->len, |
@@ -1491,16 +1490,6 @@ static int rr_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1491 | } | 1490 | } |
1492 | 1491 | ||
1493 | 1492 | ||
1494 | static struct net_device_stats *rr_get_stats(struct net_device *dev) | ||
1495 | { | ||
1496 | struct rr_private *rrpriv; | ||
1497 | |||
1498 | rrpriv = netdev_priv(dev); | ||
1499 | |||
1500 | return(&rrpriv->stats); | ||
1501 | } | ||
1502 | |||
1503 | |||
1504 | /* | 1493 | /* |
1505 | * Read the firmware out of the EEPROM and put it into the SRAM | 1494 | * Read the firmware out of the EEPROM and put it into the SRAM |
1506 | * (or from user space - later) | 1495 | * (or from user space - later) |