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 8546AA00E6 for ; Tue, 6 Aug 2019 04:41:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 77D761B9D5; Tue, 6 Aug 2019 04:41:43 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 75B621B995 for ; Tue, 6 Aug 2019 04:41:40 +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 orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Aug 2019 19:41:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,352,1559545200"; d="scan'208";a="257897185" Received: from dpdk-moyufen01.sh.intel.com ([10.67.111.77]) by orsmga001.jf.intel.com with ESMTP; 05 Aug 2019 19:41:38 -0700 From: yufengmx To: dts@dpdk.org Cc: yufengmx Date: Tue, 6 Aug 2019 10:42:32 +0800 Message-Id: <1565059352-215395-3-git-send-email-yufengx.mo@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1565059352-215395-1-git-send-email-yufengx.mo@intel.com> References: <1565059352-215395-1-git-send-email-yufengx.mo@intel.com> Subject: [dts] [PATCH V1 2/2] [next]framework/pktgen_trex: convert core mask setting to 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" list format *. convert core mask setting to list format. *. create _get_traffic_option to convert pktgen.cfg setting value to traffic start options. Signed-off-by: yufengmx --- framework/pktgen_trex.py | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/framework/pktgen_trex.py b/framework/pktgen_trex.py index 159750e..9044682 100644 --- a/framework/pktgen_trex.py +++ b/framework/pktgen_trex.py @@ -451,6 +451,23 @@ class TrexPacketGenerator(PacketGenerator): from trex_stl_lib.api import STLClient # set trex class self.STLClient = STLClient + # get configuration from pktgen config file + self._get_traffic_option() + + def _get_traffic_option(self): + ''' get configuration from pktgen config file ''' + # set trex coremask + _core_mask = self.conf.get("core_mask") + self.core_mask = \ + [int(item[2:], 16) for item in _core_mask.split(',')] \ + if _core_mask and '0x' in _core_mask else \ + None + # In case of several ports, ensure their transmitting time is + # synchronized. + _synchronized = self.conf.get("synchronized") + self.sync = True \ + if _synchronized and _synchronized.lower() == 'true' else \ + False def _connect(self): self._conn = self.STLClient(server=self.conf["server"]) @@ -792,10 +809,9 @@ class TrexPacketGenerator(PacketGenerator): warmup = int(self.conf["warmup"]) if self.conf.has_key("warmup") \ else 25 # set trex coremask - wait_interval, core_mask = ( - warmup+30, int(self.conf["core_mask"], 16)) \ - if self.conf.has_key("core_mask") \ - else (warmup+5, 0x3) + wait_interval = warmup+30 \ + if self.conf.has_key("core_mask") \ + else warmup+5 try: ########################################### @@ -806,7 +822,8 @@ class TrexPacketGenerator(PacketGenerator): 'ports': self._traffic_ports, 'mult': rate_percent, 'duration': duration, - 'core_mask':core_mask, + 'core_mask': self.core_mask, + 'synchronized': self.sync, 'force': True,} self.logger.info("begin traffic ......") self._conn.start(**run_opt) -- 1.9.3