[PATCH] rpmsg: glink: Implement get_mtu callback
From: Chunkai Deng
Date: Thu Sep 17 2026 - 05:55:11 EST
Without a .get_mtu() callback rpmsg_get_mtu() returns -ENOTSUPP, which
makes rpmsg_tty unusable over GLINK: every write fails and write_room()
reports zero. Implementing the callback is all that is needed to reach a
remote console exposed as an rpmsg tty channel.
GLINK has no protocol level MTU. __qcom_glink_send() splits a message
into GLINK_CMD_TX_DATA and GLINK_CMD_TX_DATA_CONT chunks that the remote
reassembles, so a single message is bounded neither by the FIFO size nor
by any fixed buffer. The only bound is the intent the remote allocates,
which is negotiated per message at runtime and is therefore not known
when .get_mtu() is called. Report INT_MAX, the largest value existing
callers can represent: rpmsg_tty narrows the ssize_t result to an int and
treats negative values as errors, so anything above INT_MAX would be
misread as a failure.
Assisted-by: Claude:claude-opus-5
Co-developed-by: Chris Lew <christopher.lew@xxxxxxxxxxxxxxxx>
Signed-off-by: Chris Lew <christopher.lew@xxxxxxxxxxxxxxxx>
Signed-off-by: Chunkai Deng <chunkai.deng@xxxxxxxxxxxxxxxx>
Acked-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
---
drivers/rpmsg/qcom_glink_native.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index 55793fc18293b..ade9ca1cb9b9a 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -6,6 +6,7 @@
#include <linux/idr.h>
#include <linux/interrupt.h>
#include <linux/io.h>
+#include <linux/limits.h>
#include <linux/list.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
@@ -1605,6 +1606,11 @@ static struct device_node *qcom_glink_match_channel(struct device_node *node,
return NULL;
}
+static ssize_t qcom_glink_get_mtu(struct rpmsg_endpoint *ept)
+{
+ return INT_MAX;
+}
+
static const struct rpmsg_device_ops glink_device_ops = {
.create_ept = qcom_glink_create_ept,
.announce_create = qcom_glink_announce_create,
@@ -1617,6 +1623,7 @@ static const struct rpmsg_endpoint_ops glink_endpoint_ops = {
.trysend = qcom_glink_trysend,
.trysendto = qcom_glink_trysendto,
.set_flow_control = qcom_glink_set_flow_control,
+ .get_mtu = qcom_glink_get_mtu,
};
static void qcom_glink_rpdev_release(struct device *dev)
---
base-commit: f2bfbc3554ca6919484030729424b9dee2942d24
change-id: 20260911-rpmsg-glink-get-mtu-dbae4369d347
Best regards,
--
Chunkai Deng <chunkai.deng@xxxxxxxxxxxxxxxx>