aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ucc_geth.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/ucc_geth.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/ucc_geth.c')
-rw-r--r--drivers/net/ucc_geth.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 8da41229594a..9667dac383f0 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3350,14 +3350,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
3350 return 0; 3350 return 0;
3351} 3351}
3352 3352
3353/* returns a net_device_stats structure pointer */
3354static struct net_device_stats *ucc_geth_get_stats(struct net_device *dev)
3355{
3356 struct ucc_geth_private *ugeth = netdev_priv(dev);
3357
3358 return &(ugeth->stats);
3359}
3360
3361/* ucc_geth_timeout gets called when a packet has not been 3353/* ucc_geth_timeout gets called when a packet has not been
3362 * transmitted after a set amount of time. 3354 * transmitted after a set amount of time.
3363 * For now, assume that clearing out all the structures, and 3355 * For now, assume that clearing out all the structures, and
@@ -3368,7 +3360,7 @@ static void ucc_geth_timeout(struct net_device *dev)
3368 3360
3369 ugeth_vdbg("%s: IN", __FUNCTION__); 3361 ugeth_vdbg("%s: IN", __FUNCTION__);
3370 3362
3371 ugeth->stats.tx_errors++; 3363 dev->stats.tx_errors++;
3372 3364
3373 ugeth_dump_regs(ugeth); 3365 ugeth_dump_regs(ugeth);
3374 3366
@@ -3396,7 +3388,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
3396 3388
3397 spin_lock_irq(&ugeth->lock); 3389 spin_lock_irq(&ugeth->lock);
3398 3390
3399 ugeth->stats.tx_bytes += skb->len; 3391 dev->stats.tx_bytes += skb->len;
3400 3392
3401 /* Start from the next BD that should be filled */ 3393 /* Start from the next BD that should be filled */
3402 bd = ugeth->txBd[txQ]; 3394 bd = ugeth->txBd[txQ];
@@ -3488,9 +3480,9 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
3488 dev_kfree_skb_any(skb); 3480 dev_kfree_skb_any(skb);
3489 3481
3490 ugeth->rx_skbuff[rxQ][ugeth->skb_currx[rxQ]] = NULL; 3482 ugeth->rx_skbuff[rxQ][ugeth->skb_currx[rxQ]] = NULL;
3491 ugeth->stats.rx_dropped++; 3483 dev->stats.rx_dropped++;
3492 } else { 3484 } else {
3493 ugeth->stats.rx_packets++; 3485 dev->stats.rx_packets++;
3494 howmany++; 3486 howmany++;
3495 3487
3496 /* Prep the skb for the packet */ 3488 /* Prep the skb for the packet */
@@ -3499,7 +3491,7 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
3499 /* Tell the skb what kind of packet this is */ 3491 /* Tell the skb what kind of packet this is */
3500 skb->protocol = eth_type_trans(skb, ugeth->dev); 3492 skb->protocol = eth_type_trans(skb, ugeth->dev);
3501 3493
3502 ugeth->stats.rx_bytes += length; 3494 dev->stats.rx_bytes += length;
3503 /* Send the packet up the stack */ 3495 /* Send the packet up the stack */
3504#ifdef CONFIG_UGETH_NAPI 3496#ifdef CONFIG_UGETH_NAPI
3505 netif_receive_skb(skb); 3497 netif_receive_skb(skb);
@@ -3514,7 +3506,7 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
3514 if (!skb) { 3506 if (!skb) {
3515 if (netif_msg_rx_err(ugeth)) 3507 if (netif_msg_rx_err(ugeth))
3516 ugeth_warn("%s: No Rx Data Buffer", __FUNCTION__); 3508 ugeth_warn("%s: No Rx Data Buffer", __FUNCTION__);
3517 ugeth->stats.rx_dropped++; 3509 dev->stats.rx_dropped++;
3518 break; 3510 break;
3519 } 3511 }
3520 3512
@@ -3556,7 +3548,7 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
3556 if ((bd == ugeth->txBd[txQ]) && (netif_queue_stopped(dev) == 0)) 3548 if ((bd == ugeth->txBd[txQ]) && (netif_queue_stopped(dev) == 0))
3557 break; 3549 break;
3558 3550
3559 ugeth->stats.tx_packets++; 3551 dev->stats.tx_packets++;
3560 3552
3561 /* Free the sk buffer associated with this TxBD */ 3553 /* Free the sk buffer associated with this TxBD */
3562 dev_kfree_skb_irq(ugeth-> 3554 dev_kfree_skb_irq(ugeth->
@@ -3673,10 +3665,10 @@ static irqreturn_t ucc_geth_irq_handler(int irq, void *info)
3673 /* Errors and other events */ 3665 /* Errors and other events */
3674 if (ucce & UCCE_OTHER) { 3666 if (ucce & UCCE_OTHER) {
3675 if (ucce & UCCE_BSY) { 3667 if (ucce & UCCE_BSY) {
3676 ugeth->stats.rx_errors++; 3668 dev->stats.rx_errors++;
3677 } 3669 }
3678 if (ucce & UCCE_TXE) { 3670 if (ucce & UCCE_TXE) {
3679 ugeth->stats.tx_errors++; 3671 dev->stats.tx_errors++;
3680 } 3672 }
3681 } 3673 }
3682 3674
@@ -3969,7 +3961,6 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3969 netif_napi_add(dev, &ugeth->napi, ucc_geth_poll, UCC_GETH_DEV_WEIGHT); 3961 netif_napi_add(dev, &ugeth->napi, ucc_geth_poll, UCC_GETH_DEV_WEIGHT);
3970#endif /* CONFIG_UGETH_NAPI */ 3962#endif /* CONFIG_UGETH_NAPI */
3971 dev->stop = ucc_geth_close; 3963 dev->stop = ucc_geth_close;
3972 dev->get_stats = ucc_geth_get_stats;
3973// dev->change_mtu = ucc_geth_change_mtu; 3964// dev->change_mtu = ucc_geth_change_mtu;
3974 dev->mtu = 1500; 3965 dev->mtu = 1500;
3975 dev->set_multicast_list = ucc_geth_set_multi; 3966 dev->set_multicast_list = ucc_geth_set_multi;