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/3] Optimize virtual machine port map routine
Date: Mon, 29 Jun 2015 13:17:14 +0800	[thread overview]
Message-ID: <1435555035-28355-3-git-send-email-yong.liu@intel.com> (raw)
In-Reply-To: <1435555035-28355-1-git-send-email-yong.liu@intel.com>

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

Skip ping from those devices which on the same PF devices.

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

diff --git a/framework/virt_dut.py b/framework/virt_dut.py
index 79ecc2a..2edbf6f 100644
--- a/framework/virt_dut.py
+++ b/framework/virt_dut.py
@@ -285,29 +285,32 @@ class VirtDut(DPDKdut):
 
         hits = [False] * len(self.tester.ports_info)
 
-        for dutPort in range(nrPorts):
-            peer = self.get_peer_pci(dutPort)
+        for vmPort in range(nrPorts):
+            vmpci = self.ports_info[vmPort]['pci']
+            peer = self.get_peer_pci(vmPort)
             # if peer pci configured
             if peer is not None:
                 for remotePort in range(len(self.tester.ports_info)):
                     if self.tester.ports_info[remotePort]['pci'] == peer:
                         hits[remotePort] = True
-                        self.ports_map[dutPort] = remotePort
+                        self.ports_map[vmPort] = remotePort
                         break
-                if self.ports_map[dutPort] == -1:
+                if self.ports_map[vmPort] == -1:
                     self.logger.error("CONFIGURED TESTER PORT CANNOT FOUND!!!")
                 else:
                     continue  # skip ping6 map
 
-            if hasattr(self.hyper, 'pt_devices'):
-                hostpci = self.hyper.pt_devices[dutPort]
-                netdev = get_netdev(self.host_dut, hostpci)
+            # strip pci address on host for pass-through device
+            hostpci = 'N/A'
+            for pci_map in self.hyper.pci_maps:
+                if vmpci == pci_map['guestpci']:
+                    hostpci = pci_map['hostpci']
+                    break
 
             # auto ping port map
             for remotePort in range(len(self.tester.ports_info)):
                 # for two vfs connected to same tester port
-                # can't skip those teste ports even have hits
-                # need skip ping self vf port
+                # need skip ping from devices on same pf device
                 remotepci = self.tester.ports_info[remotePort]['pci']
                 remoteport =  self.tester.ports_info[remotePort]['port']
                 vfs = []
@@ -315,21 +318,21 @@ class VirtDut(DPDKdut):
                 host_ip = self.crb['IP'].split(':')[0]
                 if self.crb['tester IP'] == host_ip:
                     vfs = remoteport.get_sriov_vfs_pci()
-                # if hostpci is vf of tester port
-                if netdev.pci in vfs:
-                    print dts.RED("Skip ping from PF device")
-                    continue
+                    # if hostpci is vf of tester port
+                    if hostpci == remotepci or hostpci in vfs:
+                        print dts.RED("Skip ping from same PF device")
+                        continue
 
-                ipv6 = self.get_ipv6_address(dutPort)
+                ipv6 = self.get_ipv6_address(vmPort)
                 if ipv6 == "Not connected":
                     continue
 
                 out = self.tester.send_ping6(
-                    remotePort, ipv6, self.get_mac_address(dutPort))
+                    remotePort, ipv6, self.get_mac_address(vmPort))
 
                 if ('64 bytes from' in out):
                     self.logger.info(
-                        "PORT MAP: [dut %d: tester %d]" % (dutPort, remotePort))
-                    self.ports_map[dutPort] = remotePort
+                        "PORT MAP: [dut %d: tester %d]" % (vmPort, remotePort))
+                    self.ports_map[vmPort] = remotePort
                     hits[remotePort] = True
                     continue
-- 
1.9.3

  parent reply	other threads:[~2015-06-29  5:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-29  5:17 [dts] [PATCH 0/3] Optimize virtual machine network topology discovery Yong Liu
2015-06-29  5:17 ` [dts] [PATCH 1/3] Add new API for get host and VM pass-throught devices pci mapping Yong Liu
2015-06-29  5:17 ` Yong Liu [this message]
2015-06-29  5:17 ` [dts] [PATCH 3/3] Refresh default VM configurations after setting VM name Yong Liu

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=1435555035-28355-3-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).