While sending data, use the remote intent id buffer of suitable size
that was passed by remote previously.
Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Just like we allocating and sending intent ids to remote, remote side
allocates and sends us the intents as well. So save the intent ids and
use it later while sending data targeting the appropriate intents based
on the size.
Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Preallocate local intent buffers and pass the intent ids to the remote.
This way there are some default intents available for the remote to
start sending data without having to wait by sending intent requests. Do
this by adding the rpmsg announce_create ops, which gets called right
after the rpmsg device gets probed.
Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Send RX data receive ack to remote and also inform that local intent
buffer is used and freed. This informs the remote to request for next
set of intent buffers before doing a send operation.
Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
To fully read the received rx data from FIFO both the command and data
has to be read. Currently we read command, data separately and process
them. By adding an offset parameter to RX FIFO peak accessor, command
and data can be read together, simplifying things. So introduce this.
Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
So previously on request from remote side, we allocated local intent
buffers and passed the ids to the remote. Now when we receive data
buffers from remote directed to that intent id, copy the data to the
corresponding preallocated intent buffer.
Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Intents are nothing but pre-allocated buffers of appropriate size that
are allocated on the local side and communicated to the remote side and
the remote stores the list of intent ids that it is informed.
Later when remote side is intenting to send data, it picks up a right
intent (based on the size) and sends the data buffer and the intent id.
Local side receives the data and copies it to the local intent buffer.
The whole idea is to avoid stalls on the transport for allocating
memory, used for copy based transports.
When the remote request to allocate buffers using CMD_RX_INTENT_REQ, we
allocate buffers of requested size, store the buffer id locally and also
communicate the intent id to the remote.
Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The channel members lcids, rcids synchronised using the idr_lock is
accessed in both atomic/non-atomic contexts. The readers are not
currently synchronised. That no correct, so add the readers as well
under the lock and use a spinlock.
Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
G-link supports a version number and feature flags for each transport.
A combination of the version number and feature flags enable/disable:
(*) G-Link software updates for each edge
(*) Individual features for each edge
Endpoints negotiate both the version and the supported flags when
the transport is opened and they cannot be changed after negotiation has
been completed.
Each full implementation of G-Link must support a minimum of the current
version, the previous version, and the base negotiation version called v0.
Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The glink protocol supports different types of transports (shared
memory). With the core protocol remaining the same, the way the
transport's memory is probed and accessed is different. So add support
for glink's smem based transports.
Adding a new smem transport register function and the fifo accessors for
the same.
Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
mbox_request_channel is done in probe, so free the channel in remove.
Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The TX FIFO can be full, if the remote client has not read enough data
(or) reading it slowly. So its nessecary to return -EAGAIN to the local
client to enable retry.
Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Glink protocol requires that each message is aligned on a 8 byte offset.
This is purely a restriction from glink, so in order to support clients
which do not adher to this, allow data packets of any size, but align
the head index accordingly, effectively removing the alignment
restriction.
Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Move the common part of glink core protocol implementation to
glink_native.c that can be shared with the smem based glink
transport in the later patches.
Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>