dm writecache: add cond_resched to loop in persistent_memory_claim()
[linux/fpc-iii.git] / drivers / infiniband / hw / hns / hns_roce_hw_v2_dfx.c
blob5a97b5a0b7be34040ad2888ea97f7c4dacdfdd01
1 // SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2 // Copyright (c) 2019 Hisilicon Limited.
4 #include "hnae3.h"
5 #include "hns_roce_device.h"
6 #include "hns_roce_cmd.h"
7 #include "hns_roce_hw_v2.h"
9 int hns_roce_v2_query_cqc_info(struct hns_roce_dev *hr_dev, u32 cqn,
10 int *buffer)
12 struct hns_roce_v2_cq_context *cq_context;
13 struct hns_roce_cmd_mailbox *mailbox;
14 int ret;
16 mailbox = hns_roce_alloc_cmd_mailbox(hr_dev);
17 if (IS_ERR(mailbox))
18 return PTR_ERR(mailbox);
20 cq_context = mailbox->buf;
21 ret = hns_roce_cmd_mbox(hr_dev, 0, mailbox->dma, cqn, 0,
22 HNS_ROCE_CMD_QUERY_CQC,
23 HNS_ROCE_CMD_TIMEOUT_MSECS);
24 if (ret) {
25 dev_err(hr_dev->dev, "QUERY cqc cmd process error\n");
26 goto err_mailbox;
29 memcpy(buffer, cq_context, sizeof(*cq_context));
31 err_mailbox:
32 hns_roce_free_cmd_mailbox(hr_dev, mailbox);
34 return ret;