[dts] [PATCH V2 2/2] [next]framework/pktgen_trex: convert core mask setting to
Chen, Zhaoyan
zhaoyan.chen at intel.com
Tue Aug 6 08:13:36 CEST 2019
Acked-by: Zhaoyan Chen <zhaoyan.chen at intel.com>
Regards,
Zhaoyan Chen
> -----Original Message-----
> From: dts [mailto:dts-bounces at dpdk.org] On Behalf Of yufengmx
> Sent: Tuesday, August 6, 2019 2:03 PM
> To: dts at dpdk.org
> Cc: Mo, YufengX <yufengx.mo at intel.com>
> Subject: [dts] [PATCH V2 2/2] [next]framework/pktgen_trex: convert core mask
> setting to
>
> 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 <yufengx.mo at intel.com>
> ---
> framework/pktgen_trex.py | 26 +++++++++++++++++++++-----
> 1 file changed, 21 insertions(+), 5 deletions(-)
>
> diff --git a/framework/pktgen_trex.py b/framework/pktgen_trex.py index
> 159750e..c05741b 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")
> + if _core_mask:
> + if '0x' in _core_mask:
> + self.core_mask = \
> + [int(item[2:], 16) for item in _core_mask.split(',')]
> + else:
> + self.core_mask = self.STLClient.CORE_MASK_PIN \
> + if _core_mask.upper() == 'CORE_MASK_PIN' else \
> + None
> + else:
> + self.core_mask = None
>
> 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,7 @@ class TrexPacketGenerator(PacketGenerator):
> 'ports': self._traffic_ports,
> 'mult': rate_percent,
> 'duration': duration,
> - 'core_mask':core_mask,
> + 'core_mask': self.core_mask,
> 'force': True,}
> self.logger.info("begin traffic ......")
> self._conn.start(**run_opt)
> --
> 1.9.3
More information about the dts
mailing list