Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modem: pipe: Add explicit timeout to sync APIs #74325

Merged

Conversation

bjarki-andreasen
Copy link
Collaborator

@bjarki-andreasen bjarki-andreasen commented Jun 14, 2024

The modem pipe APIs include synchronous calls to open/close, which internally use a fixed timeout of 10 seconds. The timeout should be configurable through the APIs, anywhere from K_NO_WAIT to K_FOREVER.

This commit adds timeout parameters to the open/close APIs, and updates in-tree usage of the open/close APIs to explicitly provide the previously implicit timeout of 10 seconds.

The timeouts can be optimized to be lower in some cases, but initially just keep the 10 second timeouts to not break anything :)

The modem pipe APIs include synchronous calls to open/close,
which internally use a fixed timeout of 10 seconds. The timeout
should be configurable through the APIs, anywhere from K_NO_WAIT
to K_FOREVER.

This commit adds timeout parameters to the open/close APIs, and
updates in-tree usage of the open/close APIs to explicitly
provide the previously implicit timeout of 10 seconds.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
Copy link
Member

@rerickson1 rerickson1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A change for the better :)

@@ -188,21 +188,21 @@ static int gnss_luatos_air530z_init(const struct device *dev)

luatos_air530z_init_dynamic_script(dev);

ret = modem_pipe_open(data->uart_pipe);
ret = modem_pipe_open(data->uart_pipe, K_SECONDS(10));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the number be a kconfig option? (could be on a followup)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed could be nice to have a global default defined by a Kconfig option.

@bjarki-andreasen bjarki-andreasen added this to the v4.0.0 milestone Jun 18, 2024
@bjarki-andreasen
Copy link
Collaborator Author

This PR does break the modem pipe API, so I would like to not include it in 3.7.0 to emphasize modem subsystem stability for LTS for downstream users :)

@@ -87,6 +87,7 @@ void modem_pipe_init(struct modem_pipe *pipe, void *data, struct modem_pipe_api
* @brief Open pipe
*
* @param pipe Pipe instance
* @param timeout Timeout waiting for pipe to open
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param timeout Timeout waiting for pipe to open
* @param timeout Time to wait for pipe to open

@@ -188,21 +188,21 @@ static int gnss_luatos_air530z_init(const struct device *dev)

luatos_air530z_init_dynamic_script(dev);

ret = modem_pipe_open(data->uart_pipe);
ret = modem_pipe_open(data->uart_pipe, K_SECONDS(10));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed could be nice to have a global default defined by a Kconfig option.

Copy link
Collaborator

@tomi-font tomi-font left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thought: maybe a migration guide entry is in order for this?
Don't know how it goes for code marked experimental.

@bjarki-andreasen
Copy link
Collaborator Author

One more thought: maybe a migration guide entry is in order for this? Don't know how it goes for code marked experimental.

Sure :) I will add it after the release notes for 4.0.0 show up :)

@aescolar
Copy link
Member

Sure :) I will add it after the release notes for 4.0.0 show up :)

@bjarki-andreasen they are there now

@carlescufi carlescufi merged commit 372c718 into zephyrproject-rtos:main Jul 29, 2024
28 checks passed
@JordanYates
Copy link
Collaborator

API calls missed are failing in CI and fixed in #76449

tomi-font added a commit to tomi-font/zephyr that referenced this pull request Jul 30, 2024
Add the missing timeout parameter to `modem_pipe_open()` and
`modem_pipe_close()` calls.
10 seconds is the default value used in the Zephyr tree.

Fixes a regression introduced in
zephyrproject-rtos#74325.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
@tomi-font
Copy link
Collaborator

Also this is missing the migration guide entry we were talking about.

tomi-font added a commit to tomi-font/zephyr that referenced this pull request Jul 30, 2024
Add the missing timeout parameter to `modem_pipe_open()` and
`modem_pipe_close()` calls.
10 seconds is the default value used in the Zephyr tree.

Fixes a regression introduced in
zephyrproject-rtos#74325.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
aescolar pushed a commit that referenced this pull request Jul 30, 2024
Add the missing timeout parameter to `modem_pipe_open()` and
`modem_pipe_close()` calls.
10 seconds is the default value used in the Zephyr tree.

Fixes a regression introduced in
#74325.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
coreboot-org-bot pushed a commit to coreboot/zephyr-cros that referenced this pull request Jul 30, 2024
Add the missing timeout parameter to `modem_pipe_open()` and
`modem_pipe_close()` calls.
10 seconds is the default value used in the Zephyr tree.

Fixes a regression introduced in
zephyrproject-rtos/zephyr#74325.

(cherry picked from commit 48d69b4)

Original-Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
GitOrigin-RevId: 48d69b4
Change-Id: I3c3938e8f1baa75e13b838b0a5a9b7c18f69ac29
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5748700
Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
Commit-Queue: Fabio Baltieri <fabiobaltieri@google.com>
Tested-by: Fabio Baltieri <fabiobaltieri@google.com>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
mariucker pushed a commit to mariucker/zephyr that referenced this pull request Dec 12, 2024
Add the missing timeout parameter to `modem_pipe_open()` and
`modem_pipe_close()` calls.
10 seconds is the default value used in the Zephyr tree.

Fixes a regression introduced in
zephyrproject-rtos#74325.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants