From: Arnaud Pouliquen <arnaud.pouliquen@st.com> To: Ohad Ben-Cohen <ohad@wizery.com>, Bjorn Andersson <bjorn.andersson@linaro.org>, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: arnaud.pouliquen@st.com, Suman Anna <s-anna@ti.com>, Fabien DESSENNE <fabien.dessenne@st.com>, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH 2/3] rpmsg: glink: implement get_mtu ops Date: Thu, 5 Sep 2019 16:27:09 +0200 [thread overview] Message-ID: <1567693630-27544-3-git-send-email-arnaud.pouliquen@st.com> (raw) In-Reply-To: <1567693630-27544-1-git-send-email-arnaud.pouliquen@st.com> 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
WARNING: multiple messages have this Message-ID (diff)
From: Arnaud Pouliquen <arnaud.pouliquen@st.com> To: Ohad Ben-Cohen <ohad@wizery.com>, Bjorn Andersson <bjorn.andersson@linaro.org>, <linux-kernel@vger.kernel.org>, <linux-remoteproc@vger.kernel.org>, <linux-arm-msm@vger.kernel.org> Cc: <arnaud.pouliquen@st.com>, Suman Anna <s-anna@ti.com>, Fabien DESSENNE <fabien.dessenne@st.com>, <linux-stm32@st-md-mailman.stormreply.com> Subject: [PATCH 2/3] rpmsg: glink: implement get_mtu ops Date: Thu, 5 Sep 2019 16:27:09 +0200 [thread overview] Message-ID: <1567693630-27544-3-git-send-email-arnaud.pouliquen@st.com> (raw) In-Reply-To: <1567693630-27544-1-git-send-email-arnaud.pouliquen@st.com> 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
next prev parent reply other threads:[~2019-09-05 14:27 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-09-05 14:27 [PATCH 0/3] Add API to get rpmsg message max length Arnaud Pouliquen 2019-09-05 14:27 ` Arnaud Pouliquen 2019-09-05 14:27 ` [PATCH 1/3] rpmsg: core: add API to get message length Arnaud Pouliquen 2019-09-05 14:27 ` Arnaud Pouliquen 2019-09-05 14:42 ` Jeffrey Hugo 2019-09-05 16:02 ` Arnaud Pouliquen 2019-09-05 16:02 ` Arnaud Pouliquen 2019-09-05 16:18 ` Jeffrey Hugo 2019-09-10 9:56 ` Arnaud Pouliquen 2019-09-10 9:56 ` Arnaud Pouliquen 2019-09-05 14:27 ` Arnaud Pouliquen [this message] 2019-09-05 14:27 ` [PATCH 2/3] rpmsg: glink: implement get_mtu ops Arnaud Pouliquen 2019-09-05 14:27 ` [PATCH 3/3] rpmsg: smd: " Arnaud Pouliquen 2019-09-05 14:27 ` Arnaud Pouliquen
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1567693630-27544-3-git-send-email-arnaud.pouliquen@st.com \ --to=arnaud.pouliquen@st.com \ --cc=bjorn.andersson@linaro.org \ --cc=fabien.dessenne@st.com \ --cc=linux-arm-msm@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-remoteproc@vger.kernel.org \ --cc=linux-stm32@st-md-mailman.stormreply.com \ --cc=ohad@wizery.com \ --cc=s-anna@ti.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.