[dts] [PATCH 6/6] framework/crb: rework restore_interfaces()
Liu, Yong
yong.liu at intel.com
Wed Jan 14 02:35:54 CET 2015
That's great, will merged into main branch.
> -----Original Message-----
> From: Qiu, Michael
> Sent: Tuesday, January 13, 2015 9:42 PM
> To: dts at dpdk.org
> Cc: Liu, Yong; Qiu, Michael
> Subject: [PATCH 6/6] framework/crb: rework restore_interfaces()
>
> Currently restore_interfaces() is very ugly, and hard to add new
> device's support.
>
> Just make it more flexible to support other new device.
>
> Signed-off-by: Michael Qiu <michael.qiu at intel.com>
> ---
> framework/crb.py | 33 ++++++++++++++++++---------------
> 1 file changed, 18 insertions(+), 15 deletions(-)
>
> diff --git a/framework/crb.py b/framework/crb.py
> index ee005c4..a08db46 100644
> --- a/framework/crb.py
> +++ b/framework/crb.py
> @@ -139,30 +139,33 @@ class Crb(object):
> """
> Restore Linux interfaces.
> """
> + # ToDo: put to cfg file later
> + driver_list = ["igb", "ixgbe", "e1000e", "e1000", "virtio_net", "i40e"]
> if dts.drivername == "vfio-pci":
> self.send_expect("rmmod vfio_iommu_type1", "# ", 10)
> self.send_expect("rmmod vfio_pci", "# ", 10)
> self.send_expect("rmmod vfio", "# ", 10)
> else:
> self.send_expect("rmmod igb_uio", "# ", 10)
> - self.send_expect("modprobe igb", "# ", 20)
> - self.send_expect("modprobe ixgbe", "# ", 20)
> - self.send_expect("modprobe e1000e", "# ", 20)
> - self.send_expect("modprobe e1000", "# ", 20)
> - self.send_expect("modprobe virtio_net", "# ", 20)
> + for driver in driver_list:
> + # Need remove check after i40e driver in upstream linux kernel
> + if driver != "i40e":
> + self.send_expect("modprobe %s"%driver, "# ", 20)
> + else:
> + self.send_expect("insmod /root/i40e.ko", "# ", 30)
>
> try:
> for (pci_bus, pci_id) in self.pci_devices_info:
> - if pci_id in ('8086:10fb', '8086:151c', '8086:1528', '8086:1512',
> '8086:154a'):
> - self.send_expect("echo 0000:%s >
> /sys/bus/pci/drivers/ixgbe/bind" % pci_bus, "# ")
> - elif pci_id in ('8086:10e8', '8086:150e', '8086:1521', '8086:10c9',
> '8086:1526', '8086:1533'):
> - self.send_expect("echo 0000:%s > /sys/bus/pci/drivers/igb/bind" %
> pci_bus, "# ")
> - elif pci_id in('8086:10d3', '8086:10b9'):
> - self.send_expect("echo 0000:%s >
> /sys/bus/pci/drivers/e1000e/bind" % pci_bus, "# ")
> - elif pci_id in ('8086:100f', '8086:100e'):
> - self.send_expect("echo 0000:%s >
> /sys/bus/pci/drivers/e1000/bind" % pci_bus, "# ")
> - elif pci_id in ('1af4:1000'):
> - self.send_expect("echo 0000%s > /sys/bus/pci/drivers/virtio-
> pci/bind" % pci_bus, "# ")
> + full_bus = "0000:%s"% pci_bus
> + driver_path = "/sys/bus/pci/devices/%s/driver"%full_bus
> + # Get the abs path of the driver
> + driver_path = self.send_expect("cd %s && pwd -P" %
> + driver_path, "# ",
> + verify = True)
> + if driver_path != -1 and \
> + driver_path.split('/')[-1] in driver_list:
> + self.send_expect("echo %s > %s/bind" %
> + (full_bus, driver_path), "# ")
> else:
> continue
>
> --
> 1.9.3
More information about the dts
mailing list