From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 3AA999370 for ; Thu, 8 Sep 2016 11:00:25 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP; 08 Sep 2016 02:00:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,298,1470726000"; d="scan'208";a="1036963014" Received: from unknown (HELO dpdk-fedora20.icx.intel.com) ([10.240.176.135]) by fmsmga001.fm.intel.com with ESMTP; 08 Sep 2016 02:00:23 -0700 From: "xu,gang" To: dts@dpdk.org Cc: "xu,gang" Date: Thu, 8 Sep 2016 16:55:47 +0800 Message-Id: <1473324947-8753-1-git-send-email-gangx.xu@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [dts] [PATCH V3] modify pci prefix error on freebsd V3 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Sep 2016 09:00:25 -0000 Signed-off-by: xu,gang --- framework/crb.py | 2 +- framework/dut.py | 14 +++++++------- nics/net_device.py | 17 +++++++++-------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/framework/crb.py b/framework/crb.py index 066bb3f..51946f5 100644 --- a/framework/crb.py +++ b/framework/crb.py @@ -281,7 +281,7 @@ class Crb(object): return None return match.group(1) - def get_pci_dev_driver_freebsd(self, bus_id, devfun_id): + def get_pci_dev_driver_freebsd(self, domain_id, bus_id, devfun_id): """ Get the driver of specified pci device. """ diff --git a/framework/dut.py b/framework/dut.py index 2f4e53a..86923d1 100644 --- a/framework/dut.py +++ b/framework/dut.py @@ -229,10 +229,7 @@ class Dut(Crb): """ After all execution done, some special nic like fm10k should be stop """ - for port in self.ports_info: - pci_bus = port['pci'] - pci_id = port['type'] - # get device driver + for (pci_bus, pci_id) in self.pci_devices_info: driver = settings.get_nic_driver(pci_id) if driver is not None: # unbind device driver @@ -718,15 +715,18 @@ class Dut(Crb): self.ports_info = [] skipped = RED('Skipped: Unknown/not selected') - + for (pci_bus, pci_id) in self.pci_devices_info: if not dts.accepted_nic(pci_id): self.logger.info("DUT: [%s %s] %s" % (pci_bus, pci_id, skipped)) continue - - port = GetNicObj(self, pci_bus, '') + addr_array = pci_bus.split(':') + domain_id = addr_array[0] + bus_id = addr_array[1] + devfun_id = addr_array[2] + port = GetNicObj(self, domain_id, bus_id, devfun_id) intf = port.get_interface_name() macaddr = port.get_mac_addr() diff --git a/nics/net_device.py b/nics/net_device.py index 897ceb9..be25ab7 100644 --- a/nics/net_device.py +++ b/nics/net_device.py @@ -136,7 +136,7 @@ class NetDevice(object): socket = -1 return socket - def get_nic_socket_freebsd(self, bus_id, devfun_id): + def get_nic_socket_freebsd(self, domain_id, bus_id, devfun_id): NotImplemented @nic_has_driver @@ -200,7 +200,7 @@ class NetDevice(object): domain_id, bus_id, devfun_id) return self.__send_expect(command, '# ') - def get_interface_name_freebsd(self, bus_id, devfun_id, driver): + def get_interface_name_freebsd(self, domain_id, bus_id, devfun_id, driver): """ Get interface name of specified pci device on Freebsd. """ @@ -212,14 +212,15 @@ class NetDevice(object): get_interface_name_freebsd = getattr(self, 'get_interface_name_freebsd_%s' % generic_driver) - return get_interface_name_freebsd(bus_id, devfun_id) + return get_interface_name_freebsd(domain_id, bus_id, devfun_id) - def get_interface_name_freebsd_generic(self, bus_id, devfun_id): + def get_interface_name_freebsd_generic(self, domain_id, bus_id, devfun_id): """ Get the interface name by the default way on freebsd. """ + pci_str = "%s:%s:%s" % (domain_id, bus_id, devfun_id) out = self.__send_expect("pciconf -l", "# ") - rexp = r"(\w*)@pci0:%s" % bus_id + rexp = r"(\w*)@pci0:%s" % pci_str pattern = re.compile(rexp) match = pattern.findall(out) if len(match) == 0: @@ -307,7 +308,7 @@ class NetDevice(object): (domain_id, bus_id, devfun_id, virtio, intf)) return self.__send_expect(command, '# ') - def get_mac_addr_freebsd(self, intf, bus_id, devfun_id, driver): + def get_mac_addr_freebsd(self, intf, domain_id, bus_id, devfun_id, driver): """ Get mac address of specified pci device on Freebsd. """ @@ -323,9 +324,9 @@ class NetDevice(object): 'get_mac_addr_freebsd_%s' % generic_driver) - return get_mac_addr_freebsd(intf, bus_id, devfun_id) + return get_mac_addr_freebsd(intf, domain_id, bus_id, devfun_id) - def get_mac_addr_freebsd_generic(self, intf, bus_id, devfun_id): + def get_mac_addr_freebsd_generic(self, intf, domain_id, bus_id, devfun_id): """ Get the MAC by the default way on Freebsd. """ -- 1.9.3