RDMA/hns: Replace wmb&__raw_writeq with writeq
authorLang Cheng <chenglang@huawei.com>
Fri, 5 Feb 2021 09:39:29 +0000 (17:39 +0800)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 9 Feb 2021 00:25:25 +0000 (20:25 -0400)
commit86f767e6fc1e719215ccf2b2ec65466f505f731b
treed67567bf0c558669ba71162e84418a680ae263f2
parent3fe07a008e0b4f88280e0c66241fdfa02f1604a2
RDMA/hns: Replace wmb&__raw_writeq with writeq

Currently, the driver updates doorbell looks like this:

post()
{
wqe.field = 0x111;
wmb();
update_wq_db();
}

update_wq_db()
{
db.field = 0x222;
__raw_writeq(db, db_reg);
}

writeq() is a better choice than __raw_writeq() because it calls dma_wmb()
to barrier in ARM64, and dma_wmb() is better than wmb() for ROCEE device.

This patch removes all wmb() before updating doorbell of SQ/RQ/CQ/SRQ by
replacing __raw_writeq() with writeq() to improve performence.  The new
process looks like this:

post()
{
wqe.field = 0x111;
update_wq_db();
}

update_wq_db()
{
db.field = 0x222;
writeq(db, db_reg);
}

Link: https://lore.kernel.org/r/1612517974-31867-8-git-send-email-liweihang@huawei.com
Signed-off-by: Lang Cheng <chenglang@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/hns/hns_roce_device.h
drivers/infiniband/hw/hns/hns_roce_hw_v1.c
drivers/infiniband/hw/hns/hns_roce_hw_v2.c