Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

RDMA/hns: Support to query firmware version

Implement the ops named get_dev_fw_str to support ib_get_device_fw_str().

Link: https://lore.kernel.org/r/1615882161-53827-1-git-send-email-liweihang@huawei.com
Signed-off-by: Lang Cheng <chenglang@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

authored by

Lang Cheng and committed by
Jason Gunthorpe
847d19a4 ad50294d

+14
+14
drivers/infiniband/hw/hns/hns_roce_main.c
··· 394 394 { 395 395 } 396 396 397 + static void hns_roce_get_fw_ver(struct ib_device *device, char *str) 398 + { 399 + u64 fw_ver = to_hr_dev(device)->caps.fw_ver; 400 + unsigned int major, minor, sub_minor; 401 + 402 + major = upper_32_bits(fw_ver); 403 + minor = high_16_bits(lower_32_bits(fw_ver)); 404 + sub_minor = low_16_bits(fw_ver); 405 + 406 + snprintf(str, IB_FW_VERSION_NAME_MAX, "%u.%u.%04u", major, minor, 407 + sub_minor); 408 + } 409 + 397 410 static void hns_roce_unregister_device(struct hns_roce_dev *hr_dev) 398 411 { 399 412 struct hns_roce_ib_iboe *iboe = &hr_dev->iboe; ··· 422 409 .uverbs_abi_ver = 1, 423 410 .uverbs_no_driver_id_binding = 1, 424 411 412 + .get_dev_fw_str = hns_roce_get_fw_ver, 425 413 .add_gid = hns_roce_add_gid, 426 414 .alloc_pd = hns_roce_alloc_pd, 427 415 .alloc_ucontext = hns_roce_alloc_ucontext,