qede: Fix statistics' strings for Tx/Rx queues
When an interface is configured to use Tx/Rx-only queues,
the length of the statistics would be shortened to accomodate only the
statistics required per-each queue, and the values would be provided
accordingly.
However, the strings provided would still contain both Tx and Rx strings
for each one of the queues [regardless of its configuration], which might
lead to out-of-bound access when filling the buffers as well as incorrect
statistics presented.
Fixes: 9a4d7e86ac
("qede: Add support for Tx/Rx-only queues.")
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
4f2e4ad56a
commit
cbbf049a7c
|
@ -175,16 +175,23 @@ static void qede_get_strings_stats(struct qede_dev *edev, u8 *buf)
|
||||||
for (i = 0, k = 0; i < QEDE_QUEUE_CNT(edev); i++) {
|
for (i = 0, k = 0; i < QEDE_QUEUE_CNT(edev); i++) {
|
||||||
int tc;
|
int tc;
|
||||||
|
|
||||||
for (j = 0; j < QEDE_NUM_RQSTATS; j++)
|
if (edev->fp_array[i].type & QEDE_FASTPATH_RX) {
|
||||||
sprintf(buf + (k + j) * ETH_GSTRING_LEN,
|
for (j = 0; j < QEDE_NUM_RQSTATS; j++)
|
||||||
"%d: %s", i, qede_rqstats_arr[j].string);
|
|
||||||
k += QEDE_NUM_RQSTATS;
|
|
||||||
for (tc = 0; tc < edev->num_tc; tc++) {
|
|
||||||
for (j = 0; j < QEDE_NUM_TQSTATS; j++)
|
|
||||||
sprintf(buf + (k + j) * ETH_GSTRING_LEN,
|
sprintf(buf + (k + j) * ETH_GSTRING_LEN,
|
||||||
"%d.%d: %s", i, tc,
|
"%d: %s", i,
|
||||||
qede_tqstats_arr[j].string);
|
qede_rqstats_arr[j].string);
|
||||||
k += QEDE_NUM_TQSTATS;
|
k += QEDE_NUM_RQSTATS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (edev->fp_array[i].type & QEDE_FASTPATH_TX) {
|
||||||
|
for (tc = 0; tc < edev->num_tc; tc++) {
|
||||||
|
for (j = 0; j < QEDE_NUM_TQSTATS; j++)
|
||||||
|
sprintf(buf + (k + j) *
|
||||||
|
ETH_GSTRING_LEN,
|
||||||
|
"%d.%d: %s", i, tc,
|
||||||
|
qede_tqstats_arr[j].string);
|
||||||
|
k += QEDE_NUM_TQSTATS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue