net/ifc: invoke ifcvf HW init function in probe
authorXiaolong Ye <xiaolong.ye@intel.com>
Wed, 10 Oct 2018 13:22:35 +0000 (21:22 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 11 Oct 2018 16:56:02 +0000 (18:56 +0200)
As ifcvf_init_hw is independent with ifcvf_vfio_setup, it's better to
invoke it directly in probe func.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Xiao Wang <xiao.w.wang@intel.com>
drivers/net/ifc/ifcvf_vdpa.c

index 0d237ae..e1edb32 100644 (file)
@@ -112,7 +112,6 @@ ifcvf_vfio_setup(struct ifcvf_internal *internal)
        struct rte_pci_device *dev = internal->pdev;
        char devname[RTE_DEV_NAME_MAX_LEN] = {0};
        int iommu_group_num;
-       int ret = 0;
        int i;
 
        internal->vfio_dev_fd = -1;
@@ -146,9 +145,8 @@ ifcvf_vfio_setup(struct ifcvf_internal *internal)
                internal->hw.mem_resource[i].len =
                        internal->pdev->mem_resource[i].len;
        }
-       ret = ifcvf_init_hw(&internal->hw, internal->pdev);
 
-       return ret;
+       return 0;
 
 err:
        rte_vfio_container_destroy(internal->vfio_container_fd);
@@ -758,6 +756,9 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
        if (ifcvf_vfio_setup(internal) < 0)
                return -1;
 
+       if (ifcvf_init_hw(&internal->hw, internal->pdev) < 0)
+               return -1;
+
        internal->max_queues = IFCVF_MAX_QUEUES;
        features = ifcvf_get_features(&internal->hw);
        internal->features = (features &