test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH 1/2] Support assign vf mac address in scenario configuration
@ 2015-09-18 14:39 Yong Liu
  2015-09-18 14:39 ` [dts] [PATCH 2/2] Support VF mac address assign feature Yong Liu
  0 siblings, 1 reply; 2+ messages in thread
From: Yong Liu @ 2015-09-18 14:39 UTC (permalink / raw)
  To: dts

From: Marvin Liu <yong.liu@intel.com>

Scenario module will call Netdevice module set_vf_mac_addr function to assign VF mac address.

Signed-off-by: Marvin Liu <yong.liu@intel.com>

diff --git a/conf/scene/vf_passthrough.cfg b/conf/scene/vf_passthrough.cfg
index aa5493d..19f41c1 100644
--- a/conf/scene/vf_passthrough.cfg
+++ b/conf/scene/vf_passthrough.cfg
@@ -18,11 +18,13 @@ mem =
     size=2048,hugepage=no;
 disk =
     file=/storage/vm-image/vm0.img;
+login =
+    user=root,password=tester;
 dev_gen =
     pf_idx=0,vf_num=2,driver=default;
     pf_idx=1,vf_num=2,driver=default;
 device =
-    vf_idx=0,pf_dev=0,guestpci=auto;
-    vf_idx=0,pf_dev=1,guestpci=auto;
+    vf_idx=0,pf_dev=0,guestpci=auto,mac=00:00:00:00:01:01;
+    vf_idx=0,pf_dev=1,guestpci=auto,mac=00:00:00:00:01:02;
 vnc = 
     displayNum=1;
diff --git a/framework/virt_scene.py b/framework/virt_scene.py
index b201541..7eb475d 100644
--- a/framework/virt_scene.py
+++ b/framework/virt_scene.py
@@ -259,6 +259,7 @@ class VirtScene(object):
         # strip vf pci id
         if 'pf_dev' in param.keys():
             pf = int(param['pf_dev'])
+            pf_net = self.host_dut.ports_info[pf]['port']
             vfs = self.host_dut.ports_info[pf]['vfs_port']
             vf_idx = int(param['vf_idx'])
             if vf_idx >= len(vfs):
@@ -268,6 +269,8 @@ class VirtScene(object):
             vf_param['opt_host'] = vf_pci
             if param['guestpci'] != 'auto':
                 vf_param['opt_addr'] = param['guestpci']
+            if 'mac' in param.keys():
+                pf_net.set_vf_mac_addr(vf_idx, param['mac'])
         else:
             print dts.RED("Invalid vf device config, request pf_dev")
 
-- 
1.9.3

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [dts] [PATCH 2/2] Support VF mac address assign feature
  2015-09-18 14:39 [dts] [PATCH 1/2] Support assign vf mac address in scenario configuration Yong Liu
@ 2015-09-18 14:39 ` Yong Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Yong Liu @ 2015-09-18 14:39 UTC (permalink / raw)
  To: dts

From: Marvin Liu <yong.liu@intel.com>

Assgin VF mac address when pf driver is default linux driver.
Now not support other dirver yet.

Signed-off-by: Marvin Liu <yong.liu@intel.com>

diff --git a/framework/net_device.py b/framework/net_device.py
index 9afa6ca..37495bd 100644
--- a/framework/net_device.py
+++ b/framework/net_device.py
@@ -198,6 +198,24 @@ class NetDevice(object):
         return match[0]
 
     @nic_has_driver
+    def set_vf_mac_addr(self, vf_idx=0, mac="00:00:00:00:00:01"):
+        """
+        Set mac address of specified vf device.
+        """
+        set_vf_mac_addr = getattr(self, 'set_vf_mac_addr_%s' % self.__get_os_type())
+        out = set_vf_mac_addr(self.intf_name, vf_idx, mac)
+
+    def set_vf_mac_addr_linux(self, intf, vf_idx, mac):
+        """
+        Set mac address of specified vf device on linux.
+        """
+        if self.current_driver != self.default_driver:
+            print "Only support when PF bound to default driver"
+            return
+
+        self.__send_expect("ip link set %s vf %d mac %s" % (intf, vf_idx, mac), "# ")
+
+    @nic_has_driver
     def get_mac_addr(self):
         """
         Get mac address of specified pci device.
-- 
1.9.3

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-18 14:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-18 14:39 [dts] [PATCH 1/2] Support assign vf mac address in scenario configuration Yong Liu
2015-09-18 14:39 ` [dts] [PATCH 2/2] Support VF mac address assign feature Yong Liu

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).