aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/ethtool.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2011-02-18 14:14:13 -0500
committerBen Hutchings <bhutchings@solarflare.com>2011-02-28 18:57:24 -0500
commit119226c563be011c6396c6a2d268d1ca7e467bd3 (patch)
tree6c96d4691d354cea92e435915293a56e1f9bcb8b /drivers/net/sfc/ethtool.c
parent0a6f40c66ba388e6349a11bea146955716c4d492 (diff)
sfc: Expose TX push and TSO counters through ethtool statistics
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/sfc/ethtool.c')
-rw-r--r--drivers/net/sfc/ethtool.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c
index 52fa661aede9..158d5b5630b6 100644
--- a/drivers/net/sfc/ethtool.c
+++ b/drivers/net/sfc/ethtool.c
@@ -28,7 +28,8 @@ struct efx_ethtool_stat {
28 enum { 28 enum {
29 EFX_ETHTOOL_STAT_SOURCE_mac_stats, 29 EFX_ETHTOOL_STAT_SOURCE_mac_stats,
30 EFX_ETHTOOL_STAT_SOURCE_nic, 30 EFX_ETHTOOL_STAT_SOURCE_nic,
31 EFX_ETHTOOL_STAT_SOURCE_channel 31 EFX_ETHTOOL_STAT_SOURCE_channel,
32 EFX_ETHTOOL_STAT_SOURCE_tx_queue
32 } source; 33 } source;
33 unsigned offset; 34 unsigned offset;
34 u64(*get_stat) (void *field); /* Reader function */ 35 u64(*get_stat) (void *field); /* Reader function */
@@ -86,6 +87,10 @@ static u64 efx_get_atomic_stat(void *field)
86 EFX_ETHTOOL_STAT(field, channel, n_##field, \ 87 EFX_ETHTOOL_STAT(field, channel, n_##field, \
87 unsigned int, efx_get_uint_stat) 88 unsigned int, efx_get_uint_stat)
88 89
90#define EFX_ETHTOOL_UINT_TXQ_STAT(field) \
91 EFX_ETHTOOL_STAT(tx_##field, tx_queue, field, \
92 unsigned int, efx_get_uint_stat)
93
89static struct efx_ethtool_stat efx_ethtool_stats[] = { 94static struct efx_ethtool_stat efx_ethtool_stats[] = {
90 EFX_ETHTOOL_U64_MAC_STAT(tx_bytes), 95 EFX_ETHTOOL_U64_MAC_STAT(tx_bytes),
91 EFX_ETHTOOL_U64_MAC_STAT(tx_good_bytes), 96 EFX_ETHTOOL_U64_MAC_STAT(tx_good_bytes),
@@ -116,6 +121,10 @@ static struct efx_ethtool_stat efx_ethtool_stats[] = {
116 EFX_ETHTOOL_ULONG_MAC_STAT(tx_non_tcpudp), 121 EFX_ETHTOOL_ULONG_MAC_STAT(tx_non_tcpudp),
117 EFX_ETHTOOL_ULONG_MAC_STAT(tx_mac_src_error), 122 EFX_ETHTOOL_ULONG_MAC_STAT(tx_mac_src_error),
118 EFX_ETHTOOL_ULONG_MAC_STAT(tx_ip_src_error), 123 EFX_ETHTOOL_ULONG_MAC_STAT(tx_ip_src_error),
124 EFX_ETHTOOL_UINT_TXQ_STAT(tso_bursts),
125 EFX_ETHTOOL_UINT_TXQ_STAT(tso_long_headers),
126 EFX_ETHTOOL_UINT_TXQ_STAT(tso_packets),
127 EFX_ETHTOOL_UINT_TXQ_STAT(pushes),
119 EFX_ETHTOOL_U64_MAC_STAT(rx_bytes), 128 EFX_ETHTOOL_U64_MAC_STAT(rx_bytes),
120 EFX_ETHTOOL_U64_MAC_STAT(rx_good_bytes), 129 EFX_ETHTOOL_U64_MAC_STAT(rx_good_bytes),
121 EFX_ETHTOOL_U64_MAC_STAT(rx_bad_bytes), 130 EFX_ETHTOOL_U64_MAC_STAT(rx_bad_bytes),
@@ -470,6 +479,7 @@ static void efx_ethtool_get_stats(struct net_device *net_dev,
470 struct efx_mac_stats *mac_stats = &efx->mac_stats; 479 struct efx_mac_stats *mac_stats = &efx->mac_stats;
471 struct efx_ethtool_stat *stat; 480 struct efx_ethtool_stat *stat;
472 struct efx_channel *channel; 481 struct efx_channel *channel;
482 struct efx_tx_queue *tx_queue;
473 struct rtnl_link_stats64 temp; 483 struct rtnl_link_stats64 temp;
474 int i; 484 int i;
475 485
@@ -495,6 +505,15 @@ static void efx_ethtool_get_stats(struct net_device *net_dev,
495 data[i] += stat->get_stat((void *)channel + 505 data[i] += stat->get_stat((void *)channel +
496 stat->offset); 506 stat->offset);
497 break; 507 break;
508 case EFX_ETHTOOL_STAT_SOURCE_tx_queue:
509 data[i] = 0;
510 efx_for_each_channel(channel, efx) {
511 efx_for_each_channel_tx_queue(tx_queue, channel)
512 data[i] +=
513 stat->get_stat((void *)tx_queue
514 + stat->offset);
515 }
516 break;
498 } 517 }
499 } 518 }
500} 519}