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

Function vhost_alloc_copy_ind_table

dpdk/lib/vhost/vhost.c:306–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304}
305
306void *
307vhost_alloc_copy_ind_table(struct virtio_net *dev, struct vhost_virtqueue *vq,
308 uint64_t desc_addr, uint64_t desc_len)
309{
310 void *idesc;
311 uint64_t src, dst;
312 uint64_t len, remain = desc_len;
313
314 idesc = rte_malloc_socket(__func__, desc_len, 0, vq->numa_node);
315 if (unlikely(!idesc))
316 return NULL;
317
318 dst = (uint64_t)(uintptr_t)idesc;
319
320 while (remain) {
321 len = remain;
322 src = vhost_iova_to_vva(dev, vq, desc_addr, &len,
323 VHOST_ACCESS_RO);
324 if (unlikely(!src || !len)) {
325 rte_free(idesc);
326 return NULL;
327 }
328
329 rte_memcpy((void *)(uintptr_t)dst, (void *)(uintptr_t)src, len);
330
331 remain -= len;
332 dst += len;
333 desc_addr += len;
334 }
335
336 return idesc;
337}
338
339void
340cleanup_vq(struct vhost_virtqueue *vq, int destroy)

Callers 3

fill_vec_buf_splitFunction · 0.85

Calls 3

rte_malloc_socketFunction · 0.85
rte_freeFunction · 0.85
rte_memcpyFunction · 0.50

Tested by

no test coverage detected