aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/vxge
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-08-17 23:42:54 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-19 03:16:51 -0400
commitdd57f970f91e2371040db709b3731ac34e43ccdb (patch)
treee51cbe0b96df2e5b7ce5881574c7c62112a75479 /drivers/net/vxge
parentb92840900fb575004cac694e56fd0a43f54dc344 (diff)
vxge: Implement 64bit stats
vxge_get_stats() is racy, since it clears a block of memory (net_stats) possibly still used by other cpus. We can update this driver to full 64bit stats, since ndo_get_stats64() provides a private block to store results, and driver maintains 64bit counters already. We also remove net_stats field from struct vxge_sw_stats Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Acked-by: Jon Mason <jon.mason@exar.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vxge')
-rw-r--r--drivers/net/vxge/vxge-main.c22
-rw-r--r--drivers/net/vxge/vxge-main.h1
2 files changed, 7 insertions, 16 deletions
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
index f5334b287fdb..01cdec712b64 100644
--- a/drivers/net/vxge/vxge-main.c
+++ b/drivers/net/vxge/vxge-main.c
@@ -2914,26 +2914,18 @@ static int vxge_change_mtu(struct net_device *dev, int new_mtu)
2914} 2914}
2915 2915
2916/** 2916/**
2917 * vxge_get_stats 2917 * vxge_get_stats64
2918 * @dev: pointer to the device structure 2918 * @dev: pointer to the device structure
2919 * @stats: pointer to struct rtnl_link_stats64
2919 * 2920 *
2920 * Updates the device statistics structure. This function updates the device
2921 * statistics structure in the net_device structure and returns a pointer
2922 * to the same.
2923 */ 2921 */
2924static struct net_device_stats * 2922static struct rtnl_link_stats64 *
2925vxge_get_stats(struct net_device *dev) 2923vxge_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *net_stats)
2926{ 2924{
2927 struct vxgedev *vdev; 2925 struct vxgedev *vdev = netdev_priv(dev);
2928 struct net_device_stats *net_stats;
2929 int k; 2926 int k;
2930 2927
2931 vdev = netdev_priv(dev); 2928 /* net_stats already zeroed by caller */
2932
2933 net_stats = &vdev->stats.net_stats;
2934
2935 memset(net_stats, 0, sizeof(struct net_device_stats));
2936
2937 for (k = 0; k < vdev->no_of_vpath; k++) { 2929 for (k = 0; k < vdev->no_of_vpath; k++) {
2938 net_stats->rx_packets += vdev->vpaths[k].ring.stats.rx_frms; 2930 net_stats->rx_packets += vdev->vpaths[k].ring.stats.rx_frms;
2939 net_stats->rx_bytes += vdev->vpaths[k].ring.stats.rx_bytes; 2931 net_stats->rx_bytes += vdev->vpaths[k].ring.stats.rx_bytes;
@@ -3102,7 +3094,7 @@ vxge_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
3102static const struct net_device_ops vxge_netdev_ops = { 3094static const struct net_device_ops vxge_netdev_ops = {
3103 .ndo_open = vxge_open, 3095 .ndo_open = vxge_open,
3104 .ndo_stop = vxge_close, 3096 .ndo_stop = vxge_close,
3105 .ndo_get_stats = vxge_get_stats, 3097 .ndo_get_stats64 = vxge_get_stats64,
3106 .ndo_start_xmit = vxge_xmit, 3098 .ndo_start_xmit = vxge_xmit,
3107 .ndo_validate_addr = eth_validate_addr, 3099 .ndo_validate_addr = eth_validate_addr,
3108 .ndo_set_multicast_list = vxge_set_multicast, 3100 .ndo_set_multicast_list = vxge_set_multicast,
diff --git a/drivers/net/vxge/vxge-main.h b/drivers/net/vxge/vxge-main.h
index 2e3b064b8e4b..d4be07eaacd7 100644
--- a/drivers/net/vxge/vxge-main.h
+++ b/drivers/net/vxge/vxge-main.h
@@ -172,7 +172,6 @@ struct vxge_msix_entry {
172 172
173struct vxge_sw_stats { 173struct vxge_sw_stats {
174 /* Network Stats (interface stats) */ 174 /* Network Stats (interface stats) */
175 struct net_device_stats net_stats;
176 175
177 /* Tx */ 176 /* Tx */
178 u64 tx_frms; 177 u64 tx_frms;