mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
samples: rpmsg: Add MTU size info
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@amd.com> Acked-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> Link: https://lore.kernel.org/r/20260828145853.2843486-6-tanmay.shah@amd.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
This commit is contained in:
parent
079844f735
commit
1029c89baf
|
|
@ -52,6 +52,7 @@ static int rpmsg_sample_probe(struct rpmsg_device *rpdev)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct instance_data *idata;
|
struct instance_data *idata;
|
||||||
|
ssize_t mtu, msg_len;
|
||||||
|
|
||||||
dev_info(&rpdev->dev, "new channel: 0x%x -> 0x%x!\n",
|
dev_info(&rpdev->dev, "new channel: 0x%x -> 0x%x!\n",
|
||||||
rpdev->src, rpdev->dst);
|
rpdev->src, rpdev->dst);
|
||||||
|
|
@ -62,8 +63,25 @@ static int rpmsg_sample_probe(struct rpmsg_device *rpdev)
|
||||||
|
|
||||||
dev_set_drvdata(&rpdev->dev, idata);
|
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);
|
||||||
|
|
||||||
|
msg_len = strlen(MSG);
|
||||||
|
/* make sure our message fits in a single rpmsg buffer */
|
||||||
|
if (msg_len > mtu) {
|
||||||
|
dev_err(&rpdev->dev,
|
||||||
|
"message size %zu exceeds rpmsg MTU size %ld\n",
|
||||||
|
strlen(MSG), mtu);
|
||||||
|
return -EMSGSIZE;
|
||||||
|
}
|
||||||
|
|
||||||
/* send a message to our remote processor */
|
/* send a message to our remote processor */
|
||||||
ret = rpmsg_send(rpdev->ept, MSG, strlen(MSG));
|
ret = rpmsg_send(rpdev->ept, MSG, msg_len);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&rpdev->dev, "rpmsg_send failed: %d\n", ret);
|
dev_err(&rpdev->dev, "rpmsg_send failed: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user