The parameter 'devices_requested' is irrelated to driver_option 'max_vfs'
of 'igb'.

NIC card 82576 has two network interfaces and each can be
virtualized up to 7 virtual functions, therefore we multiply
two for the value of driver_option 'max_vfs' and can thus get
the total number of VFs.

Signed-off-by: Yolkfull Chow <[email protected]>
---
 client/tests/kvm/kvm_utils.py      |   17 +++++++++++------
 client/tests/kvm/virtlab_tests.cfg |   20 ++++++++++++++++++++
 2 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py
index 6017656..25289e9 100644
--- a/client/tests/kvm/kvm_utils.py
+++ b/client/tests/kvm/kvm_utils.py
@@ -1117,17 +1117,22 @@ class PciAssignable(object):
         """
         Get VFs count number according to lspci.
         """
+        # FIXME: Need to think out a method of identify which
+        # 'virtual function' belongs to which physical card considering
+        # that if the host has more than one 82576 card. PCI_ID?
         cmd = "lspci | grep 'Virtual Function' | wc -l"
-        # For each VF we'll see 2 prints of 'Virtual Function', so let's
-        # divide the result per 2
-        return int(commands.getoutput(cmd)) / 2
+        return int(commands.getoutput(cmd))
 
 
     def check_vfs_count(self):
         """
         Check VFs count number according to the parameter driver_options.
         """
-        return (self.get_vfs_count == self.devices_requested)
+        # Network card 82576 has two network interfaces and each can be
+        # virtualized up to 7 virtual functions, therefore we multiply
+        # two for the value of driver_option 'max_vfs'.
+        expected_count = int((re.findall("(\d)", self.driver_option)[0])) * 2
+        return (self.get_vfs_count == expected_count)
 
 
     def is_binded_to_stub(self, full_id):
@@ -1159,6 +1164,8 @@ class PciAssignable(object):
         elif not self.check_vfs_count():
             os.system("modprobe -r %s" % self.driver)
             re_probe = True
+        else:
+            return True
 
         # Re-probe driver with proper number of VFs
         if re_probe:
@@ -1166,8 +1173,6 @@ class PciAssignable(object):
             s, o = commands.getstatusoutput(cmd)
             if s:
                 return False
-            if not self.check_vfs_count():
-                return False
             return True
 
 
diff --git a/client/tests/kvm/virtlab_tests.cfg 
b/client/tests/kvm/virtlab_tests.cfg
index 736d8af..42a9643 100644
--- a/client/tests/kvm/virtlab_tests.cfg
+++ b/client/tests/kvm/virtlab_tests.cfg
@@ -1578,6 +1578,26 @@ vlan:
     RHEL-4.8:
         listen_cmd = "nc -l -p %s > %s"
 
+variants:
+    - @no_pci_assignable:
+        pci_assignable = no
+    - pf_assignable:
+        pci_assignable = pf
+        device_names = eth1
+    - vf_assignable:
+        pci_assignable = vf
+        # Driver (kernel module) that supports SR-IOV hardware.
+        # As of today (30-11-2009), we have 2 drivers for this type of 
hardware:
+        # Intel® 82576 Gigabit Ethernet Controller - igb
+        # Neterion® X3100™ - vxge
+        driver = igb
+        # Driver option to specify the maximum number of virtual functions
+        # (on vxge the option is , for example, is max_config_dev)
+        # the default below is for the igb driver
+        driver_option = "max_vfs=7"
+        # Number of devices that are going to be requested (<=8)
+        devices_requested = 8
+
 image_name.* ?<= images/
 cdrom.* ?<= isos/
 steps ?<= steps/
-- 
1.5.5.6

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to