On 5/29/26 18:43, Tanmay Shah wrote:
RPMsg MTU size can be variable now and no longer hardcoded to 512 bytes.
Add log to the sample driver that prints current MTU size of the rpmsg
buffer.
Signed-off-by: Tanmay Shah <[email protected]>
---
Changes in v3:
- Check for error when retrieving MTU size
- %s/mtu/MTU/
samples/rpmsg/rpmsg_client_sample.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/samples/rpmsg/rpmsg_client_sample.c
b/samples/rpmsg/rpmsg_client_sample.c
index ae5081662283..55afa53189af 100644
--- a/samples/rpmsg/rpmsg_client_sample.c
+++ b/samples/rpmsg/rpmsg_client_sample.c
@@ -52,6 +52,7 @@ static int rpmsg_sample_probe(struct rpmsg_device *rpdev)
{
int ret;
struct instance_data *idata;
+ ssize_t mtu;
dev_info(&rpdev->dev, "new channel: 0x%x -> 0x%x!\n",
rpdev->src, rpdev->dst);
@@ -62,6 +63,14 @@ static int rpmsg_sample_probe(struct rpmsg_device *rpdev)
dev_set_drvdata(&rpdev->dev, idata);
+ mtu = rpmsg_get_mtu(rpdev->ept);
+ if (mtu < 0) {
+ dev_warn(&rpdev->dev, "invalid rpmsg MTU size = %ld\n", mtu);
+ return mtu;
+ }
+
+ dev_info(&rpdev->dev, "rpmsg MTU size = %ld\n", mtu);
+
Do you really need this commit? rpmsg_send should return an error if the
buffer size is insufficient [1].
[1]
https://elixir.bootlin.com/linux/v7.0.10/source/drivers/rpmsg/virtio_rpmsg_bus.c#L517
Regards,
Arnaud
/* send a message to our remote processor */
ret = rpmsg_send(rpdev->ept, MSG, strlen(MSG));
if (ret) {