* [dts] [PATCH V1 0/1] framework/pktgen: fix rfc2544 zero loss rate return value error.
@ 2020-08-07 4:59 yufengmx
2020-08-07 4:59 ` [dts] [PATCH V1 1/1] framework/pktgen: fix rfc2544 zero loss rate return value yufengmx
0 siblings, 1 reply; 2+ messages in thread
From: yufengmx @ 2020-08-07 4:59 UTC (permalink / raw)
To: dts; +Cc: yufengmx
v1:
- fix rfc2544 zero loss rate return value error when rfc2544 loss rate not hit condition.
yufengmx (1):
framework/pktgen: fix rfc2544 zero loss rate return value error.
framework/pktgen_base.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--
2.21.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* [dts] [PATCH V1 1/1] framework/pktgen: fix rfc2544 zero loss rate return value
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
0 siblings, 0 replies; 2+ messages in thread
From: yufengmx @ 2020-08-07 4:59 UTC (permalink / raw)
To: dts; +Cc: yufengmx
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-07 5:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [dts] [PATCH V1 1/1] framework/pktgen: fix rfc2544 zero loss rate return value yufengmx
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).