Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/138832/?format=api
http://patchwork.dpdk.org/api/patches/138832/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20240326190422.577028-7-luca.vizzarro@arm.com/", "project": { "id": 1, "url": "http://patchwork.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20240326190422.577028-7-luca.vizzarro@arm.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20240326190422.577028-7-luca.vizzarro@arm.com", "date": "2024-03-26T19:04:22", "name": "[6/6] dts: add statefulness to TestPmdShell", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "3bd299b5d05da4efeae7f7a66be481a847329d9f", "submitter": { "id": 3197, "url": "http://patchwork.dpdk.org/api/people/3197/?format=api", "name": "Luca Vizzarro", "email": "luca.vizzarro@arm.com" }, "delegate": { "id": 1, "url": "http://patchwork.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20240326190422.577028-7-luca.vizzarro@arm.com/mbox/", "series": [ { "id": 31622, "url": "http://patchwork.dpdk.org/api/series/31622/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=31622", "date": "2024-03-26T19:04:16", "name": "dts: add testpmd params and statefulness", "version": 1, "mbox": "http://patchwork.dpdk.org/series/31622/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/138832/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/138832/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 0A69343D5B;\n\tTue, 26 Mar 2024 20:05:20 +0100 (CET)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 72C5C427E3;\n\tTue, 26 Mar 2024 20:04:43 +0100 (CET)", "from foss.arm.com (foss.arm.com [217.140.110.172])\n by mails.dpdk.org (Postfix) with ESMTP id D8B7A40ED6\n for <dev@dpdk.org>; Tue, 26 Mar 2024 20:04:40 +0100 (CET)", "from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])\n by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 109B1339;\n Tue, 26 Mar 2024 12:05:14 -0700 (PDT)", "from localhost.localdomain (unknown [10.57.16.115])\n by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C18B13F64C;\n Tue, 26 Mar 2024 12:04:37 -0700 (PDT)" ], "From": "Luca Vizzarro <luca.vizzarro@arm.com>", "To": "dev@dpdk.org", "Cc": "=?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>,\n Luca Vizzarro <luca.vizzarro@arm.com>,\n Jack Bond-Preston <jack.bond-preston@arm.com>,\n Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>", "Subject": "[PATCH 6/6] dts: add statefulness to TestPmdShell", "Date": "Tue, 26 Mar 2024 19:04:22 +0000", "Message-Id": "<20240326190422.577028-7-luca.vizzarro@arm.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20240326190422.577028-1-luca.vizzarro@arm.com>", "References": "<20240326190422.577028-1-luca.vizzarro@arm.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org" }, "content": "This commit provides a state container for TestPmdShell. It currently\nonly indicates whether the packet forwarding has started\nor not, and the number of ports which were given to the shell.\n\nThis also fixes the behaviour of `wait_link_status_up` to use the\ncommand timeout as inherited from InteractiveShell.\n\nSigned-off-by: Luca Vizzarro <luca.vizzarro@arm.com>\nReviewed-by: Jack Bond-Preston <jack.bond-preston@arm.com>\nReviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>\n---\n dts/framework/remote_session/testpmd_shell.py | 41 +++++++++++++------\n 1 file changed, 28 insertions(+), 13 deletions(-)", "diff": "diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py\nindex a823dc53be..ea1d254f86 100644\n--- a/dts/framework/remote_session/testpmd_shell.py\n+++ b/dts/framework/remote_session/testpmd_shell.py\n@@ -678,19 +678,27 @@ def __str__(self) -> str:\n return self.pci_address\n \n \n+@dataclass(slots=True)\n+class TestPmdState:\n+ \"\"\"Session state container.\"\"\"\n+\n+ #:\n+ packet_forwarding_started: bool = False\n+\n+ #: The number of ports which were allowed on the command-line when testpmd was started.\n+ number_of_ports: int = 0\n+\n+\n class TestPmdShell(InteractiveShell):\n \"\"\"Testpmd interactive shell.\n \n The testpmd shell users should never use\n the :meth:`~.interactive_shell.InteractiveShell.send_command` method directly, but rather\n call specialized methods. If there isn't one that satisfies a need, it should be added.\n-\n- Attributes:\n- number_of_ports: The number of ports which were allowed on the command-line when testpmd\n- was started.\n \"\"\"\n \n- number_of_ports: int\n+ #: Current state\n+ state: TestPmdState = TestPmdState()\n \n #: The path to the testpmd executable.\n path: ClassVar[PurePath] = PurePath(\"app\", \"dpdk-testpmd\")\n@@ -723,7 +731,13 @@ def _start_application(self, get_privileged_command: Callable[[str], str] | None\n if self._app_args.app_params is None:\n self._app_args.app_params = TestPmdParameters()\n \n- self.number_of_ports = len(self._app_args.ports) if self._app_args.ports is not None else 0\n+ assert isinstance(self._app_args.app_params, TestPmdParameters)\n+\n+ if self._app_args.app_params.auto_start:\n+ self.state.packet_forwarding_started = True\n+\n+ if self._app_args.ports is not None:\n+ self.state.number_of_ports = len(self._app_args.ports)\n \n super()._start_application(get_privileged_command)\n \n@@ -746,12 +760,14 @@ def start(self, verify: bool = True) -> None:\n self._logger.debug(f\"Failed to start packet forwarding: \\n{start_cmd_output}\")\n raise InteractiveCommandExecutionError(\"Testpmd failed to start packet forwarding.\")\n \n- for port_id in range(self.number_of_ports):\n+ for port_id in range(self.state.number_of_ports):\n if not self.wait_link_status_up(port_id):\n raise InteractiveCommandExecutionError(\n \"Not all ports came up after starting packet forwarding in testpmd.\"\n )\n \n+ self.state.packet_forwarding_started = True\n+\n def stop(self, verify: bool = True) -> None:\n \"\"\"Stop packet forwarding.\n \n@@ -773,6 +789,8 @@ def stop(self, verify: bool = True) -> None:\n self._logger.debug(f\"Failed to stop packet forwarding: \\n{stop_cmd_output}\")\n raise InteractiveCommandExecutionError(\"Testpmd failed to stop packet forwarding.\")\n \n+ self.state.packet_forwarding_started = False\n+\n def get_devices(self) -> list[TestPmdDevice]:\n \"\"\"Get a list of device names that are known to testpmd.\n \n@@ -788,19 +806,16 @@ def get_devices(self) -> list[TestPmdDevice]:\n dev_list.append(TestPmdDevice(line))\n return dev_list\n \n- def wait_link_status_up(self, port_id: int, timeout=SETTINGS.timeout) -> bool:\n- \"\"\"Wait until the link status on the given port is \"up\".\n+ def wait_link_status_up(self, port_id: int) -> bool:\n+ \"\"\"Wait until the link status on the given port is \"up\". Times out.\n \n Arguments:\n port_id: Port to check the link status on.\n- timeout: Time to wait for the link to come up. The default value for this\n- argument may be modified using the :option:`--timeout` command-line argument\n- or the :envvar:`DTS_TIMEOUT` environment variable.\n \n Returns:\n Whether the link came up in time or not.\n \"\"\"\n- time_to_stop = time.time() + timeout\n+ time_to_stop = time.time() + self._timeout\n port_info: str = \"\"\n while time.time() < time_to_stop:\n port_info = self.send_command(f\"show port info {port_id}\")\n", "prefixes": [ "6/6" ] }{ "id": 138832, "url": "