summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/hns/hns_roce_cmd.c
diff options
context:
space:
mode:
authorYixian Liu <liuyixian@huawei.com>2019-08-29 16:41:41 +0800
committerJason Gunthorpe <jgg@mellanox.com>2019-09-16 10:52:20 -0300
commit3d50503b3b33d87bc929eee6b65d206a36bc4579 (patch)
tree18823d35d3d5666aca9466dedb30c9279df9eb44 /drivers/infiniband/hw/hns/hns_roce_cmd.c
parentf8659d68e2bee5b86a1beaf7be42d942e1fc81f4 (diff)
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>
Diffstat (limited to 'drivers/infiniband/hw/hns/hns_roce_cmd.c')
-rw-r--r--drivers/infiniband/hw/hns/hns_roce_cmd.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/drivers/infiniband/hw/hns/hns_roce_cmd.c b/drivers/infiniband/hw/hns/hns_roce_cmd.c
index ade26faade8d..455d533dd7c4 100644
--- a/drivers/infiniband/hw/hns/hns_roce_cmd.c
+++ b/drivers/infiniband/hw/hns/hns_roce_cmd.c
@@ -251,23 +251,15 @@ int hns_roce_cmd_use_events(struct hns_roce_dev *hr_dev)
hr_cmd->token_mask = CMD_TOKEN_MASK;
hr_cmd->use_events = 1;
- down(&hr_cmd->poll_sem);
-
return 0;
}
void hns_roce_cmd_use_polling(struct hns_roce_dev *hr_dev)
{
struct hns_roce_cmdq *hr_cmd = &hr_dev->cmd;
- int i;
-
- hr_cmd->use_events = 0;
-
- for (i = 0; i < hr_cmd->max_cmds; ++i)
- down(&hr_cmd->event_sem);
kfree(hr_cmd->context);
- up(&hr_cmd->poll_sem);
+ hr_cmd->use_events = 0;
}
struct hns_roce_cmd_mailbox