From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0080.outbound.protection.outlook.com [104.47.42.80]) by dpdk.org (Postfix) with ESMTP id 87BD037B0 for ; Wed, 26 Apr 2017 15:53:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=TcYWthagv5YzDHeC/90fXrCClvStDCOimZPlqG9nOpU=; b=nN6whppWV0EQkOxAcs6jPeiWHuVtDI43hElb66UXPkTFErSgnEVY/GaPcRNllF17vAeA4ojdAAjIiYakZWvnDT5YcgpxPB0OOS/TJCQRH19E47xxnseD40Q4wMHf/SSiUmkTnfhoUjdi0+lwK6r4RCjOmHQiwbz9nQgZo+jkrcQ= Authentication-Results: monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=none action=none header.from=caviumnetworks.com; Received: from prathyusha-Precision-Tower-5810.caveonetworks.com (111.93.218.67) by CY1PR0701MB2106.namprd07.prod.outlook.com (10.163.142.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1047.13; Wed, 26 Apr 2017 13:52:57 +0000 From: Guduri Prathyusha To: thomas@monjalon.net Cc: dev@dpdk.org, lijuanx.a.tu@intel.com, Guduri Prathyusha Date: Wed, 26 Apr 2017 19:22:19 +0530 Message-Id: <1493214739-9957-1-git-send-email-gprathyusha@caviumnetworks.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR01CA0097.INDPRD01.PROD.OUTLOOK.COM (10.174.208.13) To CY1PR0701MB2106.namprd07.prod.outlook.com (10.163.142.156) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 906c898b-9e6d-4e82-4091-08d48cab8d28 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:CY1PR0701MB2106; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB2106; 3:EELrJa9Hn30J2kqUVd65Bt+Rl2lEimPbSTNPZfMMtTiGfy4y8Gp57E89/fgc5OXRfFARadqX5vJZoBGHIh2uIGkUHgdNGy6/AVyDBflDISbTTt+n2x51V3IWjNhPMs0dOajxMVHMcIQQ41yhEkgGw/+qrs7VDOcOFPYkcI4xnH3ZFcjUgXFgEBmAcZ2sFcSrs8Gs6jIM0/G5FC7Tc4RziXz8QOp6VphRojWt27WZ7UE23kZ+H9kkKWIeQ9O2j/cUeLtca7nTTdbiS3WKmdk0XDQTnuIIWGXZw4XadwD5bwpV8LOBAIy8N10yZ3EOWQkS4H3AqVRFZzemRONLh4SPIA==; 25:ORkDujcDxOOPG6C/7aXyjrhZggXjAPbHGhXjCyQPYZRGr0+uYxBLSGE5AkxHIjk4/4cgcR6pa5XrzdbqrYHlH+jbRWmvs6KutmIgF/b4Nru6mEvXHc6lKuYfS1Nj/W6yzFOzV1EMsEULpssAQDtV0aSbsGrlN5NcikNboMl8jenT/hiranEt1Qkg8SX5nyBOqdFxZ7N5op8n9uJnV+rc4UjRt4Kffh5eObdJpoUUN3vB0QC3Fyx8dqmsnAodnNHIOIEnuCFL/AFT5q4qCM6s4eVLcrlSKV7BPqBv9erlVqUzghBwwnngE5ew0Vx7EhQNi3x8/z3tv1/Jpxk4bKzPQTvYRihFQhNoSFs4Htx4VSOb4hvqA9Z9iXPGqel4z+32VqgmvUfHH/19MnVXNkH1E8ZxW9ZccFGnTM1Zoh14Rne8uIrX7O435Z/4uV+PVBE8tslNQpK6i8u62ZWuvFoSEA== X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB2106; 31:InEFYrydLqWxdqZLKYcsoSx7kvB82wpgYKe4fOTftuzDWzjC28sUjuqZiz0oiXpvC4/csKMwTdVaseGi73Pku5fHE8BjQuQKp1vxaWJgzQsQ+i7EaKm22rovxfUhRe6dkRXi13oGDhAQzrIymYXCWc094q0i+pp5KtgwQKc49RKzXDQcA7yNJ3S62JMdfBQjbjpaF7TkmOhKjkWtc6WCiIfLMYTK1ITM0jZTSroRWHuvPWjKzuA1YSdZvVfBOJJD; 20:36G12aotKE0v0jJ+dNchwlglzI3/C7nXIwxctUc7H3kqTb+Q45smDyjunPZDNHDl6vyMK5+FnDsdrnY636lLGy4FqjHbjqjdC+ydQg5ZBRxVul9NpZTRBUO5R2UTwQ4K6FBJI1k3Jopp5gvjD61Q8ueM6eRkrCZ9XrVJ8jM4ji0NtAZTc10LfMRyQVJayW/9I2JbPuNTo7SwOVC1350FFfxdiX8yWnOnnyPRZChFdLGetGFEV4nPiCv0+/XxV0AE516nk3IkoVo3mxZxD8j0XQO39ZLKss5Z7Df+PGl3uuhLAjDtnPsIoUQWwRjkHF09swdChnbXCBRxp6dEXheYNs/OI9Bbdv6PZAdicKAfBl0jZS2dMY06CbKnVnuZmRxEM3Zk5VrBWm1zozq6EzlF4Jhqa1P00rCp47FUiwzq5eVvLxLO3uSTYcV3Ej45hJW2qEZ/0G9Lc6RW91Ts7FboXIkpEZ9Nhsk+PKSq5Gf497f1SgRS9f1hJjwu4Cz59yaittNkJfkDhv6F1jIZuGpHgNKf74tYTXLY9OFNdHelpfB0dfPxTHYcu3yqNrjWaINH2E8Lze3pc14shgKOCQir40TGryDHdoVeQOlhsglXGao= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(93006095)(3002001)(6041248)(20161123560025)(20161123564025)(20161123555025)(20161123562025)(201703131423075)(201703061421075)(201703161042150)(6072148)(6042181); SRVR:CY1PR0701MB2106; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0701MB2106; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB2106; 4:LELsukHIPUwFkBO8IW4XjNxx9Pol+J8WkjkdcMZHdR3irj9jekCqGyqOQbZ7c3UDDWFQvc/uQDgZ1NRvxtSZ/LbYC/nto8HyV03aMp1THcygpErPJylLZYSTuMIKbbe7l0Q6czfBeBAGnDKT60oB6GhK4DHfTRHKmVXv6lxTgRlYuBeoH08JA7GdJ+iIKYGHd17oWN1YVNoPLlCBa9Tghl/CiidgIx+bBRqMADTT/R1ybmLQPKKlh1BRqGWkMYCx1NfP14hW19UW0xDTVWlp+SV59HWOhMo0Yp9a9xsxYzToaq30F9o/DSs7FLib2BZX01TJ0/R7FOIGrJZFwvEwV8WkufvMHYuGWNQmm40c8hXuNMVkIwZ5FkpuUM0WalT1oc0oSpYsz3ARFqAZ6ULcZeBozN5j4sBsO7pHkkQ4D3YHoGADW+OhoTOyq1/PV06H9p8D69wsndqO43jEkFg37+fTPTxr0zfiO/P3Z0EXy6DKKpLypBWNURVd34pSZor3q6GFfMAjHDVhK+gswlOiWyNloZVpTZWVim83SMX61lY07t5V8bUoFfH1Lgz2UAS1Ga5unwoebvIS/9K1E8Vz3kQi//iKWAseDhqWyaX44VRkdd1h995dCeXlHWnCT4usYKnFVCyHoOh14M2mWEBrKFc8qUCPTCTIuPpc341BWViIGxF0ih7U4Qi++VRRJYXeN4IdaNy+Az8YdA+1smjA64QKltVWriiZIx5R3T8cCFD5ohWcSq4gkZEq4MyvOVWf X-Forefront-PRVS: 0289B6431E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(50986999)(5009440100003)(36756003)(5003940100001)(6116002)(53416004)(5660300001)(3846002)(42186005)(6486002)(6506006)(66066001)(8676002)(33646002)(305945005)(189998001)(25786009)(47776003)(48376002)(7736002)(53936002)(6916009)(42882006)(50226002)(2351001)(6666003)(6512007)(4720700003)(50466002)(81166006)(110136004)(2906002)(4326008)(38730400002)(2361001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0701MB2106; H:prathyusha-Precision-Tower-5810.caveonetworks.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB2106; 23:Ii3YTmdRHiYfULPYSYGrKQHOC+Lzkog5RI3Nk6buKOVkarqiQGIIG90WKTuZ5aphvohK6QrN+qjuJ2rQG+EVzK0NCw4yGHW8lHCWFLWVOFVqfgw1qaD/TuS6eCb/mfnGIIU9oVOWuB6Hk5XUPuHhspwnAobkjC/x1aKOXzgL5XKls/gZd2jGvOsUk5N2yOGbjx3W6HItchl/j7MOagyZslogYGQjDdApDlB+ITDz8QZzwTUEwYn5KTdCbnYqNnHc6A9LvSn57cG5om2Ts2AzjELf5Gi21TmEvDEDbjlVZyzRHT8T4EmX/UTVMQZbl5ET+Eyv+m5kBoo6WyrHOBkbKNujj5mFOZPDtoPr0XUMU6gKjYbFaoON20Rrkmofi3RKdbemco60HxlrY/h0pQWbqQPeEYNwMoNQVKDb2Ju1gWh0Th8JZ5g2dSnvPVt4YNBquyhTyh2zu+e5mHfu+nriRS73kvQ2JFoF77PY9TvPKkbc1lIDcnOOvDpk3j4Kc/VA31bpVIcAlQYYXHjhk/mKpLqynuRCj7XwkEuHLWUqmmVWJ839szbDCKhCqYP1PF0/K33iX5lmTdEbFTUArx7sAjqIdp9i9CRCp7/342bDoR5lhMNs6w9gA9OIBC914k7fVeU7a3bql+ETlwe33iO1oa+08P0f8B6AiEl5HyHA28NJMsj50ZMvtor+OnCHEzpg9/w5FXYQrNpmpo2DHWigalZy2dRbV8wq699K3lbguTBCQY5XFjqG1v9fki+dxn0kgHoY2cvZvAn9n9dn7bl2UeJNIKaBQyG+yM77VvdTPMxTYh9t3TehpXbTn/Ls5CSqTbF5oaN71rFBXzqoOW+899ZPpBucg/tj5ttTqdGAY/wyaWcIINMGIcLgWivpGMs/q0MrGQgb6aV35cfvwK+btgi3x1RNecJhU/r8BCPz3wVDBcsA8hRFbinowbGUsk/M X-Microsoft-Exchange-Diag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sbV4PCp7vK22v1y5xivxsrmNHcNhXq4VyzsyQnb6pkxorQ8NcYAZeQmpeeOrRMtQjP1TNJyl0RZNY39m//GRyMd5uFyG6SUVDt9IDDooZRG7FtBqF/Cavly7miQdGyio8vfUps2gUqBQbJtjet99FTM9KHIASKd1pYrCk3FM67ipK+xg== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2017 13:52:57.0806 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0701MB2106 Subject: [dpdk-dev] [PATCH] usertools: fix device binding when using with kernel tools X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 13:53:03 -0000 The following sequence of operation gives error in binding devices 1) Bind a device using dpdk-devbind.py 2) Unbind the device using kernel tools(/sys/bus/pci/device/driver/unbind) 3) Bind the device using kernel tools(/sys/bus/pci/driver/new_id and /sys/bus/pci/driver/bind) The bind failure was due to cached driver name in 'driver_override'. Fix it by writing 'null' to driver_override just after binding a device so that any method of binding/unbinding can be used. Fixes: 2fc350293570 ("usertools: use optimized driver override scheme to bind") Reported-by: Tu LijuanX A Signed-off-by: Guduri Prathyusha --- usertools/dpdk-devbind.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py index bb4d536..1dc1065 100755 --- a/usertools/dpdk-devbind.py +++ b/usertools/dpdk-devbind.py @@ -386,25 +386,6 @@ def unbind_one(dev_id, force): "Skipping unbind" % (dev_id)) return - # For kernels > 3.15 driver_override is used to bind a device to a driver. - # Before unbinding it, overwrite driver_override with empty string so that - # the device can be bound to any other driver - filename = "/sys/bus/pci/devices/%s/driver_override" % dev_id - if os.path.exists(filename): - try: - f = open(filename, "w") - except: - print("Error: unbind failed for %s - Cannot open %s" - % (dev_id, filename)) - sys.exit(1) - try: - f.write("\00") - f.close() - except: - print("Error: unbind failed for %s - Cannot open %s" - % (dev_id, filename)) - sys.exit(1) - # write to /sys to unbind filename = "/sys/bus/pci/drivers/%s/unbind" % dev["Driver_str"] try: @@ -507,6 +488,25 @@ def bind_one(dev_id, driver, force): bind_one(dev_id, saved_driver, force) return + # For kernels > 3.15 driver_override is used to bind a device to a driver. + # Before unbinding it, overwrite driver_override with empty string so that + # the device can be bound to any other driver + filename = "/sys/bus/pci/devices/%s/driver_override" % dev_id + if os.path.exists(filename): + try: + f = open(filename, "w") + except: + print("Error: unbind failed for %s - Cannot open %s" + % (dev_id, filename)) + sys.exit(1) + try: + f.write("\00") + f.close() + except: + print("Error: unbind failed for %s - Cannot open %s" + % (dev_id, filename)) + sys.exit(1) + def unbind_all(dev_list, force=False): """Unbind method, takes a list of device locations""" -- 1.7.9.5