mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-25 18:30:06 +00:00
![Chengchang Tang](/assets/img/avatar_default.png)
The current mailbox functions have too many parameters, making the code difficult to maintain. So construct a new structure mbox_msg to pass the information needed by mailbox. Link: https://lore.kernel.org/r/20220302064830.61706-6-liangwenpeng@huawei.com Signed-off-by: Chengchang Tang <tangchengchang@huawei.com> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
34 lines
814 B
C
34 lines
814 B
C
// SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
|
|
// Copyright (c) 2019 Hisilicon Limited.
|
|
|
|
#include "hnae3.h"
|
|
#include "hns_roce_device.h"
|
|
#include "hns_roce_cmd.h"
|
|
#include "hns_roce_hw_v2.h"
|
|
|
|
int hns_roce_v2_query_cqc_info(struct hns_roce_dev *hr_dev, u32 cqn,
|
|
int *buffer)
|
|
{
|
|
struct hns_roce_v2_cq_context *cq_context;
|
|
struct hns_roce_cmd_mailbox *mailbox;
|
|
int ret;
|
|
|
|
mailbox = hns_roce_alloc_cmd_mailbox(hr_dev);
|
|
if (IS_ERR(mailbox))
|
|
return PTR_ERR(mailbox);
|
|
|
|
cq_context = mailbox->buf;
|
|
ret = hns_roce_cmd_mbox(hr_dev, 0, mailbox->dma, HNS_ROCE_CMD_QUERY_CQC,
|
|
cqn);
|
|
if (ret) {
|
|
dev_err(hr_dev->dev, "QUERY cqc cmd process error\n");
|
|
goto err_mailbox;
|
|
}
|
|
|
|
memcpy(buffer, cq_context, sizeof(*cq_context));
|
|
|
|
err_mailbox:
|
|
hns_roce_free_cmd_mailbox(hr_dev, mailbox);
|
|
|
|
return ret;
|
|
}
|