hns_roce_hw_v2_dfx.c (814B)
1// SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) 2// Copyright (c) 2019 Hisilicon Limited. 3 4#include "hnae3.h" 5#include "hns_roce_device.h" 6#include "hns_roce_cmd.h" 7#include "hns_roce_hw_v2.h" 8 9int hns_roce_v2_query_cqc_info(struct hns_roce_dev *hr_dev, u32 cqn, 10 int *buffer) 11{ 12 struct hns_roce_v2_cq_context *cq_context; 13 struct hns_roce_cmd_mailbox *mailbox; 14 int ret; 15 16 mailbox = hns_roce_alloc_cmd_mailbox(hr_dev); 17 if (IS_ERR(mailbox)) 18 return PTR_ERR(mailbox); 19 20 cq_context = mailbox->buf; 21 ret = hns_roce_cmd_mbox(hr_dev, 0, mailbox->dma, HNS_ROCE_CMD_QUERY_CQC, 22 cqn); 23 if (ret) { 24 dev_err(hr_dev->dev, "QUERY cqc cmd process error\n"); 25 goto err_mailbox; 26 } 27 28 memcpy(buffer, cq_context, sizeof(*cq_context)); 29 30err_mailbox: 31 hns_roce_free_cmd_mailbox(hr_dev, mailbox); 32 33 return ret; 34}