| 217 | } |
| 218 | |
| 219 | static void |
| 220 | vhost_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 | |
| 248 | void |
| 249 | vhost_user_iotlb_cache_insert(struct virtio_net *dev, uint64_t iova, uint64_t uaddr, |
no test coverage detected