[dts] [PATCH for-next v2 2/3] nics/net_device: add a function to get nic speed
Ali Alnubani
alialnu at mellanox.com
Sat Mar 31 00:55:54 CEST 2018
Thank you for pointing that out Marvin.
Sent a v3 of the patchset.
Regards,
Ali
________________________________
From: Liu, Yong <yong.liu at intel.com>
Sent: Friday, March 30, 2018 11:29:01 AM
To: Ali Alnubani; dts at dpdk.org
Cc: dpdklab at iol.unh.edu
Subject: Re: [dts] [PATCH for-next v2 2/3] nics/net_device: add a function to get nic speed
Hi Ali,
Since kernel module is the precondition of NIC interface, please add
wrapper function nic_has_driver.
Thanks,
Marvin
On 03/30/2018 07:47 AM, Ali Alnubani wrote:
> Needed to differentiate between nics with same
> device identifier, but with different speeds.
>
> Signed-off-by: Ali Alnubani <alialnu at mellanox.com>
> ---
> nics/net_device.py | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/nics/net_device.py b/nics/net_device.py
> index 4861145..0f4bac3 100644
> --- a/nics/net_device.py
> +++ b/nics/net_device.py
> @@ -539,6 +539,20 @@ class NetDevice(object):
> """
> return self.crb.get_pci_dev_id(self.domain_id, self.bus_id, self.devfun_id)
>
> + def get_nic_speed(self):
> + """
> + Get the speed of specified pci device.
> + """
> + nic_speed = None
> + command = ('cat /sys/bus/pci/devices/%s\:%s\:%s/net/*/speed' % ( \
> + self.domain_id, self.bus_id, self.devfun_id))
> + try:
> + nic_speed = self.__send_expect(command, '# ')
> + except Exception as e:
> + print 'Failed to get the speed of the pci device [%s:%s:%s]: %s' \
> + % (self.domain_id, self.bus_id, self.devfun_id, e)
> + return nic_speed
> +
> @nic_has_driver
> def get_sriov_vfs_pci(self):
> """
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://dpdk.org/ml/archives/dts/attachments/20180330/8fde6bb3/attachment.html>
More information about the dts
mailing list