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 58C84A0613 for ; Thu, 26 Sep 2019 09:21:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BBD051BEA4; Thu, 26 Sep 2019 09:21:43 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 448AD2B8D for ; Thu, 26 Sep 2019 09:21:42 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Sep 2019 00:21:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,551,1559545200"; d="scan'208";a="273244182" Received: from dpdk-moyufen06.sh.intel.com ([10.67.116.222]) by orsmga001.jf.intel.com with ESMTP; 26 Sep 2019 00:21:40 -0700 From: yufengmx To: dts@dpdk.org, yinan.wang@intel.com, lihongx.ma@intel.com Cc: zhaoyan.chen@intel.com, yufengmx Date: Thu, 26 Sep 2019 15:23:17 +0800 Message-Id: <20190926072317.19170-2-yufengx.mo@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190926072317.19170-1-yufengx.mo@intel.com> References: <20190926072317.19170-1-yufengx.mo@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dts] [PATCH V1 1/1] dts/pktgen: fix rfc2544 rate percent bug 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" When do rfc2544, streams rate percent should be set a new rate percent and stream attached on port should be cleared. 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 cd541b0..7855f6f 100644 --- a/framework/pktgen_base.py +++ b/framework/pktgen_base.py @@ -145,14 +145,14 @@ class PacketGenerator(object): if not self.__streams: return for stream in self.__streams: - stream['rate'] = rate_percent + stream['options']['stream_config']['rate'] = rate_percent def _set_stream_pps(self, pps): ''' set all streams' pps ''' if not self.__streams: return for stream in self.__streams: - stream['pps'] = pps + stream['options']['stream_config']['pps'] = pps def reset_streams(self): self.__streams = [] @@ -265,12 +265,15 @@ class PacketGenerator(object): tx_num, rx_num = result.values()[0][1:] return rate_percent, tx_num, rx_num _options = deepcopy(options) + if 'rate' in _options: + _options.pop('rate') while not status and rate_percent > 0: rate_percent = rate_percent - rate_step if rate_percent <= 0: msg = "rfc2544 run under zero rate" self.logger.warning(msg) break + self._clear_streams() # set stream rate percent to custom value self._set_stream_rate_percent(rate_percent) # run loss rate testing -- 2.21.0