Commit 8956927f authored by Arun Kumar Neelakantam's avatar Arun Kumar Neelakantam Committed by Bjorn Andersson

rpmsg: glink: Add TX_DATA_CONT command while sending

With current design the transport can send packets of size upto
FIFO_SIZE which is 16k and return failure for all packets above 16k.

Add TX_DATA_CONT command to send packets greater than 16k by splitting
into 8K chunks.
Signed-off-by: default avatarArun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: default avatarDeepak Kumar Singh <deesin@codeaurora.org>
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/1596086296-28529-4-git-send-email-deesin@codeaurora.org
parent 63b8d799
...@@ -1271,6 +1271,8 @@ static int __qcom_glink_send(struct glink_channel *channel, ...@@ -1271,6 +1271,8 @@ static int __qcom_glink_send(struct glink_channel *channel,
} __packed req; } __packed req;
int ret; int ret;
unsigned long flags; unsigned long flags;
int chunk_size = len;
int left_size = 0;
if (!glink->intentless) { if (!glink->intentless) {
while (!intent) { while (!intent) {
...@@ -1304,18 +1306,46 @@ static int __qcom_glink_send(struct glink_channel *channel, ...@@ -1304,18 +1306,46 @@ static int __qcom_glink_send(struct glink_channel *channel,
iid = intent->id; iid = intent->id;
} }
if (wait && chunk_size > SZ_8K) {
chunk_size = SZ_8K;
left_size = len - chunk_size;
}
req.msg.cmd = cpu_to_le16(RPM_CMD_TX_DATA); req.msg.cmd = cpu_to_le16(RPM_CMD_TX_DATA);
req.msg.param1 = cpu_to_le16(channel->lcid); req.msg.param1 = cpu_to_le16(channel->lcid);
req.msg.param2 = cpu_to_le32(iid); req.msg.param2 = cpu_to_le32(iid);
req.chunk_size = cpu_to_le32(len); req.chunk_size = cpu_to_le32(chunk_size);
req.left_size = cpu_to_le32(0); req.left_size = cpu_to_le32(left_size);
ret = qcom_glink_tx(glink, &req, sizeof(req), data, len, wait); ret = qcom_glink_tx(glink, &req, sizeof(req), data, chunk_size, wait);
/* Mark intent available if we failed */ /* Mark intent available if we failed */
if (ret && intent) if (ret && intent) {
intent->in_use = false; intent->in_use = false;
return ret;
}
while (left_size > 0) {
data = (void *)((char *)data + chunk_size);
chunk_size = left_size;
if (chunk_size > SZ_8K)
chunk_size = SZ_8K;
left_size -= chunk_size;
req.msg.cmd = cpu_to_le16(RPM_CMD_TX_DATA_CONT);
req.msg.param1 = cpu_to_le16(channel->lcid);
req.msg.param2 = cpu_to_le32(iid);
req.chunk_size = cpu_to_le32(chunk_size);
req.left_size = cpu_to_le32(left_size);
ret = qcom_glink_tx(glink, &req, sizeof(req), data,
chunk_size, wait);
/* Mark intent available if we failed */
if (ret && intent) {
intent->in_use = false;
break;
}
}
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment