| 144 | } |
| 145 | |
| 146 | void |
| 147 | vhost_user_iotlb_pending_insert(struct virtio_net *dev, uint64_t iova, uint8_t perm) |
| 148 | { |
| 149 | struct vhost_iotlb_entry *node; |
| 150 | |
| 151 | node = vhost_user_iotlb_pool_get(dev); |
| 152 | if (node == NULL) { |
| 153 | VHOST_LOG_CONFIG(dev->ifname, DEBUG, |
| 154 | "IOTLB pool empty, clear entries for pending insertion\n"); |
| 155 | if (!TAILQ_EMPTY(&dev->iotlb_pending_list)) |
| 156 | vhost_user_iotlb_pending_remove_all(dev); |
| 157 | else |
| 158 | vhost_user_iotlb_cache_random_evict(dev); |
| 159 | node = vhost_user_iotlb_pool_get(dev); |
| 160 | if (node == NULL) { |
| 161 | VHOST_LOG_CONFIG(dev->ifname, ERR, |
| 162 | "IOTLB pool still empty, pending insertion failure\n"); |
| 163 | return; |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | node->iova = iova; |
| 168 | node->perm = perm; |
| 169 | |
| 170 | rte_rwlock_write_lock(&dev->iotlb_pending_lock); |
| 171 | |
| 172 | TAILQ_INSERT_TAIL(&dev->iotlb_pending_list, node, next); |
| 173 | |
| 174 | rte_rwlock_write_unlock(&dev->iotlb_pending_lock); |
| 175 | } |
| 176 | |
| 177 | void |
| 178 | vhost_user_iotlb_pending_remove(struct virtio_net *dev, uint64_t iova, uint64_t size, uint8_t perm) |
no test coverage detected