[PATCH v3 4/4] samples: rpmsg: add MTU size info

From: Tanmay Shah

Date: Fri May 29 2026 - 12:53:16 EST


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 <tanmay.shah@xxxxxxx>
---

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);
+
/* send a message to our remote processor */
ret = rpmsg_send(rpdev->ept, MSG, strlen(MSG));
if (ret) {
--
2.34.1