| 305 | } |
| 306 | |
| 307 | void |
| 308 | vhost_user_iotlb_cache_remove(struct virtio_net *dev, uint64_t iova, uint64_t size) |
| 309 | { |
| 310 | struct vhost_iotlb_entry *node, *temp_node, *prev_node = NULL; |
| 311 | |
| 312 | if (unlikely(!size)) |
| 313 | return; |
| 314 | |
| 315 | vhost_user_iotlb_wr_lock_all(dev); |
| 316 | |
| 317 | RTE_TAILQ_FOREACH_SAFE(node, &dev->iotlb_list, next, temp_node) { |
| 318 | /* Sorted list */ |
| 319 | if (unlikely(iova + size < node->iova)) |
| 320 | break; |
| 321 | |
| 322 | if (iova < node->iova + node->size) { |
| 323 | struct vhost_iotlb_entry *next_node = RTE_TAILQ_NEXT(node, next); |
| 324 | |
| 325 | vhost_user_iotlb_clear_dump(node, prev_node, next_node); |
| 326 | |
| 327 | TAILQ_REMOVE(&dev->iotlb_list, node, next); |
| 328 | vhost_user_iotlb_remove_notify(dev, node); |
| 329 | vhost_user_iotlb_pool_put(dev, node); |
| 330 | dev->iotlb_cache_nr--; |
| 331 | } else { |
| 332 | prev_node = node; |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | vhost_user_iotlb_wr_unlock_all(dev); |
| 337 | } |
| 338 | |
| 339 | uint64_t |
| 340 | vhost_user_iotlb_cache_find(struct virtio_net *dev, uint64_t iova, uint64_t *size, uint8_t perm) |
no test coverage detected