qlcnic: Fix ethtool statistics collection

o Properly fill statistics data into buffer.
  Update buffer pointer properly after filling statistics data into buffer.

Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Shahed Shaikh 2013-03-08 09:53:52 +00:00 committed by David S. Miller
parent 1075822c87
commit 9434dbfe54
1 changed files with 4 additions and 4 deletions

View File

@ -1071,8 +1071,7 @@ qlcnic_get_strings(struct net_device *dev, u32 stringset, u8 *data)
} }
} }
static void static u64 *qlcnic_fill_stats(u64 *data, void *stats, int type)
qlcnic_fill_stats(u64 *data, void *stats, int type)
{ {
if (type == QLCNIC_MAC_STATS) { if (type == QLCNIC_MAC_STATS) {
struct qlcnic_mac_statistics *mac_stats = struct qlcnic_mac_statistics *mac_stats =
@ -1121,6 +1120,7 @@ qlcnic_fill_stats(u64 *data, void *stats, int type)
*data++ = QLCNIC_FILL_STATS(esw_stats->local_frames); *data++ = QLCNIC_FILL_STATS(esw_stats->local_frames);
*data++ = QLCNIC_FILL_STATS(esw_stats->numbytes); *data++ = QLCNIC_FILL_STATS(esw_stats->numbytes);
} }
return data;
} }
static void qlcnic_get_ethtool_stats(struct net_device *dev, static void qlcnic_get_ethtool_stats(struct net_device *dev,
@ -1148,7 +1148,7 @@ static void qlcnic_get_ethtool_stats(struct net_device *dev,
/* Retrieve MAC statistics from firmware */ /* Retrieve MAC statistics from firmware */
memset(&mac_stats, 0, sizeof(struct qlcnic_mac_statistics)); memset(&mac_stats, 0, sizeof(struct qlcnic_mac_statistics));
qlcnic_get_mac_stats(adapter, &mac_stats); qlcnic_get_mac_stats(adapter, &mac_stats);
qlcnic_fill_stats(data, &mac_stats, QLCNIC_MAC_STATS); data = qlcnic_fill_stats(data, &mac_stats, QLCNIC_MAC_STATS);
} }
if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED)) if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED))
@ -1160,7 +1160,7 @@ static void qlcnic_get_ethtool_stats(struct net_device *dev,
if (ret) if (ret)
return; return;
qlcnic_fill_stats(data, &port_stats.rx, QLCNIC_ESW_STATS); data = qlcnic_fill_stats(data, &port_stats.rx, QLCNIC_ESW_STATS);
ret = qlcnic_get_port_stats(adapter, adapter->ahw->pci_func, ret = qlcnic_get_port_stats(adapter, adapter->ahw->pci_func,
QLCNIC_QUERY_TX_COUNTER, &port_stats.tx); QLCNIC_QUERY_TX_COUNTER, &port_stats.tx);
if (ret) if (ret)