From patchwork Fri Jul 14 15:23:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jiale, SongX" X-Patchwork-Id: 129536 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C8DF942E6E; Fri, 14 Jul 2023 09:08:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C01D440A81; Fri, 14 Jul 2023 09:08:45 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 987C240685 for ; Fri, 14 Jul 2023 09:08:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689318524; x=1720854524; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=UHnjDi5ISxiKFBYhWs+dbytoIJl1psQrimrlj4OkMqU=; b=ezjhiMoNmQbVY0KEq/1wEjKuyaHd1e3XfRdoYAm49IYSBrF5D673Gy/f d9G9BHiC8/aT4XA9q7XJZZ4luQ1dBHWiRQiqOQ5TH1SLxulQyDrpbLd7+ CvdjxQ2qlCu8XYrwM+fYJfoS9vQbWIQSQmmdDWOY4agVI8p5sF/nRqWyR xPcWkRfzuFIfjh6dLpdKnHd7o1GJsJpPJfYIf3cr0u/r34aN2d61H20oP aN66IYgSgRsW3vo1GCsf28hhPUG9dZd1R17y547edYCYrnAPk14Ali6fT qs5U8gylUEJ5bxn2q0MnmpC7reYmnvjwg+zapWmFmQPWXInPqTqx+2iJ9 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="355347393" X-IronPort-AV: E=Sophos;i="6.01,204,1684825200"; d="scan'208";a="355347393" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2023 00:08:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="757473597" X-IronPort-AV: E=Sophos;i="6.01,204,1684825200"; d="scan'208";a="757473597" Received: from unknown (HELO dpdk.sh.intel.com) ([10.239.252.241]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2023 00:08:42 -0700 From: Jiale Song To: dts@dpdk.org Cc: Jiale Song Subject: [dts] [PATCH V1] framework/dut: optimize scripts Date: Fri, 14 Jul 2023 23:23:04 +0800 Message-Id: <20230714152304.1129546-1-songx.jiale@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org 1. delete unnecessary waiting time. the iavf driver does not need to execute a separate wait, which is invalid and only increases the invalid waiting time. 2. when the NIC name is N/A or empty, the name cannot be changed no matter how long it is waiting. after obtaining N/A, it is necessary to rebind the driver of the NIC. Signed-off-by: Jiale Song --- framework/dut.py | 48 +++++++++++++++--------------------------------- 1 file changed, 15 insertions(+), 33 deletions(-) diff --git a/framework/dut.py b/framework/dut.py index 0adb2786..61ef2839 100644 --- a/framework/dut.py +++ b/framework/dut.py @@ -416,50 +416,32 @@ class Dut(Crb): port = GetNicObj(self, domain_id, bus_id, devfun_id) - self.send_expect( - "echo %s > /sys/bus/pci/devices/%s\:%s\:%s/driver/unbind" - % (pci_bus, domain_id, bus_id, devfun_id), - "# ", - timeout=30, - ) - # bind to linux kernel driver - if not self.is_container: - self.send_expect("modprobe %s" % driver, "# ", timeout=30) - self.send_expect( - "echo %s > /sys/bus/pci/drivers/%s/bind" % (pci_bus, driver), - "# ", - timeout=30, - ) pull_retries = 5 itf = "N/A" while pull_retries > 0: + self.send_expect( + "echo %s > /sys/bus/pci/devices/%s\:%s\:%s/driver/unbind" + % (pci_bus, domain_id, bus_id, devfun_id), + "# ", + timeout=30, + ) + # bind to linux kernel driver + if not self.is_container: + self.send_expect("modprobe %s" % driver, "# ", timeout=30) + self.send_expect( + "echo %s > /sys/bus/pci/drivers/%s/bind" % (pci_bus, driver), + "# ", + timeout=30, + ) + time.sleep(1) if port_info["port_id"] == 1: itf = port.get_interface_name() else: itf = port.get_interface2_name() if not itf or itf == "N/A": - time.sleep(1) pull_retries -= 1 else: break - else: - # try to bind nic with iavf - if driver == "iavf": - self.send_expect("modprobe %s" % driver, "# ") - self.send_expect( - "echo %s > /sys/bus/pci/drivers/%s/bind" - % (pci_bus, driver), - "# ", - ) - pull_retries = 5 - itf = "N/A" - while pull_retries > 0: - itf = port.get_interface_name() - if not itf or itf == "N/A": - time.sleep(1) - pull_retries -= 1 - else: - break if itf == "N/A": self.logger.warning("Fail to bind the device with the linux driver") else: