- conf->uio_driver_name = format (0, "uio_pci_generic%c", 0);
-
- /*
- * Use 1G huge pages if available.
- */
- if (!no_huge && !huge_dir)
- {
- u32 x, *mem_by_socket = 0;
- uword c = 0;
- int rv;
-
- umount ((char *) huge_dir_path);
-
- /* Process "socket-mem" parameter value */
- if (vec_len (socket_mem))
- {
- unformat_input_t in;
- unformat_init_vector (&in, socket_mem);
- while (unformat_check_input (&in) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (&in, "%u,", &x))
- ;
- else if (unformat (&in, "%u", &x))
- ;
- else if (unformat (&in, ","))
- x = 0;
- else
- break;
-
- vec_add1 (mem_by_socket, x);
- }
- /* Note: unformat_free vec_frees(in.buffer), aka socket_mem... */
- unformat_free (&in);
- socket_mem = 0;
- }
- else
- {
- /* *INDENT-OFF* */
- clib_bitmap_foreach (c, tm->cpu_socket_bitmap, (
- {
- vec_validate(mem_by_socket, c);
- mem_by_socket[c] = 64; /* default per-socket mem */
- }
- ));
- /* *INDENT-ON* */
- }
-
- /* *INDENT-OFF* */
- clib_bitmap_foreach (c, tm->cpu_socket_bitmap, (
- {
- clib_error_t *e;
-
- vec_validate(mem_by_socket, c);
-
- e = clib_sysfs_prealloc_hugepages(c, 2 << 10, mem_by_socket[c] / 2);
- if (e)
- clib_error_report (e);
- }));
- /* *INDENT-ON* */
-
- if (mem_by_socket == 0)
- {
- error = clib_error_return (0, "mem_by_socket NULL");
- goto done;
- }
- _vec_len (mem_by_socket) = c + 1;
-
- /* regenerate socket_mem string */
- vec_foreach_index (x, mem_by_socket)
- socket_mem = format (socket_mem, "%s%u",
- socket_mem ? "," : "", mem_by_socket[x]);
- socket_mem = format (socket_mem, "%c", 0);
-
- vec_free (mem_by_socket);