diff options
author | Parav Pandit <parav@mellanox.com> | 2018-12-14 00:32:42 -0600 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-12-20 14:09:45 -0700 |
commit | d5108e69fe013ff47ab815b849caba9cc33ca1e5 (patch) | |
tree | c52aa055bdfb5defb1dd6ad5001e21f1f800d01a /drivers/infiniband/sw/rxe/rxe_verbs.h | |
parent | 6e3722baac048fdf95b867c5ee7e270718e8630d (diff) | |
download | linux-d5108e69fe013ff47ab815b849caba9cc33ca1e5.tar.bz2 |
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_verbs.h')
-rw-r--r-- | drivers/infiniband/sw/rxe/rxe_verbs.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.h b/drivers/infiniband/sw/rxe/rxe_verbs.h index 831381b7788d..74e04801d34d 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.h +++ b/drivers/infiniband/sw/rxe/rxe_verbs.h @@ -409,16 +409,16 @@ struct rxe_dev { spinlock_t mmap_offset_lock; /* guard mmap_offset */ int mmap_offset; - u64 stats_counters[RXE_NUM_OF_COUNTERS]; + atomic64_t stats_counters[RXE_NUM_OF_COUNTERS]; struct rxe_port port; struct list_head list; struct crypto_shash *tfm; }; -static inline void rxe_counter_inc(struct rxe_dev *rxe, enum rxe_counters cnt) +static inline void rxe_counter_inc(struct rxe_dev *rxe, enum rxe_counters index) { - rxe->stats_counters[cnt]++; + atomic64_inc(&rxe->stats_counters[index]); } static inline struct rxe_dev *to_rdev(struct ib_device *dev) |