From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 5F7484C92 for ; Fri, 30 Mar 2018 02:40:04 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2018 17:40:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,378,1517904000"; d="scan'208";a="212497979" Received: from dpdk-test32.sh.intel.com (HELO [10.67.118.224]) ([10.67.118.224]) by orsmga005.jf.intel.com with ESMTP; 29 Mar 2018 17:40:01 -0700 Message-ID: <5ABDF54D.8000301@intel.com> Date: Fri, 30 Mar 2018 16:29:01 +0800 From: "Liu, Yong" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Ali Alnubani , dts@dpdk.org CC: dpdklab@iol.unh.edu References: <20180329234744.17716-1-alialnu@mellanox.com> <20180329234744.17716-3-alialnu@mellanox.com> In-Reply-To: <20180329234744.17716-3-alialnu@mellanox.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dts] [PATCH for-next v2 2/3] nics/net_device: add a function to get nic speed X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Mar 2018 00:40:05 -0000 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 > --- > 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): > """