vlib_buffer_main_t *bm = vm->buffer_main;
vlib_physmem_main_t *vpm = &vm->physmem_main;
struct rte_mempool *rmp;
+#if RTE_VERSION < RTE_VERSION_NUM(16, 7, 0, 0)
uword new_start, new_size;
+#endif
int i;
if (!rte_pktmbuf_pool_create)
VLIB_BUFFER_PRE_DATA_SIZE + VLIB_BUFFER_DATA_SIZE, /* dataroom size */
socket_id); /* cpu socket */
- vec_free (pool_name);
-
if (rmp)
{
- new_start = pointer_to_uword (rmp);
#if RTE_VERSION >= RTE_VERSION_NUM(16, 7, 0, 0)
- new_size = (uintptr_t)STAILQ_FIRST(&rmp->mem_list)->addr + STAILQ_FIRST(&rmp->mem_list)->len - new_start;
+ {
+ uword this_pool_end;
+ uword this_pool_start;
+ uword this_pool_size;
+ uword save_vpm_start, save_vpm_end, save_vpm_size;
+ struct rte_mempool_memhdr *memhdr;
+
+ this_pool_start = ~0ULL;
+ this_pool_end = 0LL;
+
+ STAILQ_FOREACH (memhdr, &rmp->mem_list, next)
+ {
+ if (((uword)(memhdr->addr + memhdr->len)) > this_pool_end)
+ this_pool_end = (uword)(memhdr->addr + memhdr->len);
+ if (((uword)memhdr->addr) < this_pool_start)
+ this_pool_start = (uword)(memhdr->addr);
+ }
+ ASSERT (this_pool_start < ~0ULL && this_pool_end > 0);
+ this_pool_size = this_pool_end - this_pool_start;
+
+ if (CLIB_DEBUG > 1)
+ {
+ clib_warning ("%s: pool start %llx pool end %llx pool size %lld",
+ pool_name, this_pool_start, this_pool_end,
+ this_pool_size);
+ clib_warning
+ ("before: virtual.start %llx virtual.end %llx virtual.size %lld",
+ vpm->virtual.start, vpm->virtual.end, vpm->virtual.size);
+ }
+
+ save_vpm_start = vpm->virtual.start;
+ save_vpm_end = vpm->virtual.end;
+ save_vpm_size = vpm->virtual.size;
+
+ if ((this_pool_start < vpm->virtual.start) || vpm->virtual.start == 0)
+ vpm->virtual.start = this_pool_start;
+ if (this_pool_end > vpm->virtual.end)
+ vpm->virtual.end = this_pool_end;
+
+ vpm->virtual.size = vpm->virtual.end - vpm->virtual.start;
+
+ if (CLIB_DEBUG > 1)
+ {
+ clib_warning
+ ("after: virtual.start %llx virtual.end %llx virtual.size %lld",
+ vpm->virtual.start, vpm->virtual.end, vpm->virtual.size);
+ }
+
+ /* check if fits into buffer index range */
+ if ((u64) vpm->virtual.size >
+ ((u64) 1 << (32 + CLIB_LOG2_CACHE_LINE_BYTES)))
+ {
+ clib_warning ("physmem: virtual size out of range!");
+ vpm->virtual.start = save_vpm_start;
+ vpm->virtual.end = save_vpm_end;
+ vpm->virtual.size = save_vpm_size;
+ rmp = 0;
+ }
+ }
+ if (rmp)
+ {
+ bm->pktmbuf_pools[socket_id] = rmp;
+ vec_free(pool_name);
+ return 0;
+ }
+ }
#else
+ new_start = pointer_to_uword (rmp);
new_size = rmp->elt_va_end - new_start;
-#endif
if (vpm->virtual.size > 0)
{
vpm->virtual.start = new_start;
vpm->virtual.size = new_size;
vpm->virtual.end = new_start + new_size;
+ vec_free(pool_name);
return 0;
}
+#endif
+
+ vec_free (pool_name);
/* no usable pool for this socket, try to use pool from another one */
for (i = 0; i < vec_len (bm->pktmbuf_pools); i++)
{
int rv = 0;
vl_api_create_vhost_user_if_reply_t * rmp;
-#if DPDK > 0 && DPDK_VHOST_USER
+#if DPDK > 0
u32 sw_if_index = (u32)~0;
vnet_main_t * vnm = vnet_get_main();
vlib_main_t * vm = vlib_get_main();
- rv = dpdk_vhost_user_create_if(vnm, vm, (char *)mp->sock_filename,
+ rv = vhost_user_create_if(vnm, vm, (char *)mp->sock_filename,
mp->is_server, &sw_if_index, (u64)~0,
mp->renumber, ntohl(mp->custom_dev_instance),
(mp->use_custom_mac)?mp->mac_address:NULL);