Hi,

I didn't noticed previously that this might be connected to my change so thank for giving the feedback.

I need to spend some time and think about it, but is seems that "wirespeed" function should be function of a nic or rather a port, not test class.
And I'm surprised that it didn't check the actual speed of a port since even ThunderX NIC 10G can work either 1G or 10G.

So in general please give me some time I should came up with some more elegant solution which possibly I can add as V2 of this patch.

On 4 December 2017 at 13:12, Verma, Ayuj <Ayuj.Verma@cavium.com> wrote:

Hi Biernacki,


Thanks for the heads up.

The reason for us to put this check is ThunderX Ethernet controllers 1G, 10G and 40G NIC devices have same device-id which make it difficult to recognize correct device being tested, which is required in ./framework/test_case.py  "wirespeed" to provide bitrate for particular NIC.


Initially we added support for 10G only but, we planed to have support for our 40G NIC also.


More acceptable way to do this might be having a global variable for linkspeed and using it further in 

./framework/test_case.py or elsewhere.
User can provide linkspeed.

Let us know your thoughts on this.

Thanks and regards
Ayuj Verma






From: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
Sent: 04 December 2017 16:14
To: dts@dpdk.org; Verma, Ayuj; Jogarao, Nartu
Cc: Herbert Guan; Radoslaw Biernacki; Czubak, Angela; Liu, Yong
Subject: Re: [PATCH 1/4] framework/crb: Fixing ThunderX ethernet controler detection
 
Ayuj and Jogarao you might also be interested to look at this one.

On 1 December 2017 at 22:20, Radoslaw Biernacki <radoslaw.biernacki@linaro.org> wrote:
Asking for link speed for ThunderX Ethernet controller is not reliable
since driver report error when the link is down. In fact we dont need
to ask for link speed as Ethernet controllers can be easily identified
by device name from lspci. The mapping will fuhrer filter out the PF
and VF interfaces which does not have the interface name assigned.

Fixes: 150716d93f5e ("framework crb: Appending only 10G devices for cavium")

Signed-off-by: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
---
 framework/crb.py | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/framework/crb.py b/framework/crb.py
index dd29a8b..36b1ffe 100644
--- a/framework/crb.py
+++ b/framework/crb.py
@@ -268,20 +268,13 @@ class Crb(object):
         Look for the NIC's information (PCI Id and card type).
         """
         out = self.send_expect(
-            "lspci -Dnn | grep -i eth", "# ", alt_session=True)
+            "lspci -Dnn | grep -i 'Ethernet controller'", "# ", alt_session=True)
         rexp = r"([\da-f]{4}:[\da-f]{2}:[\da-f]{2}.\d{1}) .*Eth.*?ernet .*?([\da-f]{4}:[\da-f]{4})"
         pattern = re.compile(rexp)
         match = pattern.findall(out)
         self.pci_devices_info = []
         for i in range(len(match)):
-            #check if device is cavium and check its linkspeed, append only if it is 10G
-            if "177d:" in match[i][1]:
-                linkspeed = "10000"
-                nic_linkspeed = self.send_command("cat /sys/bus/pci/devices/%s/net/*/speed" % match[i][0])
-                if nic_linkspeed == linkspeed:
-                    self.pci_devices_info.append((match[i][0], match[i][1]))
-            else:
-                self.pci_devices_info.append((match[i][0], match[i][1]))
+            self.pci_devices_info.append((match[i][0], match[i][1]))

     def pci_devices_information_uncached_freebsd(self):
         """
--
2.7.4