From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0080.outbound.protection.outlook.com [104.47.36.80]) by dpdk.org (Postfix) with ESMTP id B024E3977 for ; Fri, 15 Jul 2016 11:52:02 +0200 (CEST) Received: from BLUPR0301CA0014.namprd03.prod.outlook.com (10.162.113.152) by BN3PR03MB2401.namprd03.prod.outlook.com (10.166.75.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.528.16; Fri, 15 Jul 2016 09:52:01 +0000 Received: from BN1AFFO11FD019.protection.gbl (2a01:111:f400:7c10::123) by BLUPR0301CA0014.outlook.office365.com (2a01:111:e400:5259::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.534.14 via Frontend Transport; Fri, 15 Jul 2016 09:52:01 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; rehivetech.com; dkim=none (message not signed) header.d=none;rehivetech.com; 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 BN1AFFO11FD019.mail.protection.outlook.com (10.58.52.79) with Microsoft SMTP Server (TLS) id 15.1.534.7 via Frontend Transport; Fri, 15 Jul 2016 09:51:59 +0000 Received: from [10.232.14.199] (Tophie.ap.freescale.net [10.232.14.199]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u6F9puje010962; Fri, 15 Jul 2016 02:51:57 -0700 To: Jan Viktorin References: <1466510566-9240-1-git-send-email-shreyansh.jain@nxp.com> <1468303282-2806-1-git-send-email-shreyansh.jain@nxp.com> <1468303282-2806-16-git-send-email-shreyansh.jain@nxp.com> <20160714185021.493910ea@jvn> CC: , , From: Shreyansh jain Message-ID: <5788B262.3010301@nxp.com> Date: Fri, 15 Jul 2016 15:22:34 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <20160714185021.493910ea@jvn> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-Matching-Connectors: 131130499199275904; (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)(377454003)(199003)(24454002)(189002)(6806005)(47776003)(92566002)(104016004)(97736004)(93886004)(54356999)(2906002)(50466002)(86362001)(50986999)(68736007)(8676002)(230700001)(110136002)(11100500001)(85426001)(23746002)(64126003)(4326007)(87266999)(76176999)(83506001)(33656002)(65816999)(2950100001)(77096005)(8936002)(81156014)(7846002)(189998001)(87936001)(586003)(65806001)(5890100001)(81166006)(80316001)(19580405001)(36756003)(19580395003)(105606002)(4001350100001)(59896002)(305945005)(65956001)(356003)(106466001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB2401; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD019; 1:8mLcl3rafhglSYU44TmN+L404emo0eoprXCXjF36xCCf28XMlVHUmDuIAMv4PpikjtIVMhGLofBmAtqHPeQiil7YQao0G1mEfT0smXwDw4iFseY5+EESGERLI2nFzJYhVAiFQiy/dg9uHq9YOZTq1jrc1hJLxyJQPtzBUpUXoQUPUgqRlJObdqm5Wro3LQrMlF/mmnNPeriO2jfsqBhFJDMgAZs3PYK/CbEl9hX6wGPTv4lyKTFqQSxlxwPbtCpKVgPW9L2bp4uWjX14MiGI8XV3m+Wt4qRZmORtBgKbW36fqYAJsuQSxyHCfYRk0lg9WJ5TZT9Xc+arRiIEJytCLk+pn6gznC3WLJzArrSlpoHDv7t/bKJh5Ye7IW4MV0P8L9h1eAXZd98a7LCY3WMSaagcNqO3Q63p4FK+x8MO5nV1Saf2OqRBgN6Glb9MWBgCKszZLBBBv9F+LEeL185lyPSHflaZmRk1V2cAdJX03r2R1g/TTxgJJAjLziBcuUreOZMS3rLerzMmng5T/2cy7tOzNPf2hAhgCqZ6HBkcxQ5p+XSzSl4ijTDXYmPce4HUefZ1acetx5CZ+WkNH4kDgg== X-MS-Office365-Filtering-Correlation-Id: ec88cc53-2564-46f2-50c0-08d3ac95aa70 X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2401; 2:59EEtaDrv1mOfXkRlzChLqqzq1rTJks5vPw2zaboF2pGD7z2jlOLREx5bgusAobL4bZogZVHezonMDT7R8FRxDpvUqYTrCyNOcxZxa6YlrKY4IoWidncg1uAvw68E5dgQbNdqg7oUxr62JhC4B3DZorrcvYO2fjCwUSmQcHTE7RvGKJXDtNfsX59vBfUmaCE; 3:JJdpYUdSELka+Bm4aKtp+39eRT60VOhfkIBdlDYaeFAur0gbQTdcDh9raoOZ4FNYUh7O36Q6KPopdRrlRTOYYw6VyaMs6aoMgLum8KSdr1iW3sUQTKlD70Wdgo8BHb6x4FdMwmdrZWRkSM1qc5TnDDoxG2ZVgxM5rQ3e7YEz+U9h3bokb0/NL81Lj1Pp7X/qsLEYBGxKIXMYCazM4ccyGsVsH4ugsaN2Q4a7ffrqcV0= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR03MB2401; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2401; 25:ty5y/HTWpqxi9aY0yseJQeZFeFQ34nQTNUddf+LrKLjygWF5MpwszcbRhHcXzJNxnkQOcmTou5lqZe1p1X4olh5l8kMLHxEMAkIXCmewEW3RBjQmJhcKEX+pzLyFDiX6unOqngdw5u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1hE+gkKvkWWKM87sbwZEtYj/iByamDcwGkMUKulAulxJZ641IIFteuEuUxvZLF+gXPXJ8aNylIkBUVzV4lFEX0Yez4078GW2hYscoCV5PFBCk0zo2OPdZ6Xvr+iKT1pwX72A6u5kqegLZQ8+UQ6XNZ3T2+UR7TuD7VWSsCCK6SnZCnTS+V+jOT2QzWiWwwjFImgbpXOsXltaxLdBaRdPBziaVaAUDaig2bMpc/Xrg+GOf5WnzZS+uvy6E0vnKrpl/NSfbGNJQqpMG9UaBg+s5C/jnwt2EG7k3DsljhqmRTsSyxZ+6Kcm+rMvTuR7qyHBtpZ3VEd3SQVc9Vjiw0OA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13015025)(13018025)(13017025)(5005006)(8121501046)(13023025)(13024025)(10201501046)(3002001)(6055026); SRVR:BN3PR03MB2401; BCL:0; PCL:0; RULEID:(400006); SRVR:BN3PR03MB2401; X-Forefront-PRVS: 00046D390F X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; BN3PR03MB2401; 23:rSuxsjXl6IaeH06WpUJqjydj9FrSpjPBYq2b+?= =?Windows-1252?Q?hmtfUS3huXLMDx1VeYs9/LcKI7XEcz+m65xGQzL44twEZ3ukzTnPag4n?= =?Windows-1252?Q?QyYduITTeyop+n5GuBewPDxdhYeAR/NRtdMW66rEoT+lHwKbQouda7a9?= =?Windows-1252?Q?/O3ZUPYXot4v+nnPicSlkXpz53nZ2Wue5dDscTgHXiENU5n6ytSy50Yv?= =?Windows-1252?Q?vIt3sctlLu0699MnfWL1cYU230DgPMBOXyEwG68YoSusNNDtDxhejZU0?= =?Windows-1252?Q?yyjNaq5NZD58o7ZwzjiSANiJ3UKL6EeZHcGzLK3HY4EnZITHfTp56vMS?= =?Windows-1252?Q?puptc4Z/Vi7dnN/cas4GFlT5/1IyiQwTVP1Tt0XY/kP/1P7093EDTPA/?= =?Windows-1252?Q?Wckjhs5nmmtEhh8m4OLCUkrtlpcV9buF+rx3a+VQbLHX/CGNRRS6YTgT?= =?Windows-1252?Q?QrN+5r7joGMJEgfbmLaLZ1tT/9s4hechiK4BhSVVz6FTnMVeMUrxwrFl?= =?Windows-1252?Q?P3H3Dltb7csLwTw0449HDAoepVAD8ysZsJBK1NkinvCCchGoCgv6Hk7m?= =?Windows-1252?Q?Rl9kVGRTIlmNfFX6C9cEhsx0umYyx50lL/6mEXH+ZDJ0R9lj7OEcTePw?= =?Windows-1252?Q?+9oTlaOdSb9KJMsx0cwjJIHYuT9y7xWLa7ZgNbUtlsm1Kod5QjVmy2mT?= =?Windows-1252?Q?JBZ00a6y5uqrzcbqcGD+hYRJNkmqyhMttvjgK+DRUKbe6LealDjLuwPh?= =?Windows-1252?Q?FScWT6eUrJSZdVyUMziJP/t6Rb2TvW/s0m8bVD+8OqDZTqFxM+boeL9H?= =?Windows-1252?Q?GFhD7+C8gns/TwO3lPKU69xSxwG/k2hCaq2nugiGUD1UpS+Z1OfCbP2K?= =?Windows-1252?Q?zhfEeNRbPqd3F+IySfCmqA51ErOG2G1fT8jbhs4XJ8X2TsbObnHlwef8?= =?Windows-1252?Q?F8laoDz1j4RAKL8HjHUH8WMHEGIx+zqQG43jI7eXy6PLXtHQUxDkOlYI?= =?Windows-1252?Q?ZteWaoj1t+lThp6agdDenGUneT5W9L/Gd/iKkLYQWP5AwcbEqO0GOMwn?= =?Windows-1252?Q?qPnjcyFZUqBxwOXHGVG6SwHOZz7anSTnk/cpippP6IGRP8Q1kbpvI4Mn?= =?Windows-1252?Q?osBN6AjGvahvdkIdQYK1IpJcivGoCAXjUpQIYagRB46Z6EoT21bovGgz?= =?Windows-1252?Q?M2oCpvYKsQUBAB0+yLDX0+X2i0kx+v6ZxYjeZTPdRIYj69FR8/qCkVKU?= =?Windows-1252?Q?VnMejxTp5rRXh7T1pOKwfiypg1cAlTE0mWsNfcWn1kqcCimkG9fVaRmA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ThM5xP056IgqHB SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2016 09:51:59.7247 (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: BN3PR03MB2401 Subject: Re: [dpdk-dev] [PATCH v6 15/17] eal: add hotplug operations for pci and vdev 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: Fri, 15 Jul 2016 09:52:03 -0000 On Thursday 14 July 2016 10:20 PM, Jan Viktorin wrote: > On Tue, 12 Jul 2016 11:31:20 +0530 > Shreyansh Jain wrote: > >> Hotplug which deals with resources should come from the layer that already >> handles them, i.e. EAL. >> >> For both attach and detach operations, 'name' is used to select the bus >> that will handle the request. >> >> Signed-off-by: David Marchand >> Signed-off-by: Shreyansh Jain >> --- >> lib/librte_eal/bsdapp/eal/rte_eal_version.map | 2 ++ >> lib/librte_eal/common/eal_common_dev.c | 47 +++++++++++++++++++++++++ >> lib/librte_eal/common/include/rte_dev.h | 25 +++++++++++++ >> lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 ++ >> 4 files changed, 76 insertions(+) >> >> diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map >> index 1852c4a..6f9324f 100644 >> --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map >> +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map >> @@ -159,5 +159,7 @@ DPDK_16.07 { >> rte_keepalive_mark_sleep; >> rte_keepalive_register_relay_callback; >> rte_thread_setname; >> + rte_eal_dev_attach; >> + rte_eal_dev_detach; >> >> } DPDK_16.04; >> diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c >> index a8a4146..14c6cf1 100644 >> --- a/lib/librte_eal/common/eal_common_dev.c >> +++ b/lib/librte_eal/common/eal_common_dev.c >> @@ -150,3 +150,50 @@ rte_eal_vdev_uninit(const char *name) >> RTE_LOG(ERR, EAL, "no driver found for %s\n", name); >> return -EINVAL; >> } >> + >> +int rte_eal_dev_attach(const char *name, const char *devargs) >> +{ >> + struct rte_pci_addr addr; >> + int ret = -1; >> + >> + if (name == NULL || devargs == NULL) { >> + RTE_LOG(ERR, EAL, "Invalid device arguments provided\n"); >> + return ret; >> + } >> + >> + if (eal_parse_pci_DomBDF(name, &addr) == 0) { >> + if (rte_eal_pci_probe_one(&addr) < 0) >> + goto err; >> + >> + } else { >> + if (rte_eal_vdev_init(name, devargs)) >> + goto err; >> + } >> + >> + return 0; >> + >> +err: >> + RTE_LOG(ERR, EAL, "Driver cannot attach the device\n"); > > I think this log can be more specific. We have the name of the device. > It might be confusing to the user when the attach fails and there is > no simple way how to determine which one. Agree. I will update with 'name'. > >> + return ret; >> +} >> + >> +int rte_eal_dev_detach(const char *name) >> +{ >> + struct rte_pci_addr addr; >> + >> + if (name == NULL) >> + goto err; >> + >> + if (eal_parse_pci_DomBDF(name, &addr) == 0) { >> + if (rte_eal_pci_detach(&addr) < 0) >> + goto err; >> + } else { >> + if (rte_eal_vdev_uninit(name)) >> + goto err; >> + } >> + return 0; >> + >> +err: >> + RTE_LOG(ERR, EAL, "Driver cannot detach the device\n"); > > Same as for attach. OK. > >> + return -1; >> +} >> diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h >> index 994650b..2f0579c 100644 >> --- a/lib/librte_eal/common/include/rte_dev.h >> +++ b/lib/librte_eal/common/include/rte_dev.h >> @@ -178,6 +178,31 @@ int rte_eal_vdev_init(const char *name, const char *args); >> */ >> int rte_eal_vdev_uninit(const char *name); >> >> +/** >> + * Attach a resource to a registered driver. > > From my POV, the term "resource" is not good here. We have > rte_pci_resource but we refer to a device here. The function is called > rte_eal_DEV_attach. No idea why to call it a resource. Your point of 'resource' for 'rte_eal_*dev*_attach' makes sense. Ideally I wouldn't have given much heed to this - for me 'resource' is just a device representation within EAL. But, now that you have highlighted, name<=>comment is certainly mismatch. I will change. > >> + * >> + * @param name >> + * The resource name, that refers to a pci resource or some private >> + * way of designating a resource for vdev drivers. Based on this >> + * resource name, eal will identify a driver capable of handling >> + * this resource and pass this resource to the driver probing >> + * function. >> + * @param devargs >> + * Device arguments to be passed to the driver. >> + * @return >> + * 0 on success, negative on error. >> + */ >> +int rte_eal_dev_attach(const char *name, const char *devargs); >> + >> +/** >> + * Detach a resource from its driver. > > Same here for resource. I will change to "Detach a device from its driver". > > Jan > >> + * >> + * @param name >> + * Same description as for rte_eal_dev_attach(). >> + * Here, eal will call the driver detaching function. >> + */ >> +int rte_eal_dev_detach(const char *name); >> + >> #define DRIVER_EXPORT_NAME_ARRAY(n, idx) n##idx[] >> >> #define DRIVER_EXPORT_NAME(name, idx) \ >> diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map >> index a617b9e..db866b8 100644 >> --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map >> +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map >> @@ -163,5 +163,7 @@ DPDK_16.07 { >> rte_keepalive_mark_sleep; >> rte_keepalive_register_relay_callback; >> rte_thread_setname; >> + rte_eal_dev_attach; >> + rte_eal_dev_detach; >> >> } DPDK_16.04; >