Use vppinfra bitmap for dpdk coremask
Change-Id: Iec5ebadf120f742f43a681c4d394aa97ad2ae1e1 Signed-off-by: Damjan Marion <damarion@cisco.com>
This commit is contained in:
@ -1303,24 +1303,23 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
|
||||
if (!dm->coremask_set_manually)
|
||||
{
|
||||
vlib_thread_registration_t * tr;
|
||||
uword coremask;
|
||||
uword * coremask = 0;
|
||||
int i;
|
||||
|
||||
/* main thread core */
|
||||
coremask = 1 << tm->main_lcore;
|
||||
coremask = clib_bitmap_set(coremask, tm->main_lcore, 1);
|
||||
|
||||
for (i = 0; i < vec_len (tm->registrations); i++)
|
||||
{
|
||||
tr = tm->registrations[i];
|
||||
if (clib_bitmap_is_zero(tr->coremask))
|
||||
continue;
|
||||
coremask |= tr->coremask[0];
|
||||
coremask = clib_bitmap_or(coremask, tr->coremask);
|
||||
}
|
||||
|
||||
vec_insert (dm->eal_init_args, 2, 1);
|
||||
dm->eal_init_args[1] = (u8 *) "-c";
|
||||
tmp = format (0, "%x%c", coremask, 0);
|
||||
tmp = format (0, "%U%c", format_bitmap_hex, coremask, 0);
|
||||
dm->eal_init_args[2] = tmp;
|
||||
clib_bitmap_free(coremask);
|
||||
}
|
||||
|
||||
if (!dm->nchannels_set_manually)
|
||||
|
@ -542,7 +542,7 @@ unformat_bitmap_list(unformat_input_t * input, va_list * va)
|
||||
else
|
||||
goto error;
|
||||
|
||||
if ((b < a) || (b > 63))
|
||||
if (b < a)
|
||||
goto error;
|
||||
|
||||
for (i = a; i <= b; i++)
|
||||
@ -555,4 +555,27 @@ error:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline u8 *
|
||||
format_bitmap_hex(u8 * s, va_list * args)
|
||||
{
|
||||
uword * bitmap = va_arg (*args, uword *);
|
||||
int i, is_trailing_zero = 1;
|
||||
|
||||
if (!bitmap)
|
||||
return format(s, "0");
|
||||
|
||||
i = vec_bytes (bitmap) * 2;
|
||||
|
||||
while (i > 0)
|
||||
{
|
||||
u8 x = clib_bitmap_get_multiple(bitmap, --i * 4, 4);
|
||||
|
||||
if (x && is_trailing_zero)
|
||||
is_trailing_zero = 0;
|
||||
|
||||
if (x || !is_trailing_zero)
|
||||
s = format(s, "%x", x);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
#endif /* included_clib_bitmap_h */
|
||||
|
Reference in New Issue
Block a user