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 8B9D6A04D7; Tue, 11 Aug 2020 05:23:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 823E11C020; Tue, 11 Aug 2020 05:23:59 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 1434BF90 for ; Tue, 11 Aug 2020 05:23:55 +0200 (CEST) IronPort-SDR: axSkdkLuMXo4v1LPyJReckE6fVNss1h2FWmJlNH94x2gYXWwkIGUedR0GEtx8bGUbcnwlJgbsF IsNasDurJCSA== X-IronPort-AV: E=McAfee;i="6000,8403,9709"; a="133199297" X-IronPort-AV: E=Sophos;i="5.75,459,1589266800"; d="scan'208";a="133199297" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2020 20:23:55 -0700 IronPort-SDR: HblfehNeXv/ZS4NadBhhYJVXs5h5R985VxR3EaYwIGO2w4hbYCg/RBRs54vbx1RCc4uojtMbxj LOHaelVuxFZA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,459,1589266800"; d="scan'208";a="334436343" Received: from dpdk-moyufen06.sh.intel.com ([10.67.116.208]) by orsmga007.jf.intel.com with ESMTP; 10 Aug 2020 20:23:53 -0700 From: yufengmx To: dts@dpdk.org Cc: yufengmx Date: Tue, 11 Aug 2020 11:21:45 +0800 Message-Id: <20200811032145.18999-2-yufengx.mo@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200811032145.18999-1-yufengx.mo@intel.com> References: <20200811032145.18999-1-yufengx.mo@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dts] [PATCH V2 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 | 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