Skip to content

Commit 95393d6

Browse files
dts: testpmd link check on port start
When running our existing DTS testsuites on a new NIC we observed packets would not transmit from the traffic generator to the system under test even after DPDK testpmd and the NIC under test had indicated readiness. After investigation, we determined that the existing readiness check in DTS for testpmd start (checking that port is started) is insufficient, because on some systems the link will remain down for some measurable time, creating a race condition between the testpmd port's link coming up and the DTS execution reaching the packet transmission step. This change will ensure that testpmd start will block until the port is reporting that its link is up. In addition, the interval in between checking the link state has been reduced in order to speed up the execution. Signed-off-by: Patrick Robb <[email protected]> Tested-by: Patrick Robb <[email protected]> Reviewed-by: Andrew Bailey <[email protected]> Reviewed-by: Dean Marx <[email protected]>
1 parent 4f35a61 commit 95393d6

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

dts/api/testpmd/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,22 @@ def _requires_started_ports(func: TestPmdMethod) -> TestPmdMethod:
9393
9494
Args:
9595
func: The :class:`TestPmd` method to decorate.
96+
97+
Raises:
98+
InteractiveCommandExecutionError: If the ports has been started but a port link will not come up.
9699
"""
97100

98101
@functools.wraps(func)
99102
def _wrapper(self: "TestPmd", *args: P.args, **kwargs: P.kwargs) -> Any:
100103
if not self.ports_started:
101104
self._logger.debug("Ports need to be started to continue.")
102105
self.start_all_ports()
106+
if get_ctx().topology.type is not LinkTopology.NO_LINK:
107+
for port in self.ports:
108+
if not self.wait_link_status_up(port.id):
109+
raise InteractiveCommandExecutionError(
110+
f"Port {port.id} link failed to come up."
111+
)
103112

104113
return func(self, *args, **kwargs)
105114

@@ -265,7 +274,7 @@ def wait_link_status_up(self, port_id: int, timeout=SETTINGS.timeout) -> bool:
265274
port_info = self.send_command(f"show port info {port_id}")
266275
if "Link status: up" in port_info:
267276
break
268-
time.sleep(0.5)
277+
time.sleep(0.25)
269278
else:
270279
self._logger.error(f"The link for port {port_id} did not come up in the given timeout.")
271280
return "Link status: up" in port_info

0 commit comments

Comments
 (0)