From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 27F0D2BF7 for ; Fri, 2 Mar 2018 02:51:51 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Mar 2018 17:51:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,409,1515484800"; d="scan'208";a="179250360" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga004.jf.intel.com with ESMTP; 01 Mar 2018 17:51:49 -0800 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 1 Mar 2018 17:51:49 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 1 Mar 2018 17:51:48 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.116]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.125]) with mapi id 14.03.0319.002; Fri, 2 Mar 2018 09:51:47 +0800 From: "Liu, Yong" To: Patrick MacArthur , "dts@dpdk.org" CC: "dpdklab@iol.unh.edu" Thread-Topic: [dts] [PATCH for-next 5/6] framework/pktgen: Start T-Rex during prepare_generator() Thread-Index: AQHTqm/2y1HQx6avgU+JBLD03ALsCaO8OyfA Date: Fri, 2 Mar 2018 01:51:46 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E62FA5DBC@SHSMSX103.ccr.corp.intel.com> References: <20180220172612.11973-1-pmacarth@iol.unh.edu> <20180220172612.11973-6-pmacarth@iol.unh.edu> In-Reply-To: <20180220172612.11973-6-pmacarth@iol.unh.edu> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDVlZGU4YWQtNjQwNS00YzA5LWJlZWYtYWQ0YzgzNTVkOTYwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiI0UGdlbmE1Qitvd2F2VWl3N25sK09reTJCSjJlRlMyM1VVNjdyUldvUzVESzFzV2U2NGZ3K1VUN00wVXp2RmVEIn0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH for-next 5/6] framework/pktgen: Start T-Rex during prepare_generator() 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: , X-List-Received-Date: Fri, 02 Mar 2018 01:51:52 -0000 Hi Patrick, In our deployment, multiple tester machine may be connected to one Packet G= eneration Machine.=20 If we run multiple execution tasks on those machines at the same time, ther= e will be mutual interference between the tasks. My suggestion is that import additional configure option like Trex_setup. I= f this option is true, DTS will start/stop Trex. Thanks, Marvin > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Patrick MacArthur > Sent: Wednesday, February 21, 2018 1:26 AM > To: dts@dpdk.org > Cc: pmacarth@iol.unh.edu; dpdklab@iol.unh.edu > Subject: [dts] [PATCH for-next 5/6] framework/pktgen: Start T-Rex during > prepare_generator() >=20 > The currently merged patchset for T-Rex does not actually start T-Rex. > Add some code to start T-Rex as part of packet generator setup during > the prepare_generator() step. We need T-Rex running during this step so > we can determine which ports the T-Rex API is making available to the > DUT before we set up the DUT's network interfaces accordingly. >=20 > This change assumes that T-Rex will always be run on the tester node. >=20 > Tested-by: Ali Alnubani > Signed-off-by: Patrick MacArthur > --- > framework/pktgen.py | 30 +++++++++++++++++++++++------- > framework/tester.py | 1 + > 2 files changed, 24 insertions(+), 7 deletions(-) >=20 > diff --git a/framework/pktgen.py b/framework/pktgen.py > index 9e052c832da9..c7fc81ae58fc 100644 > --- a/framework/pktgen.py > +++ b/framework/pktgen.py > @@ -204,6 +204,7 @@ class TrexPacketGenerator(PacketGenerator): > def __init__(self, tester): > self.pktgen_type =3D "trex" > self._conn =3D None > + self.control_session =3D None > self._ports =3D [] > self._traffic_ports =3D [] > self._transmit_streams =3D {} > @@ -218,7 +219,6 @@ class TrexPacketGenerator(PacketGenerator): >=20 > def connect(self): > self._conn =3D self.trex_client(server=3Dself.conf["server"]) > - time.sleep(30) > self._conn.connect() > for p in self._conn.get_all_ports(): > self._ports.append(p) > @@ -295,7 +295,11 @@ class TrexPacketGenerator(PacketGenerator): > app_param_temp =3D app_param_temp + " --cfg " + > self.conf[key] > elif key =3D=3D 'core_num': > app_param_temp =3D app_param_temp + " -c " + self.conf[k= ey] > - > + app =3D self.conf['trex_root_path'] + os.sep + self.trex_app > + cmd =3D app + " " + app_param_temp > + self.control_session =3D > self.tester.create_session('trex_control_session') > + self.control_session.send_expect('cd ' + > self.conf['trex_root_path'] + os.sep + 'scripts', '# ') > + self.control_session.send_expect(app + " " + app_param_temp, '- > Per port stats table', 30) >=20 > # Insert Trex api library > sys.path.insert(0, > "{0}/scripts/automation/trex_control_plane/stl".format(self.conf['trex_ro= o > t_path'])) > @@ -377,16 +381,22 @@ class TrexPacketGenerator(PacketGenerator): > if self.conf.has_key("warmup"): > warmup =3D int(self.conf["warmup"]) >=20 > + self._traffic_ports =3D list() > + for stream_id in stream_ids: > + > self._traffic_ports.append(self._ports[self._get_stream(stream_id)['tx_po= r > t']]) > + > + print self._traffic_ports > + self._conn.set_service_mode(ports=3Dself._traffic_ports, > enabled=3DTrue) > + self._conn.resolve(ports=3Dself._traffic_ports) > + self._conn.set_service_mode(ports=3Dself._traffic_ports, > enabled=3DFalse) > + > for stream_id in stream_ids: > stream =3D self._get_stream(stream_id) > # tester port to Trex port > tx_port =3D stream["tx_port"] > p =3D self._ports[tx_port] > - self._conn.add_streams(self._transmit_streams[stream_id], > ports=3D[p]) > + sid =3D > self._conn.add_streams(self._transmit_streams[stream_id], ports=3D[p]) > rate =3D stream["options"]["rate"] > - self._traffic_ports.append(p) > - > - print self._traffic_ports >=20 > if self.conf.has_key("core_mask"): > self._conn.start(ports=3Dself._traffic_ports, mult=3Drate, > duration=3Dwarmup, core_mask=3Dself.conf["core_mask"]) > @@ -421,7 +431,13 @@ class TrexPacketGenerator(PacketGenerator): > return rate_rx_bits, rate_rx_pkts >=20 > def quit_generator(self): > - self.disconnect() > + if self._conn is not None: > + self.disconnect() > + self.tester.send_expect('pkill -f _t-rex-64', '# ') > + time.sleep(5) > + if self.control_session is not None: > + self.tester.destroy_session(self.control_session) > + self.control_session =3D None >=20 > def getPacketGenerator(tester, pktgen_type=3D"trex"): > """ > diff --git a/framework/tester.py b/framework/tester.py > index be5b0e13897c..e20c4f8ffcf7 100755 > --- a/framework/tester.py > +++ b/framework/tester.py > @@ -743,5 +743,6 @@ class Tester(Crb): > """ > Close all resource before crb exit > """ > + self.pktgen.quit_generator() > self.logger.logger_exit() > self.close() > -- > 2.14.1