From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E1CBEA0561; Thu, 18 Mar 2021 10:31:21 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DBCE8140F34; Thu, 18 Mar 2021 10:31:21 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id BE214140F34 for ; Thu, 18 Mar 2021 10:31:19 +0100 (CET) IronPort-SDR: KF0qpgIcysnbJIPGTdcIjMxQ+UzfPkKz1m6V5FS9TEoJ3vvo8P5xxNJFJRZJutH9x56FjRa20I IdIWnLGkAEKA== X-IronPort-AV: E=McAfee;i="6000,8403,9926"; a="189731926" X-IronPort-AV: E=Sophos;i="5.81,258,1610438400"; d="scan'208";a="189731926" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2021 02:31:19 -0700 IronPort-SDR: 6+S0kYYgBBYMFuRUT5kExeVszGWKuctapV0Je1Aop353DKmFGDDd46480A/8hQSohYoaJlN4+q kAzrb7LCi5VA== X-IronPort-AV: E=Sophos;i="5.81,258,1610438400"; d="scan'208";a="413013409" Received: from unknown (HELO localhost.localdomain) ([10.240.183.57]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2021 02:31:17 -0700 From: Haiyang Zhao To: dts@dpdk.org Cc: lijuan.tu@intel.com, Haiyang Zhao Date: Thu, 18 Mar 2021 17:22:14 +0800 Message-Id: <20210318092215.27270-5-haiyangx.zhao@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210318092215.27270-1-haiyangx.zhao@intel.com> References: <20210318092215.27270-1-haiyangx.zhao@intel.com> Subject: [dts] [PATCH V2 4/5] framework/dut: get nic package in dut prerequisites X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 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" get nic package if nic kernel driver is ice, and it will retry three times in case of get package failed. Signed-off-by: Haiyang Zhao --- framework/dut.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/framework/dut.py b/framework/dut.py index 113116f2..5bc84fca 100644 --- a/framework/dut.py +++ b/framework/dut.py @@ -404,11 +404,12 @@ class Dut(Crb): self.map_available_ports() # disable tester port ipv6 self.disable_tester_ipv6() + self.get_nic_configurations() + # print latest ports_info for port_info in self.ports_info: self.logger.info(port_info) - if self.nic is None: - self.nic = port_info['port'] + if self.ports_map is None or len(self.ports_map) == 0: self.logger.warning("ports_map should not be empty, please check all links") @@ -419,6 +420,24 @@ class Dut(Crb): name_cfg = AppNameConf() self.apps_name_conf = name_cfg.load_app_name_conf() + def get_nic_configurations(self): + retry_times = 3 + if self.ports_info: + self.nic = self.ports_info[0]['port'] + # TODO: get nic driver/firmware version + if self.nic.default_driver == 'ice': + self.get_nic_pkg(retry_times) + + def get_nic_pkg(self, retry_times=3): + self.nic.pkg = self.nic.get_nic_pkg() + while not self.nic.pkg and retry_times > 0: + self.restore_interfaces() + self.nic.pkg = self.nic.get_nic_pkg() + retry_times = retry_times - 1 + self.logger.info('pkg: {}'.format(self.nic.pkg)) + if not self.nic.pkg: + raise Exception('Get nic pkg failed') + def restore_interfaces(self): """ Restore all ports's interfaces. -- 2.17.1