From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 555F2A04AE; Fri, 7 Aug 2020 07:01:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A84D51C033; Fri, 7 Aug 2020 07:01:56 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 368132B87 for ; Fri, 7 Aug 2020 07:01:55 +0200 (CEST) IronPort-SDR: F4DEpOGTuJ+fikimDwPsGARXrgBl/FrmVEJiGLIOXaElZlLcQBGfkMDWiKgqP9fm0b3VtQ8dsq gh+ja/7dJk2w== X-IronPort-AV: E=McAfee;i="6000,8403,9705"; a="150727955" X-IronPort-AV: E=Sophos;i="5.75,444,1589266800"; d="scan'208";a="150727955" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Aug 2020 22:01:54 -0700 IronPort-SDR: mR/FgxkUAdqI92JMOLhGT45fCcdfBPxDFLFCakgjuIJAVxCjPhz99NclpbTaouRHHmRX06VQ2M UB3CcDwbIM8g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,444,1589266800"; d="scan'208";a="325640911" Received: from dpdk-moyufen06.sh.intel.com ([10.67.116.208]) by fmsmga002.fm.intel.com with ESMTP; 06 Aug 2020 22:01:53 -0700 From: yufengmx To: dts@dpdk.org Cc: yufengmx Date: Fri, 7 Aug 2020 12:59:53 +0800 Message-Id: <20200807045953.31955-2-yufengx.mo@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200807045953.31955-1-yufengx.mo@intel.com> References: <20200807045953.31955-1-yufengx.mo@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dts] [PATCH V1 1/1] framework/pktgen: fix rfc2544 zero loss rate return value X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" error. fix rfc2544 zero loss rate return value error when rfc2544 loss rate not hit condition. Signed-off-by: yufengmx --- 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