summaryrefslogtreecommitdiff
path: root/drivers/infiniband/sw/rxe/rxe_hw_counters.c
diff options
context:
space:
mode:
authorParav Pandit <parav@mellanox.com>2018-12-14 09:32:42 +0300
committerJason Gunthorpe <jgg@mellanox.com>2018-12-21 00:09:45 +0300
commitd5108e69fe013ff47ab815b849caba9cc33ca1e5 (patch)
treec52aa055bdfb5defb1dd6ad5001e21f1f800d01a /drivers/infiniband/sw/rxe/rxe_hw_counters.c
parent6e3722baac048fdf95b867c5ee7e270718e8630d (diff)
downloadlinux-d5108e69fe013ff47ab815b849caba9cc33ca1e5.tar.xz
IB/rxe: Make counters thread safe
Current rxe device counters are not thread safe. When multiple QPs are used, they can be racy. Make them thread safe by making it atomic64. Fixes: 0b1e5b99a48b ("IB/rxe: Add port protocol stats") Signed-off-by: Parav Pandit <parav@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/sw/rxe/rxe_hw_counters.c')
-rw-r--r--drivers/infiniband/sw/rxe/rxe_hw_counters.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/sw/rxe/rxe_hw_counters.c b/drivers/infiniband/sw/rxe/rxe_hw_counters.c
index 4a24895846d3..636edb5f4cf4 100644
--- a/drivers/infiniband/sw/rxe/rxe_hw_counters.c
+++ b/drivers/infiniband/sw/rxe/rxe_hw_counters.c
@@ -62,7 +62,7 @@ int rxe_ib_get_hw_stats(struct ib_device *ibdev,
return -EINVAL;
for (cnt = 0; cnt < ARRAY_SIZE(rxe_counter_name); cnt++)
- stats->value[cnt] = dev->stats_counters[cnt];
+ stats->value[cnt] = atomic64_read(&dev->stats_counters[cnt]);
return ARRAY_SIZE(rxe_counter_name);
}