Skip to content

Commit 2182816

Browse files
Ayaz AbdullaJeff Garzik
authored andcommitted
forcedeth: statistics optimization
This patch optimizes the data paths that can support hw counters. It removes the sw counted statistics. This is the last patch for the optimization set. Bumping up version of driver. Signed-Off-By: Ayaz Abdulla <aabdulla@nvidia.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
1 parent 57fff69 commit 2182816

1 file changed

Lines changed: 17 additions & 21 deletions

File tree

‎drivers/net/forcedeth.c‎

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
* 0.57: 14 May 2006: Mac address set in probe/remove and order corrections.
112112
* 0.58: 30 Oct 2006: Added support for sideband management unit.
113113
* 0.59: 30 Oct 2006: Added support for recoverable error.
114+
* 0.60: 20 Jan 2007: Code optimizations for rings, rx & tx data paths, and stats.
114115
*
115116
* Known bugs:
116117
* We suspect that on some hardware no TX done interrupts are generated.
@@ -127,7 +128,7 @@
127128
#else
128129
#define DRIVERNAPI
129130
#endif
130-
#define FORCEDETH_VERSION "0.59"
131+
#define FORCEDETH_VERSION "0.60"
131132
#define DRV_NAME "forcedeth"
132133

133134
#include <linux/module.h>
@@ -1351,10 +1352,19 @@ static struct net_device_stats *nv_get_stats(struct net_device *dev)
13511352
{
13521353
struct fe_priv *np = netdev_priv(dev);
13531354

1354-
/* It seems that the nic always generates interrupts and doesn't
1355-
* accumulate errors internally. Thus the current values in np->stats
1356-
* are already up to date.
1357-
*/
1355+
/* If the nic supports hw counters then retrieve latest values */
1356+
if (np->driver_data & (DEV_HAS_STATISTICS_V1|DEV_HAS_STATISTICS_V2)) {
1357+
nv_get_hw_stats(dev);
1358+
1359+
/* copy to net_device stats */
1360+
np->stats.tx_bytes = np->estats.tx_bytes;
1361+
np->stats.tx_fifo_errors = np->estats.tx_fifo_errors;
1362+
np->stats.tx_carrier_errors = np->estats.tx_carrier_errors;
1363+
np->stats.rx_crc_errors = np->estats.rx_crc_errors;
1364+
np->stats.rx_over_errors = np->estats.rx_over_errors;
1365+
np->stats.rx_errors = np->estats.rx_errors_total;
1366+
np->stats.tx_errors = np->estats.tx_errors_total;
1367+
}
13581368
return &np->stats;
13591369
}
13601370

@@ -1944,16 +1954,8 @@ static void nv_tx_done_optimized(struct net_device *dev, int limit)
19441954
np->get_tx_ctx->dma = 0;
19451955

19461956
if (flags & NV_TX2_LASTPACKET) {
1947-
if (flags & NV_TX2_ERROR) {
1948-
if (flags & NV_TX2_UNDERFLOW)
1949-
np->stats.tx_fifo_errors++;
1950-
if (flags & NV_TX2_CARRIERLOST)
1951-
np->stats.tx_carrier_errors++;
1952-
np->stats.tx_errors++;
1953-
} else {
1957+
if (!(flags & NV_TX2_ERROR))
19541958
np->stats.tx_packets++;
1955-
np->stats.tx_bytes += np->get_tx_ctx->skb->len;
1956-
}
19571959
dev_kfree_skb_any(np->get_tx_ctx->skb);
19581960
np->get_tx_ctx->skb = NULL;
19591961
}
@@ -2290,7 +2292,6 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit)
22902292
if (flags & NV_RX2_ERROR4) {
22912293
len = nv_getlen(dev, skb->data, len);
22922294
if (len < 0) {
2293-
np->stats.rx_errors++;
22942295
dev_kfree_skb(skb);
22952296
goto next_pkt;
22962297
}
@@ -2303,11 +2304,6 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit)
23032304
}
23042305
/* the rest are hard errors */
23052306
else {
2306-
if (flags & NV_RX2_CRCERR)
2307-
np->stats.rx_crc_errors++;
2308-
if (flags & NV_RX2_OVERFLOW)
2309-
np->stats.rx_over_errors++;
2310-
np->stats.rx_errors++;
23112307
dev_kfree_skb(skb);
23122308
goto next_pkt;
23132309
}
@@ -4941,7 +4937,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
49414937
np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK;
49424938
dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG;
49434939
dev->features |= NETIF_F_TSO;
4944-
}
4940+
}
49454941

49464942
np->vlanctl_bits = 0;
49474943
if (id->driver_data & DEV_HAS_VLAN) {

0 commit comments

Comments
 (0)