MCPcopy Create free account
hub / github.com/F-Stack/f-stack / qva_to_vva

Function qva_to_vva

dpdk/lib/vhost/vhost_user.c:681–708  ·  view source on GitHub ↗

Converts QEMU virtual address to Vhost virtual address. */

Source from the content-addressed store, hash-verified

679
680/* Converts QEMU virtual address to Vhost virtual address. */
681static uint64_t
682qva_to_vva(struct virtio_net *dev, uint64_t qva, uint64_t *len)
683{
684 struct rte_vhost_mem_region *r;
685 uint32_t i;
686
687 if (unlikely(!dev || !dev->mem))
688 goto out_error;
689
690 /* Find the region where the address lives. */
691 for (i = 0; i < dev->mem->nregions; i++) {
692 r = &dev->mem->regions[i];
693
694 if (qva >= r->guest_user_addr &&
695 qva < r->guest_user_addr + r->size) {
696
697 if (unlikely(*len > r->guest_user_addr + r->size - qva))
698 *len = r->guest_user_addr + r->size - qva;
699
700 return qva - r->guest_user_addr +
701 r->host_user_addr;
702 }
703 }
704out_error:
705 *len = 0;
706
707 return 0;
708}
709
710
711/*

Callers 2

ring_addr_to_vvaFunction · 0.85
vhost_user_iotlb_msgFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected