From: yufengmx <yufengx.mo@intel.com>
To: dts@dpdk.org
Cc: yufengmx <yufengx.mo@intel.com>
Subject: [dts] [PATCH V1 1/1] framework/pktgen: fix rfc2544 zero loss rate return value
Date: Fri, 7 Aug 2020 12:59:53 +0800 [thread overview]
Message-ID: <20200807045953.31955-2-yufengx.mo@intel.com> (raw)
In-Reply-To: <20200807045953.31955-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 | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/framework/pktgen_base.py b/framework/pktgen_base.py
index 049142f..768362d 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,7 +563,7 @@ 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]
+ ret_value = hit_rate, hit_result[0][1], hit_result[0][2]
self.logger.info("zero loss rate is %f" % rate)
return ret_value
--
2.21.0
prev parent reply other threads:[~2020-08-07 5:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-07 4:59 [dts] [PATCH V1 0/1] framework/pktgen: fix rfc2544 zero loss rate return value error yufengmx
2020-08-07 4:59 ` yufengmx [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=20200807045953.31955-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).