aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sis190.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-10-03 20:41:50 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:51:16 -0400
commit09f75cd7bf13720738e6a196cc0107ce9a5bd5a0 (patch)
tree4c85b0b395abe7f88c87162fc22570e5de255cb1 /drivers/net/sis190.c
parentff8ac60948ba819b89e9c87083e8050fc2f89999 (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/sis190.c')
-rw-r--r--drivers/net/sis190.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index e810ae942cd6..808141b46585 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -270,7 +270,6 @@ struct sis190_private {
270 void __iomem *mmio_addr; 270 void __iomem *mmio_addr;
271 struct pci_dev *pci_dev; 271 struct pci_dev *pci_dev;
272 struct net_device *dev; 272 struct net_device *dev;
273 struct net_device_stats stats;
274 spinlock_t lock; 273 spinlock_t lock;
275 u32 rx_buf_sz; 274 u32 rx_buf_sz;
276 u32 cur_rx; 275 u32 cur_rx;
@@ -569,7 +568,7 @@ static inline int sis190_rx_pkt_err(u32 status, struct net_device_stats *stats)
569static int sis190_rx_interrupt(struct net_device *dev, 568static int sis190_rx_interrupt(struct net_device *dev,
570 struct sis190_private *tp, void __iomem *ioaddr) 569 struct sis190_private *tp, void __iomem *ioaddr)
571{ 570{
572 struct net_device_stats *stats = &tp->stats; 571 struct net_device_stats *stats = &dev->stats;
573 u32 rx_left, cur_rx = tp->cur_rx; 572 u32 rx_left, cur_rx = tp->cur_rx;
574 u32 delta, count; 573 u32 delta, count;
575 574
@@ -683,8 +682,8 @@ static void sis190_tx_interrupt(struct net_device *dev,
683 682
684 skb = tp->Tx_skbuff[entry]; 683 skb = tp->Tx_skbuff[entry];
685 684
686 tp->stats.tx_packets++; 685 dev->stats.tx_packets++;
687 tp->stats.tx_bytes += skb->len; 686 dev->stats.tx_bytes += skb->len;
688 687
689 sis190_unmap_tx_skb(tp->pci_dev, skb, txd); 688 sis190_unmap_tx_skb(tp->pci_dev, skb, txd);
690 tp->Tx_skbuff[entry] = NULL; 689 tp->Tx_skbuff[entry] = NULL;
@@ -1080,7 +1079,7 @@ static void sis190_tx_clear(struct sis190_private *tp)
1080 tp->Tx_skbuff[i] = NULL; 1079 tp->Tx_skbuff[i] = NULL;
1081 dev_kfree_skb(skb); 1080 dev_kfree_skb(skb);
1082 1081
1083 tp->stats.tx_dropped++; 1082 tp->dev->stats.tx_dropped++;
1084 } 1083 }
1085 tp->cur_tx = tp->dirty_tx = 0; 1084 tp->cur_tx = tp->dirty_tx = 0;
1086} 1085}
@@ -1143,7 +1142,7 @@ static int sis190_start_xmit(struct sk_buff *skb, struct net_device *dev)
1143 1142
1144 if (unlikely(skb->len < ETH_ZLEN)) { 1143 if (unlikely(skb->len < ETH_ZLEN)) {
1145 if (skb_padto(skb, ETH_ZLEN)) { 1144 if (skb_padto(skb, ETH_ZLEN)) {
1146 tp->stats.tx_dropped++; 1145 dev->stats.tx_dropped++;
1147 goto out; 1146 goto out;
1148 } 1147 }
1149 len = ETH_ZLEN; 1148 len = ETH_ZLEN;
@@ -1196,13 +1195,6 @@ out:
1196 return NETDEV_TX_OK; 1195 return NETDEV_TX_OK;
1197} 1196}
1198 1197
1199static struct net_device_stats *sis190_get_stats(struct net_device *dev)
1200{
1201 struct sis190_private *tp = netdev_priv(dev);
1202
1203 return &tp->stats;
1204}
1205
1206static void sis190_free_phy(struct list_head *first_phy) 1198static void sis190_free_phy(struct list_head *first_phy)
1207{ 1199{
1208 struct sis190_phy *cur, *next; 1200 struct sis190_phy *cur, *next;
@@ -1795,7 +1787,6 @@ static int __devinit sis190_init_one(struct pci_dev *pdev,
1795 dev->open = sis190_open; 1787 dev->open = sis190_open;
1796 dev->stop = sis190_close; 1788 dev->stop = sis190_close;
1797 dev->do_ioctl = sis190_ioctl; 1789 dev->do_ioctl = sis190_ioctl;
1798 dev->get_stats = sis190_get_stats;
1799 dev->tx_timeout = sis190_tx_timeout; 1790 dev->tx_timeout = sis190_tx_timeout;
1800 dev->watchdog_timeo = SIS190_TX_TIMEOUT; 1791 dev->watchdog_timeo = SIS190_TX_TIMEOUT;
1801 dev->hard_start_xmit = sis190_start_xmit; 1792 dev->hard_start_xmit = sis190_start_xmit;