test suite reviews and discussions
 help / color / mirror / Atom feed
From: Yong Liu <yong.liu@intel.com>
To: dts@dpdk.org
Subject: [dts] [PATCH 2/2] Support VF mac address assign feature
Date: Fri, 18 Sep 2015 22:39:08 +0800	[thread overview]
Message-ID: <1442587148-23698-2-git-send-email-yong.liu@intel.com> (raw)
In-Reply-To: <1442587148-23698-1-git-send-email-yong.liu@intel.com>

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

      reply	other threads:[~2015-09-18 14:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [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=1442587148-23698-2-git-send-email-yong.liu@intel.com \
    --to=yong.liu@intel.com \
    --cc=dts@dpdk.org \
    /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).