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

Function write_back_completed_descs_split

dpdk/lib/vhost/virtio_net.c:2185–2215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2183}
2184
2185static __rte_always_inline void
2186write_back_completed_descs_split(struct vhost_virtqueue *vq, uint16_t n_descs)
2187 __rte_shared_locks_required(&vq->access_lock)
2188{
2189 struct vhost_async *async = vq->async;
2190 uint16_t nr_left = n_descs;
2191 uint16_t nr_copy;
2192 uint16_t to, from;
2193
2194 do {
2195 from = async->last_desc_idx_split & (vq->size - 1);
2196 nr_copy = nr_left + from <= vq->size ? nr_left : vq->size - from;
2197 to = vq->last_used_idx & (vq->size - 1);
2198
2199 if (to + nr_copy <= vq->size) {
2200 rte_memcpy(&vq->used->ring[to], &async->descs_split[from],
2201 nr_copy * sizeof(struct vring_used_elem));
2202 } else {
2203 uint16_t size = vq->size - to;
2204
2205 rte_memcpy(&vq->used->ring[to], &async->descs_split[from],
2206 size * sizeof(struct vring_used_elem));
2207 rte_memcpy(&vq->used->ring[0], &async->descs_split[from + size],
2208 (nr_copy - size) * sizeof(struct vring_used_elem));
2209 }
2210
2211 async->last_desc_idx_split += nr_copy;
2212 vq->last_used_idx += nr_copy;
2213 nr_left -= nr_copy;
2214 } while (nr_left > 0);
2215}
2216
2217static __rte_always_inline void
2218write_back_completed_descs_packed(struct vhost_virtqueue *vq,

Callers 2

Calls 1

rte_memcpyFunction · 0.50

Tested by

no test coverage detected