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

openamp: add new API rpmsg_virtio_get_rx_buffer_size() #521

Merged
merged 1 commit into from
Nov 6, 2023

Conversation

CV-Bowen
Copy link
Contributor

With this API, user can get the rx buffer size, and use this buffer safer in endpoint callback function.
Follow shows an example:

static int rpmsgfs_ept_cb(FAR struct rpmsg_endpoint *ept,
                          FAR void *data, size_t len, uint32_t src,
                          FAR void *priv)
{
    /* No need extra stack variable or malloced buffer, user can fill the response data in the data directly,
     * And to avoid the data overflow, user can call rpmsg_virtio_get_rx_buffer_size() to get the limitation
     * of input data.
     */

    /* Call rpmsg_send(ept, data, data_len) to send the response data */
    rpmsg_send(ept, data, len);
}

@CV-Bowen
Copy link
Contributor Author

Just rebase to origin/main to pass CI.

lib/include/openamp/rpmsg_virtio.h Show resolved Hide resolved
lib/rpmsg/rpmsg_virtio.c Outdated Show resolved Hide resolved
lib/rpmsg/rpmsg_virtio.c Outdated Show resolved Hide resolved
lib/rpmsg/rpmsg_virtio.c Show resolved Hide resolved
lib/rpmsg/rpmsg_virtio.c Show resolved Hide resolved
This API can be used by the endpoint callback to limit the rx
buffer usage range.

Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
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.

LGTM

Copy link
Collaborator

@tnmysh tnmysh left a comment

Choose a reason for hiding this comment

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

LGTM.

@arnopo arnopo merged commit d513645 into OpenAMP:main Nov 6, 2023
3 checks passed
@arnopo arnopo added this to the Release V2024.04 milestone Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants