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

Function vhost_user_iotlb_cache_random_evict

dpdk/lib/vhost/iotlb.c:219–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217}
218
219static void
220vhost_user_iotlb_cache_random_evict(struct virtio_net *dev)
221{
222 struct vhost_iotlb_entry *node, *temp_node, *prev_node = NULL;
223 int entry_idx;
224
225 vhost_user_iotlb_wr_lock_all(dev);
226
227 entry_idx = rte_rand() % dev->iotlb_cache_nr;
228
229 RTE_TAILQ_FOREACH_SAFE(node, &dev->iotlb_list, next, temp_node) {
230 if (!entry_idx) {
231 struct vhost_iotlb_entry *next_node = RTE_TAILQ_NEXT(node, next);
232
233 vhost_user_iotlb_clear_dump(node, prev_node, next_node);
234
235 TAILQ_REMOVE(&dev->iotlb_list, node, next);
236 vhost_user_iotlb_remove_notify(dev, node);
237 vhost_user_iotlb_pool_put(dev, node);
238 dev->iotlb_cache_nr--;
239 break;
240 }
241 prev_node = node;
242 entry_idx--;
243 }
244
245 vhost_user_iotlb_wr_unlock_all(dev);
246}
247
248void
249vhost_user_iotlb_cache_insert(struct virtio_net *dev, uint64_t iova, uint64_t uaddr,

Callers 2

Calls 4

rte_randFunction · 0.85

Tested by

no test coverage detected