test suite reviews and discussions
 help / color / mirror / Atom feed
From: yufengmx <yufengx.mo@intel.com>
To: dts@dpdk.org
Cc: yufengmx <yufengx.mo@intel.com>
Subject: [dts] [PATCH V2 1/1] framework/pktgen: fix rfc2544 zero loss rate return value
Date: Tue, 11 Aug 2020 11:21:45 +0800	[thread overview]
Message-ID: <20200811032145.18999-2-yufengx.mo@intel.com> (raw)
In-Reply-To: <20200811032145.18999-1-yufengx.mo@intel.com>

 error.

fix rfc2544 zero loss rate return value error when rfc2544 loss rate not hit condition.

Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
 framework/pktgen_base.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/framework/pktgen_base.py b/framework/pktgen_base.py
index 049142f..8003e01 100644
--- a/framework/pktgen_base.py
+++ b/framework/pktgen_base.py
@@ -508,6 +508,7 @@ class PacketGenerator(object):
         # traffic parameters for dichotomy algorithm
         loss_rate_table = []
         hit_result = None
+        hit_rate = 0
         rate = traffic_rate_max = max_rate
         traffic_rate_min = min_rate
         while True:
@@ -523,6 +524,7 @@ class PacketGenerator(object):
             # if upper bound rate percent hit, quit the left flow
             if rate == max_rate and status:
                 hit_result = result
+                hit_rate = rate
                 break
             # if lower bound rate percent not hit, quit the left flow
             if rate == min_rate and not status:
@@ -530,6 +532,7 @@ class PacketGenerator(object):
             if status:
                 traffic_rate_min = rate
                 hit_result = result
+                hit_rate = rate
             else:
                 traffic_rate_max = rate
             if traffic_rate_max - traffic_rate_min < accuracy:
@@ -549,7 +552,7 @@ class PacketGenerator(object):
                 ret_value = 0, result[0][0][1], result[0][0][2], 0
             else:
                 self.logger.debug(pformat(loss_rate_table))
-                ret_value = rate, hit_result[0][0][1], hit_result[0][0][2], hit_result[1][1]
+                ret_value = hit_rate, hit_result[0][0][1], hit_result[0][0][2], hit_result[1][1]
         else:
             if not hit_result:
                 msg = ('expected permit loss rate <{0}> '
@@ -560,8 +563,8 @@ class PacketGenerator(object):
                 ret_value = 0, result[0][1], result[0][2]
             else:
                 self.logger.debug(pformat(loss_rate_table))
-                ret_value = rate, hit_result[0][1], hit_result[0][2]
-        self.logger.info("zero loss rate is %f" % rate)
+                ret_value = hit_rate, hit_result[0][1], hit_result[0][2]
+        self.logger.info("zero loss rate is %f" % hit_rate)
 
         return ret_value
 
-- 
2.21.0


  reply	other threads:[~2020-08-11  3:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-11  3:21 [dts] [PATCH V2 0/1] framework/pktgen: fix rfc2544 zero loss rate return value error yufengmx
2020-08-11  3:21 ` yufengmx [this message]
2020-08-12  8:09   ` [dts] [PATCH V2 1/1] framework/pktgen: fix rfc2544 zero loss rate return value Tu, Lijuan

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=20200811032145.18999-2-yufengx.mo@intel.com \
    --to=yufengx.mo@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).