test suite reviews and discussions
 help / color / mirror / Atom feed
From: Haiyang Zhao <haiyangx.zhao@intel.com>
To: dts@dpdk.org
Cc: Lijuan.Tu@intel.com, Haiyang Zhao <haiyangx.zhao@intel.com>
Subject: [dts] [PATCH V1 4/5] framework/dut: get nic package in dut prerequisites
Date: Wed, 17 Mar 2021 15:16:24 +0800
Message-ID: <20210317071625.13041-5-haiyangx.zhao@intel.com> (raw)
In-Reply-To: <20210317071625.13041-1-haiyangx.zhao@intel.com>

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 <haiyangx.zhao@intel.com>
---
 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


  parent reply	other threads:[~2021-03-17  7:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-17  7:16 [dts] [PATCH V1 0/5] framework: add a proposal of recognizing pkgs Haiyang Zhao
2021-03-17  7:16 ` [dts] [PATCH V1 1/5] framework/exception: add new exception VerifySkip Haiyang Zhao
2021-03-17  7:16 ` [dts] [PATCH V1 2/5] framework/test_case: handle the VerifySkip exception and add some functions Haiyang Zhao
2021-03-17  7:16 ` [dts] [PATCH V1 3/5] nics/net_device: add attribute pkg and get method Haiyang Zhao
2021-03-17  7:16 ` Haiyang Zhao [this message]
2021-03-17  7:16 ` [dts] [PATCH V1 5/5] tests: add nic and pkg check for rss_gtpu Haiyang Zhao
2021-03-17  7:30 ` [dts] [PATCH V1 0/5] framework: add a proposal of recognizing pkgs Zhao, HaiyangX

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210317071625.13041-5-haiyangx.zhao@intel.com \
    --to=haiyangx.zhao@intel.com \
    --cc=Lijuan.Tu@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

test suite reviews and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dts/0 dts/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dts dts/ https://inbox.dpdk.org/dts \
		dts@dpdk.org
	public-inbox-index dts

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dts


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git