From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0075.outbound.protection.outlook.com [157.56.110.75]) by dpdk.org (Postfix) with ESMTP id 65D5D9A8A for ; Mon, 7 Dec 2015 17:58:17 +0100 (CET) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Kamil.Rytarowski@caviumnetworks.com; Received: from cavium1.semihalf.local (80.82.22.190) by BY2PR07MB1442.namprd07.prod.outlook.com (10.162.76.144) with Microsoft SMTP Server (TLS) id 15.1.331.20; Mon, 7 Dec 2015 16:58:15 +0000 From: Kamil Rytarowski To: Date: Mon, 7 Dec 2015 17:57:40 +0100 Message-ID: <1449507460-32038-2-git-send-email-Kamil.Rytarowski@caviumnetworks.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1449507460-32038-1-git-send-email-Kamil.Rytarowski@caviumnetworks.com> References: <1449499771-31466-1-git-send-email-Kamil.Rytarowski@caviumnetworks.com> <1449507460-32038-1-git-send-email-Kamil.Rytarowski@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [80.82.22.190] X-ClientProxiedBy: HE1PR01CA0030.eurprd01.prod.exchangelabs.com (25.163.2.168) To BY2PR07MB1442.namprd07.prod.outlook.com (25.162.76.144) X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB1442; 2:eL6k2BbNkDvoA3prkKOaW6zECzfrqymLINVRJ1WJ79c7dlrpA4GjqJs3gpB1vyHS9BbtN6rJ/4bfzDl8W6WEzsLJoVQd/N2hMPMPOEzYrzmU0I6G13NYJgMd88Fh1XskyKdhyUuDR9tLqy2FuQcgmg==; 3:IfnV2/qlnif5HuF269PCxTplTt8J4cMErnLMJ4s5p+o67BL/n5AQBWnr6slMmtG4EkM0wBUsYPrm0vAUOpC0Uk9YJWrBP3qz1svt9X5+JdULvqL3uYqGqyFyf2L+x6b3; 25:92ePZsy/spiLZHoD4xATVnVTXdPYvoVWOVwvpnTpm3+by3Mw8Bk/NY57e6js9pkKgI6iRs+TPDcjnL4CO+7yax3Lgaus399Bz9NowaKPbVtIcjaBEhvux1/c6KOKsMMUbAiaC53gANdZAyy2kNf02eZ0z/YUUk9Wz81tELvxxT3k2hA4Ym+o2d2sbnzQL/yeXNW6oeOlKY7HsIO6WDSunGgg5dqHZvhQhs+v5uRSXfkrneTfSzSagSJm0HVIahPF X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR07MB1442; X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB1442; 20:tAE3z5FGsNByolVEK50reZ3nXMOuEdwFz4UKYTeQdATHX6vfZiotUMrDn4l2BhKntBDPBT+HN9HhTjZXkpSE//3RlwNDK2xR6sIe7CeP7N563m6SDwfWAP0pRf6rHb5ZvQC9MJD0vaiZiuyCRAsRL5gSnLiZG3ZI7gpmh3gNPIGwKQPhUykbdPTShZPTuFsnppsaQxTNvL6ps1DX0YwkgQngw/44J+pKruFuG6Vr4Wny+SeLTm90GQ3tkNs/aPMK68tkmgM6w7QZ0RJyPwaUPMEXANasNaC13gY4jmpj7M8FZ4KYeeIwn7T9Rbv33lm4MhUc5hDGMLM59L4C5jCA6XLnulICXMpCIaOSj9WIuPPPhBnn3M4XtrqrILDsmT+XQvx0/B0uNWO7x5KVZLglyIsgRg1OUZXD8L4Fck0CDsHdyhGvtoQYRl4QcvUkaVal0OLmKyrIEPgaIG9BqAlZWuHuA+rgx7AB8Wz+w5+TTinfoSrEgucwwTHYN4U42WWpSCeEUnfw5rpZgsJqFO7qBaXH3AKPjO3FCoN8PTHrLMw8U4t2Wl3kVplJzN40eoHxclkOl/AAuxShCykVxeuOR5FQjvl8eRop/ocNsJ7Xm0k= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236414709691187); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(3002001)(10201501046); SRVR:BY2PR07MB1442; BCL:0; PCL:0; RULEID:; SRVR:BY2PR07MB1442; X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB1442; 4:jpvigqyf1Gwb3Lf3/RA7vaSu/N8JJnV/s5OhUIhASft0UhvKVcEazk9jRnyuVykwIju88FHI8FcS43+3UKslHEZQtugw1MEYCT/+/cMcWM/VJStyuO7FK6aJ0uRlVkxfO2RlwaKXduikgmAlXG+J301RnrwM/Yy+gvzRia7Iyd0nMaJ4Iqzqemdvqz07mw4pIA76x8y+D0V/Sjwi8buK7ZHu5QZ5cyhwIhdEr8+FbJ/ZnAmlVBXEY3r3U4s8QHigDuwzfP7kR3+WHHEyy0wstCQDw/r3hMFq3a6hQptRquQF/vPE2Y9lxllMcISjoH8nY/3hw+LvaGXDpij+eeD/AgAikGDraMAcxhhov2OIYK8GhNB8iwxxoEZfPx+XE2+b+P+Qnh21UHYpMcm6DW3z2kiJI3eZcE+5KcOiaBCubFs= X-Forefront-PRVS: 078310077C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(189002)(199003)(81156007)(5008740100001)(110136002)(105586002)(97736004)(42186005)(189998001)(107886002)(47776003)(40100003)(19580395003)(5003940100001)(4001430100002)(5001960100002)(19580405001)(101416001)(66066001)(76176999)(5004730100002)(87976001)(50226001)(86362001)(48376002)(2950100001)(3846002)(586003)(106356001)(6116002)(450100001)(92566002)(229853001)(50466002)(50986999)(2351001)(77096005)(1096002)(122386002)(36756003)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR07MB1442; H:cavium1.semihalf.local; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR07MB1442; 23:wApO7ofIels/cx+6rgljLn488M2LmI84C/oy8CGNs?= =?us-ascii?Q?XBOTu7uRZ4yVBSXxtbuAuzkSOcdpSbVhMXdULwhI1jFHQj+w4o6o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r+e9645icl241NhBA0vvVa+bVhF+U7MDt2cnVasqoXg1i?= =?us-ascii?Q?oKa6mWD3x2IT3PvhUMbEd/JORLubWI21Kyj/gi196MXjFBXiLRiS4/biuwOJ?= =?us-ascii?Q?OtBFO1EdqP2BeK7XoaQYqfrRp7E71zmIa3kahmeD32Hr3vDAaR5uzigNgqIO?= =?us-ascii?Q?OeuWg6jVF8=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB1442; 5:VKVzngxTWQhwImV0d5i8i64gUVjfKNjxtqY3xeka36wBkgb1LSxx9Q8BhJPWa5VQxnM8pzEIJSzEByQK3tIIE0O5eKJI8Zk9XTXvsrmAe/Yb5Xqyb4+H02Cf7m6wFbstThUwTShtkISOgsqBQLkzuQ==; 24:l8X5mJCiKiojXAQFr0ExBF71n+QwrZRMz3eSThcoQO0qDv2r0wcPxHrL9izro5saYUJfzSpYJKMlKekuTCjJwQ5c1RYxLOG4RyjIvZ9nWBU= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2015 16:58:15.1858 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR07MB1442 Subject: [dpdk-dev] [PATCH v2 2/2] eal/linux: Add support for handling built-in kernel modules X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2015 16:58:17 -0000 Currently rte_eal_check_module() detects Linux kernel modules via reading /proc/modules. Built-in ones aren't listed there and therefore they are not being found by the script. Add support for checking built-in modules with parsing the sysfs files Signed-off-by: Kamil Rytarowski --- lib/librte_eal/linuxapp/eal/eal.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 635ec36..6cab906 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -52,6 +52,8 @@ #if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686) #include #endif +#include +#include #include #include @@ -902,7 +904,10 @@ int rte_eal_check_module(const char *module_name) { char mod_name[30]; /* Any module names can be longer than 30 bytes? */ + char sysfs_mod_name[PATH_MAX]; + struct stat st; int ret = 0; + int rv; int n; if (NULL == module_name) @@ -918,9 +923,23 @@ rte_eal_check_module(const char *module_name) n = fscanf(fd, "%29s %*[^\n]", mod_name); if ((n == 1) && !strcmp(mod_name, module_name)) { ret = 1; - break; + goto finish; } } + RTE_LOG(DEBUG, EAL, "Module %s not found in /proc/modules", + module_name); + + /* A module might be builtin, try sysfs */ + snprintf(sysfs_mod_name, PATH_MAX, "/sys/module/%s", module_name); + if ((rv = stat(sysfs_mod_name, &st)) == 0) { + ret = 1; + goto finish; + } + + RTE_LOG(DEBUG, EAL, "Open %s failed! error %i (%s)\n", + sysfs_mod_name, errno, strerror(errno)); + +finish: fclose(fd); return ret; -- 2.5.0