From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B7741A034F; Sat, 2 Nov 2019 15:23:24 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1510A1D405; Sat, 2 Nov 2019 15:23:24 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 88D121BF1B for ; Sat, 2 Nov 2019 15:23:22 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA2EN7p9016831; Sat, 2 Nov 2019 07:23:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=CSzzwiDINyDRrXwar/b6AvSIg01HRE4bn7a/voezkXQ=; b=oC8O80/gPUhyVWY8Rf2RwBIi53f9Z1BJsBwei6S4GPoTaXMAP1BTRcP193LoCQgMBsEy PmvfNeEbtz9QhU5EXrDNTBM32TMCEkdm8X2uHbf2rjLPaCjpUImRQMeJwoyAJK9Ju8wb 89qgxx4LQAXxJjITmUOj17/22qOS0tbT4Wvk5gxqAif1zq2G/pC9WyqM2xkXVUC7aaWd quOyl64wTQ6C7pPE9LH5q3tH45e3nYX1Ma4OMrAIUJkK2O3QuWg27sg/ahUmhdn8kWLV wV/pXLeZAwcphyKaSTdNp8FXJ4qFVh8imECSmtecMttR3et7Nw87amt/3zgPJ3+0DQxg hQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2w17n8rg93-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sat, 02 Nov 2019 07:23:21 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sat, 2 Nov 2019 07:23:20 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Sat, 2 Nov 2019 07:23:20 -0700 Received: from BG-LT7430.marvell.com (unknown [10.28.17.62]) by maili.marvell.com (Postfix) with ESMTP id 2D9603F703F; Sat, 2 Nov 2019 07:23:17 -0700 (PDT) From: To: , CC: , Pavan Nikhilesh , "Phanendra Vukkisala" Date: Sat, 2 Nov 2019 19:53:15 +0530 Message-ID: <20191102142316.750-1-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190921181626.13034-1-pbhagavatula@marvell.com> References: <20190921181626.13034-1-pbhagavatula@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-11-02_09:2019-11-01,2019-11-02 signatures=0 Subject: [dpdk-dev] [PATCH v2] usertools: enhance device bind script module detection 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Pavan Nikhilesh Some kernel modules use '-' in their name when registering through `pci_register_driver` and the same name is populated in '/sys/bus/pci/drivers/'. But the kernel always populates modules names replacing '-' with '_' in '/sys/module/'. Example: # ./usertools/dpdk-devbind.py -b octeontx2-nicpf 0002:03:00.0 Error: Driver 'octeontx2-nicpf' is not loaded. # ls /sys/bus/pci/drivers/octeontx2-nicpf bind module new_id remove_id uevent unbind # ls /sys/module/octeontx2_nicpf/ drivers uevent version The patch addresses it by always replacing '-' with '_' when looking in '/sys/module/' Signed-off-by: Phanendra Vukkisala Signed-off-by: Pavan Nikhilesh --- usertools/dpdk-devbind.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py index 7b5cbc12c..b1d149876 100755 --- a/usertools/dpdk-devbind.py +++ b/usertools/dpdk-devbind.py @@ -153,6 +153,9 @@ def check_output(args, stderr=None): def module_is_loaded(module): global loaded_modules + if module == 'vfio_pci': + module = 'vfio-pci' + if loaded_modules: return module in loaded_modules @@ -520,7 +523,7 @@ def bind_all(dev_list, driver, force=False): pass # check if we're attempting to bind to a driver that isn't loaded - if not module_is_loaded(driver): + if not module_is_loaded(driver.replace('-','_')): sys.exit("Error: Driver '%s' is not loaded." % driver) try: -- 2.17.1