X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_eal%2Flinuxapp%2Feal%2Feal.c;h=f99e1586380d6b6b6dec7cc111a045af354c67cf;hb=8bae1da2afe0;hp=5e5a7a0f9c3de99ab6e23fb1779aa9439c4a962d;hpb=8552f950ee9d90466e70176352fd2491bd6118dd;p=dpdk.git diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 5e5a7a0f9c..f99e158638 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -50,7 +50,9 @@ #include #include #include +#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686) #include +#endif #include #include @@ -446,14 +448,17 @@ eal_parse_base_virtaddr(const char *arg) 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; } @@ -673,13 +678,19 @@ rte_eal_mcfg_complete(void) /* * 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(). */ @@ -848,3 +859,31 @@ int rte_eal_has_hugepages(void) { 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; +}