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

ipc_service: Extend API with nocopy functions #44033

Merged
merged 4 commits into from
Apr 1, 2022

Conversation

carlocaione
Copy link
Collaborator

@carlocaione carlocaione commented Mar 21, 2022

This PR follows the discussion at #43924. The idea is that we want to extend the IPC service API to expose several new functions that can be used by backends with nocopy capabilities.

In this PR we also adapt the static vrings backend and the related sample.

include/ipc/ipc_service.h Outdated Show resolved Hide resolved
include/ipc/ipc_service.h Outdated Show resolved Hide resolved
include/ipc/ipc_service.h Show resolved Hide resolved
include/ipc/ipc_service.h Outdated Show resolved Hide resolved
include/ipc/ipc_service.h Outdated Show resolved Hide resolved
include/ipc/ipc_service.h Outdated Show resolved Hide resolved
include/ipc/ipc_service.h Show resolved Hide resolved
include/ipc/ipc_service.h Outdated Show resolved Hide resolved
include/ipc/ipc_service.h Outdated Show resolved Hide resolved
include/ipc/ipc_service_backend.h Outdated Show resolved Hide resolved
include/ipc/ipc_service.h Outdated Show resolved Hide resolved
include/ipc/ipc_service.h Show resolved Hide resolved
include/ipc/ipc_service.h Outdated Show resolved Hide resolved
include/ipc/ipc_service.h Outdated Show resolved Hide resolved
include/ipc/ipc_service.h Outdated Show resolved Hide resolved
include/ipc/ipc_service.h Outdated Show resolved Hide resolved
@carlocaione
Copy link
Collaborator Author

@nordic-krch @pdunaj @hubertmis @arnopo I added some commits to this PR to also adapt the static vrings backend to the new API and changed the current sample so that we use the NOCOPY on one of the tested instances.

subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c Outdated Show resolved Hide resolved
include/ipc/ipc_service.h Outdated Show resolved Hide resolved
@carlocaione carlocaione force-pushed the extend_ipc branch 2 times, most recently from 89ef492 to fa4371a Compare March 25, 2022 11:13
@carlocaione
Copy link
Collaborator Author

@hubertmis @nordic-krch some changes:

  • added a new ipc_service_get_tx_buffer_size() function
  • ipc_service_get_tx_buffer() now fails with -ENOMEM when you request a buffer too big / small and the buffer is not allocated. You can still pass 0 as size parameter to allocate a buffer as big as possible.

hubertmis
hubertmis previously approved these changes Mar 30, 2022
Copy link
Member

@hubertmis hubertmis left a comment

Choose a reason for hiding this comment

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

Looks good!

samples/subsys/ipc/ipc_service/static_vrings/src/main.c Outdated Show resolved Hide resolved
nordic-krch
nordic-krch previously approved these changes Mar 30, 2022
include/ipc/ipc_service.h Outdated Show resolved Hide resolved
nordic-krch
nordic-krch previously approved these changes Mar 31, 2022
Copy link
Collaborator

@arnopo arnopo left a comment

Choose a reason for hiding this comment

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

My apologize I'm quite late on the review...
First of all, congratulation for this very good work !
Few minor remarks + a proposal to save a copy

include/ipc/ipc_service.h Outdated Show resolved Hide resolved
include/ipc/ipc_service.h Outdated Show resolved Hide resolved
subsys/ipc/ipc_service/ipc_service.c Outdated Show resolved Hide resolved
subsys/ipc/ipc_service/ipc_service.c Outdated Show resolved Hide resolved
And add some more details in documentation.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Add several new functions to the IPC service API:
  - ipc_service_get_tx_buffer()
  - ipc_service_drop_tx_buffer()
  - ipc_service_send_nocopy()
  - ipc_service_release_rx_buffer()
  - ipc_service_hold_rx_buffer()

This set of function is used to support backends with nocopy capability.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Add the newly introduced NOCOPY capability to the static vrings backend.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
At least for one of the instances, use the NOCOPY feature of the
backend.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
@MaureenHelm MaureenHelm merged commit 35e058b into zephyrproject-rtos:main Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs area: IPC Inter-Process Communication area: Samples Samples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ipc_service: Extend API with zero-copy send
8 participants