linux/drivers/infiniband/hw/hns/hns_roce_hw_v2_dfx.c
<<
>>
Prefs
   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, 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;
  27        }
  28
  29        memcpy(buffer, cq_context, sizeof(*cq_context));
  30
  31err_mailbox:
  32        hns_roce_free_cmd_mailbox(hr_dev, mailbox);
  33
  34        return ret;
  35}
  36