aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/forcedeth.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-10-16 20:56:09 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-16 20:56:09 -0400
commit8148ff4512cc6b402e11ccfa02cc4eb41fb7e66c (patch)
treedf903c96bcf192f765c0674a97c7d01328834731 /drivers/net/forcedeth.c
parent3f88ce495b11bb4a68e4f291e8dc3057a1cf9daf (diff)
[netdrvr] forcedeth: remove in-driver copy of net_device_stats
A copy of struct net_device_stats now lives in struct net_device, making in-driver copies a waste of memory. Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/forcedeth.c')
-rw-r--r--drivers/net/forcedeth.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 16f7a07d89d9..cfbb7aacfe94 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -128,7 +128,7 @@
128#else 128#else
129#define DRIVERNAPI 129#define DRIVERNAPI
130#endif 130#endif
131#define FORCEDETH_VERSION "0.60" 131#define FORCEDETH_VERSION "0.61"
132#define DRV_NAME "forcedeth" 132#define DRV_NAME "forcedeth"
133 133
134#include <linux/module.h> 134#include <linux/module.h>
@@ -752,7 +752,6 @@ struct fe_priv {
752 752
753 /* General data: 753 /* General data:
754 * Locking: spin_lock(&np->lock); */ 754 * Locking: spin_lock(&np->lock); */
755 struct net_device_stats stats;
756 struct nv_ethtool_stats estats; 755 struct nv_ethtool_stats estats;
757 int in_shutdown; 756 int in_shutdown;
758 u32 linkspeed; 757 u32 linkspeed;
@@ -1505,15 +1504,16 @@ static struct net_device_stats *nv_get_stats(struct net_device *dev)
1505 nv_get_hw_stats(dev); 1504 nv_get_hw_stats(dev);
1506 1505
1507 /* copy to net_device stats */ 1506 /* copy to net_device stats */
1508 np->stats.tx_bytes = np->estats.tx_bytes; 1507 dev->stats.tx_bytes = np->estats.tx_bytes;
1509 np->stats.tx_fifo_errors = np->estats.tx_fifo_errors; 1508 dev->stats.tx_fifo_errors = np->estats.tx_fifo_errors;
1510 np->stats.tx_carrier_errors = np->estats.tx_carrier_errors; 1509 dev->stats.tx_carrier_errors = np->estats.tx_carrier_errors;
1511 np->stats.rx_crc_errors = np->estats.rx_crc_errors; 1510 dev->stats.rx_crc_errors = np->estats.rx_crc_errors;
1512 np->stats.rx_over_errors = np->estats.rx_over_errors; 1511 dev->stats.rx_over_errors = np->estats.rx_over_errors;
1513 np->stats.rx_errors = np->estats.rx_errors_total; 1512 dev->stats.rx_errors = np->estats.rx_errors_total;
1514 np->stats.tx_errors = np->estats.tx_errors_total; 1513 dev->stats.tx_errors = np->estats.tx_errors_total;
1515 } 1514 }
1516 return &np->stats; 1515
1516 return &dev->stats;
1517} 1517}
1518 1518
1519/* 1519/*
@@ -1733,7 +1733,7 @@ static void nv_drain_tx(struct net_device *dev)
1733 np->tx_ring.ex[i].buflow = 0; 1733 np->tx_ring.ex[i].buflow = 0;
1734 } 1734 }
1735 if (nv_release_txskb(dev, &np->tx_skb[i])) 1735 if (nv_release_txskb(dev, &np->tx_skb[i]))
1736 np->stats.tx_dropped++; 1736 dev->stats.tx_dropped++;
1737 } 1737 }
1738} 1738}
1739 1739
@@ -2049,13 +2049,13 @@ static void nv_tx_done(struct net_device *dev)
2049 if (flags & NV_TX_LASTPACKET) { 2049 if (flags & NV_TX_LASTPACKET) {
2050 if (flags & NV_TX_ERROR) { 2050 if (flags & NV_TX_ERROR) {
2051 if (flags & NV_TX_UNDERFLOW) 2051 if (flags & NV_TX_UNDERFLOW)
2052 np->stats.tx_fifo_errors++; 2052 dev->stats.tx_fifo_errors++;
2053 if (flags & NV_TX_CARRIERLOST) 2053 if (flags & NV_TX_CARRIERLOST)
2054 np->stats.tx_carrier_errors++; 2054 dev->stats.tx_carrier_errors++;
2055 np->stats.tx_errors++; 2055 dev->stats.tx_errors++;
2056 } else { 2056 } else {
2057 np->stats.tx_packets++; 2057 dev->stats.tx_packets++;
2058 np->stats.tx_bytes += np->get_tx_ctx->skb->len; 2058 dev->stats.tx_bytes += np->get_tx_ctx->skb->len;
2059 } 2059 }
2060 dev_kfree_skb_any(np->get_tx_ctx->skb); 2060 dev_kfree_skb_any(np->get_tx_ctx->skb);
2061 np->get_tx_ctx->skb = NULL; 2061 np->get_tx_ctx->skb = NULL;
@@ -2064,13 +2064,13 @@ static void nv_tx_done(struct net_device *dev)
2064 if (flags & NV_TX2_LASTPACKET) { 2064 if (flags & NV_TX2_LASTPACKET) {
2065 if (flags & NV_TX2_ERROR) { 2065 if (flags & NV_TX2_ERROR) {
2066 if (flags & NV_TX2_UNDERFLOW) 2066 if (flags & NV_TX2_UNDERFLOW)
2067 np->stats.tx_fifo_errors++; 2067 dev->stats.tx_fifo_errors++;
2068 if (flags & NV_TX2_CARRIERLOST) 2068 if (flags & NV_TX2_CARRIERLOST)
2069 np->stats.tx_carrier_errors++; 2069 dev->stats.tx_carrier_errors++;
2070 np->stats.tx_errors++; 2070 dev->stats.tx_errors++;
2071 } else { 2071 } else {
2072 np->stats.tx_packets++; 2072 dev->stats.tx_packets++;
2073 np->stats.tx_bytes += np->get_tx_ctx->skb->len; 2073 dev->stats.tx_bytes += np->get_tx_ctx->skb->len;
2074 } 2074 }
2075 dev_kfree_skb_any(np->get_tx_ctx->skb); 2075 dev_kfree_skb_any(np->get_tx_ctx->skb);
2076 np->get_tx_ctx->skb = NULL; 2076 np->get_tx_ctx->skb = NULL;
@@ -2107,7 +2107,7 @@ static void nv_tx_done_optimized(struct net_device *dev, int limit)
2107 2107
2108 if (flags & NV_TX2_LASTPACKET) { 2108 if (flags & NV_TX2_LASTPACKET) {
2109 if (!(flags & NV_TX2_ERROR)) 2109 if (!(flags & NV_TX2_ERROR))
2110 np->stats.tx_packets++; 2110 dev->stats.tx_packets++;
2111 dev_kfree_skb_any(np->get_tx_ctx->skb); 2111 dev_kfree_skb_any(np->get_tx_ctx->skb);
2112 np->get_tx_ctx->skb = NULL; 2112 np->get_tx_ctx->skb = NULL;
2113 } 2113 }
@@ -2308,7 +2308,7 @@ static int nv_rx_process(struct net_device *dev, int limit)
2308 if (flags & NV_RX_ERROR4) { 2308 if (flags & NV_RX_ERROR4) {
2309 len = nv_getlen(dev, skb->data, len); 2309 len = nv_getlen(dev, skb->data, len);
2310 if (len < 0) { 2310 if (len < 0) {
2311 np->stats.rx_errors++; 2311 dev->stats.rx_errors++;
2312 dev_kfree_skb(skb); 2312 dev_kfree_skb(skb);
2313 goto next_pkt; 2313 goto next_pkt;
2314 } 2314 }
@@ -2322,12 +2322,12 @@ static int nv_rx_process(struct net_device *dev, int limit)
2322 /* the rest are hard errors */ 2322 /* the rest are hard errors */
2323 else { 2323 else {
2324 if (flags & NV_RX_MISSEDFRAME) 2324 if (flags & NV_RX_MISSEDFRAME)
2325 np->stats.rx_missed_errors++; 2325 dev->stats.rx_missed_errors++;
2326 if (flags & NV_RX_CRCERR) 2326 if (flags & NV_RX_CRCERR)
2327 np->stats.rx_crc_errors++; 2327 dev->stats.rx_crc_errors++;
2328 if (flags & NV_RX_OVERFLOW) 2328 if (flags & NV_RX_OVERFLOW)
2329 np->stats.rx_over_errors++; 2329 dev->stats.rx_over_errors++;
2330 np->stats.rx_errors++; 2330 dev->stats.rx_errors++;
2331 dev_kfree_skb(skb); 2331 dev_kfree_skb(skb);
2332 goto next_pkt; 2332 goto next_pkt;
2333 } 2333 }
@@ -2343,7 +2343,7 @@ static int nv_rx_process(struct net_device *dev, int limit)
2343 if (flags & NV_RX2_ERROR4) { 2343 if (flags & NV_RX2_ERROR4) {
2344 len = nv_getlen(dev, skb->data, len); 2344 len = nv_getlen(dev, skb->data, len);
2345 if (len < 0) { 2345 if (len < 0) {
2346 np->stats.rx_errors++; 2346 dev->stats.rx_errors++;
2347 dev_kfree_skb(skb); 2347 dev_kfree_skb(skb);
2348 goto next_pkt; 2348 goto next_pkt;
2349 } 2349 }
@@ -2357,10 +2357,10 @@ static int nv_rx_process(struct net_device *dev, int limit)
2357 /* the rest are hard errors */ 2357 /* the rest are hard errors */
2358 else { 2358 else {
2359 if (flags & NV_RX2_CRCERR) 2359 if (flags & NV_RX2_CRCERR)
2360 np->stats.rx_crc_errors++; 2360 dev->stats.rx_crc_errors++;
2361 if (flags & NV_RX2_OVERFLOW) 2361 if (flags & NV_RX2_OVERFLOW)
2362 np->stats.rx_over_errors++; 2362 dev->stats.rx_over_errors++;
2363 np->stats.rx_errors++; 2363 dev->stats.rx_errors++;
2364 dev_kfree_skb(skb); 2364 dev_kfree_skb(skb);
2365 goto next_pkt; 2365 goto next_pkt;
2366 } 2366 }
@@ -2389,8 +2389,8 @@ static int nv_rx_process(struct net_device *dev, int limit)
2389 netif_rx(skb); 2389 netif_rx(skb);
2390#endif 2390#endif
2391 dev->last_rx = jiffies; 2391 dev->last_rx = jiffies;
2392 np->stats.rx_packets++; 2392 dev->stats.rx_packets++;
2393 np->stats.rx_bytes += len; 2393 dev->stats.rx_bytes += len;
2394next_pkt: 2394next_pkt:
2395 if (unlikely(np->get_rx.orig++ == np->last_rx.orig)) 2395 if (unlikely(np->get_rx.orig++ == np->last_rx.orig))
2396 np->get_rx.orig = np->first_rx.orig; 2396 np->get_rx.orig = np->first_rx.orig;
@@ -2507,8 +2507,8 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit)
2507 } 2507 }
2508 2508
2509 dev->last_rx = jiffies; 2509 dev->last_rx = jiffies;
2510 np->stats.rx_packets++; 2510 dev->stats.rx_packets++;
2511 np->stats.rx_bytes += len; 2511 dev->stats.rx_bytes += len;
2512 } else { 2512 } else {
2513 dev_kfree_skb(skb); 2513 dev_kfree_skb(skb);
2514 } 2514 }