From: Ali Alnubani <alialnu@mellanox.com>
To: dts@dpdk.org
Subject: [dts] [PATCH for-next v3 2/3] nics/net_device: add a function to get nic speed
Date: Sat, 31 Mar 2018 01:52:40 +0300 [thread overview]
Message-ID: <20180330225241.1399-3-alialnu@mellanox.com> (raw)
In-Reply-To: <20180330225241.1399-1-alialnu@mellanox.com>
Needed to differentiate between nics with same
device identifier, but with different speeds.
Signed-off-by: Ali Alnubani <alialnu@mellanox.com>
---
nics/net_device.py | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/nics/net_device.py b/nics/net_device.py
index 4861145..c32850c 100644
--- a/nics/net_device.py
+++ b/nics/net_device.py
@@ -539,6 +539,25 @@ class NetDevice(object):
"""
return self.crb.get_pci_dev_id(self.domain_id, self.bus_id, self.devfun_id)
+ @nic_has_driver
+ def get_nic_speed(self):
+ """
+ Get the speed of specified pci device.
+ """
+ get_nic_speed = getattr(
+ self, 'get_nic_speed_%s' %
+ self.__get_os_type())
+ return get_nic_speed(self.domain_id, self.bus_id, self.devfun_id)
+
+ def get_nic_speed_linux(self, domain_id, bus_id, devfun_id):
+ command = ('cat /sys/bus/pci/devices/%s\:%s\:%s/net/*/speed' %
+ (domain_id, bus_id, devfun_id))
+ nic_speed = self.__send_expect(command, '# ')
+ return nic_speed
+
+ def get_nic_speed_freebsd(self, domain_id, bus_id, devfun_id):
+ NotImplemented
+
@nic_has_driver
def get_sriov_vfs_pci(self):
"""
--
2.16.2
next prev parent reply other threads:[~2018-03-30 22:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-30 22:52 [dts] [PATCH for-next v3 0/3] nic_single_core_perf: add support for Mellanox's nics Ali Alnubani
2018-03-30 22:52 ` [dts] [PATCH for-next v3 1/3] framework/project_dpdk: pass module setup for mlx5_core Ali Alnubani
2018-03-30 22:52 ` Ali Alnubani [this message]
2018-03-30 22:52 ` [dts] [PATCH for-next v3 3/3] nic_single_core_perf: add support for Mellanox's nics Ali Alnubani
2018-04-02 12:57 ` [dts] [PATCH for-next v3 0/3] " Liu, Yong
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=20180330225241.1399-3-alialnu@mellanox.com \
--to=alialnu@mellanox.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
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).