aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sb1250-mac.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/sb1250-mac.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/sb1250-mac.c')
-rw-r--r--drivers/net/sb1250-mac.c39
1 files changed, 11 insertions, 28 deletions
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
index b6cafac97200..76e7ee9a6cbc 100644
--- a/drivers/net/sb1250-mac.c
+++ b/drivers/net/sb1250-mac.c
@@ -241,7 +241,6 @@ struct sbmac_softc {
241 struct napi_struct napi; 241 struct napi_struct napi;
242 spinlock_t sbm_lock; /* spin lock */ 242 spinlock_t sbm_lock; /* spin lock */
243 struct timer_list sbm_timer; /* for monitoring MII */ 243 struct timer_list sbm_timer; /* for monitoring MII */
244 struct net_device_stats sbm_stats;
245 int sbm_devflags; /* current device flags */ 244 int sbm_devflags; /* current device flags */
246 245
247 int sbm_phy_oldbmsr; 246 int sbm_phy_oldbmsr;
@@ -317,7 +316,6 @@ static int sbmac_set_duplex(struct sbmac_softc *s,sbmac_duplex_t duplex,sbmac_fc
317static int sbmac_open(struct net_device *dev); 316static int sbmac_open(struct net_device *dev);
318static void sbmac_timer(unsigned long data); 317static void sbmac_timer(unsigned long data);
319static void sbmac_tx_timeout (struct net_device *dev); 318static void sbmac_tx_timeout (struct net_device *dev);
320static struct net_device_stats *sbmac_get_stats(struct net_device *dev);
321static void sbmac_set_rx_mode(struct net_device *dev); 319static void sbmac_set_rx_mode(struct net_device *dev);
322static int sbmac_mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 320static int sbmac_mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
323static int sbmac_close(struct net_device *dev); 321static int sbmac_close(struct net_device *dev);
@@ -1190,6 +1188,7 @@ static void sbmac_netpoll(struct net_device *netdev)
1190static int sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d, 1188static int sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d,
1191 int work_to_do, int poll) 1189 int work_to_do, int poll)
1192{ 1190{
1191 struct net_device *dev = sc->sbm_dev;
1193 int curidx; 1192 int curidx;
1194 int hwidx; 1193 int hwidx;
1195 sbdmadscr_t *dsc; 1194 sbdmadscr_t *dsc;
@@ -1202,7 +1201,7 @@ static int sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d,
1202 1201
1203again: 1202again:
1204 /* Check if the HW dropped any frames */ 1203 /* Check if the HW dropped any frames */
1205 sc->sbm_stats.rx_fifo_errors 1204 dev->stats.rx_fifo_errors
1206 += __raw_readq(sc->sbm_rxdma.sbdma_oodpktlost) & 0xffff; 1205 += __raw_readq(sc->sbm_rxdma.sbdma_oodpktlost) & 0xffff;
1207 __raw_writeq(0, sc->sbm_rxdma.sbdma_oodpktlost); 1206 __raw_writeq(0, sc->sbm_rxdma.sbdma_oodpktlost);
1208 1207
@@ -1261,7 +1260,7 @@ again:
1261 1260
1262 if (unlikely (sbdma_add_rcvbuffer(d,NULL) == 1261 if (unlikely (sbdma_add_rcvbuffer(d,NULL) ==
1263 -ENOBUFS)) { 1262 -ENOBUFS)) {
1264 sc->sbm_stats.rx_dropped++; 1263 dev->stats.rx_dropped++;
1265 sbdma_add_rcvbuffer(d,sb); /* re-add old buffer */ 1264 sbdma_add_rcvbuffer(d,sb); /* re-add old buffer */
1266 /* No point in continuing at the moment */ 1265 /* No point in continuing at the moment */
1267 printk(KERN_ERR "dropped packet (1)\n"); 1266 printk(KERN_ERR "dropped packet (1)\n");
@@ -1297,13 +1296,13 @@ again:
1297 dropped = netif_rx(sb); 1296 dropped = netif_rx(sb);
1298 1297
1299 if (dropped == NET_RX_DROP) { 1298 if (dropped == NET_RX_DROP) {
1300 sc->sbm_stats.rx_dropped++; 1299 dev->stats.rx_dropped++;
1301 d->sbdma_remptr = SBDMA_NEXTBUF(d,sbdma_remptr); 1300 d->sbdma_remptr = SBDMA_NEXTBUF(d,sbdma_remptr);
1302 goto done; 1301 goto done;
1303 } 1302 }
1304 else { 1303 else {
1305 sc->sbm_stats.rx_bytes += len; 1304 dev->stats.rx_bytes += len;
1306 sc->sbm_stats.rx_packets++; 1305 dev->stats.rx_packets++;
1307 } 1306 }
1308 } 1307 }
1309 } else { 1308 } else {
@@ -1311,7 +1310,7 @@ again:
1311 * Packet was mangled somehow. Just drop it and 1310 * Packet was mangled somehow. Just drop it and
1312 * put it back on the receive ring. 1311 * put it back on the receive ring.
1313 */ 1312 */
1314 sc->sbm_stats.rx_errors++; 1313 dev->stats.rx_errors++;
1315 sbdma_add_rcvbuffer(d,sb); 1314 sbdma_add_rcvbuffer(d,sb);
1316 } 1315 }
1317 1316
@@ -1351,6 +1350,7 @@ done:
1351 1350
1352static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d, int poll) 1351static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d, int poll)
1353{ 1352{
1353 struct net_device *dev = sc->sbm_dev;
1354 int curidx; 1354 int curidx;
1355 int hwidx; 1355 int hwidx;
1356 sbdmadscr_t *dsc; 1356 sbdmadscr_t *dsc;
@@ -1401,8 +1401,8 @@ static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d, int poll)
1401 * Stats 1401 * Stats
1402 */ 1402 */
1403 1403
1404 sc->sbm_stats.tx_bytes += sb->len; 1404 dev->stats.tx_bytes += sb->len;
1405 sc->sbm_stats.tx_packets++; 1405 dev->stats.tx_packets++;
1406 1406
1407 /* 1407 /*
1408 * for transmits, we just free buffers. 1408 * for transmits, we just free buffers.
@@ -2457,7 +2457,6 @@ static int sbmac_init(struct net_device *dev, int idx)
2457 dev->open = sbmac_open; 2457 dev->open = sbmac_open;
2458 dev->hard_start_xmit = sbmac_start_tx; 2458 dev->hard_start_xmit = sbmac_start_tx;
2459 dev->stop = sbmac_close; 2459 dev->stop = sbmac_close;
2460 dev->get_stats = sbmac_get_stats;
2461 dev->set_multicast_list = sbmac_set_rx_mode; 2460 dev->set_multicast_list = sbmac_set_rx_mode;
2462 dev->do_ioctl = sbmac_mii_ioctl; 2461 dev->do_ioctl = sbmac_mii_ioctl;
2463 dev->tx_timeout = sbmac_tx_timeout; 2462 dev->tx_timeout = sbmac_tx_timeout;
@@ -2748,7 +2747,7 @@ static void sbmac_tx_timeout (struct net_device *dev)
2748 2747
2749 2748
2750 dev->trans_start = jiffies; 2749 dev->trans_start = jiffies;
2751 sc->sbm_stats.tx_errors++; 2750 dev->stats.tx_errors++;
2752 2751
2753 spin_unlock_irq (&sc->sbm_lock); 2752 spin_unlock_irq (&sc->sbm_lock);
2754 2753
@@ -2758,22 +2757,6 @@ static void sbmac_tx_timeout (struct net_device *dev)
2758 2757
2759 2758
2760 2759
2761static struct net_device_stats *sbmac_get_stats(struct net_device *dev)
2762{
2763 struct sbmac_softc *sc = netdev_priv(dev);
2764 unsigned long flags;
2765
2766 spin_lock_irqsave(&sc->sbm_lock, flags);
2767
2768 /* XXX update other stats here */
2769
2770 spin_unlock_irqrestore(&sc->sbm_lock, flags);
2771
2772 return &sc->sbm_stats;
2773}
2774
2775
2776
2777static void sbmac_set_rx_mode(struct net_device *dev) 2760static void sbmac_set_rx_mode(struct net_device *dev)
2778{ 2761{
2779 unsigned long flags; 2762 unsigned long flags;