lkml.org 
[lkml]   [2019]   [Sep]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/3] rpmsg: glink: implement get_mtu ops
Date
Implement the get_mtu ops to return the maximum size of
the message that can be sent.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
---
drivers/rpmsg/qcom_glink_native.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)

diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index 621f1afd4d6b..8a477416a38a 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -1312,6 +1312,29 @@ static int qcom_glink_trysend(struct rpmsg_endpoint *ept, void *data, int len)
return __qcom_glink_send(channel, data, len, false);
}

+static ssize_t qcom_glink_get_mtu(struct rpmsg_endpoint *ept)
+{
+ struct glink_channel *channel = to_glink_channel(ept);
+ size_t mtu_size = 0;
+ struct qcom_glink *glink = channel->glink;
+ struct glink_core_rx_intent *tmp;
+ unsigned long flags;
+ int iid = 0;
+
+ if (!glink->intentless) {
+ spin_lock_irqsave(&channel->intent_lock, flags);
+ idr_for_each_entry(&channel->riids, tmp, iid) {
+ if (tmp->size > mtu_size && !tmp->in_use)
+ mtu_size = tmp->size;
+ }
+ spin_unlock_irqrestore(&channel->intent_lock, flags);
+
+ return mtu_size;
+ } else {
+ return qcom_glink_tx_avail(glink);
+ }
+}
+
/*
* Finds the device_node for the glink child interested in this channel.
*/
@@ -1345,6 +1368,7 @@ static const struct rpmsg_endpoint_ops glink_endpoint_ops = {
.destroy_ept = qcom_glink_destroy_ept,
.send = qcom_glink_send,
.trysend = qcom_glink_trysend,
+ .get_mtu = qcom_glink_get_mtu,
};

static void qcom_glink_rpdev_release(struct device *dev)
--
2.7.4
\
 
 \ /
  Last update: 2019-09-05 16:28    [W:0.085 / U:1.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site