aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/82596.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/82596.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/82596.c')
-rw-r--r--drivers/net/82596.c65
1 files changed, 27 insertions, 38 deletions
diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index 43dffdca708f..6b03416731de 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -326,7 +326,6 @@ struct i596_private {
326 struct i596_cmd *cmd_head; 326 struct i596_cmd *cmd_head;
327 int cmd_backlog; 327 int cmd_backlog;
328 unsigned long last_cmd; 328 unsigned long last_cmd;
329 struct net_device_stats stats;
330 struct i596_rfd rfds[RX_RING_SIZE]; 329 struct i596_rfd rfds[RX_RING_SIZE];
331 struct i596_rbd rbds[RX_RING_SIZE]; 330 struct i596_rbd rbds[RX_RING_SIZE];
332 struct tx_cmd tx_cmds[TX_RING_SIZE]; 331 struct tx_cmd tx_cmds[TX_RING_SIZE];
@@ -360,7 +359,6 @@ static int i596_open(struct net_device *dev);
360static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev); 359static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev);
361static irqreturn_t i596_interrupt(int irq, void *dev_id); 360static irqreturn_t i596_interrupt(int irq, void *dev_id);
362static int i596_close(struct net_device *dev); 361static int i596_close(struct net_device *dev);
363static struct net_device_stats *i596_get_stats(struct net_device *dev);
364static void i596_add_cmd(struct net_device *dev, struct i596_cmd *cmd); 362static void i596_add_cmd(struct net_device *dev, struct i596_cmd *cmd);
365static void i596_tx_timeout (struct net_device *dev); 363static void i596_tx_timeout (struct net_device *dev);
366static void print_eth(unsigned char *buf, char *str); 364static void print_eth(unsigned char *buf, char *str);
@@ -828,7 +826,7 @@ memory_squeeze:
828 if (skb == NULL) { 826 if (skb == NULL) {
829 /* XXX tulip.c can defer packets here!! */ 827 /* XXX tulip.c can defer packets here!! */
830 printk(KERN_WARNING "%s: i596_rx Memory squeeze, dropping packet.\n", dev->name); 828 printk(KERN_WARNING "%s: i596_rx Memory squeeze, dropping packet.\n", dev->name);
831 lp->stats.rx_dropped++; 829 dev->stats.rx_dropped++;
832 } 830 }
833 else { 831 else {
834 if (!rx_in_place) { 832 if (!rx_in_place) {
@@ -844,28 +842,28 @@ memory_squeeze:
844#endif 842#endif
845 netif_rx(skb); 843 netif_rx(skb);
846 dev->last_rx = jiffies; 844 dev->last_rx = jiffies;
847 lp->stats.rx_packets++; 845 dev->stats.rx_packets++;
848 lp->stats.rx_bytes+=pkt_len; 846 dev->stats.rx_bytes+=pkt_len;
849 } 847 }
850 } 848 }
851 else { 849 else {
852 DEB(DEB_ERRORS, printk(KERN_DEBUG "%s: Error, rfd.stat = 0x%04x\n", 850 DEB(DEB_ERRORS, printk(KERN_DEBUG "%s: Error, rfd.stat = 0x%04x\n",
853 dev->name, rfd->stat)); 851 dev->name, rfd->stat));
854 lp->stats.rx_errors++; 852 dev->stats.rx_errors++;
855 if ((rfd->stat) & 0x0001) 853 if ((rfd->stat) & 0x0001)
856 lp->stats.collisions++; 854 dev->stats.collisions++;
857 if ((rfd->stat) & 0x0080) 855 if ((rfd->stat) & 0x0080)
858 lp->stats.rx_length_errors++; 856 dev->stats.rx_length_errors++;
859 if ((rfd->stat) & 0x0100) 857 if ((rfd->stat) & 0x0100)
860 lp->stats.rx_over_errors++; 858 dev->stats.rx_over_errors++;
861 if ((rfd->stat) & 0x0200) 859 if ((rfd->stat) & 0x0200)
862 lp->stats.rx_fifo_errors++; 860 dev->stats.rx_fifo_errors++;
863 if ((rfd->stat) & 0x0400) 861 if ((rfd->stat) & 0x0400)
864 lp->stats.rx_frame_errors++; 862 dev->stats.rx_frame_errors++;
865 if ((rfd->stat) & 0x0800) 863 if ((rfd->stat) & 0x0800)
866 lp->stats.rx_crc_errors++; 864 dev->stats.rx_crc_errors++;
867 if ((rfd->stat) & 0x1000) 865 if ((rfd->stat) & 0x1000)
868 lp->stats.rx_length_errors++; 866 dev->stats.rx_length_errors++;
869 } 867 }
870 868
871 /* Clear the buffer descriptor count and EOF + F flags */ 869 /* Clear the buffer descriptor count and EOF + F flags */
@@ -916,8 +914,8 @@ static void i596_cleanup_cmd(struct net_device *dev, struct i596_private *lp)
916 914
917 dev_kfree_skb(skb); 915 dev_kfree_skb(skb);
918 916
919 lp->stats.tx_errors++; 917 dev->stats.tx_errors++;
920 lp->stats.tx_aborted_errors++; 918 dev->stats.tx_aborted_errors++;
921 919
922 ptr->v_next = ptr->b_next = I596_NULL; 920 ptr->v_next = ptr->b_next = I596_NULL;
923 tx_cmd->cmd.command = 0; /* Mark as free */ 921 tx_cmd->cmd.command = 0; /* Mark as free */
@@ -1038,10 +1036,10 @@ static void i596_tx_timeout (struct net_device *dev)
1038 DEB(DEB_ERRORS,printk(KERN_ERR "%s: transmit timed out, status resetting.\n", 1036 DEB(DEB_ERRORS,printk(KERN_ERR "%s: transmit timed out, status resetting.\n",
1039 dev->name)); 1037 dev->name));
1040 1038
1041 lp->stats.tx_errors++; 1039 dev->stats.tx_errors++;
1042 1040
1043 /* Try to restart the adaptor */ 1041 /* Try to restart the adaptor */
1044 if (lp->last_restart == lp->stats.tx_packets) { 1042 if (lp->last_restart == dev->stats.tx_packets) {
1045 DEB(DEB_ERRORS,printk(KERN_ERR "Resetting board.\n")); 1043 DEB(DEB_ERRORS,printk(KERN_ERR "Resetting board.\n"));
1046 /* Shutdown and restart */ 1044 /* Shutdown and restart */
1047 i596_reset (dev, lp, ioaddr); 1045 i596_reset (dev, lp, ioaddr);
@@ -1050,7 +1048,7 @@ static void i596_tx_timeout (struct net_device *dev)
1050 DEB(DEB_ERRORS,printk(KERN_ERR "Kicking board.\n")); 1048 DEB(DEB_ERRORS,printk(KERN_ERR "Kicking board.\n"));
1051 lp->scb.command = CUC_START | RX_START; 1049 lp->scb.command = CUC_START | RX_START;
1052 CA (dev); 1050 CA (dev);
1053 lp->last_restart = lp->stats.tx_packets; 1051 lp->last_restart = dev->stats.tx_packets;
1054 } 1052 }
1055 1053
1056 dev->trans_start = jiffies; 1054 dev->trans_start = jiffies;
@@ -1082,7 +1080,7 @@ static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev)
1082 if (tx_cmd->cmd.command) { 1080 if (tx_cmd->cmd.command) {
1083 printk(KERN_NOTICE "%s: xmit ring full, dropping packet.\n", 1081 printk(KERN_NOTICE "%s: xmit ring full, dropping packet.\n",
1084 dev->name); 1082 dev->name);
1085 lp->stats.tx_dropped++; 1083 dev->stats.tx_dropped++;
1086 1084
1087 dev_kfree_skb(skb); 1085 dev_kfree_skb(skb);
1088 } else { 1086 } else {
@@ -1107,8 +1105,8 @@ static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev)
1107 DEB(DEB_TXADDR,print_eth(skb->data, "tx-queued")); 1105 DEB(DEB_TXADDR,print_eth(skb->data, "tx-queued"));
1108 i596_add_cmd(dev, &tx_cmd->cmd); 1106 i596_add_cmd(dev, &tx_cmd->cmd);
1109 1107
1110 lp->stats.tx_packets++; 1108 dev->stats.tx_packets++;
1111 lp->stats.tx_bytes += length; 1109 dev->stats.tx_bytes += length;
1112 } 1110 }
1113 1111
1114 netif_start_queue(dev); 1112 netif_start_queue(dev);
@@ -1237,7 +1235,6 @@ struct net_device * __init i82596_probe(int unit)
1237 dev->open = i596_open; 1235 dev->open = i596_open;
1238 dev->stop = i596_close; 1236 dev->stop = i596_close;
1239 dev->hard_start_xmit = i596_start_xmit; 1237 dev->hard_start_xmit = i596_start_xmit;
1240 dev->get_stats = i596_get_stats;
1241 dev->set_multicast_list = set_multicast_list; 1238 dev->set_multicast_list = set_multicast_list;
1242 dev->tx_timeout = i596_tx_timeout; 1239 dev->tx_timeout = i596_tx_timeout;
1243 dev->watchdog_timeo = TX_TIMEOUT; 1240 dev->watchdog_timeo = TX_TIMEOUT;
@@ -1343,17 +1340,17 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id)
1343 if ((ptr->status) & STAT_OK) { 1340 if ((ptr->status) & STAT_OK) {
1344 DEB(DEB_TXADDR,print_eth(skb->data, "tx-done")); 1341 DEB(DEB_TXADDR,print_eth(skb->data, "tx-done"));
1345 } else { 1342 } else {
1346 lp->stats.tx_errors++; 1343 dev->stats.tx_errors++;
1347 if ((ptr->status) & 0x0020) 1344 if ((ptr->status) & 0x0020)
1348 lp->stats.collisions++; 1345 dev->stats.collisions++;
1349 if (!((ptr->status) & 0x0040)) 1346 if (!((ptr->status) & 0x0040))
1350 lp->stats.tx_heartbeat_errors++; 1347 dev->stats.tx_heartbeat_errors++;
1351 if ((ptr->status) & 0x0400) 1348 if ((ptr->status) & 0x0400)
1352 lp->stats.tx_carrier_errors++; 1349 dev->stats.tx_carrier_errors++;
1353 if ((ptr->status) & 0x0800) 1350 if ((ptr->status) & 0x0800)
1354 lp->stats.collisions++; 1351 dev->stats.collisions++;
1355 if ((ptr->status) & 0x1000) 1352 if ((ptr->status) & 0x1000)
1356 lp->stats.tx_aborted_errors++; 1353 dev->stats.tx_aborted_errors++;
1357 } 1354 }
1358 1355
1359 dev_kfree_skb_irq(skb); 1356 dev_kfree_skb_irq(skb);
@@ -1408,8 +1405,8 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id)
1408 if (netif_running(dev)) { 1405 if (netif_running(dev)) {
1409 DEB(DEB_ERRORS,printk(KERN_ERR "%s: i596 interrupt receive unit inactive, status 0x%x\n", dev->name, status)); 1406 DEB(DEB_ERRORS,printk(KERN_ERR "%s: i596 interrupt receive unit inactive, status 0x%x\n", dev->name, status));
1410 ack_cmd |= RX_START; 1407 ack_cmd |= RX_START;
1411 lp->stats.rx_errors++; 1408 dev->stats.rx_errors++;
1412 lp->stats.rx_fifo_errors++; 1409 dev->stats.rx_fifo_errors++;
1413 rebuild_rx_bufs(dev); 1410 rebuild_rx_bufs(dev);
1414 } 1411 }
1415 } 1412 }
@@ -1492,14 +1489,6 @@ static int i596_close(struct net_device *dev)
1492 return 0; 1489 return 0;
1493} 1490}
1494 1491
1495static struct net_device_stats *
1496 i596_get_stats(struct net_device *dev)
1497{
1498 struct i596_private *lp = dev->priv;
1499
1500 return &lp->stats;
1501}
1502
1503/* 1492/*
1504 * Set or clear the multicast filter for this adaptor. 1493 * Set or clear the multicast filter for this adaptor.
1505 */ 1494 */