RDMA/hns: Optimize cmd init and mode selection for hip08
authorYixian Liu <liuyixian@huawei.com>
Thu, 29 Aug 2019 08:41:41 +0000 (16:41 +0800)
committerJason Gunthorpe <jgg@mellanox.com>
Mon, 16 Sep 2019 13:52:20 +0000 (10:52 -0300)
commit3d50503b3b33d87bc929eee6b65d206a36bc4579
tree18823d35d3d5666aca9466dedb30c9279df9eb44
parentf8659d68e2bee5b86a1beaf7be42d942e1fc81f4
RDMA/hns: Optimize cmd init and mode selection for hip08

There are two modes for mailbox command (cmd) queue, i.e., event mode and
poll mode. For each mode, we use corresponding semaphores to protect the
cmd queue resource competition, so called event_sem and poll_sem. During
cmd init, both semaphores are initialized and poll mode is selected.
Thus, there is no need to up poll_sema again in cmd_use_polling.

Furthermore, there is no need to down the sema of the other side while
switching mode. This patch aims to decouple the switch between event mode
and poll mode of cmd.

Link: https://lore.kernel.org/r/1567068102-56919-2-git-send-email-liweihang@hisilicon.com
Signed-off-by: Yixian Liu <liuyixian@huawei.com>
Signed-off-by: Weihang Li <liweihang@hisilicon.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/hns/hns_roce_cmd.c
drivers/infiniband/hw/hns/hns_roce_main.c