From: "Liu, Yong" <yong.liu@intel.com>
To: "Qiu, Michael" <michael.qiu@intel.com>, "dts@dpdk.org" <dts@dpdk.org>
Subject: Re: [dts] [PATCH 6/6] framework/crb: rework restore_interfaces()
Date: Wed, 14 Jan 2015 01:35:54 +0000 [thread overview]
Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E10D4C287@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <1421156540-25810-7-git-send-email-michael.qiu@intel.com>
That's great, will merged into main branch.
> -----Original Message-----
> From: Qiu, Michael
> Sent: Tuesday, January 13, 2015 9:42 PM
> To: dts@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@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
prev parent reply other threads:[~2015-01-14 1:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-13 13:42 [dts] [PATCH 0/6] DTS enhancement and clean up Michael Qiu
2015-01-13 13:42 ` [dts] [PATCH 1/6] framework/tester: Fix NoneType Error of port_map Michael Qiu
2015-01-14 1:15 ` Liu, Yong
2015-01-25 1:07 ` Liu, Yong
2015-01-13 13:42 ` [dts] [PATCH 2/6] framework/crbs: Info clean up of crbs Michael Qiu
2015-01-25 1:07 ` Liu, Yong
2015-01-13 13:42 ` [dts] [PATCH 3/6] framework: Add login password support Michael Qiu
2015-01-14 1:18 ` Liu, Yong
2015-01-25 1:07 ` Liu, Yong
2015-01-13 13:42 ` [dts] [PATCH 4/6] framework/ssh: Add verify ability for command execution Michael Qiu
2015-01-14 1:24 ` Liu, Yong
2015-01-27 5:22 ` [dts] [PATCH v2] " Michael Qiu
2015-02-15 5:05 ` Liu, Yong
2015-01-13 13:42 ` [dts] [PATCH 5/6] framework: Fix ifname not found error Michael Qiu
2015-01-14 1:35 ` Liu, Yong
2015-01-13 13:42 ` [dts] [PATCH 6/6] framework/crb: rework restore_interfaces() Michael Qiu
2015-01-14 1:35 ` Liu, Yong [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86228AFD5BCD8E4EBFD2B90117B5E81E10D4C287@SHSMSX103.ccr.corp.intel.com \
--to=yong.liu@intel.com \
--cc=dts@dpdk.org \
--cc=michael.qiu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).