Commit d5e83632 authored by Yuval Mintz's avatar Yuval Mintz Committed by David S. Miller

bnx2x: fixed ethtool statistics for MF modes

Previosuly, in MF modes `ethtool -S' lacked some of the statistics
which appeared in non-MF modes. This has been fixed.
Signed-off-by: default avatarYuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: default avatarEilon Greenstein <eilong@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 460a25cd
...@@ -2121,18 +2121,16 @@ static int bnx2x_get_sset_count(struct net_device *dev, int stringset) ...@@ -2121,18 +2121,16 @@ static int bnx2x_get_sset_count(struct net_device *dev, int stringset)
case ETH_SS_STATS: case ETH_SS_STATS:
if (is_multi(bp)) { if (is_multi(bp)) {
num_stats = bnx2x_num_stat_queues(bp) * num_stats = bnx2x_num_stat_queues(bp) *
BNX2X_NUM_Q_STATS; BNX2X_NUM_Q_STATS;
if (!IS_MF_MODE_STAT(bp)) } else
num_stats += BNX2X_NUM_STATS; num_stats = 0;
} else { if (IS_MF_MODE_STAT(bp)) {
if (IS_MF_MODE_STAT(bp)) { for (i = 0; i < BNX2X_NUM_STATS; i++)
num_stats = 0; if (IS_FUNC_STAT(i))
for (i = 0; i < BNX2X_NUM_STATS; i++) num_stats++;
if (IS_FUNC_STAT(i)) } else
num_stats++; num_stats += BNX2X_NUM_STATS;
} else
num_stats = BNX2X_NUM_STATS;
}
return num_stats; return num_stats;
case ETH_SS_TEST: case ETH_SS_TEST:
...@@ -2151,8 +2149,8 @@ static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf) ...@@ -2151,8 +2149,8 @@ static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
switch (stringset) { switch (stringset) {
case ETH_SS_STATS: case ETH_SS_STATS:
k = 0;
if (is_multi(bp)) { if (is_multi(bp)) {
k = 0;
for_each_eth_queue(bp, i) { for_each_eth_queue(bp, i) {
memset(queue_name, 0, sizeof(queue_name)); memset(queue_name, 0, sizeof(queue_name));
sprintf(queue_name, "%d", i); sprintf(queue_name, "%d", i);
...@@ -2163,20 +2161,17 @@ static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf) ...@@ -2163,20 +2161,17 @@ static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
queue_name); queue_name);
k += BNX2X_NUM_Q_STATS; k += BNX2X_NUM_Q_STATS;
} }
if (IS_MF_MODE_STAT(bp))
break;
for (j = 0; j < BNX2X_NUM_STATS; j++)
strcpy(buf + (k + j)*ETH_GSTRING_LEN,
bnx2x_stats_arr[j].string);
} else {
for (i = 0, j = 0; i < BNX2X_NUM_STATS; i++) {
if (IS_MF_MODE_STAT(bp) && IS_PORT_STAT(i))
continue;
strcpy(buf + j*ETH_GSTRING_LEN,
bnx2x_stats_arr[i].string);
j++;
}
} }
for (i = 0, j = 0; i < BNX2X_NUM_STATS; i++) {
if (IS_MF_MODE_STAT(bp) && IS_PORT_STAT(i))
continue;
strcpy(buf + (k + j)*ETH_GSTRING_LEN,
bnx2x_stats_arr[i].string);
j++;
}
break; break;
case ETH_SS_TEST: case ETH_SS_TEST:
...@@ -2190,10 +2185,9 @@ static void bnx2x_get_ethtool_stats(struct net_device *dev, ...@@ -2190,10 +2185,9 @@ static void bnx2x_get_ethtool_stats(struct net_device *dev,
{ {
struct bnx2x *bp = netdev_priv(dev); struct bnx2x *bp = netdev_priv(dev);
u32 *hw_stats, *offset; u32 *hw_stats, *offset;
int i, j, k; int i, j, k = 0;
if (is_multi(bp)) { if (is_multi(bp)) {
k = 0;
for_each_eth_queue(bp, i) { for_each_eth_queue(bp, i) {
hw_stats = (u32 *)&bp->fp[i].eth_q_stats; hw_stats = (u32 *)&bp->fp[i].eth_q_stats;
for (j = 0; j < BNX2X_NUM_Q_STATS; j++) { for (j = 0; j < BNX2X_NUM_Q_STATS; j++) {
...@@ -2214,46 +2208,28 @@ static void bnx2x_get_ethtool_stats(struct net_device *dev, ...@@ -2214,46 +2208,28 @@ static void bnx2x_get_ethtool_stats(struct net_device *dev,
} }
k += BNX2X_NUM_Q_STATS; k += BNX2X_NUM_Q_STATS;
} }
if (IS_MF_MODE_STAT(bp)) }
return;
hw_stats = (u32 *)&bp->eth_stats; hw_stats = (u32 *)&bp->eth_stats;
for (j = 0; j < BNX2X_NUM_STATS; j++) { for (i = 0, j = 0; i < BNX2X_NUM_STATS; i++) {
if (bnx2x_stats_arr[j].size == 0) { if (IS_MF_MODE_STAT(bp) && IS_PORT_STAT(i))
/* skip this counter */ continue;
buf[k + j] = 0; if (bnx2x_stats_arr[i].size == 0) {
continue; /* skip this counter */
} buf[k + j] = 0;
offset = (hw_stats + bnx2x_stats_arr[j].offset); j++;
if (bnx2x_stats_arr[j].size == 4) { continue;
/* 4-byte counter */
buf[k + j] = (u64) *offset;
continue;
}
/* 8-byte counter */
buf[k + j] = HILO_U64(*offset, *(offset + 1));
} }
} else { offset = (hw_stats + bnx2x_stats_arr[i].offset);
hw_stats = (u32 *)&bp->eth_stats; if (bnx2x_stats_arr[i].size == 4) {
for (i = 0, j = 0; i < BNX2X_NUM_STATS; i++) { /* 4-byte counter */
if (IS_MF_MODE_STAT(bp) && IS_PORT_STAT(i)) buf[k + j] = (u64) *offset;
continue;
if (bnx2x_stats_arr[i].size == 0) {
/* skip this counter */
buf[j] = 0;
j++;
continue;
}
offset = (hw_stats + bnx2x_stats_arr[i].offset);
if (bnx2x_stats_arr[i].size == 4) {
/* 4-byte counter */
buf[j] = (u64) *offset;
j++;
continue;
}
/* 8-byte counter */
buf[j] = HILO_U64(*offset, *(offset + 1));
j++; j++;
continue;
} }
/* 8-byte counter */
buf[k + j] = HILO_U64(*offset, *(offset + 1));
j++;
} }
} }
......
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