0001
0002
0003
0004 #include "hnae3.h"
0005 #include "hns_roce_device.h"
0006 #include "hns_roce_cmd.h"
0007 #include "hns_roce_hw_v2.h"
0008
0009 int hns_roce_v2_query_cqc_info(struct hns_roce_dev *hr_dev, u32 cqn,
0010 int *buffer)
0011 {
0012 struct hns_roce_v2_cq_context *cq_context;
0013 struct hns_roce_cmd_mailbox *mailbox;
0014 int ret;
0015
0016 mailbox = hns_roce_alloc_cmd_mailbox(hr_dev);
0017 if (IS_ERR(mailbox))
0018 return PTR_ERR(mailbox);
0019
0020 cq_context = mailbox->buf;
0021 ret = hns_roce_cmd_mbox(hr_dev, 0, mailbox->dma, HNS_ROCE_CMD_QUERY_CQC,
0022 cqn);
0023 if (ret) {
0024 dev_err(hr_dev->dev, "QUERY cqc cmd process error\n");
0025 goto err_mailbox;
0026 }
0027
0028 memcpy(buffer, cq_context, sizeof(*cq_context));
0029
0030 err_mailbox:
0031 hns_roce_free_cmd_mailbox(hr_dev, mailbox);
0032
0033 return ret;
0034 }