From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0062.outbound.protection.outlook.com [104.47.42.62]) by dpdk.org (Postfix) with ESMTP id 23FB8A2F for ; Thu, 10 Nov 2016 06:44:27 +0100 (CET) Received: from BN3PR0301CA0071.namprd03.prod.outlook.com (10.160.152.167) by BN6PR03MB2737.namprd03.prod.outlook.com (10.173.144.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.16; Thu, 10 Nov 2016 05:44:24 +0000 Received: from BN1AFFO11FD040.protection.gbl (2a01:111:f400:7c10::166) by BN3PR0301CA0071.outlook.office365.com (2a01:111:e400:401e::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.707.6 via Frontend Transport; Thu, 10 Nov 2016 05:44:24 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; linaro.org; dkim=none (message not signed) header.d=none;linaro.org; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD040.mail.protection.outlook.com (10.58.52.251) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.707.3 via Frontend Transport; Thu, 10 Nov 2016 05:44:24 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:1091; Count:13 Received: from [10.232.14.87] ([10.232.14.87]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id uAA5iLBN024521; Wed, 9 Nov 2016 22:44:21 -0700 To: Jianbo Liu References: <1477581467-12588-1-git-send-email-shreyansh.jain@nxp.com> <1477657598-826-1-git-send-email-shreyansh.jain@nxp.com> <1477657598-826-4-git-send-email-shreyansh.jain@nxp.com> CC: , Thomas Monjalon , Jan Viktorin From: Shreyansh Jain Message-ID: Date: Thu, 10 Nov 2016 11:16:40 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-IncomingHeaderCount: 13 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131232302646646889; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(24454002)(377454003)(6666003)(4001350100001)(106466001)(6916009)(93886004)(33646002)(189998001)(86362001)(575784001)(31696002)(105606002)(36756003)(23676002)(81156014)(4326007)(81166006)(31686004)(65826007)(8676002)(50466002)(47776003)(110136003)(356003)(83506001)(97736004)(2950100002)(92566002)(586003)(230700001)(65956001)(85426001)(626004)(104016004)(5660300001)(77096005)(305945005)(54356999)(68736007)(65806001)(2906002)(8936002)(50986999)(7846002)(76176999)(87936001)(64126003)(229853002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2737; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD040; 1:93OGB1MwTUFGhXb6Io2quWi377UD3EvkzGty7uQW0Beqiltlj6bbe6jEF2bB27Nd+xDQjDq0MuImmY71N7krTKm8ebg+Mf991EEuZ2reFFdKagl4MEny5g1cvkUdR6X4sy5ABI4jMG9y66hXb7aXaVSjDj5pOLCdbcm0+2t4dUB7PuOEeY3IRQJzBTcUxbFEX6vsfSpNzUyi0WDp/Qjgcd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DkcFL3MqU2GMneRsx1VosZXNQyesRb9ZXjytWHKaK+zmMJdRhs1hpfRWgVpGTZuEX/0+ZvfxtJVpHcrRr2J+cqBX/DWQUOYsqPGm09V/Y+V+btaXDyOnLc74EzpjlLn+HQ3BJ5m5Y36cVbA3z5shWWJVp14O4H3rRsxZJ98LON+KGgfhQqsOqDSQ64GxAc/ZLgfpBhv+3JTOYBFV87FJ/y1I7UzHfvpSUXFt2ZciSEe3R+hVCDBfrGCOo/Xvhl X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13015025)(5005006)(13018025)(13024025)(8121501046)(13023025)(13017025)(10201501046)(3002001)(6055026); SRVR:BN6PR03MB2737; BCL:0; PCL:0; RULEID:(400006); SRVR:BN6PR03MB2737; X-Forefront-PRVS: 01221E3973 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjZQUjAzTUIyNzM3OzIzOjhqdVdIdnlkL2JKMGJCSlppRWt6V1RZcENv?= =?utf-8?B?M0pIRDNGSlFtRTFtcHRyL3hJSVlZemUrQWk0Z3pZazQ2MnFCSkJKbnhLOFFp?= =?utf-8?B?TXdHcFBZbHVOT0VqdDNNWm5RK3dneERKYWltankyQ2lLVUNrdzlqc09VOVFU?= =?utf-8?B?anJWdlhHb3VNUjk0RktMUzF4bk5iY1BKdFBsRTJwaHNpbzdITWZpSE5IenpQ?= =?utf-8?B?Z0s0ejNNSU9kRGw0TEJnTlFkaVBlTFRKWTMyRWpISEdiK0V2ZFJHK05sTTk0?= =?utf-8?B?YUcxQm5FU2hLS1dNVFl6TzUweDVSZHhlcjdMR240Znl3WUtodFVCRE9zTG1q?= =?utf-8?B?cHFIc3laa0tUbWMwU0c4ZzdkVDRRZDRLVEJWQlVNWlBTQWZKUURzaGg4S0w0?= =?utf-8?B?UklPR2dKSFdHOGQwWFVxVU5CMDJOcXVmVzlpQ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S9+xSYutKaWivOhYasvkLAgwiVNOftx2XtRtTkklcGqaxPGzGh+si4i; 24:7Hn65hMt5eD9DiCSE2vGwIAoCLLjwp6cMqECRLDUJc/i+RBYK5klfWmsr1cTPOhaszkXe4R/u+PahAOPZQWp0SqcETQXqbP3WI2uxTuatLA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2737; 7:rxXLspCM1laAZTgtBX9rfAt3f0kN9jMdyeM88ZIn29qTk35Htwy1m7rdCoy87EtZQ1kqdBlGtyM+mDEn97KQAN3OoBJeXim/chQVidgfqXHpscTiiY33XJ/K37BrZBQbqMrxFpDbMJdXkXH4IeYSW52BtoC6pKCzYfpR/EGy5O/R7YF2JixF6NxM1pgsqFLC2H2Eol08mPy4N6GTDEq2hjZ223zzL23MI3U2Wf6bJXeQNNpu+6Ag6f+yNFOSrDTrZxK6UYr5fXjONOSsFUOKZEwWvT3H2Mw6bGc4w24IwRVQGiHpNdy4Rwu3Q731PBWE6o9Ii8qnUNi2M6WgaCYhLm1DvFh1DABvJCtmP4n5DMs= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2016 05:44:24.3994 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR03MB2737 Subject: Re: [dpdk-dev] [PATCH v7 03/21] eal/linux: generalize PCI kernel unbinding driver to EAL 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: Thu, 10 Nov 2016 05:44:29 -0000 Hello Jianbo, Thanks a lot for your time in commenting this. My comments inline (as well as on other similar mails). On Thursday 10 November 2016 07:54 AM, Jianbo Liu wrote: > On 28 October 2016 at 20:26, Shreyansh Jain wrote: >> From: Jan Viktorin >> >> Generalize the PCI-specific pci_unbind_kernel_driver. It is now divided >> into two parts. First, determination of the path and string identification >> of the device to be unbound. Second, the actual unbind operation which is >> generic. >> >> BSD implementation updated as ENOTSUP >> >> Signed-off-by: Jan Viktorin >> Signed-off-by: Shreyansh Jain >> -- >> Changes since v2: >> - update BSD support for unbind kernel driver >> --- >> lib/librte_eal/bsdapp/eal/eal.c | 7 +++++++ >> lib/librte_eal/bsdapp/eal/eal_pci.c | 4 ++-- >> lib/librte_eal/common/eal_private.h | 13 +++++++++++++ >> lib/librte_eal/linuxapp/eal/eal.c | 26 ++++++++++++++++++++++++++ >> lib/librte_eal/linuxapp/eal/eal_pci.c | 33 +++++++++------------------------ >> 5 files changed, 57 insertions(+), 26 deletions(-) >> >> diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c >> index 35e3117..5271fc2 100644 >> --- a/lib/librte_eal/bsdapp/eal/eal.c >> +++ b/lib/librte_eal/bsdapp/eal/eal.c >> @@ -633,3 +633,10 @@ rte_eal_process_type(void) >> { >> return rte_config.process_type; >> } >> + >> +int >> +rte_eal_unbind_kernel_driver(const char *devpath __rte_unused, >> + const char *devid __rte_unused) >> +{ >> + return -ENOTSUP; >> +} >> diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c >> index 7ed0115..703f034 100644 >> --- a/lib/librte_eal/bsdapp/eal/eal_pci.c >> +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c >> @@ -89,11 +89,11 @@ >> >> /* unbind kernel driver for this device */ >> int >> -pci_unbind_kernel_driver(struct rte_pci_device *dev __rte_unused) >> +pci_unbind_kernel_driver(struct rte_pci_device *dev) >> { >> RTE_LOG(ERR, EAL, "RTE_PCI_DRV_FORCE_UNBIND flag is not implemented " >> "for BSD\n"); >> - return -ENOTSUP; >> + return rte_eal_unbind_kernel_driver(dev); > > Missing the second parameter for devid. Indeed. I will fix this. Being BSD, I didn't compile test this part. I will have to find a way to fix this in my sanity before sending next series. > >> } >> >> /* Map pci device */ >> diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h >> index 9e7d8f6..b0c208a 100644 >> --- a/lib/librte_eal/common/eal_private.h >> +++ b/lib/librte_eal/common/eal_private.h >> @@ -256,6 +256,19 @@ int rte_eal_alarm_init(void); >> int rte_eal_check_module(const char *module_name); >> >> /** >> + * Unbind kernel driver bound to the device specified by the given devpath, >> + * and its string identification. >> + * >> + * @param devpath path to the device directory ("/sys/.../devices/") >> + * @param devid identification of the device () >> + * >> + * @return >> + * -1 unbind has failed >> + * 0 module has been unbound >> + */ >> +int rte_eal_unbind_kernel_driver(const char *devpath, const char *devid); >> + >> +/** >> * Get cpu core_id. >> * >> * This function is private to the EAL. >> diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c >> index 2075282..5f6676d 100644 >> --- a/lib/librte_eal/linuxapp/eal/eal.c >> +++ b/lib/librte_eal/linuxapp/eal/eal.c >> @@ -943,3 +943,29 @@ rte_eal_check_module(const char *module_name) >> /* Module has been found */ >> return 1; >> } >> + >> +int >> +rte_eal_unbind_kernel_driver(const char *devpath, const char *devid) >> +{ >> + char filename[PATH_MAX]; >> + FILE *f; >> + >> + snprintf(filename, sizeof(filename), >> + "%s/driver/unbind", devpath); >> + >> + f = fopen(filename, "w"); >> + if (f == NULL) /* device was not bound */ >> + return 0; >> + >> + if (fwrite(devid, strlen(devid), 1, f) == 0) { >> + RTE_LOG(ERR, EAL, "%s(): could not write to %s\n", __func__, >> + filename); >> + goto error; >> + } >> + >> + fclose(f); >> + return 0; >> +error: >> + fclose(f); >> + return -1; >> +} >> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c >> index 876ba38..a03553f 100644 >> --- a/lib/librte_eal/linuxapp/eal/eal_pci.c >> +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c >> @@ -59,38 +59,23 @@ int >> pci_unbind_kernel_driver(struct rte_pci_device *dev) >> { >> int n; >> - FILE *f; >> - char filename[PATH_MAX]; >> - char buf[BUFSIZ]; >> + char devpath[PATH_MAX]; >> + char devid[BUFSIZ]; >> struct rte_pci_addr *loc = &dev->addr; >> >> - /* open /sys/bus/pci/devices/AAAA:BB:CC.D/driver */ >> - snprintf(filename, sizeof(filename), >> - "%s/" PCI_PRI_FMT "/driver/unbind", pci_get_sysfs_path(), >> + /* devpath /sys/bus/pci/devices/AAAA:BB:CC.D */ >> + snprintf(devpath, sizeof(devpath), >> + "%s/" PCI_PRI_FMT, pci_get_sysfs_path(), >> loc->domain, loc->bus, loc->devid, loc->function); >> >> - f = fopen(filename, "w"); >> - if (f == NULL) /* device was not bound */ >> - return 0; >> - >> - n = snprintf(buf, sizeof(buf), PCI_PRI_FMT "\n", >> + n = snprintf(devid, sizeof(devid), PCI_PRI_FMT "\n", >> loc->domain, loc->bus, loc->devid, loc->function); >> - if ((n < 0) || (n >= (int)sizeof(buf))) { >> + if ((n < 0) || (n >= (int)sizeof(devid))) { >> RTE_LOG(ERR, EAL, "%s(): snprintf failed\n", __func__); >> - goto error; >> - } >> - if (fwrite(buf, n, 1, f) == 0) { >> - RTE_LOG(ERR, EAL, "%s(): could not write to %s\n", __func__, >> - filename); >> - goto error; >> + return -1; >> } >> >> - fclose(f); >> - return 0; >> - >> -error: >> - fclose(f); >> - return -1; >> + return rte_eal_unbind_kernel_driver(devpath, devid); >> } >> >> static int >> -- >> 2.7.4 >> > - Shreyansh