1 // SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2 // Copyright (c) 2019 Hisilicon Limited.
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,
12 struct hns_roce_v2_cq_context *cq_context;
13 struct hns_roce_cmd_mailbox *mailbox;
16 mailbox = hns_roce_alloc_cmd_mailbox(hr_dev);
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);
25 dev_err(hr_dev->dev, "QUERY cqc cmd process error\n");
29 memcpy(buffer, cq_context, sizeof(*cq_context));
32 hns_roce_free_cmd_mailbox(hr_dev, mailbox);