test suite reviews and discussions
 help / color / mirror / Atom feed
From: Marvin Liu <yong.liu@intel.com>
To: dts@dpdk.org
Cc: Marvin Liu <yong.liu@intel.com>
Subject: [dts] [PATCH v1] framework/packet: wait link status ready before transmission packets
Date: Thu, 24 Aug 2017 03:31:07 -0400	[thread overview]
Message-ID: <1503559867-29762-1-git-send-email-yong.liu@intel.com> (raw)

Link status may not be ready when suite calling transmission function.
Now check link status first and then transmit packets.

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

diff --git a/framework/packet.py b/framework/packet.py
index 924fd5e..e9a1c41 100755
--- a/framework/packet.py
+++ b/framework/packet.py
@@ -351,7 +351,21 @@ class scapy(object):
 
     def send_pkt(self, intf='', count=1):
         self.print_summary()
+
         if intf != '':
+            # wait few seconds for link ready
+            countdown = 600
+            while countdown:
+                link_st = subprocess.check_output("ip link show %s" % intf,
+                                                  stderr=subprocess.STDOUT,
+                                                  shell=True)
+                if "LOWER_UP" in link_st:
+                    break
+                else:
+                    time.sleep(0.01)
+                    countdown -= 1
+                    continue
+
             # fix fortville can't receive packets with 00:00:00:00:00:00
             if self.pkt.getlayer(0).src == "00:00:00:00:00:00":
                 self.pkt.getlayer(0).src = get_if_hwaddr(intf)
-- 
1.9.3

                 reply	other threads:[~2017-08-24  7:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1503559867-29762-1-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).