* Re: [dts] [PATCH V2]framework/pktgen_base: fix rfc2544 return value missing zero
2019-08-26 1:18 ` [dts] [PATCH V2]framework/pktgen_base: fix rfc2544 return value missing zero yufengmx
@ 2019-08-26 1:35 ` Ma, LihongX
2019-09-04 5:01 ` Tu, Lijuan
1 sibling, 0 replies; 4+ messages in thread
From: Ma, LihongX @ 2019-08-26 1:35 UTC (permalink / raw)
To: Mo, YufengX, dts
Tested-by: lihong<lihongx.ma@intel.com>
-----Original Message-----
From: Mo, YufengX
Sent: Monday, August 26, 2019 9:19 AM
To: dts@dpdk.org; Ma, LihongX <lihongx.ma@intel.com>
Cc: Mo, YufengX <yufengx.mo@intel.com>
Subject: [dts][PATCH V2]framework/pktgen_base: fix rfc2544 return value missing zero
loss rate
fix rfc2544 return value missing zero loss rate.
Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
framework/pktgen_base.py | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/framework/pktgen_base.py b/framework/pktgen_base.py index e9d3fcb..06ad738 100644
--- a/framework/pktgen_base.py
+++ b/framework/pktgen_base.py
@@ -256,20 +256,20 @@ class PacketGenerator(object):
def measure_rfc2544(self, stream_ids=[], options={}):
""" check loss rate with rate percent dropping """
loss_rate_table = []
- rate_percent = float(100)
+ rate_percent = options.get('rate') or float(100)
permit_loss_rate = options.get('pdr') or 0
self.logger.info("allow loss rate: %f " % permit_loss_rate)
rate_step = options.get('drop_step') or 1
result = self._measure_loss(stream_ids, options)
status = self._check_loss_rate(result, permit_loss_rate)
- loss_rate_table.append(
- [options.get('rate') or rate_percent, result])
+ loss_rate_table.append([rate_percent, result])
# if first time loss rate is ok, ignore left flow
if status:
# return data is the same with dts/etgen format
# In fact, multiple link peer have multiple loss rate value,
# here only pick one
- return result.values()[0]
+ tx_num, rx_num = result.values()[0][1:]
+ return rate_percent, tx_num, rx_num
_options = deepcopy(options)
while not status and rate_percent > 0:
rate_percent = rate_percent - rate_step @@ -288,7 +288,10 @@ class PacketGenerator(object):
# use last result as return data to keep the same with dts/etgen format
# In fact, multiple link peer have multiple loss rate value,
# here only pick one
- return loss_rate_table[-1][1].values()[0]
+ last_result = loss_rate_table[-1]
+ rate_percent = last_result[0]
+ tx_num, rx_num = last_result[1].values()[0][1:]
+ return rate_percent, tx_num, rx_num
def measure_rfc2544_with_pps(self, stream_ids=[], options={}):
"""
--
1.9.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dts] [PATCH V2]framework/pktgen_base: fix rfc2544 return value missing zero
2019-08-26 1:18 ` [dts] [PATCH V2]framework/pktgen_base: fix rfc2544 return value missing zero yufengmx
2019-08-26 1:35 ` Ma, LihongX
@ 2019-09-04 5:01 ` Tu, Lijuan
1 sibling, 0 replies; 4+ messages in thread
From: Tu, Lijuan @ 2019-09-04 5:01 UTC (permalink / raw)
To: Mo, YufengX, dts, Ma, LihongX; +Cc: Mo, YufengX
Applied, thanks
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of yufengmx
> Sent: Monday, August 26, 2019 9:19 AM
> To: dts@dpdk.org; Ma, LihongX <lihongx.ma@intel.com>
> Cc: Mo, YufengX <yufengx.mo@intel.com>
> Subject: [dts] [PATCH V2]framework/pktgen_base: fix rfc2544 return value
> missing zero
>
> loss rate
>
> fix rfc2544 return value missing zero loss rate.
>
> Signed-off-by: yufengmx <yufengx.mo@intel.com>
> ---
> framework/pktgen_base.py | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/framework/pktgen_base.py b/framework/pktgen_base.py index
> e9d3fcb..06ad738 100644
> --- a/framework/pktgen_base.py
> +++ b/framework/pktgen_base.py
> @@ -256,20 +256,20 @@ class PacketGenerator(object):
> def measure_rfc2544(self, stream_ids=[], options={}):
> """ check loss rate with rate percent dropping """
> loss_rate_table = []
> - rate_percent = float(100)
> + rate_percent = options.get('rate') or float(100)
> permit_loss_rate = options.get('pdr') or 0
> self.logger.info("allow loss rate: %f " % permit_loss_rate)
> rate_step = options.get('drop_step') or 1
> result = self._measure_loss(stream_ids, options)
> status = self._check_loss_rate(result, permit_loss_rate)
> - loss_rate_table.append(
> - [options.get('rate') or rate_percent, result])
> + loss_rate_table.append([rate_percent, result])
> # if first time loss rate is ok, ignore left flow
> if status:
> # return data is the same with dts/etgen format
> # In fact, multiple link peer have multiple loss rate value,
> # here only pick one
> - return result.values()[0]
> + tx_num, rx_num = result.values()[0][1:]
> + return rate_percent, tx_num, rx_num
> _options = deepcopy(options)
> while not status and rate_percent > 0:
> rate_percent = rate_percent - rate_step @@ -288,7 +288,10 @@
> class PacketGenerator(object):
> # use last result as return data to keep the same with dts/etgen format
> # In fact, multiple link peer have multiple loss rate value,
> # here only pick one
> - return loss_rate_table[-1][1].values()[0]
> + last_result = loss_rate_table[-1]
> + rate_percent = last_result[0]
> + tx_num, rx_num = last_result[1].values()[0][1:]
> + return rate_percent, tx_num, rx_num
>
> def measure_rfc2544_with_pps(self, stream_ids=[], options={}):
> """
> --
> 1.9.3
^ permalink raw reply [flat|nested] 4+ messages in thread