X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=drivers%2Fnet%2Fifc%2Fifcvf_vdpa.c;h=e1edb328cc1a7968d655cea621e6964d067a9875;hb=45e4cf1939106f4894d9025c7c4e1bef7f66749d;hp=7d3085d8dc921246b7eaaa57a917b91724c77ea2;hpb=d7fe5a2861e7be43be746592193fe57b57601c9e;p=dpdk.git diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c index 7d3085d8dc..e1edb328cc 100644 --- a/drivers/net/ifc/ifcvf_vdpa.c +++ b/drivers/net/ifc/ifcvf_vdpa.c @@ -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); @@ -206,7 +204,7 @@ exit: } static uint64_t -qva_to_gpa(int vid, uint64_t qva) +hva_to_gpa(int vid, uint64_t hva) { struct rte_vhost_memory *mem = NULL; struct rte_vhost_mem_region *reg; @@ -219,9 +217,9 @@ qva_to_gpa(int vid, uint64_t qva) for (i = 0; i < mem->nregions; i++) { reg = &mem->regions[i]; - if (qva >= reg->host_user_addr && - qva < reg->host_user_addr + reg->size) { - gpa = qva - reg->host_user_addr + reg->guest_phys_addr; + if (hva >= reg->host_user_addr && + hva < reg->host_user_addr + reg->size) { + gpa = hva - reg->host_user_addr + reg->guest_phys_addr; break; } } @@ -247,21 +245,21 @@ vdpa_ifcvf_start(struct ifcvf_internal *internal) for (i = 0; i < nr_vring; i++) { rte_vhost_get_vhost_vring(vid, i, &vq); - gpa = qva_to_gpa(vid, (uint64_t)(uintptr_t)vq.desc); + gpa = hva_to_gpa(vid, (uint64_t)(uintptr_t)vq.desc); if (gpa == 0) { DRV_LOG(ERR, "Fail to get GPA for descriptor ring."); return -1; } hw->vring[i].desc = gpa; - gpa = qva_to_gpa(vid, (uint64_t)(uintptr_t)vq.avail); + gpa = hva_to_gpa(vid, (uint64_t)(uintptr_t)vq.avail); if (gpa == 0) { DRV_LOG(ERR, "Fail to get GPA for available ring."); return -1; } hw->vring[i].avail = gpa; - gpa = qva_to_gpa(vid, (uint64_t)(uintptr_t)vq.used); + gpa = hva_to_gpa(vid, (uint64_t)(uintptr_t)vq.used); if (gpa == 0) { DRV_LOG(ERR, "Fail to get GPA for used ring."); return -1; @@ -285,7 +283,7 @@ ifcvf_used_ring_log(struct ifcvf_hw *hw, uint32_t queue, uint8_t *log_buf) pfn = hw->vring[queue].used / PAGE_SIZE; size = hw->vring[queue].size * sizeof(struct vring_used_elem) + - sizeof(__virtio16) * 3; + sizeof(uint16_t) * 3; for (i = 0; i <= size / PAGE_SIZE; i++) __sync_fetch_and_or_8(&log_buf[(pfn + i) / 8], @@ -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 &