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 1/6] nics/net_device: add driver/firmware
Date: Mon, 22 Mar 2021 10:46:11 +0800 [thread overview]
Message-ID: <20210322024616.14499-2-haiyangx.zhao@intel.com> (raw)
In-Reply-To: <20210322024616.14499-1-haiyangx.zhao@intel.com>
add attribute driver/firmware and the related methods for NetDevice.
Signed-off-by: Haiyang Zhao <haiyangx.zhao@intel.com>
---
nics/net_device.py | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/nics/net_device.py b/nics/net_device.py
index 6a26d1eb..98d31237 100644
--- a/nics/net_device.py
+++ b/nics/net_device.py
@@ -71,7 +71,9 @@ class NetDevice(object):
self.intf2_name = None
self.get_interface_name()
self.socket = self.get_nic_socket()
- self.pkg = {}
+ self.driver_version = ''
+ self.firmware = ''
+ self.pkg = None
def stop(self):
pass
@@ -123,6 +125,7 @@ class NetDevice(object):
"""
Get the NIC pkg.
"""
+ self.pkg = {'type': '', 'version': ''}
out = self.__send_expect('dmesg | grep "DDP package" | tail -1', '# ')
if 'could not load' in out:
print(RED(out))
@@ -140,6 +143,36 @@ class NetDevice(object):
self.pkg['version'] = pkg_info[1].strip()
return self.pkg
+ @nic_has_driver
+ def get_driver_firmware(self):
+ """
+ Get NIC driver and firmware version.
+ """
+ get_driver_firmware = getattr(
+ self, 'get_driver_firmware_%s' %
+ self.__get_os_type())
+ get_driver_firmware()
+
+ def get_driver_firmware_linux(self):
+ """
+ Get NIC driver and firmware version.
+ """
+ rexp = 'version:\s.+'
+ pattern = re.compile(rexp)
+ out = self.__send_expect('ethtool -i {} | grep version'.format(self.intf_name), '# ')
+ driver_firmware = pattern.findall(out)
+ if len(driver_firmware) > 1:
+ self.driver_version = driver_firmware[0].split(': ')[-1].strip()
+ self.firmware = driver_firmware[1].split(': ')[-1].strip()
+
+ return self.driver_version, self.firmware
+
+ def get_driver_firmware_freebsd(self):
+ """
+ Get the NIC driver and firmware version.
+ """
+ NotImplemented
+
def get_nic_socket(self):
"""
Get socket id of specified pci device.
--
2.17.1
next prev parent reply other threads:[~2021-03-22 2:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-22 2:46 [dts] [PATCH V1 0/6] framework: add dirver/firmware/pkg in result Haiyang Zhao
2021-03-22 2:46 ` Haiyang Zhao [this message]
2021-03-22 2:46 ` [dts] [PATCH V1 2/6] framework/dut: get nic driver/firmware info Haiyang Zhao
2021-03-22 2:46 ` [dts] [PATCH V1 3/6] framework/test_result: add driver/firmware/package Haiyang Zhao
2021-03-22 2:46 ` [dts] [PATCH V1 4/6] framework/dts: add more nic configurations in result Haiyang Zhao
2021-03-22 2:46 ` [dts] [PATCH V1 5/6] framework/excel_reporter: add driver/firmware/pkg Haiyang Zhao
2021-03-22 2:46 ` [dts] [PATCH V1 6/6] framework/json_reporter: " Haiyang Zhao
2021-03-22 2:58 ` [dts] [PATCH V1 0/6] framework: add dirver/firmware/pkg in result Zhao, HaiyangX
2021-03-25 5:48 ` Tu, Lijuan
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=20210322024616.14499-2-haiyangx.zhao@intel.com \
--to=haiyangx.zhao@intel.com \
--cc=dts@dpdk.org \
--cc=lijuan.tu@intel.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).