Commit c1d869d6 authored by Mark Zhang's avatar Mark Zhang Committed by Jason Gunthorpe

RDMA/counter: Query a counter before release

Query a dynamically-allocated counter before release it, to update it's
hwcounters and log all of them into history data. Otherwise all values of
these hwcounters will be lost.

Fixes: f34a55e4 ("RDMA/core: Get sum value of all counters when perform a sysfs stat read")
Link: https://lore.kernel.org/r/20200621110000.56059-1-leon@kernel.orgSigned-off-by: default avatarMark Zhang <markz@mellanox.com>
Reviewed-by: default avatarMaor Gottlieb <maorg@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent a17f4bed
...@@ -202,7 +202,7 @@ static int __rdma_counter_unbind_qp(struct ib_qp *qp) ...@@ -202,7 +202,7 @@ static int __rdma_counter_unbind_qp(struct ib_qp *qp)
return ret; return ret;
} }
static void counter_history_stat_update(const struct rdma_counter *counter) static void counter_history_stat_update(struct rdma_counter *counter)
{ {
struct ib_device *dev = counter->device; struct ib_device *dev = counter->device;
struct rdma_port_counter *port_counter; struct rdma_port_counter *port_counter;
...@@ -212,6 +212,8 @@ static void counter_history_stat_update(const struct rdma_counter *counter) ...@@ -212,6 +212,8 @@ static void counter_history_stat_update(const struct rdma_counter *counter)
if (!port_counter->hstats) if (!port_counter->hstats)
return; return;
rdma_counter_query_stats(counter);
for (i = 0; i < counter->stats->num_counters; i++) for (i = 0; i < counter->stats->num_counters; i++)
port_counter->hstats->value[i] += counter->stats->value[i]; port_counter->hstats->value[i] += counter->stats->value[i];
} }
......
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