aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorfrançois romieu <romieu@fr.zoreil.com>2011-08-03 22:38:28 -0400
committerDavid S. Miller <davem@davemloft.net>2011-08-08 01:00:38 -0400
commitad66fa7a704f179fd3f88dece544e2d18078860f (patch)
treeb5cdc4f821828da0945aa1b7859cfaf457087a03 /drivers/net
parent3cb7a7986ace516b97bb6bee2a78eba73e616a87 (diff)
via-velocity : ethtool statistics support.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Tested-by: Jon Nelson <jnelson@jamponi.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/via-velocity.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index ae66696d4ac8..27bcd3bea133 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -3449,6 +3449,77 @@ static int velocity_set_coalesce(struct net_device *dev,
3449 return 0; 3449 return 0;
3450} 3450}
3451 3451
3452static const char velocity_gstrings[][ETH_GSTRING_LEN] = {
3453 "rx_all",
3454 "rx_ok",
3455 "tx_ok",
3456 "rx_error",
3457 "rx_runt_ok",
3458 "rx_runt_err",
3459 "rx_64",
3460 "tx_64",
3461 "rx_65_to_127",
3462 "tx_65_to_127",
3463 "rx_128_to_255",
3464 "tx_128_to_255",
3465 "rx_256_to_511",
3466 "tx_256_to_511",
3467 "rx_512_to_1023",
3468 "tx_512_to_1023",
3469 "rx_1024_to_1518",
3470 "tx_1024_to_1518",
3471 "tx_ether_collisions",
3472 "rx_crc_errors",
3473 "rx_jumbo",
3474 "tx_jumbo",
3475 "rx_mac_control_frames",
3476 "tx_mac_control_frames",
3477 "rx_frame_alignement_errors",
3478 "rx_long_ok",
3479 "rx_long_err",
3480 "tx_sqe_errors",
3481 "rx_no_buf",
3482 "rx_symbol_errors",
3483 "in_range_length_errors",
3484 "late_collisions"
3485};
3486
3487static void velocity_get_strings(struct net_device *dev, u32 sset, u8 *data)
3488{
3489 switch (sset) {
3490 case ETH_SS_STATS:
3491 memcpy(data, *velocity_gstrings, sizeof(velocity_gstrings));
3492 break;
3493 }
3494}
3495
3496static int velocity_get_sset_count(struct net_device *dev, int sset)
3497{
3498 switch (sset) {
3499 case ETH_SS_STATS:
3500 return ARRAY_SIZE(velocity_gstrings);
3501 default:
3502 return -EOPNOTSUPP;
3503 }
3504}
3505
3506static void velocity_get_ethtool_stats(struct net_device *dev,
3507 struct ethtool_stats *stats, u64 *data)
3508{
3509 if (netif_running(dev)) {
3510 struct velocity_info *vptr = netdev_priv(dev);
3511 u32 *p = vptr->mib_counter;
3512 int i;
3513
3514 spin_lock_irq(&vptr->lock);
3515 velocity_update_hw_mibs(vptr);
3516 spin_unlock_irq(&vptr->lock);
3517
3518 for (i = 0; i < ARRAY_SIZE(velocity_gstrings); i++)
3519 *data++ = *p++;
3520 }
3521}
3522
3452static const struct ethtool_ops velocity_ethtool_ops = { 3523static const struct ethtool_ops velocity_ethtool_ops = {
3453 .get_settings = velocity_get_settings, 3524 .get_settings = velocity_get_settings,
3454 .set_settings = velocity_set_settings, 3525 .set_settings = velocity_set_settings,
@@ -3458,6 +3529,9 @@ static const struct ethtool_ops velocity_ethtool_ops = {
3458 .get_msglevel = velocity_get_msglevel, 3529 .get_msglevel = velocity_get_msglevel,
3459 .set_msglevel = velocity_set_msglevel, 3530 .set_msglevel = velocity_set_msglevel,
3460 .get_link = velocity_get_link, 3531 .get_link = velocity_get_link,
3532 .get_strings = velocity_get_strings,
3533 .get_sset_count = velocity_get_sset_count,
3534 .get_ethtool_stats = velocity_get_ethtool_stats,
3461 .get_coalesce = velocity_get_coalesce, 3535 .get_coalesce = velocity_get_coalesce,
3462 .set_coalesce = velocity_set_coalesce, 3536 .set_coalesce = velocity_set_coalesce,
3463 .begin = velocity_ethtool_up, 3537 .begin = velocity_ethtool_up,