rte_rwlock_write_lock(&vq->iotlb_pending_lock);
- TAILQ_FOREACH_SAFE(node, &vq->iotlb_pending_list, next, temp_node) {
+ RTE_TAILQ_FOREACH_SAFE(node, &vq->iotlb_pending_list, next, temp_node) {
TAILQ_REMOVE(&vq->iotlb_pending_list, node, next);
rte_mempool_put(vq->iotlb_pool, node);
}
}
void
-vhost_user_iotlb_pending_insert(struct vhost_virtqueue *vq,
+vhost_user_iotlb_pending_insert(struct virtio_net *dev, struct vhost_virtqueue *vq,
uint64_t iova, uint8_t perm)
{
struct vhost_iotlb_entry *node;
ret = rte_mempool_get(vq->iotlb_pool, (void **)&node);
if (ret) {
- VHOST_LOG_CONFIG(DEBUG, "IOTLB pool empty, clear entries\n");
+ VHOST_LOG_CONFIG(DEBUG,
+ "(%s) IOTLB pool %s empty, clear entries for pending insertion\n",
+ dev->ifname, vq->iotlb_pool->name);
if (!TAILQ_EMPTY(&vq->iotlb_pending_list))
vhost_user_iotlb_pending_remove_all(vq);
else
vhost_user_iotlb_cache_random_evict(vq);
ret = rte_mempool_get(vq->iotlb_pool, (void **)&node);
if (ret) {
- VHOST_LOG_CONFIG(ERR, "IOTLB pool still empty, failure\n");
+ VHOST_LOG_CONFIG(ERR,
+ "(%s) IOTLB pool %s still empty, pending insertion failure\n",
+ dev->ifname, vq->iotlb_pool->name);
return;
}
}
rte_rwlock_write_lock(&vq->iotlb_pending_lock);
- TAILQ_FOREACH_SAFE(node, &vq->iotlb_pending_list, next, temp_node) {
+ RTE_TAILQ_FOREACH_SAFE(node, &vq->iotlb_pending_list, next,
+ temp_node) {
if (node->iova < iova)
continue;
if (node->iova >= iova + size)
rte_rwlock_write_lock(&vq->iotlb_lock);
- TAILQ_FOREACH_SAFE(node, &vq->iotlb_list, next, temp_node) {
+ RTE_TAILQ_FOREACH_SAFE(node, &vq->iotlb_list, next, temp_node) {
TAILQ_REMOVE(&vq->iotlb_list, node, next);
rte_mempool_put(vq->iotlb_pool, node);
}
entry_idx = rte_rand() % vq->iotlb_cache_nr;
- TAILQ_FOREACH_SAFE(node, &vq->iotlb_list, next, temp_node) {
+ RTE_TAILQ_FOREACH_SAFE(node, &vq->iotlb_list, next, temp_node) {
if (!entry_idx) {
TAILQ_REMOVE(&vq->iotlb_list, node, next);
rte_mempool_put(vq->iotlb_pool, node);
}
void
-vhost_user_iotlb_cache_insert(struct vhost_virtqueue *vq, uint64_t iova,
- uint64_t uaddr, uint64_t size, uint8_t perm)
+vhost_user_iotlb_cache_insert(struct virtio_net *dev, struct vhost_virtqueue *vq,
+ uint64_t iova, uint64_t uaddr,
+ uint64_t size, uint8_t perm)
{
struct vhost_iotlb_entry *node, *new_node;
int ret;
ret = rte_mempool_get(vq->iotlb_pool, (void **)&new_node);
if (ret) {
- VHOST_LOG_CONFIG(DEBUG, "IOTLB pool empty, clear entries\n");
+ VHOST_LOG_CONFIG(DEBUG,
+ "(%s) IOTLB pool %s empty, clear entries for cache insertion\n",
+ dev->ifname, vq->iotlb_pool->name);
if (!TAILQ_EMPTY(&vq->iotlb_list))
vhost_user_iotlb_cache_random_evict(vq);
else
vhost_user_iotlb_pending_remove_all(vq);
ret = rte_mempool_get(vq->iotlb_pool, (void **)&new_node);
if (ret) {
- VHOST_LOG_CONFIG(ERR, "IOTLB pool still empty, failure\n");
+ VHOST_LOG_CONFIG(ERR,
+ "(%s) IOTLB pool %s still empty, cache insertion failed\n",
+ dev->ifname, vq->iotlb_pool->name);
return;
}
}
rte_rwlock_write_lock(&vq->iotlb_lock);
- TAILQ_FOREACH_SAFE(node, &vq->iotlb_list, next, temp_node) {
+ RTE_TAILQ_FOREACH_SAFE(node, &vq->iotlb_list, next, temp_node) {
/* Sorted list */
if (unlikely(iova + size < node->iova))
break;
snprintf(pool_name, sizeof(pool_name), "iotlb_%u_%d_%d",
getpid(), dev->vid, vq_index);
- VHOST_LOG_CONFIG(DEBUG, "IOTLB cache name: %s\n", pool_name);
+ VHOST_LOG_CONFIG(DEBUG, "(%s) IOTLB cache name: %s\n", dev->ifname, pool_name);
/* If already created, free it and recreate */
vq->iotlb_pool = rte_mempool_lookup(pool_name);
- if (vq->iotlb_pool)
- rte_mempool_free(vq->iotlb_pool);
+ rte_mempool_free(vq->iotlb_pool);
vq->iotlb_pool = rte_mempool_create(pool_name,
IOTLB_CACHE_SIZE, sizeof(struct vhost_iotlb_entry), 0,
0, 0, NULL, NULL, NULL, socket,
- MEMPOOL_F_NO_CACHE_ALIGN |
- MEMPOOL_F_SP_PUT);
+ RTE_MEMPOOL_F_NO_CACHE_ALIGN |
+ RTE_MEMPOOL_F_SP_PUT);
if (!vq->iotlb_pool) {
- VHOST_LOG_CONFIG(ERR,
- "Failed to create IOTLB cache pool (%s)\n",
- pool_name);
+ VHOST_LOG_CONFIG(ERR, "(%s) Failed to create IOTLB cache pool %s\n",
+ dev->ifname, pool_name);
return -1;
}