sfc: Expose TX push and TSO counters through ethtool statistics
authorBen Hutchings <bhutchings@solarflare.com>
Fri, 18 Feb 2011 19:14:13 +0000 (19:14 +0000)
committerBen Hutchings <bhutchings@solarflare.com>
Mon, 28 Feb 2011 23:57:24 +0000 (23:57 +0000)
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
drivers/net/sfc/ethtool.c

index 52fa661..158d5b5 100644 (file)
@@ -28,7 +28,8 @@ struct efx_ethtool_stat {
        enum {
                EFX_ETHTOOL_STAT_SOURCE_mac_stats,
                EFX_ETHTOOL_STAT_SOURCE_nic,
-               EFX_ETHTOOL_STAT_SOURCE_channel
+               EFX_ETHTOOL_STAT_SOURCE_channel,
+               EFX_ETHTOOL_STAT_SOURCE_tx_queue
        } source;
        unsigned offset;
        u64(*get_stat) (void *field); /* Reader function */
@@ -86,6 +87,10 @@ static u64 efx_get_atomic_stat(void *field)
        EFX_ETHTOOL_STAT(field, channel, n_##field,             \
                         unsigned int, efx_get_uint_stat)
 
+#define EFX_ETHTOOL_UINT_TXQ_STAT(field)                       \
+       EFX_ETHTOOL_STAT(tx_##field, tx_queue, field,           \
+                        unsigned int, efx_get_uint_stat)
+
 static struct efx_ethtool_stat efx_ethtool_stats[] = {
        EFX_ETHTOOL_U64_MAC_STAT(tx_bytes),
        EFX_ETHTOOL_U64_MAC_STAT(tx_good_bytes),
@@ -116,6 +121,10 @@ static struct efx_ethtool_stat efx_ethtool_stats[] = {
        EFX_ETHTOOL_ULONG_MAC_STAT(tx_non_tcpudp),
        EFX_ETHTOOL_ULONG_MAC_STAT(tx_mac_src_error),
        EFX_ETHTOOL_ULONG_MAC_STAT(tx_ip_src_error),
+       EFX_ETHTOOL_UINT_TXQ_STAT(tso_bursts),
+       EFX_ETHTOOL_UINT_TXQ_STAT(tso_long_headers),
+       EFX_ETHTOOL_UINT_TXQ_STAT(tso_packets),
+       EFX_ETHTOOL_UINT_TXQ_STAT(pushes),
        EFX_ETHTOOL_U64_MAC_STAT(rx_bytes),
        EFX_ETHTOOL_U64_MAC_STAT(rx_good_bytes),
        EFX_ETHTOOL_U64_MAC_STAT(rx_bad_bytes),
@@ -470,6 +479,7 @@ static void efx_ethtool_get_stats(struct net_device *net_dev,
        struct efx_mac_stats *mac_stats = &efx->mac_stats;
        struct efx_ethtool_stat *stat;
        struct efx_channel *channel;
+       struct efx_tx_queue *tx_queue;
        struct rtnl_link_stats64 temp;
        int i;
 
@@ -495,6 +505,15 @@ static void efx_ethtool_get_stats(struct net_device *net_dev,
                                data[i] += stat->get_stat((void *)channel +
                                                          stat->offset);
                        break;
+               case EFX_ETHTOOL_STAT_SOURCE_tx_queue:
+                       data[i] = 0;
+                       efx_for_each_channel(channel, efx) {
+                               efx_for_each_channel_tx_queue(tx_queue, channel)
+                                       data[i] +=
+                                               stat->get_stat((void *)tx_queue
+                                                              + stat->offset);
+                       }
+                       break;
                }
        }
 }