[v2,2/5] framework/dut: only map ports not already matched

Message ID 20230209152717.4057220-3-niklas.soderlund@corigine.com (mailing list archive)
State Accepted
Headers
Series Add initial support for NFP PMD |

Commit Message

Niklas Söderlund Feb. 9, 2023, 3:27 p.m. UTC
  From: Qin Ke <qin.ke@corigine.com>

When NIC has two ports but single PCI address, the function of
map_available_ports_uncached will match both the two dut ports
with the first tester port beacause the two tester ports have the
same PCI address as the only matching condition.

Add support for it by only mapping ports not already matched. It
ignores the tester port which has been matched and added to dut
ports map, then the second tester port can be matched correctly.

Signed-off-by: Qin Ke <qin.ke@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
 framework/dut.py | 1 +
 1 file changed, 1 insertion(+)
  

Patch

diff --git a/framework/dut.py b/framework/dut.py
index eb988ac3e265..64de28a5fdd8 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -1250,6 +1250,7 @@  class Dut(Crb):
                     elif (
                         self.tester.ports_info[remotePort]["pci"].lower()
                         == peer.lower()
+                        and hits[remotePort] == False
                     ):
                         hits[remotePort] = True
                         self.ports_map[dutPort] = remotePort