Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dd57f970 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

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: default avatarEric Dumazet <eric.dumazet@gmail.com>
Acked-by: default avatarJon Mason <jon.mason@exar.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b9284090
Loading
Loading
Loading
Loading
+7 −15
Original line number Original line Diff line number Diff line
@@ -2914,26 +2914,18 @@ static int vxge_change_mtu(struct net_device *dev, int new_mtu)
}
}


/**
/**
 * vxge_get_stats
 * vxge_get_stats64
 * @dev: pointer to the device structure
 * @dev: pointer to the device structure
 * @stats: pointer to struct rtnl_link_stats64
 *
 *
 * Updates the device statistics structure. This function updates the device
 * statistics structure in the net_device structure and returns a pointer
 * to the same.
 */
 */
static struct net_device_stats *
static struct rtnl_link_stats64 *
vxge_get_stats(struct net_device *dev)
vxge_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *net_stats)
{
{
	struct vxgedev *vdev;
	struct vxgedev *vdev = netdev_priv(dev);
	struct net_device_stats *net_stats;
	int k;
	int k;


	vdev = netdev_priv(dev);
	/* net_stats already zeroed by caller */

	net_stats = &vdev->stats.net_stats;

	memset(net_stats, 0, sizeof(struct net_device_stats));

	for (k = 0; k < vdev->no_of_vpath; k++) {
	for (k = 0; k < vdev->no_of_vpath; k++) {
		net_stats->rx_packets += vdev->vpaths[k].ring.stats.rx_frms;
		net_stats->rx_packets += vdev->vpaths[k].ring.stats.rx_frms;
		net_stats->rx_bytes += vdev->vpaths[k].ring.stats.rx_bytes;
		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)
static const struct net_device_ops vxge_netdev_ops = {
static const struct net_device_ops vxge_netdev_ops = {
	.ndo_open               = vxge_open,
	.ndo_open               = vxge_open,
	.ndo_stop               = vxge_close,
	.ndo_stop               = vxge_close,
	.ndo_get_stats          = vxge_get_stats,
	.ndo_get_stats64        = vxge_get_stats64,
	.ndo_start_xmit         = vxge_xmit,
	.ndo_start_xmit         = vxge_xmit,
	.ndo_validate_addr      = eth_validate_addr,
	.ndo_validate_addr      = eth_validate_addr,
	.ndo_set_multicast_list = vxge_set_multicast,
	.ndo_set_multicast_list = vxge_set_multicast,
+0 −1
Original line number Original line Diff line number Diff line
@@ -172,7 +172,6 @@ struct vxge_msix_entry {


struct vxge_sw_stats {
struct vxge_sw_stats {
	/* Network Stats (interface stats) */
	/* Network Stats (interface stats) */
	struct net_device_stats net_stats;


	/* Tx */
	/* Tx */
	u64 tx_frms;
	u64 tx_frms;