If the device is a virtual function, the corresponding device capability flag should be set when querying the device. Fixes: 0b567cde9d7a ("RDMA/hns: Enable RoCE on virtual functions") Signed-off-by: Wenpeng Liang <liangwenpeng@xxxxxxxxxx> --- drivers/infiniband/hw/hns/hns_roce_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c index f73ba619f375..8dd1809947fb 100644 --- a/drivers/infiniband/hw/hns/hns_roce_main.c +++ b/drivers/infiniband/hw/hns/hns_roce_main.c @@ -207,6 +207,9 @@ static int hns_roce_query_device(struct ib_device *ib_dev, if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_XRC) props->device_cap_flags |= IB_DEVICE_XRC; + if (hr_dev->is_vf) + props->device_cap_flags |= IB_DEVICE_VIRTUAL_FUNCTION; + return 0; } -- 2.33.0