#include <errno.h>
#include <sys/mman.h>
#include <sys/queue.h>
+#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686)
#include <sys/io.h>
+#endif
#include <rte_common.h>
#include <rte_debug.h>
#include <rte_memory.h>
#include <rte_memzone.h>
#include <rte_launch.h>
-#include <rte_tailq.h>
#include <rte_eal.h>
#include <rte_eal_memconfig.h>
#include <rte_per_lcore.h>
printf("\nUsage: %s ", prgname);
eal_common_usage();
printf("EAL Linux options:\n"
- " -d LIB.so : add driver (can be used multiple times)\n"
- " --"OPT_XEN_DOM0" : support application running on Xen Domain0 "
- "without hugetlbfs\n"
- " --"OPT_SOCKET_MEM" : memory to allocate on specific\n"
- " sockets (use comma separated values)\n"
- " --"OPT_HUGE_DIR" : directory where hugetlbfs is mounted\n"
- " --"OPT_FILE_PREFIX": prefix for hugepage filenames\n"
- " --"OPT_BASE_VIRTADDR": specify base virtual address\n"
- " --"OPT_VFIO_INTR": specify desired interrupt mode for VFIO "
- "(legacy|msi|msix)\n"
- " --"OPT_CREATE_UIO_DEV": create /dev/uioX (usually done by hotplug)\n"
+ " -d LIB.so Add driver (can be used multiple times)\n"
+ " --"OPT_SOCKET_MEM" Memory to allocate on sockets (comma separated values)\n"
+ " --"OPT_HUGE_DIR" Directory where hugetlbfs is mounted\n"
+ " --"OPT_FILE_PREFIX" Prefix for hugepage filenames\n"
+ " --"OPT_BASE_VIRTADDR" Base virtual address\n"
+ " --"OPT_CREATE_UIO_DEV" Create /dev/uioX (usually done by hotplug)\n"
+ " --"OPT_VFIO_INTR" Interrupt mode for VFIO (legacy|msi|msix)\n"
+ " --"OPT_XEN_DOM0" Support running on Xen dom0 without hugetlbfs\n"
"\n");
/* Allow the application to print its usage message too if hook is set */
if ( rte_application_usage_hook ) {
return -1;
/* make sure we don't exceed 32-bit boundary on 32-bit target */
-#ifndef RTE_ARCH_X86_64
+#ifndef RTE_ARCH_64
if (addr >= UINTPTR_MAX)
return -1;
#endif
- /* align the addr on 2M boundary */
- internal_config.base_virtaddr = RTE_PTR_ALIGN_CEIL((uintptr_t)addr,
- RTE_PGSIZE_2M);
+ /* align the addr on 16M boundary, 16MB is the minimum huge page
+ * size on IBM Power architecture. If the addr is aligned to 16MB,
+ * it can align to 2MB for x86. So this alignment can also be used
+ * on x86 */
+ internal_config.base_virtaddr =
+ RTE_PTR_ALIGN_CEIL((uintptr_t)addr, (size_t)RTE_PGSIZE_16M);
return 0;
}
int ret;
/* getopt is not happy, stop right now */
- if (opt == '?')
+ if (opt == '?') {
+ eal_usage(prgname);
return -1;
+ }
ret = eal_parse_common_option(opt, optarg, &internal_config);
/* common parser is not happy */
continue;
switch (opt) {
+ case 'h':
+ eal_usage(prgname);
+ exit(EXIT_SUCCESS);
+
/* force loading of external driver */
case 'd':
solib = malloc(sizeof(*solib));
/*
* Request iopl privilege for all RPL, returns 0 on success
+ * iopl() call is mostly for the i386 architecture. For other architectures,
+ * return -1 to indicate IO privilege can't be changed in this way.
*/
int
rte_eal_iopl_init(void)
{
+#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686)
if (iopl(3) != 0)
return -1;
return 0;
+#else
+ return -1;
+#endif
}
/* Launch threads, called at application init(). */
static rte_atomic32_t run_once = RTE_ATOMIC32_INIT(0);
struct shared_driver *solib = NULL;
const char *logid;
+ char cpuset[RTE_CPU_AFFINITY_STR_LEN];
if (!rte_atomic32_test_and_set(&run_once))
return -1;
eal_thread_init_master(rte_config.master_lcore);
- RTE_LOG(DEBUG, EAL, "Master core %u is ready (tid=%x)\n",
- rte_config.master_lcore, (int)thread_id);
+ ret = eal_thread_dump_affinity(cpuset, RTE_CPU_AFFINITY_STR_LEN);
+
+ RTE_LOG(DEBUG, EAL, "Master lcore %u is ready (tid=%x;cpuset=[%s%s])\n",
+ rte_config.master_lcore, (int)thread_id, cpuset,
+ ret == 0 ? "" : "...");
if (rte_eal_dev_init() < 0)
rte_panic("Cannot init pmd devices\n");
{
return ! internal_config.no_hugetlbfs;
}
+
+int
+rte_eal_check_module(const char *module_name)
+{
+ char mod_name[30]; /* Any module names can be longer than 30 bytes? */
+ int ret = 0;
+ int n;
+
+ if (NULL == module_name)
+ return -1;
+
+ FILE *fd = fopen("/proc/modules", "r");
+ if (NULL == fd) {
+ RTE_LOG(ERR, EAL, "Open /proc/modules failed!"
+ " error %i (%s)\n", errno, strerror(errno));
+ return -1;
+ }
+ while (!feof(fd)) {
+ n = fscanf(fd, "%29s %*[^\n]", mod_name);
+ if ((n == 1) && !strcmp(mod_name, module_name)) {
+ ret = 1;
+ break;
+ }
+ }
+ fclose(fd);
+
+ return ret;
+}