RDMA/hns: Add the workqueue framework for flush cqe handler
authorYixian Liu <liuyixian@huawei.com>
Thu, 6 Feb 2020 09:56:44 +0000 (17:56 +0800)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 13 Feb 2020 20:44:20 +0000 (16:44 -0400)
commitffd541d45726341c1830ff595fd7352b6d1cfbcd
tree17adc5f31f39a2e1e5a836187dc2c2a57c28a6e7
parentf03d9fadfe13a78ee28fec320d43f7b37574adcb
RDMA/hns: Add the workqueue framework for flush cqe handler

HiP08 RoCE hardware lacks ability(a known hardware problem) to flush
outstanding WQEs if QP state gets into errored mode for some reason.  To
overcome this hardware problem and as a workaround, when QP is detected to
be in errored state during various legs like post send, post receive etc
[1], flush needs to be performed from the driver.

The earlier patch[1] sent to solve the hardware limitation explained in
the cover-letter had a bug in the software flushing leg. It acquired mutex
while modifying QP state to errored state and while conveying it to the
hardware using the mailbox. This caused leg to sleep while holding
spin-lock and caused crash.

Suggested Solution:
we have proposed to defer the flushing of the QP in the Errored state
using the workqueue to get around with the limitation of our hardware.

This patch adds the framework of the workqueue and the flush handler
function.

[1] https://patchwork.kernel.org/patch/10534271/

Link: https://lore.kernel.org/r/1580983005-13899-2-git-send-email-liuyixian@huawei.com
Signed-off-by: Yixian Liu <liuyixian@huawei.com>
Reviewed-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/hns/hns_roce_device.h
drivers/infiniband/hw/hns/hns_roce_hw_v2.c
drivers/infiniband/hw/hns/hns_roce_qp.c