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 BBF6BA04A3; Thu, 11 Jun 2020 14:17:03 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AEE521150; Thu, 11 Jun 2020 14:17:03 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 77230FFA for ; Thu, 11 Jun 2020 14:17:02 +0200 (CEST) IronPort-SDR: DCLdMJKhKzh0/AbsGmndTrfLOroFDMqmQ+XeXonFlNAVRfonVmppeid+RHBiKFYIgZcI0qC3iU 9OYpX+fuvjMg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2020 05:17:01 -0700 IronPort-SDR: Gon4uCh7NAFMYoSw0KtcCv5/0Ift7zxJTgZsGXnZjnFPbW/A1CV3MV26I9X0QV2+FMuIABqrrn yA/r9TSe4rDA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,499,1583222400"; d="scan'208";a="275314546" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga006.jf.intel.com with ESMTP; 11 Jun 2020 05:17:01 -0700 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 11 Jun 2020 05:17:01 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 11 Jun 2020 05:16:59 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.85]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.208]) with mapi id 14.03.0439.000; Thu, 11 Jun 2020 20:16:57 +0800 From: "Tu, Lijuan" To: "Ma, LihongX" , "dts@dpdk.org" , "Xie, WeiX" CC: "Ma, LihongX" Thread-Topic: [dts] [PATCH V1] framework/pktgen_trex: check the port status before start transmission Thread-Index: AQHWOk4uIVxd2zG5EEq0llRneDWm+KjTX7nA Date: Thu, 11 Jun 2020 12:16:56 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BC5BC02@SHSMSX101.ccr.corp.intel.com> References: <1591233939-19335-1-git-send-email-lihongx.ma@intel.com> In-Reply-To: <1591233939-19335-1-git-send-email-lihongx.ma@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH V1] framework/pktgen_trex: check the port status before start transmission 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" Applied, thanks -----Original Message----- From: dts On Behalf Of lihong Sent: 2020=1B$BG/=1B(B6=1B$B7n=1B(B4=1B$BF|=1B(B 9:26 To: dts@dpdk.org; Xie, WeiX Cc: Ma, LihongX Subject: [dts] [PATCH V1] framework/pktgen_trex: check the port status befo= re start transmission Signed-off-by: lihong --- framework/pktgen_trex.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/framework/pktgen_trex.py b/framework/pktgen_trex.py index 202c= 778..8da0c84 100644 --- a/framework/pktgen_trex.py +++ b/framework/pktgen_trex.py @@ -790,6 +790,21 @@ class TrexPacketGenerator(PacketGenerator): rate_percent =3D "{0}%".format(options.get('rate') or self._traffic_opt.get('rate') or '100') + # check the link status before transmission + self.logger.info('check the trex port link status') + for port in self._traffic_ports: + try_times =3D 0 + port_attr =3D self._conn.get_port_attr(port) + while try_times < 5: + self.logger.info(pformat(port_attr)) + if 'link' in port_attr.keys() and port_attr['link'].lower(= ) =3D=3D 'down': + time.sleep(2) + try_times =3D try_times + 1 + port_attr =3D self._conn.get_port_attr(port) + else: + break + if try_times =3D=3D 5 and port_attr['link'].lower() =3D=3D= 'down': + self.logger.error('the port: %d link status is=20 + down, the transmission can not work right' % port) try: # clear the stats before injecting self._conn.clear_stats() -- 2.7.4