提交 6716be3c 编写于 作者: S Shunfeng Yang 提交者: Yang Yingliang

RDMA/hns: Support to query firmware version

mainline inclusion
from mainline-v5.13
commit 847d19a4
category: bugfix
bugzilla: NA
CVE: NA

Implement the ops named get_dev_fw_str to support ib_get_device_fw_str().
Signed-off-by: NShunfeng Yang <yangshunfeng2@huawei.com>
Signed-off-by: NYangyang Li <liyangyang20@huawei.com>
Reviewed-by: Nchunzhi hu <huchunzhi@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 84fdb438
......@@ -701,6 +701,19 @@ static void hns_roce_disassociate_ucontext(struct ib_ucontext *ibcontext)
mutex_unlock(&context->vma_list_mutex);
}
static void hns_roce_get_fw_ver(struct ib_device *device, char *str)
{
u64 fw_ver = to_hr_dev(device)->caps.fw_ver;
unsigned int major, minor, sub_minor;
major = upper_32_bits(fw_ver);
minor = high_16_bits(lower_32_bits(fw_ver));
sub_minor = low_16_bits(fw_ver);
snprintf(str, IB_FW_VERSION_NAME_MAX, "%u.%u.%04u", major, minor,
sub_minor);
}
static const char * const hns_roce_hw_stats_name[] = {
"pd_alloc",
"pd_dealloc",
......@@ -923,6 +936,9 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev)
ib_dev->dealloc_ucontext = hns_roce_dealloc_ucontext;
ib_dev->mmap = hns_roce_mmap;
/* FW */
ib_dev->get_dev_fw_str = hns_roce_get_fw_ver;
/* PD */
ib_dev->alloc_pd = hns_roce_alloc_pd;
ib_dev->dealloc_pd = hns_roce_dealloc_pd;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册