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 6BC08A00C2; Wed, 17 Mar 2021 08:25:45 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 661D6242B27; Wed, 17 Mar 2021 08:25:45 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id E6816242B27 for ; Wed, 17 Mar 2021 08:25:43 +0100 (CET) IronPort-SDR: NBLLfWijpSuVceEJ+o8NxdLhTOKpHHbIJH91BsIJR4ZVnkwJldae9K0hE80vPgyM/1OUDCrdeu evvoUg0AGtWw== X-IronPort-AV: E=McAfee;i="6000,8403,9925"; a="209369063" X-IronPort-AV: E=Sophos;i="5.81,255,1610438400"; d="scan'208";a="209369063" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2021 00:25:43 -0700 IronPort-SDR: iI23ppgQUroh9hqz/JhTCy7vZGgKa4u0yG99Uf2ec22OEIQhPBe/Xj3V1pWJ5o9/4GVtUlD96D dc+d6JeMFeaA== X-IronPort-AV: E=Sophos;i="5.81,255,1610438400"; d="scan'208";a="405829320" Received: from unknown (HELO localhost.localdomain) ([10.240.183.57]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2021 00:25:42 -0700 From: Haiyang Zhao To: dts@dpdk.org Cc: Lijuan.Tu@intel.com, Haiyang Zhao Date: Wed, 17 Mar 2021 15:16:24 +0800 Message-Id: <20210317071625.13041-5-haiyangx.zhao@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210317071625.13041-1-haiyangx.zhao@intel.com> References: <20210317071625.13041-1-haiyangx.zhao@intel.com> Subject: [dts] [PATCH V1 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