Commit ad66fa7a authored by françois romieu's avatar françois romieu Committed by David S. Miller

via-velocity : ethtool statistics support.

Signed-off-by: default avatarFrancois Romieu <romieu@fr.zoreil.com>
Tested-by: default avatarJon Nelson <jnelson@jamponi.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3cb7a798
...@@ -3449,6 +3449,77 @@ static int velocity_set_coalesce(struct net_device *dev, ...@@ -3449,6 +3449,77 @@ static int velocity_set_coalesce(struct net_device *dev,
return 0; return 0;
} }
static const char velocity_gstrings[][ETH_GSTRING_LEN] = {
"rx_all",
"rx_ok",
"tx_ok",
"rx_error",
"rx_runt_ok",
"rx_runt_err",
"rx_64",
"tx_64",
"rx_65_to_127",
"tx_65_to_127",
"rx_128_to_255",
"tx_128_to_255",
"rx_256_to_511",
"tx_256_to_511",
"rx_512_to_1023",
"tx_512_to_1023",
"rx_1024_to_1518",
"tx_1024_to_1518",
"tx_ether_collisions",
"rx_crc_errors",
"rx_jumbo",
"tx_jumbo",
"rx_mac_control_frames",
"tx_mac_control_frames",
"rx_frame_alignement_errors",
"rx_long_ok",
"rx_long_err",
"tx_sqe_errors",
"rx_no_buf",
"rx_symbol_errors",
"in_range_length_errors",
"late_collisions"
};
static void velocity_get_strings(struct net_device *dev, u32 sset, u8 *data)
{
switch (sset) {
case ETH_SS_STATS:
memcpy(data, *velocity_gstrings, sizeof(velocity_gstrings));
break;
}
}
static int velocity_get_sset_count(struct net_device *dev, int sset)
{
switch (sset) {
case ETH_SS_STATS:
return ARRAY_SIZE(velocity_gstrings);
default:
return -EOPNOTSUPP;
}
}
static void velocity_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *stats, u64 *data)
{
if (netif_running(dev)) {
struct velocity_info *vptr = netdev_priv(dev);
u32 *p = vptr->mib_counter;
int i;
spin_lock_irq(&vptr->lock);
velocity_update_hw_mibs(vptr);
spin_unlock_irq(&vptr->lock);
for (i = 0; i < ARRAY_SIZE(velocity_gstrings); i++)
*data++ = *p++;
}
}
static const struct ethtool_ops velocity_ethtool_ops = { static const struct ethtool_ops velocity_ethtool_ops = {
.get_settings = velocity_get_settings, .get_settings = velocity_get_settings,
.set_settings = velocity_set_settings, .set_settings = velocity_set_settings,
...@@ -3458,6 +3529,9 @@ static const struct ethtool_ops velocity_ethtool_ops = { ...@@ -3458,6 +3529,9 @@ static const struct ethtool_ops velocity_ethtool_ops = {
.get_msglevel = velocity_get_msglevel, .get_msglevel = velocity_get_msglevel,
.set_msglevel = velocity_set_msglevel, .set_msglevel = velocity_set_msglevel,
.get_link = velocity_get_link, .get_link = velocity_get_link,
.get_strings = velocity_get_strings,
.get_sset_count = velocity_get_sset_count,
.get_ethtool_stats = velocity_get_ethtool_stats,
.get_coalesce = velocity_get_coalesce, .get_coalesce = velocity_get_coalesce,
.set_coalesce = velocity_set_coalesce, .set_coalesce = velocity_set_coalesce,
.begin = velocity_ethtool_up, .begin = velocity_ethtool_up,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment